種類
- インスタンスメソッド (879)
- 特異メソッド (48)
ライブラリ
- ビルトイン (842)
-
bigdecimal
/ util (12) - mathn (1)
- openssl (12)
- prime (60)
キーワード
- % (12)
- & (12)
- * (12)
- ** (12)
- + (12)
- - (12)
- -@ (12)
-
/ (12) - < (12)
- << (12)
- <= (12)
- <=> (12)
- == (12)
- === (12)
- > (12)
- >= (12)
- >> (12)
- [] (24)
- ^ (12)
- abs (12)
- allbits? (8)
- anybits? (8)
-
bit
_ length (12) - ceil (12)
- ceildiv (3)
- chr (24)
- denominator (12)
- digits (24)
- div (12)
- divmod (12)
- downto (24)
-
each
_ prime (24) - even? (12)
- fdiv (12)
- floor (12)
-
from
_ prime _ division (12) - gcd (12)
- gcdlcm (12)
- inspect (12)
- integer? (12)
- lcm (12)
- magnitude (12)
- modulo (12)
- next (12)
- nobits? (8)
- numerator (12)
- odd? (12)
- ord (12)
- pow (24)
- pred (12)
- prime? (12)
-
prime
_ division (12) - rationalize (24)
- remainder (12)
- round (12)
- size (12)
- sqrt (8)
- succ (12)
- times (24)
-
to
_ bn (12) -
to
_ d (12) -
to
_ f (12) -
to
_ i (12) -
to
_ int (12) -
to
_ r (12) -
to
_ s (12) - truncate (12)
-
try
_ convert (4) - upto (24)
- | (12)
- ~ (12)
検索結果
先頭5件
-
Integer
# succ -> Integer (1.0) -
self の次の整数を返します。
...self の次の整数を返します。
//emlist[][ruby]{
1.next #=> 2
(-1).next #=> 0
1.succ #=> 2
(-1).succ #=> 0
//}
@see Integer#pred... -
Integer
# times -> Enumerator (1.0) -
self 回だけ繰り返します。 self が正の整数でない場合は何もしません。
...れます。
//emlist[][ruby]{
3.times { puts "Hello, World!" } # Hello, World! と3行続いて表示される。
0.times { puts "Hello, World!" } # 何も表示されない。
5.times {|n| print n } # 01234 と表示される。
//}
@see Integer#upto, Integer#downto, Numeric#step... -
Integer
# times {|n| . . . } -> self (1.0) -
self 回だけ繰り返します。 self が正の整数でない場合は何もしません。
...れます。
//emlist[][ruby]{
3.times { puts "Hello, World!" } # Hello, World! と3行続いて表示される。
0.times { puts "Hello, World!" } # 何も表示されない。
5.times {|n| print n } # 01234 と表示される。
//}
@see Integer#upto, Integer#downto, Numeric#step... -
Integer
# to _ bn -> OpenSSL :: BN (1.0) -
Integer を同じ数を表す OpenSSL::BN のオブジェクトに 変換します。
...
Integer を同じ数を表す OpenSSL::BN のオブジェクトに
変換します。
//emlist[][ruby]{
require 'pp'
require 'openssl'
pp 5.to_bn #=> #<OpenSSL::BN 5>
pp (-5).to_bn #=> #<OpenSSL::BN -5>
//}
なお、実装は、以下のようになっています。
//emlist[][ruby]{
clas......s Integer
def to_bn
OpenSSL::BN::new(self)
end
end
//}
@see OpenSSL::BN.new, OpenSSL::BN#to_i......
Integer を同じ数を表す OpenSSL::BN のオブジェクトに
変換します。
//emlist[][ruby]{
require 'openssl'
pp 5.to_bn #=> #<OpenSSL::BN 5>
pp (-5).to_bn #=> #<OpenSSL::BN -5>
//}
なお、実装は、以下のようになっています。
//emlist[][ruby]{
class Integer
d... -
Integer
# to _ d -> BigDecimal (1.0) -
自身を BigDecimal に変換します。BigDecimal(self) と同じです。
自身を BigDecimal に変換します。BigDecimal(self) と同じです。
@return BigDecimal に変換したオブジェクト -
Integer
# to _ f -> Float (1.0) -
self を浮動小数点数(Float)に変換します。
self を浮動小数点数(Float)に変換します。
self が Float の範囲に収まらない場合、Float::INFINITY を返します。
//emlist[][ruby]{
1.to_f # => 1.0
(Float::MAX.to_i * 2).to_f # => Infinity
(-Float::MAX.to_i * 2).to_f # => -Infinity
//} -
Integer
# to _ i -> self (1.0) -
self を返します。
self を返します。
//emlist[][ruby]{
10.to_i # => 10
//} -
Integer
# to _ int -> self (1.0) -
self を返します。
self を返します。
//emlist[][ruby]{
10.to_i # => 10
//} -
Integer
# to _ r -> Rational (1.0) -
自身を Rational に変換します。
自身を Rational に変換します。
//emlist[][ruby]{
1.to_r # => (1/1)
(1<<64).to_r # => (18446744073709551616/1)
//}