1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[DOC] Integer#coerce deals with also Float

This commit is contained in:
Nobuyoshi Nakada 2021-12-29 11:50:28 +09:00
parent 27765a7502
commit 5ca51ddde8
No known key found for this signature in database
GPG key ID: 7CD2805BFA3770C6

View file

@ -6730,14 +6730,15 @@ rb_big_hash(VALUE x)
/* /*
* call-seq: * call-seq:
* big.coerce(numeric) -> array * int.coerce(numeric) -> array
* *
* Returns an array with both a +numeric+ and a +big+ represented as Bignum * Returns an array with both a +numeric+ and a +int+ represented as
* objects. * Integer objects or Float objects.
* *
* This is achieved by converting +numeric+ to a Bignum. * This is achieved by converting +numeric+ to an Integer or a Float.
* *
* A TypeError is raised if the +numeric+ is not a Fixnum or Bignum type. * A TypeError is raised if the +numeric+ is not an Integer or a Float
* type.
* *
* (0x3FFFFFFFFFFFFFFF+1).coerce(42) #=> [42, 4611686018427387904] * (0x3FFFFFFFFFFFFFFF+1).coerce(42) #=> [42, 4611686018427387904]
*/ */