るりまサーチ

最速Rubyリファレンスマニュアル検索!
47件ヒット [1-47件を表示] (0.175秒)

別のキーワード

  1. etc sc_xopen_enh_i18n
  2. rsa n=
  3. rsa n
  4. openssl n=
  5. pop n_mails

ライブラリ

クラス

検索結果

BigDecimal#divmod(n) -> [BigDecimal, BigDecimal] (21427.0)

self を other で割った商 q と余り r を、 [q, r] という 2 要素の配列にし て返します。

...り r を、 [q, r] という 2 要素の配列にし
て返します。

商は負の無限大負方向に丸められます。

@param n self を割る数を指定します。

//emlist[][ruby]{
require 'bigdecimal'

a
= BigDecimal("42")
b = BigDecimal("9")

a
.divmod(b) # => [0.4e1, 0.6e1]
//}...

Float#divmod(other) -> [Numeric] (21232.0)

self を other で割った商 q と余り r を、 [q, r] という 2 要素の配列にして返します。 商 q は常に整数ですが、余り r は整数であるとは限りません。

...ます。

@param other 自身を割る数を指定します。

//emlist[例][ruby]{
11.divmod(3) # => [3, 2]
(11.5).divmod(3.5) # => [3, 1.0]
11.divmod(-3) # => [-4, -1]
11.divmod(3.5) # => [3, 0.5]
(-11).divmod(3.5) # => [-4, 3.0]
//}

@see Numeric#div, Numeric#modulo...

Bignum#remainder(other) -> Fixnum | Bignum | Float (12207.0)

self を other で割った余り r を返します。

...self を other で割った余り r を返します。

r の符号は self と同じになります。

@param other self を割る数。

@see Bignum#divmod, Bignum#modulo, Numeric#modulo...

Integer#remainder(other) -> Numeric (12207.0)

self を other で割った余り r を返します。

...aram other self を割る数。

//emlist[][ruby]{
5.remainder(3) # => 2
-5.remainder(3) # => -2
5.remainder(-3) # => 2
-5.remainder(-3) # => -2

-1234567890987654321.remainder(13731) # => -6966
-1234567890987654321.remainder(13731.24) # => -9906.22531493148
//}

@see Integer#divmod...
..., Integer#modulo, Numeric#modulo...

Numeric#remainder(other) -> Numeric (12207.0)

self を other で割った余り r を返します。

...ther).truncate がそれに相当します。

@param other 自身を割る数を指定します。

//emlist[例][ruby]{
p 13.remainder(4) #=> 1
p (11.5).remainder(3.5) #=> 1.0
p 13.remainder(-4) #=> 1
p (-13).remainder(4) #=> -1
p (-13).remainder(-4) #=> -1
p (-11).remainder(3.5)...
...#=> -0.5
//}

@see Numeric#divmod, Numeric#modulo...

絞り込み条件を変える