mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* numeric.c: Examples and formatting for Numeric and Float
Based on a patch by Zach Morek and Oren K of newhaven.rb [Github documenting-ruby/ruby#5] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39369 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
d0a4131709
commit
8d4a11c919
2 changed files with 23 additions and 9 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
Fri Feb 22 11:00:00 2013 Zachary Scott <zachary@zacharyscott.net>
|
||||||
|
|
||||||
|
* numeric.c: Examples and formatting for Numeric and Float
|
||||||
|
Based on a patch by Zach Morek and Oren K of newhaven.rb
|
||||||
|
[Github documenting-ruby/ruby#5]
|
||||||
|
|
||||||
Fri Feb 22 07:04:41 2013 Eric Hodel <drbrain@segment7.net>
|
Fri Feb 22 07:04:41 2013 Eric Hodel <drbrain@segment7.net>
|
||||||
|
|
||||||
* lib/rubygems/installer.rb (build_extensions): Create extension
|
* lib/rubygems/installer.rb (build_extensions): Create extension
|
||||||
|
|
26
numeric.c
26
numeric.c
|
@ -522,8 +522,10 @@ num_real_p(VALUE num)
|
||||||
* call-seq:
|
* call-seq:
|
||||||
* num.integer? -> true or false
|
* num.integer? -> true or false
|
||||||
*
|
*
|
||||||
* Returns <code>true</code> if <i>num</i> is an <code>Integer</code>
|
* Returns +true+ if +num+ is an Integer (including Fixnum and Bignum).
|
||||||
* (including <code>Fixnum</code> and <code>Bignum</code>).
|
*
|
||||||
|
* (1.0).integer? #=> false
|
||||||
|
* (1).integer? #=> true
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
|
@ -596,8 +598,11 @@ num_nonzero_p(VALUE num)
|
||||||
* call-seq:
|
* call-seq:
|
||||||
* num.to_int -> integer
|
* num.to_int -> integer
|
||||||
*
|
*
|
||||||
* Invokes the child class's <code>to_i</code> method to convert
|
* Invokes the child class's +to_i+ method to convert +num+ to an integer.
|
||||||
* <i>num</i> to an integer.
|
*
|
||||||
|
* 1.0.class => Float
|
||||||
|
* 1.0.to_int.class => Fixnum
|
||||||
|
* 1.0.to_i.class => Fixnum
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
|
@ -899,10 +904,10 @@ ruby_float_mod(double x, double y)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* call-seq:
|
* call-seq:
|
||||||
* flt % other -> float
|
* float % other -> float
|
||||||
* flt.modulo(other) -> float
|
* float.modulo(other) -> float
|
||||||
*
|
*
|
||||||
* Return the modulo after division of <code>flt</code> by <code>other</code>.
|
* Return the modulo after division of +float+ by +other+.
|
||||||
*
|
*
|
||||||
* 6543.21.modulo(137) #=> 104.21
|
* 6543.21.modulo(137) #=> 104.21
|
||||||
* 6543.21.modulo(137.24) #=> 92.9299999999996
|
* 6543.21.modulo(137.24) #=> 92.9299999999996
|
||||||
|
@ -941,9 +946,12 @@ dbl2ival(double d)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* call-seq:
|
* call-seq:
|
||||||
* flt.divmod(numeric) -> array
|
* float.divmod(numeric) -> array
|
||||||
*
|
*
|
||||||
* See <code>Numeric#divmod</code>.
|
* See Numeric#divmod.
|
||||||
|
*
|
||||||
|
* 42.0.divmod 6 #=> [7, 0.0]
|
||||||
|
* 42.0.divmod 5 #=> [8, 2.0]
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
|
|
Loading…
Add table
Reference in a new issue