るりまサーチ

最速Rubyリファレンスマニュアル検索!
156件ヒット [1-100件を表示] (0.093秒)
トップページ > クエリ:a[x] > クエリ:modulo[x]

別のキーワード

  1. _builtin to_a
  2. matrix to_a
  3. to_a
  4. dbm to_a
  5. argf.class to_a

ライブラリ

クラス

キーワード

検索結果

<< 1 2 > >>

BigDecimal#modulo(n) -> BigDecimal (18201.0)

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

...

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

//emlist[][ruby]{
require 'bigdecimal'
x = BigDecimal((2**100).to_s)
( x % 3).to_i # => 1
(-x % 3).to_i # => 2
( x % -3).to_i # => -2
(-x % -3).to_i # => -1
//}

戻り値は n と同じ符号になります。これは BigDecimal#remainder と...
...
異なる点に注意してください。詳細は Numeric#%、
Numeric#remainder を参照して下さい。...

Float#modulo(other) -> Float (18201.0)

算術演算子。剰余を計算します。

...算術演算子。剰余を計算します。

@param other 二項演算の右側の引数(対象)

//emlist[例][ruby]{
# 剰余
3.0 % 1.2 # => 0.6000000000000001
3.0 % 0.0 # ZeroDivisionError
//}...

Bignum#modulo(other) -> Fixnum | Bignum | Float (15201.0)

算術演算子。剰余を計算します。

...算術演算子。剰余を計算します。

@param other 二項演算の右側の引数(対象)
@return 計算結果...

Fixnum#modulo(other) -> Fixnum | Bignum | Float (15201.0)

算術演算子。剰余を計算します。

...算術演算子。剰余を計算します。

@param other 二項演算の右側の引数(対象)
@return 計算結果...

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

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

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

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

@param other self を割る数。

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

絞り込み条件を変える

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

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

...f と同じになります。

@param 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.225...
...31493148
//}

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

Numeric#remainder(other) -> Numeric (6106.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...

ruby 1.6 feature (3354.0)

ruby 1.6 feature ruby version 1.6 は安定版です。この版での変更はバグ修正がメイン になります。

...ature
ruby version 1.6 は安定版です。この版での変更はバグ修正がメイン
になります。

((<stable-snapshot|URL:ftp://ftp.netlab.co.jp/pub/lang/ruby/stable-snapshot.tar.gz>)) は、日々更新される安定版の最新ソースです。

== 1.6.8 (2002-12-24) -> stable-sna...
...EAGAIN と EWOULDBLOCK が同じ値のシステムで、EWOULDBLOCK がなくなっ
ていました。現在は、このようなシステムでは、EWOULDBLOCK は、EAGAIN
として定義されています。(これは 1.6.7 とは異なる挙動です)

p Errno::EAGAIN...
...p f.stat.size
}

# => ruby 1.6.3 (2001-04-03) [i586-linux]
-1073741824
# => ruby 1.6.4 (2001-04-19) [i586-linux]
1073741824

: ((<Float>))#modulo, ((<Float>))#divmod

なんか修正されたみたいです ((<ruby-dev:12718>))

: ((<ObjectSpace>))...

BigDecimal#%(n) -> BigDecimal (3101.0)

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

...

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

//emlist[][ruby]{
require 'bigdecimal'
x = BigDecimal((2**100).to_s)
( x % 3).to_i # => 1
(-x % 3).to_i # => 2
( x % -3).to_i # => -2
(-x % -3).to_i # => -1
//}

戻り値は n と同じ符号になります。これは BigDecimal#remainder と...
...
異なる点に注意してください。詳細は Numeric#%、
Numeric#remainder を参照して下さい。...

Float#%(other) -> Float (3101.0)

算術演算子。剰余を計算します。

...算術演算子。剰余を計算します。

@param other 二項演算の右側の引数(対象)

//emlist[例][ruby]{
# 剰余
3.0 % 1.2 # => 0.6000000000000001
3.0 % 0.0 # ZeroDivisionError
//}...

絞り込み条件を変える

Float#divmod(other) -> [Numeric] (3006.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...
<< 1 2 > >>