48件ヒット
[1-48件を表示]
(0.029秒)
別のキーワード
検索結果
-
Integer
# pred -> Integer (18119.0) -
self から -1 した値を返します。
...self から -1 した値を返します。
//emlist[][ruby]{
1.pred #=> 0
(-1).pred #=> -2
//}
@see Integer#next... -
Numeric (48.0)
-
数値を表す抽象クラスです。Integer や Float などの数値クラス は Numeric のサブクラスとして実装されています。
...覧です。実際にどのメソッドがどのクラスに定義されているかはそれぞ
れのクラスを参照してください。
=> ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux]
Numeric Integer Fixnum Bignum Float Rational C......- o - o
polar | o - - - - - o
pred | - o - - - - -
Numeric Integer Fixnum Bi......下のように定義できます。
//emlist[例][ruby]{
if n > 0 then
n.ceil
else
n.floor
end
//}
また、任意桁の切上げ、切捨て、四捨五入を行うメソッドは以下のように
定義できます。
//emlist[][ruby]{
class Numeric
def roundup(d=0)
x = 10**d
if......覧です。実際にどのメソッドがどのクラスに定義されているかはそれぞ
れのクラスを参照してください。
=> ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-darwin15]
Numeric Integer Float Rational Complex
-------......polar | o - - - o
positive? | o - o o -
pred | - o - - -
prev_float | - - o - -... -
Integer
# next -> Integer (12.0) -
self の次の整数を返します。
...self の次の整数を返します。
//emlist[][ruby]{
1.next #=> 2
(-1).next #=> 0
1.succ #=> 2
(-1).succ #=> 0
//}
@see Integer#pred... -
Integer
# succ -> Integer (12.0) -
self の次の整数を返します。
...self の次の整数を返します。
//emlist[][ruby]{
1.next #=> 2
(-1).next #=> 0
1.succ #=> 2
(-1).succ #=> 0
//}
@see Integer#pred...