るりまサーチ

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

別のキーワード

  1. _builtin nil?
  2. nilclass nil?
  3. object nil?
  4. _builtin nil
  5. object nil

検索結果

<< 1 2 3 ... > >>

Float#<=>(other) -> -1 | 0 | 1 | nil (21129.0)

self と other を比較して、self が大きい時に正、 等しい時に 0、小さい時に負の整数を返します。 比較できない場合はnilを返します

...self が大きい時に正、
等しい時に 0、小さい時に負の整数を返します。
比較できない場合はnilを返します

//emlist[例][ruby]{
3.05 <=> 3.14 # => -1
1.732 <=> 1.414 # => 1
3.3 - 3.3 <=> 0.0 # => 0
3.14 <=> "hoge" # => nil
3.14 <=> 0.0/0.0 # => nil
//}...

Float#round(ndigits = 0) -> Integer | Float (21126.0)

自身ともっとも近い整数もしくは実数を返します。

...@param half ちょうど半分の値の丸め方を指定します。
サポートされている値は以下の通りです。

* :up or nil: 0から遠い方に丸められます。
* :even: もっとも近い偶数に丸められます。
* :down: 0に近い方に丸められます。...
...d(-2) # => 93600
t.round(-3) # => 94000
t.round(-100) # => 0

2.5.round(half: :up) # => 3
2.5.round(half: :even) # => 2
2.5.round(half: :down) # => 2
3.5.round(half: :up) # => 4
3.5.round(half: :even) # => 4
3.5.round(half: :down) # => 3
//}

@see Float#ceil, Float#floor, Float#truncate...

Float#round(ndigits = 0, half: :up) -> Integer | Float (21126.0)

自身ともっとも近い整数もしくは実数を返します。

...@param half ちょうど半分の値の丸め方を指定します。
サポートされている値は以下の通りです。

* :up or nil: 0から遠い方に丸められます。
* :even: もっとも近い偶数に丸められます。
* :down: 0に近い方に丸められます。...
...d(-2) # => 93600
t.round(-3) # => 94000
t.round(-100) # => 0

2.5.round(half: :up) # => 3
2.5.round(half: :even) # => 2
2.5.round(half: :down) # => 2
3.5.round(half: :up) # => 4
3.5.round(half: :even) # => 4
3.5.round(half: :down) # => 3
//}

@see Float#ceil, Float#floor, Float#truncate...

Float#infinite? -> 1 | -1 | nil (21117.0)

数値が +∞ のとき 1、-∞のとき -1 を返します。それ以外は nil を返 します。

...数値が +∞ のとき 1、-∞のとき -1 を返します。それ以外は nil を返
します。

//emlist[例][ruby]{
inf = 1.0/0
p inf # => Infinity
p inf.infinite? # => 1

inf = -1.0/0
p inf # => -Infinity
p inf.infinite? # => -1
//}...

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

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

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

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

メソッド Float は文字列に対し String#to_f よりも厳密な変換を...
...た場合、
例外を発生する代わりに nil を返します。
@raise ArgumentError 整数や浮動小数点数と見なせない文字列を引数に指定した場合に発生します。
@raise TypeError nil またはメソッド to_f を持たないオブジェクトを...
...例][ruby]{
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")...

絞り込み条件を変える

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

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

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

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

メソッド Float は文字列に対し String#to_f よりも厳密な変換を...
...TypeError nil またはメソッド to_f を持たないオブジェクトを引数に指定したか、
to_f が浮動小数点数を返さなかった場合に発生します。

//emlist[例][ruby]{
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")...

NilClass#to_f -> Float (3107.0)

0.0 を返します。

...0.0 を返します。

//emlist[例][ruby]{
nil
.to_f #=> 0.0
//}...

JSON::Generator::GeneratorMethods::Float#to_json(state_or_hash = nil) -> String (3101.0)

自身から生成した JSON 形式の文字列を返します。

自身から生成した JSON 形式の文字列を返します。

@param state_or_hash 生成する JSON 形式の文字列をカスタマイズするため
に JSON::State のインスタンスか、
JSON::State.new の引数と同じ Hash を
指定します。

//emlist[例][ruby]{
require "json"

(1.0).to_json # => "1.0"
//}

1.6.8から1.8.0への変更点(まとめ) (588.0)

1.6.8から1.8.0への変更点(まとめ) * ((<1.6.8から1.8.0への変更点(まとめ)/インタプリタの変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたクラス/モジュール>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたメソッド>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加された定数>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張されたクラス/メソッド(互換性のある変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/変更されたクラス/メソッド(互換性のない変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/文法の変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/正規表現>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Marshal>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Windows 対応>)) * ((<1.6.8から1.8.0への変更点(まとめ)/廃止された(される予定の)機能>)) * ((<1.6.8から1.8.0への変更点(まとめ)/ライブラリ>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張ライブラリAPI>)) * ((<1.6.8から1.8.0への変更点(まとめ)/バグ修正>)) * ((<1.6.8から1.8.0への変更点(まとめ)/サポートプラットフォームの追加>))

...りました。
* nil: 警告を出力しない (-W0 新しい警告レベル)
* false: 重要な警告のみ出力 (-W1 デフォルト)
* true: すべての警告を出力する (-W2 or -W or -v or -w or --verbose)

追加された -W オプションは $VERBOSE = nil の指定(-W0)を...
...from -:1
ruby 1.6.8 (2002-12-24) [i586-linux]
=> ruby 1.8.0 (2003-06-21) [i586-linux]
[1, 2, nil]

Proc.new { break }.call

=> ruby 1.6.8 (2002-12-24) [i586-linux]

=> -:1:in `call': break from proc-c...
...Stat#rdev_major|File::Stat/rdev_major>)) [new]
: ((<File::Stat#rdev_minor|File::Stat/rdev_minor>)) [new]

追加

=== Float

: ((<Numeric#to_int|Numeric/to_int>)) [new]
: ((<Float#to_int|Numeric/to_int>)) [new]

追加。

=== Hash

: ((<Hash#merge|Hash/merge>)) [new]
: ((<Hash#merge!|Hash/merge...

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

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

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]]....

絞り込み条件を変える

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

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

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]]....
<< 1 2 3 ... > >>