504件ヒット
[1-100件を表示]
(0.124秒)
ライブラリ
- ビルトイン (427)
- bigdecimal (22)
-
bigdecimal
/ util (22) - json (11)
- openssl (22)
クラス
- Array (19)
- BigDecimal (22)
- Complex (38)
- Enumerator (11)
-
Enumerator
:: Chain (6) -
Enumerator
:: Lazy (75) - Float (86)
- Integer (22)
-
JSON
:: State (11) - Numeric (92)
-
OpenSSL
:: PKey :: EC :: Point (22) - Random (33)
- Range (23)
- Rational (11)
- String (22)
モジュール
- Enumerable (11)
キーワード
-
/ (11) -
_ dump (11) -
allow
_ nan? (11) - bsearch (11)
-
enum
_ for (22) - finite? (16)
- grep (11)
-
grep
_ v (9) - infinite? (19)
- infinity? (11)
- inspect (22)
- lazy (22)
-
next
_ float (10) - overlap? (1)
- pack (19)
- pow (11)
-
prev
_ float (10) - rand (33)
-
set
_ to _ infinity! (11) - sign (11)
- size (28)
- step (84)
-
to
_ d (22) -
to
_ enum (22) -
to
_ f (33) -
to
_ s (22) - unpack (11)
検索結果
先頭5件
-
Float
# next _ float -> Float (9213.0) -
浮動小数点数で表現可能な self の次の値を返します。
...表現可能な self の次の値を返します。
Float::MAX.next_float、Float::INFINITY.next_float は
Float::INFINITY を返します。Float::NAN.next_float は
Float::NAN を返します。
//emlist[例][ruby]{
p 0.01.next_float # => 0.010000000000000002
p 1.0.next_float # => 1.000000000......00002
p 100.0.next_float # => 100.00000000000001
p 0.01.next_float - 0.01 # => 1.734723475976807e-18
p 1.0.next_float - 1.0 # => 2.220446049250313e-16
p 100.0.next_float - 100.0 # => 1.4210854715202004e-14
f = 0.01; 20.times { printf "%-20a %s\n", f, f.to_s; f = f.next_float }
# => 0x1.47ae1......47ae147ae1489p-7 0.010000000000000024
# 0x1.47ae147ae148ap-7 0.010000000000000026
# 0x1.47ae147ae148bp-7 0.010000000000000028
# 0x1.47ae147ae148cp-7 0.01000000000000003
# 0x1.47ae147ae148dp-7 0.010000000000000031
# 0x1.47ae147ae148ep-7 0.010000000000000033
//}
@see Float#prev_float... -
Float
# prev _ float -> Float (9213.0) -
浮動小数点数で表現可能な self の前の値を返します。
...現可能な self の前の値を返します。
(-Float::MAX).prev_float と (-Float::INFINITY).prev_float
は -Float::INFINITY を返します。Float::NAN.prev_float は
Float::NAN を返します。
//emlist[例][ruby]{
p 0.01.prev_float # => 0.009999999999999998
p 1.0.prev_float # => 0.999......99999
p 100.0.prev_float # => 99.99999999999999
p 0.01 - 0.01.prev_float # => 1.734723475976807e-18
p 1.0 - 1.0.prev_float # => 1.1102230246251565e-16
p 100.0 - 100.0.prev_float # => 1.4210854715202004e-14
f = 0.01; 20.times { printf "%-20a %s\n", f, f.to_s; f = f.prev_float }
# => 0x1.47ae1......47ae147ae146dp-7 0.009999999999999976
# 0x1.47ae147ae146cp-7 0.009999999999999974
# 0x1.47ae147ae146bp-7 0.009999999999999972
# 0x1.47ae147ae146ap-7 0.00999999999999997
# 0x1.47ae147ae1469p-7 0.009999999999999969
# 0x1.47ae147ae1468p-7 0.009999999999999967
//}
@see Float#next_float... -
OpenSSL
:: PKey :: EC :: Point # infinity? -> bool (9208.0) -
自身が無限遠点であるならば true を返します。
...自身が無限遠点であるならば true を返します。
@raise OpenSSL::PKey::EC::Point::Error エラーが生じた場合に発生します
@see OpenSSL::PKey::EC::Point#set_to_infinity!... -
OpenSSL
:: PKey :: EC :: Point # set _ to _ infinity! -> self (9208.0) -
自身を無限遠点に設定します。
...自身を無限遠点に設定します。
@raise OpenSSL::PKey::EC::Point::Error エラーが生じた場合に発生します
@see OpenSSL::PKey::EC::Point#infinity!... -
Enumerator
:: Lazy # lazy -> self (9113.0) -
self を返します。
...self を返します。
//emlist[例][ruby]{
lazy = (100..Float::INFINITY).lazy
p lazy.lazy # => #<Enumerator::Lazy: 100..Infinity>
p lazy == lazy.lazy # => true
//}... -
Enumerable
# lazy -> Enumerator :: Lazy (6207.0) -
自身を lazy な Enumerator に変換したものを返します。
...身を lazy な Enumerator に変換したものを返します。
この Enumerator は、以下のメソッドが遅延評価を行う (つまり、配列ではな
くEnumeratorを返す) ように再定義されています。
* map/collect
* flat_map/collect_concat
* select/find_all
* reje......ct
* grep
* take, take_while
* drop, drop_while
* zip (※一貫性のため、ブロックを渡さないケースのみlazy)
* cycle (※一貫性のため、ブロックを渡さないケースのみlazy)
以下はピタゴラス数 (a**2 + b**2 = c**2 を満たす自然数 a, b, c の組)......//emlist[例][ruby]{
def pythagorean_triples
(1..Float::INFINITY).lazy.flat_map {|z|
(1..z).flat_map {|x|
(x..z).select {|y|
x**2 + y**2 == z**2
}.map {|y|
[x, y, z]
}
}
}
end
# 最初の10個のピタゴラス数を表示する
p pythagorean_triples.ta... -
Range
# overlap?(range) -> bool (6149.0) -
self と range に重なりがある場合は true を、そうでない場合は false を返します。
...self と range に重なりがある場合は true を、そうでない場合は false を返します。
@param range self と重なりがあるかどうかを調べたい Range オブジェクトを指定します。
@raise TypeError 引数に Range でないオブジェクトを指定した......//emlist[例][ruby]{
(0..2).overlap?(1..3) #=> true
(0..2).overlap?(3..4) #=> false
(0..).overlap?(..0) #=> true
(0..).overlap?(...0) #=> false
//}
self の端点と range の端点が比較可能でない(<=> メソッドが nil を返す)場合、false を返します。
//emlist[......比較可能でない例][ruby]{
(1..3).overlap?('a'..'d') #=> false
//}
self または range が空である場合、false を返します。
ここで、Range が空であるとは、
* 始端が終端より大きい
* Range#exclude_end? が true であり、始端と終端が等しい
の... -
JSON
:: State # allow _ nan? -> bool (6133.0) -
NaN, Infinity, -Infinity を生成できる場合、真を返します。 そうでない場合は偽を返します。
...NaN, Infinity, -Infinity を生成できる場合、真を返します。
そうでない場合は偽を返します。
//emlist[例][ruby]{
require "json"
json_state = JSON::State.new({})
json_state.allow_nan? # => false
json_state = JSON::State.new(allow_nan: true)
json_state.allow_nan? # => tr... -
Enumerator
:: Lazy # grep(pattern) {|item| . . . } -> Enumerator :: Lazy (3119.0) -
Enumerable#grep と同じですが、配列ではなくEnumerator::Lazy を返します。
...rable#grep と同じですが、配列ではなくEnumerator::Lazy を返します。
//emlist[例][ruby]{
(100..Float::INFINITY).lazy.map(&:to_s).grep(/\A(\d)\1+\z/)
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator::Lazy: 100..Infinity>:map>:grep(/\A(\d)\1+\z/)>
(100..Float::INFINITY).laz......y.map(&:to_s).grep(/\A(\d)\1+\z/).take(10).force
# => ["111", "222", "333", "444", "555", "666", "777", "888", "999", "1111"]
//}
@see Enumerable#grep......y.map(&:to_s).grep(/\A(\d)\1+\z/).take(10).force
# => ["111", "222", "333", "444", "555", "666", "777", "888", "999", "1111"]
//}
@see Enumerable#grep, Enumerable#grep_v, Enumerator::Lazy#grep_v... -
Enumerator
:: Lazy # grep _ v(pattern) {|item| . . . } -> Enumerator :: Lazy (3119.0) -
Enumerable#grep_v と同じですが、配列ではなくEnumerator::Lazy を返します。
...rable#grep_v と同じですが、配列ではなくEnumerator::Lazy を返します。
//emlist[例][ruby]{
(100..Float::INFINITY).lazy.map(&:to_s).grep_v(/(\d).*\1/)
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator::Lazy: 100..Infinity>:map>:grep_v(/(\d).*\1/)>
(100..Float::INFINITY).laz......y.map(&:to_s).grep_v(/(\d).*\1/).take(15).force
# => ["102", "103", "104", "105", "106", "107", "108", "109", "120", "123", "124", "125", "126", "127", "128"]
//}
@see Enumerable#grep_v, Enumerable#grep, Enumerator::Lazy#grep... -
Float
# infinite? -> 1 | -1 | nil (3113.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
//}...