るりまサーチ

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

別のキーワード

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

ライブラリ

クラス

キーワード

検索結果

<< 1 2 3 > >>

ruby 1.6 feature (23030.0)

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

...uby 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-snapshot

:...
...rno

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

p Errno::EAGAIN...
....open("/tmp/1GB", "w") {|f|
f.seek(2**30-1, 0)
f.puts
f.flush
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, (...

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

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

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

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

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

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

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

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

Numeric#modulo(other) -> Numeric (18243.0)

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

...q は、Numeric#div (あるいは 「/」)で求められます。
modulo
はメソッド % の呼び出しとして定義されています。

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

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

@see Numeric#divmod, Numeric#remainder...

Integer#modulo(other) -> Numeric (18201.0)

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

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

//emlist[][ruby]{
13 % 4 # => 1
13 % -4 # => -3
-13 % 4 # => 3
-13 % -4 # => -1
//}

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

絞り込み条件を変える

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

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

...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#%、
N
umeric#remainder を参照して下さい。...

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 を返します。

.../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 (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...

Numeric (6078.0)

数値を表す抽象クラスです。Integer や Float などの数値クラス は Numeric のサブクラスとして実装されています。

...数値を表す抽象クラスです。Integer や Float などの数値クラス
Numeric のサブクラスとして実装されています。

演算や比較を行うメソッド(+, -, *, /, <=>)は Numeric のサブクラスで定義されま
す。Numeric で定義されているメソッ...
...で提供されているメソッド
(+, -, *, /, %) を利用して定義されるものがほとんどです。
つまり Numeric で定義されているメソッドは、Numeric のサブクラスとして新たに数値クラスを定義した時に、
演算メソッド(+, -, *, /, %, <=>, coe...
...o o - o
N
umeric Integer Fixnum Bignum Float Rational Complex
-------------------------------------------------------------------------------------------
modulo
| o - o...
...- -
N
umeric Integer Float Rational Complex
--------------------------------------------------------------------------------
magnitude | o o o o o
modulo
| o...

絞り込み条件を変える

Integer#pow(other, modulo) -> Integer (3213.0)

算術演算子。冪(べき乗)を計算します。

...の引数(対象)
@param modulo 指定すると、計算途中に巨大な値を生成せずに (self**other) % modulo と同じ結果を返します。
@return 計算結果
@raise TypeError 2引数 pow で Integer 以外を指定した場合に発生します。
@raise RangeError 2引数 pow で ot...
...整数になりそうなとき、警告を出したうえで Float::INFINITY を返します。

//emlist[計算を放棄して Float::INFINITY を返す例][ruby]{
p 100**9999999
# => warning: in a**b, b may be too big
# Infinity
//}

判定の閾値は変わりえます。


@see BigDecimal#pow...
...her に負の数を指定した場合に発生します。
@raise ArgumentError 計算結果が巨大になりすぎる場合に発生します。

//emlist[][ruby]{
2 ** 3 # => 8
2 ** 0 # => 1
0 ** 0 # => 1
3.pow(3, 8) # => 3
3.pow(3, -8) # => -5
3.pow(2, -2) # => -1
-3.pow(3, 8) # => 5
-3.p...
...> -3
5.pow(2, -8) # => -7
//}


計算結果が巨大すぎるときは ArgumentError が発生します。

//emlist[計算結果が巨大すぎる例][ruby]{
p 100**9999999999999999999
# => exponent is too large (ArgumentError)
//}

判定の閾値は変わりえます。

@see BigDecimal#power...
<< 1 2 3 > >>