るりまサーチ

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

別のキーワード

  1. numeric step
  2. _builtin numeric
  3. numeric eql?
  4. numeric nonzero?

ライブラリ

クラス

キーワード

検索結果

Numeric#zero? -> bool (27125.0)

自身がゼロの時、trueを返します。そうでない場合は false を返します。

...自身がゼロの時、trueを返します。そうでない場合は false を返します。

//emlist[例][ruby]{
p 10.zero? #=> false
p 0.zero? #=> true
p 0.0.zero? #=> true
//}

@see Numeric#nonzero?...

Numeric#nonzero? -> self | nil (15106.0)

自身がゼロの時 nil を返し、非ゼロの時 self を返します。

...時 nil を返し、非ゼロの時 self を返します。

//emlist[例][ruby]{
p 10.nonzero? #=> 10
p 0.nonzero? #=> nil
p 0.0.nonzero? #=> nil
p Rational(0, 2).nonzero? #=> nil
//}

非ゼロの時に self を返すため、自身が 0 の時に他の処...
...理をさせたい場合に以
下のように記述する事もできます。

//emlist[例][ruby]{
a = %w( z Bb bB bb BB a aA Aa AA A )
b = a.sort {|a,b| (a.downcase <=> b.downcase).nonzero? || a <=> b }
b #=> ["A", "a", "AA", "Aa", "aA", "BB", "Bb", "bB", "bb", "z"]
//}

@see Numeric#zero?...

Numeric (6142.0)

数値を表す抽象クラスです。Integer や Float などの数値クラス は Numeric のサブクラスとして実装されています。

...スです。Integer や Float などの数値クラス
Numeric のサブクラスとして実装されています。

演算や比較を行うメソッド(+, -, *, /, <=>)は Numeric のサブクラスで定義されま
す。Numeric で定義されているメソッドは、サブクラスで...
...提供されているメソッド
(+, -, *, /, %) を利用して定義されるものがほとんどです。
つまり Numeric で定義されているメソッドは、Numeric のサブクラスとして新たに数値クラスを定義した時に、
演算メソッド(+, -, *, /, %, <=>, coerce...
...o - -
next | - o - - - - -
nonzero? | o - - - - - -
numerator | o o - -...
...- o - - -
next_float | - - o - -
nonzero? | o - - - -
numerator | o o o o o...

NEWS for Ruby 3.0.0 (24.0)

NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...osed pipe, no broken pipe error message will be shown now. 14413
* `TRUE`/`FALSE`/`NIL` constants are no longer defined.
* Integer#zero? overrides Numeric#zero? for optimization. 16961
* Enumerable#grep and Enumerable#grep_v when passed a Regexp and no block no longer modify Regexp.last_matc...
...low compilations.
* Memory view interface [EXPERIMENTAL]
* The memory view interface is a C-API set to exchange a raw memory area, such as a numeric array or a bitmap image, between extension libraries. The extension libraries can share also the metadata of the memory area that consists of the...
...s`, `#frozen?`
* `Integer`: `#-@`, `#~`, `#abs`, `#bit_length`, `#even?`, `#integer?`, `#magnitude`, `#odd?`, `#ord`, `#to_i`, `#to_int`, `#zero?`
* `Struct`: reader methods for 10th or later members
* Constant references are inlined.
* Always generate appropriate code for `=...