回文数(かいぶんすう、Palindromic number)とは、なんらかの位取り記数法(N進法)で数を記した際、たとえば十進法において14641のように逆から数字を並べても同じ数になる数である。同様の言葉遊びである回文にちなむ名前である。具体的には 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 22, 33, 44, 55, 66, 77, 88, 99, 101, 111, 121, 131, 141, 151, 161, 171, 181, 191,…(オンライン整数列大辞典の数列 A002113) である。 回文数は、趣味の数学の分野ではよく研究の対象になる。代表的なものとしては、ある性質を持った回文数を求めることがある。以下のようなものがよく知られている。 回文素数 2, 3, 5, 7, 11, 101, 131, 151, … 回文平方数[1] 0, 1
has value 0/2 + 0/4 + 1/8. These two fractions have identical values, the only real difference being that the first is written in base 10 fractional notation, and the second in base 2. Unfortunately, most decimal fractions cannot be represented exactly as binary fractions. A consequence is that, in general, the decimal floating-point numbers you enter are only approximated by the binary floating-p
In Ruby, there are many methods available which help us to modify a float or integer value. Ruby 2.3.x In the previous versions of Ruby, we could use methods such as floor, ceil and truncate in following ways. 5.54.floor #=> 5 5.54.ceil #=> 6 5.54.truncate #=> 5 Providing an argument to these methods would result in ArgumentError exception. Ruby 2.4 Ruby community decided to come up with an option
Ruby uses Fixnum class for representing small numbers and Bignum class for big numbers. 1# Before Ruby 2.4 2 31.class #=> Fixnum 4(2 ** 62).class #=> BignumCopy In general routine work we don't have to worry about whether the number we are dealing with is Bignum or Fixnum. It's just an implementation detail. Interestingly, Ruby also has Integer class which is superclass for Fixnum and Bignum. Star
Abstract Implemented a way to optimize ruby's executions and to revert them. The strategy is restricted so that any VM states like program counter(s) would not be affected by the modifications. This restriction makes deoptimize much lightweight. Experiments show optimizations on this mechanism speeds up micro benchmarks, yet has no significant overheads for pitfall-ish activities, like eval. Intro
The first preview version of Ruby 2.4 was released a few days ago. This particular release includes a bunch of new features. Moreover, it introduces some fixes and changes that are not entirely backward compatible. Thus, we need to pay close attention to these differences in this new version of Ruby. In this post, we’ll focus on some remarkable changes in behavior, so as to better understand how o
Posted by naruse on 20 Jun 2016 We are pleased to announce the release of Ruby 2.4.0-preview1. Ruby 2.4.0-preview1 is the first preview of Ruby 2.4.0. This preview1 is released earlier than usual because it includes so many new features and improvements. Feel free to send feedback since you can still change the features. Unify Fixnum and Bignum into Integer Though ISO/IEC 30170:2012 doesn’t specif
丸めは任意の丸め幅に対し可能だが、以下では特に断らない限り、丸め幅を1とする(後段の「#例」では、丸め幅は0.1である)。任意の丸め幅で丸めるには、丸める前に丸め幅で割り、丸めた後に丸め幅をかける。 主に正数について述べるが、負数についても適宜述べる。 整数部分をそのまま残し、小数点以下を0とする丸めを「切り捨て」という。それに対し、小数点以下が0でなかった場合整数部分を1増やし、小数点以下を0とする丸めを「切り上げ」という。 負の数を考えると、「切り捨て」「切り上げ」に準ずる丸めは、4種類ある。それぞれ「○○への丸め」と呼ばれる。 符号を無視して絶対値を丸める場合、「切り捨て」は常に0へ近づく(または変わらない。以下では省略)ので「0への丸め (rounding toward zero; RZ)」、「切り上げ」は常に数直線上の無限遠点へ近づくので「無限大への丸め (rounding to
MPFR Links Internal links: Latest release: download – documentation – bugs – changes. Source code: information to use the development repository. Sample: to start with the MPFR library. FAQ: frequently asked questions. Credit: involved projects and developers. History: links to all MPFR releases and past events. Algorithms: documents describing algorithms used in MPFR. MPFR in the world: publicati
* [Feature #12005] Unify Fixnum and Bignum into Integer * include/ruby/ruby.h (rb_class_of): Return rb_cInteger for fixnums. * insns.def (INTEGER_REDEFINED_OP_FLAG): Unified from FIXNUM_REDEFINED_OP_FLAG and BIGNUM_REDEFINED_OP_FLAG. * vm_core.h: Ditto. * vm_insnhelper.c (opt_eq_func): Use INTEGER_REDEFINED_OP_FLAG instead of FIXNUM_REDEFINED_OP_FLAG. * vm.c (vm_redefinition_check_flag): Use rb_cI
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く