Skip to content

Commit

Permalink
[DOC]
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44913 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
akr committed Feb 11, 2014
1 parent 09e6766 commit 2fee22f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
7 changes: 7 additions & 0 deletions bignum.c
Original file line number Diff line number Diff line change
Expand Up @@ -6999,6 +6999,13 @@ rb_big_size(VALUE big)
* (2**10000).bit_length #=> 10001
* (2**10000+1).bit_length #=> 10001
*
* This method can be used to detect overflow in Array#pack as follows.
*
* if n.bit_length < 32
* [n].pack("l") # no overflow
* else
* raise "overflow"
* end
*/

static VALUE
Expand Down
8 changes: 8 additions & 0 deletions numeric.c
Original file line number Diff line number Diff line change
Expand Up @@ -3538,6 +3538,14 @@ fix_size(VALUE fix)
* (2**12-1).bit_length #=> 12
* (2**12).bit_length #=> 13
* (2**12+1).bit_length #=> 13
*
* This method can be used to detect overflow in Array#pack as follows.
*
* if n.bit_length < 32
* [n].pack("l") # no overflow
* else
* raise "overflow"
* end
*/

static VALUE
Expand Down

0 comments on commit 2fee22f

Please sign in to comment.