るりまサーチ

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

別のキーワード

  1. _builtin float
  2. float to_d
  3. json float
  4. float rationalize
  5. fiddle type_float

ライブラリ

クラス

モジュール

検索結果

<< 1 2 3 ... > >>

Float#*(other) -> Float (27307.0)

算術演算子。積を計算します。

...算術演算子。積を計算します。

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

//emlist[例][ruby]{
# 積
2.4 * 3 # => 7.2
//}...

Benchmark::Tms#*(x) -> Benchmark::Tms (21206.0)

self と x の乗算を計算します。

...self と x の乗算を計算します。

@param x Benchmark::Tms のオブジェクトか Float に暗黙の変換ができるオブジェクトです。

@return 計算結果は新しい Benchmark::Tms オブジェクトです。

@see Benchmark::Tms#memberwise...

Rational#*(other) -> Rational | Float (18337.0)

積を計算します。

...します。

@param other 自身に掛ける数

other に Float を指定した場合は、計算結果を Float で返しま
す。

//emlist[例][ruby]{
r = Rational(3, 4)
r * 2 # => (3/2)
r * 4 # => (3/1)
r * 0.5 # => 0.375
r * Rational(1, 2) # => (3...

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

算術演算子。積を計算します。

...算術演算子。積を計算します。

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

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

算術演算子。積を計算します。

...算術演算子。積を計算します。

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

絞り込み条件を変える

Float#**(other) -> Float (15307.0)

算術演算子。冪を計算します。

...算術演算子。冪を計算します。

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

//emlist[例][ruby]{
# 冪
1.2 ** 3.0 # => 1.7279999999999998
3.0 + 4.5 - 1.3 / 2.4 * 3 % 1.2 ** 3.0 # => 5.875
0.0 ** 0 # => 1.0
//}...

Kernel.#Float(arg, exception: true) -> Float | nil (9510.0)

引数を浮動小数点数(Float)に変換した結果を返します。

...引数を浮動小数点数(Float)に変換した結果を返します。

引数が数値の場合は素直に変換し、文字列の場合
は整数や浮動小数点数と見なせるもののみ変換します。

メソッド Float は文字列に対し String#to_f よりも厳密な変換を...
...@param exception false を指定すると、変換できなかった場合、
例外を発生する代わりに nil を返します。
@raise ArgumentError 整数や浮動小数点数と見なせない文字列を引数に指定した場合に発生します。
@raise TypeError nil...
...p Float(".1") #=> 0.1
p Float("0xa") #=> 10.0

p Float("nan") # invalid value for Float(): "nan" (ArgumentError)
p Float("INF") # invalid value for Float(): "INF" (ArgumentError)
p Float("-Inf") # invalid value for Float(): "-Inf" (ArgumentError)
p Float(("10" * 1...

Enumerator::Lazy#enum_for(method = :each, *args) {|*args| block} -> Enumerator::Lazy (9416.0)

Object#to_enum と同じですが、Enumerator::Lazy を返します。

...Object#to_enum と同じですが、Enumerator::Lazy を返します。

to_enum は「ブロック付きで呼ぶとループを実行し、ブロックを省略した場合は
E
numerator を返す」ようなメソッドを定義するときによく使われます。
このときに lazy 性が...
...umerator ではなく Enumerator::Lazy を返すようになっています。

//emlist[例][ruby]{
module Enumerable
# 要素をn回ずつ繰り返すメソッド
# 例:[1,2,3].repeat(2) #=> [1,1,2,2,3,3]
def repeat(n)
raise ArgumentError if n < 0
if block_given?
e
ach do |*v...
...n.times { yield *val }
e
nd
e
lse
to_enum(:repeat, n)
e
nd
e
nd
e
nd

r = 1..10
p r.map{|n| n**2}.repeat(2).first(5)
#=> [1, 1, 4, 4, 9]

r = 1..Float::INFINITY
p r.lazy.map{|n| n**2}.repeat(2).first(5)
#=> [1, 1, 4, 4, 9]

# Lazy#to_enum のおかげで、repeat の返り...

Enumerator::Lazy#to_enum(method = :each, *args) {|*args| block} -> Enumerator::Lazy (9416.0)

Object#to_enum と同じですが、Enumerator::Lazy を返します。

...Object#to_enum と同じですが、Enumerator::Lazy を返します。

to_enum は「ブロック付きで呼ぶとループを実行し、ブロックを省略した場合は
E
numerator を返す」ようなメソッドを定義するときによく使われます。
このときに lazy 性が...
...umerator ではなく Enumerator::Lazy を返すようになっています。

//emlist[例][ruby]{
module Enumerable
# 要素をn回ずつ繰り返すメソッド
# 例:[1,2,3].repeat(2) #=> [1,1,2,2,3,3]
def repeat(n)
raise ArgumentError if n < 0
if block_given?
e
ach do |*v...
...n.times { yield *val }
e
nd
e
lse
to_enum(:repeat, n)
e
nd
e
nd
e
nd

r = 1..10
p r.map{|n| n**2}.repeat(2).first(5)
#=> [1, 1, 4, 4, 9]

r = 1..Float::INFINITY
p r.lazy.map{|n| n**2}.repeat(2).first(5)
#=> [1, 1, 4, 4, 9]

# Lazy#to_enum のおかげで、repeat の返り...

Kernel.#Float(arg) -> Float (9410.0)

引数を浮動小数点数(Float)に変換した結果を返します。

...引数を浮動小数点数(Float)に変換した結果を返します。

引数が数値の場合は素直に変換し、文字列の場合
は整数や浮動小数点数と見なせるもののみ変換します。

メソッド Float は文字列に対し String#to_f よりも厳密な変換を...
...行います。

@param arg 変換対象のオブジェクトです。
@raise ArgumentError 整数や浮動小数点数と見なせない文字列を引数に指定した場合に発生します。
@raise TypeError nil またはメソッド to_f を持たないオブジェクトを引数に指定し...
...p Float(".1") #=> 0.1
p Float("0xa") #=> 10.0

p Float("nan") # invalid value for Float(): "nan" (ArgumentError)
p Float("INF") # invalid value for Float(): "INF" (ArgumentError)
p Float("-Inf") # invalid value for Float(): "-Inf" (ArgumentError)
p Float(("10" * 1...

絞り込み条件を変える

Enumerator::Lazy#enum_for(method = :each, *args) -> Enumerator::Lazy (9316.0)

Object#to_enum と同じですが、Enumerator::Lazy を返します。

...Object#to_enum と同じですが、Enumerator::Lazy を返します。

to_enum は「ブロック付きで呼ぶとループを実行し、ブロックを省略した場合は
E
numerator を返す」ようなメソッドを定義するときによく使われます。
このときに lazy 性が...
...umerator ではなく Enumerator::Lazy を返すようになっています。

//emlist[例][ruby]{
module Enumerable
# 要素をn回ずつ繰り返すメソッド
# 例:[1,2,3].repeat(2) #=> [1,1,2,2,3,3]
def repeat(n)
raise ArgumentError if n < 0
if block_given?
e
ach do |*v...
...n.times { yield *val }
e
nd
e
lse
to_enum(:repeat, n)
e
nd
e
nd
e
nd

r = 1..10
p r.map{|n| n**2}.repeat(2).first(5)
#=> [1, 1, 4, 4, 9]

r = 1..Float::INFINITY
p r.lazy.map{|n| n**2}.repeat(2).first(5)
#=> [1, 1, 4, 4, 9]

# Lazy#to_enum のおかげで、repeat の返り...

Enumerator::Lazy#to_enum(method = :each, *args) -> Enumerator::Lazy (9316.0)

Object#to_enum と同じですが、Enumerator::Lazy を返します。

...Object#to_enum と同じですが、Enumerator::Lazy を返します。

to_enum は「ブロック付きで呼ぶとループを実行し、ブロックを省略した場合は
E
numerator を返す」ようなメソッドを定義するときによく使われます。
このときに lazy 性が...
...umerator ではなく Enumerator::Lazy を返すようになっています。

//emlist[例][ruby]{
module Enumerable
# 要素をn回ずつ繰り返すメソッド
# 例:[1,2,3].repeat(2) #=> [1,1,2,2,3,3]
def repeat(n)
raise ArgumentError if n < 0
if block_given?
e
ach do |*v...
...n.times { yield *val }
e
nd
e
lse
to_enum(:repeat, n)
e
nd
e
nd
e
nd

r = 1..10
p r.map{|n| n**2}.repeat(2).first(5)
#=> [1, 1, 4, 4, 9]

r = 1..Float::INFINITY
p r.lazy.map{|n| n**2}.repeat(2).first(5)
#=> [1, 1, 4, 4, 9]

# Lazy#to_enum のおかげで、repeat の返り...
<< 1 2 3 ... > >>