種類
- インスタンスメソッド (158)
- 文書 (22)
- ライブラリ (11)
ライブラリ
- ビルトイン (147)
- bigdecimal (11)
モジュール
- Comparable (22)
- Enumerable (29)
検索結果
先頭5件
-
Module
# >=(other) -> bool | nil (21364.0) -
比較演算子。self が other の先祖か同一クラスである場合、 true を返します。 self が other の子孫である場合、false を返します。
...比較演算子。self が other の先祖か同一クラスである場合、 true を返します。
self が other の子孫である場合、false を返します。
継承関係にないクラス同士の比較では
nil を返します。
@param other 比較対象のモジュールやクラ......Module#<
//emlist[例][ruby]{
module Foo; end
module Bar
include Foo
end
module Baz
prepend Foo
end
Bar.ancestors # => [Bar, Foo]
Foo >= Bar # => true
Bar >= Foo # => false
Baz.ancestors # => [Foo, Baz]
Foo >= Baz # => true
Baz >= Foo # => false
Foo >= Foo # => true
Foo >= Object # => nil
//... -
Comparable
# >=(other) -> bool (21240.0) -
比較演算子 <=> をもとにオブジェクト同士を比較します。 <=> が正の整数か 0 を返した場合に、true を返します。 それ以外の整数を返した場合に、false を返します。
...以外の整数を返した場合に、false を返します。
@param other 自身と比較したいオブジェクトを指定します。
@raise ArgumentError <=> が nil を返したときに発生します。
//emlist[例][ruby]{
1 >= 0 # => true
1 >= 1 # => true
1 >= 2 # => false
//}... -
Float
# >=(other) -> bool (21224.0) -
比較演算子。数値として等しいまたは大きいか判定します。
...ram other 比較対象の数値
@return self よりも other の方が小さい場合か、
両者が等しい場合 true を返します。
そうでなければ false を返します。
//emlist[例][ruby]{
3.14 > 3.1415 # => false
3.14 >= 3.1415 # => false
//}... -
BigDecimal
# >=(other) -> bool (21216.0) -
self が other より大きいか等しい場合に true を、そうでない場合に false を返します。
...self が other より大きいか等しい場合に true を、そうでない場合に false
を返します。... -
Integer
# >=(other) -> bool (18230.0) -
比較演算子。数値として等しいまたは大きいか判定します。
...other 比較対象の数値
@return self よりも other の方が小さい場合か、
両者が等しい場合 true を返します。
そうでなければ false を返します。
//emlist[][ruby]{
1 >= 0 # => true
1 >= 1 # => true
1 >= 2 # => false
//}... -
Hash
# >=(other) -> bool (18224.0) -
other が self のサブセットか同じである場合に真を返します。
...other が self のサブセットか同じである場合に真を返します。
@param other 自身と比較したい Hash オブジェクトを指定します。
//emlist[例][ruby]{
h1 = {a:1, b:2}
h2 = {a:1, b:2, c:3}
h1 >= h2 # => false
h2 >= h1 # => true
h1 >= h1 # => true
//}
@see... -
Fixnum
# >=(other) -> bool (18206.0) -
比較演算子。数値として等しいまたは大きいか判定します。
...演算子。数値として等しいまたは大きいか判定します。
@param other 比較対象の数値
@return self よりも other の方が小さい場合か、
両者が等しい場合 true を返します。
そうでなければ false を返します。... -
bigdecimal (6036.0)
-
bigdecimal は浮動小数点数演算ライブラリです。 任意の精度で 10 進表現された浮動小数点数を扱えます。
...bigdecimal は浮動小数点数演算ライブラリです。
任意の精度で 10 進表現された浮動小数点数を扱えます。
//emlist[][ruby]{
require 'bigdecimal'
a = BigDecimal("0.123456789123456789")
b = BigDecimal("123456.78912345678", 40)
print a + b # => 0.123456912580245903456......decimal'
sum = BigDecimal("0")
for i in (1..10000)
sum = sum + BigDecimal("0.0001")
end
print sum # => 0.1e1
//}
//emlist[例3: 1.2 - 1.0 と 0.2 との比較][ruby]{
require "bigdecimal"
(BigDecimal("1.2") - BigDecimal("1.0")) == BigDecimal("0.2") # => true
(1.2 - 1.0) == 0.2 # => false
//}......internal_structure] 内部構造
BigDecimal内部で浮動小数点は構造体(Real)で表現されます。
そのうち仮数部は unsigned long の配列 (以下の構造体要素 frac) で管理されます。
概念的には、以下のようになります。
<浮動小数点数> = 0.xxx... -
Enumerable
# none? -> bool (3130.0) -
ブロックを指定しない場合は、 Enumerable オブジェクトのすべての 要素が偽であれば真を返します。そうでなければ偽を返します。
...ブロックを指定しない場合は、 Enumerable オブジェクトのすべての
要素が偽であれば真を返します。そうでなければ偽を返します。
ブロックを指定した場合は、Enumerable オブジェクトのすべての要素を
ブロックで評価した結......e を返します。
//emlist[例][ruby]{
require 'set'
Set['ant', 'bear', 'cat'].none? {|word| word.length == 5} # => true
Set['ant', 'bear', 'cat'].none? {|word| word.length >= 4} # => false
Set[].none? # => true
Set[nil].none?......# => true
Set[nil,false].none? # => true
Set[nil, false, true].none? # => false
//}......各要素に対して pattern === item を評価します。
//emlist[例][ruby]{
require 'set'
Set['ant', 'bear', 'cat'].none? {|word| word.length == 5} # => true
Set['ant', 'bear', 'cat'].none? {|word| word.length >= 4} # => false
Set['ant', 'bear', 'cat'].none?(/d/) # =>......true
Set[].none? # => true
Set[nil].none? # => true
Set[nil,false].none? # => true
Set[nil, false, true].none? # => false
//}......Set[].none? # => true
Set[nil].none? # => true
Set[nil,false].none? # => true
Set[nil, false, true].none? # => false
//}
@see Array#none?... -
Enumerable
# none? {|obj| . . . } -> bool (3130.0) -
ブロックを指定しない場合は、 Enumerable オブジェクトのすべての 要素が偽であれば真を返します。そうでなければ偽を返します。
...ブロックを指定しない場合は、 Enumerable オブジェクトのすべての
要素が偽であれば真を返します。そうでなければ偽を返します。
ブロックを指定した場合は、Enumerable オブジェクトのすべての要素を
ブロックで評価した結......e を返します。
//emlist[例][ruby]{
require 'set'
Set['ant', 'bear', 'cat'].none? {|word| word.length == 5} # => true
Set['ant', 'bear', 'cat'].none? {|word| word.length >= 4} # => false
Set[].none? # => true
Set[nil].none?......# => true
Set[nil,false].none? # => true
Set[nil, false, true].none? # => false
//}......各要素に対して pattern === item を評価します。
//emlist[例][ruby]{
require 'set'
Set['ant', 'bear', 'cat'].none? {|word| word.length == 5} # => true
Set['ant', 'bear', 'cat'].none? {|word| word.length >= 4} # => false
Set['ant', 'bear', 'cat'].none?(/d/) # =>......true
Set[].none? # => true
Set[nil].none? # => true
Set[nil,false].none? # => true
Set[nil, false, true].none? # => false
//}......Set[].none? # => true
Set[nil].none? # => true
Set[nil,false].none? # => true
Set[nil, false, true].none? # => false
//}
@see Array#none?...