るりまサーチ

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

別のキーワード

  1. _builtin >
  2. bigdecimal >
  3. comparable >
  4. float >
  5. module >

検索結果

<< 1 2 3 > >>

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

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

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

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

メソッド Float は文字列に対し String#to_f よりも厳密な変換を...
...]{
p Float(4) #=> 4.0
p Float(4_000) #=> 4000.0
p Float(9.88) #=> 9.88

p Float(Time.gm(1986)) #=> 504921600.0
p Float(Object.new) # can't convert Object into Float (TypeError)
p Float(nil) # can't convert nil into Float (TypeError)

p Float("10") #=> 10....
...0
p Float("10e2") #=> 1000.0
p Float("1e-2") #=> 0.01
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") # in...

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

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

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

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

メソッド Float は文字列に対し String#to_f よりも厳密な変換を...
...]{
p Float(4) #=> 4.0
p Float(4_000) #=> 4000.0
p Float(9.88) #=> 9.88

p Float(Time.gm(1986)) #=> 504921600.0
p Float(Object.new) # can't convert Object into Float (TypeError)
p Float(nil) # can't convert nil into Float (TypeError)

p Float("10") #=> 10....
...0
p Float("10e2") #=> 1000.0
p Float("1e-2") #=> 0.01
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") # in...

Kernel.#format(format, *arg) -> String (6336.0)

format 文字列を C 言語の sprintf と同じように解釈し、 引数をフォーマットした文字列を返します。

...format 文字列を C 言語の sprintf と同じように解釈し、
引数をフォーマットした文字列を返します。

@param format フォーマット文字列です。
@param arg フォーマットされる引数です。
@see Kernel.#printf,Time#strftime,Date.strptime

=== sprintf...
...の書式です。[] で囲まれた部分は省略可
能であることを示しています。

%[nth$][フラグ][幅][.精度]指示子
%[<name>][フラグ][幅][.精度]指示子

`%' 自身を出力するには `%%' とします。

以下それぞれの要素に関して説明します。...
...#=> "a"
p sprintf("%c", 'a') #=> "a"
//}

フラグ `-' と幅 の指定だけが意味を持ちます。

: s

文字列を出力します。

引数が String オブジェクトでなければ to_s メソッドにより文字列化
したものを引数として扱います。

: p

Object
#i...

Matrix#cofactor_expansion(row: nil, column: nil) -> object | Integer | Rational | Float (3504.0)

row 行、もしくは column 列に関するラプラス展開をする。

...Matrix#determinant を
利用すべきです。

変則的な形状の行列に対してはそれ以上の意味を持ちます。例えば
row行/column列が行列やベクトルである場合には

//emlist[例][ruby]{
require 'matrix'
# Matrix[[7,6], [3,9]].laplace_expansion(column: 1) # => 45...
...Matrix[[Vector[1, 0], Vector[0, 1]], [2, 3]].laplace_expansion(row: 0) # => Vector[3, -2]
//}

@param row 行
@param column 列
@raise ArgumentError row と column を両方指定した、もしくは両方とも指定していない、場合に発生します
@raise ExceptionForMatrix::ErrDimensi...
...onMismatch 行列が正方でない場合に発生します
@see Matrix#cofactor...

Matrix#laplace_expansion(row: nil, column: nil) -> object | Integer | Rational | Float (3504.0)

row 行、もしくは column 列に関するラプラス展開をする。

...Matrix#determinant を
利用すべきです。

変則的な形状の行列に対してはそれ以上の意味を持ちます。例えば
row行/column列が行列やベクトルである場合には

//emlist[例][ruby]{
require 'matrix'
# Matrix[[7,6], [3,9]].laplace_expansion(column: 1) # => 45...
...Matrix[[Vector[1, 0], Vector[0, 1]], [2, 3]].laplace_expansion(row: 0) # => Vector[3, -2]
//}

@param row 行
@param column 列
@raise ArgumentError row と column を両方指定した、もしくは両方とも指定していない、場合に発生します
@raise ExceptionForMatrix::ErrDimensi...
...onMismatch 行列が正方でない場合に発生します
@see Matrix#cofactor...

絞り込み条件を変える

Kernel.#sprintf(format, *arg) -> String (3236.0)

format 文字列を C 言語の sprintf と同じように解釈し、 引数をフォーマットした文字列を返します。

...format 文字列を C 言語の sprintf と同じように解釈し、
引数をフォーマットした文字列を返します。

@param format フォーマット文字列です。
@param arg フォーマットされる引数です。
@see Kernel.#printf,Time#strftime,Date.strptime

=== sprintf...
...の書式です。[] で囲まれた部分は省略可
能であることを示しています。

%[nth$][フラグ][幅][.精度]指示子
%[<name>][フラグ][幅][.精度]指示子

`%' 自身を出力するには `%%' とします。

以下それぞれの要素に関して説明します。...
...#=> "a"
p sprintf("%c", 'a') #=> "a"
//}

フラグ `-' と幅 の指定だけが意味を持ちます。

: s

文字列を出力します。

引数が String オブジェクトでなければ to_s メソッドにより文字列化
したものを引数として扱います。

: p

Object
#i...

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

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

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

to_enum は「ブロック付きで呼ぶとループを実行し、ブロックを省略した場合は
Enumerator を返す」ようなメソッドを定義するときによく使われます。
このときに lazy 性が...
...うに、Lazy#to_enum は
素のEnumerator ではなく 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...
...enum(:repeat, n)
end
end
end

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 のときは Enumerator に、...

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

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

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

to_enum は「ブロック付きで呼ぶとループを実行し、ブロックを省略した場合は
Enumerator を返す」ようなメソッドを定義するときによく使われます。
このときに lazy 性が...
...うに、Lazy#to_enum は
素のEnumerator ではなく 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...
...enum(:repeat, n)
end
end
end

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 のときは Enumerator に、...

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

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

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

to_enum は「ブロック付きで呼ぶとループを実行し、ブロックを省略した場合は
Enumerator を返す」ようなメソッドを定義するときによく使われます。
このときに lazy 性が...
...うに、Lazy#to_enum は
素のEnumerator ではなく 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...
...enum(:repeat, n)
end
end
end

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 のときは Enumerator に、...

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

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

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

to_enum は「ブロック付きで呼ぶとループを実行し、ブロックを省略した場合は
Enumerator を返す」ようなメソッドを定義するときによく使われます。
このときに lazy 性が...
...うに、Lazy#to_enum は
素のEnumerator ではなく 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...
...enum(:repeat, n)
end
end
end

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 のときは Enumerator に、...

絞り込み条件を変える

<< 1 2 3 > >>