9件ヒット
[1-9件を表示]
(0.192秒)
ライブラリ
- ビルトイン (8)
-
bigdecimal
/ util (1)
検索結果
先頭5件
-
Float
# denominator -> Integer (36907.0) -
自身を Rational に変換した時の分母を返します。
...自身を Rational に変換した時の分母を返します。
@return 分母を返します。
//emlist[例][ruby]{
2.0.denominator # => 1
0.5.denominator # => 2
//}
@see Float#numerator... -
Float
# round(ndigits = 0) -> Integer | Float (36607.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 (36607.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
# divmod(other) -> [Numeric] (18823.0) -
self を other で割った商 q と余り r を、 [q, r] という 2 要素の配列にして返します。 商 q は常に整数ですが、余り r は整数であるとは限りません。
self を other で割った商 q と余り r を、
[q, r] という 2 要素の配列にして返します。
商 q は常に整数ですが、余り r は整数であるとは限りません。
ここで、商 q と余り r は、
* self == other * q + r
と
* other > 0 のとき: 0 <= r < other
* other < 0 のとき: other < r <= 0
* q は整数
をみたす数です。
このメソッドは、メソッド / と % によって定義されています。
@param other 自身を割る数を指定します。
//emli... -
Float
# to _ d(prec) -> BigDecimal (18703.0) -
自身を BigDecimal に変換します。
...自身を BigDecimal に変換します。
@param prec 計算結果の精度。省略した場合は Float::DIG + 1 です。
@return BigDecimal に変換したオブジェクト
//emlist[][ruby]{
require 'bigdecimal'
require 'bigdecimal/util'
p 1.0.to_d # => 0.1e1
p (1.0 / 0).to_d # => I... -
Float
# floor(ndigits = 0) -> Integer | Float (18607.0) -
自身と等しいかより小さな整数のうち最大のものを返します。
...。
@param ndigits 10進数での小数点以下の有効桁数を整数で指定します。
正の整数を指定した場合、Float を返します。
小数点以下を、最大 n 桁にします。
負の整数を指定した場合、Integer を返......oor(-4) # => 30000
34567.89.floor(-3) # => 34000
34567.89.floor(-2) # => 34500
34567.89.floor(-1) # => 34560
34567.89.floor(0) # => 34567
34567.89.floor(1) # => 34567.8
34567.89.floor(2) # => 34567.89
34567.89.floor(3) # => 34567.89
//}
@see Numeric#ceil, Numeric#round, Float#truncate... -
Float
# modulo(other) -> Float (9607.0) -
算術演算子。剰余を計算します。
算術演算子。剰余を計算します。
@param other 二項演算の右側の引数(対象)
//emlist[例][ruby]{
# 剰余
3.0 % 1.2 # => 0.6000000000000001
3.0 % 0.0 # ZeroDivisionError
//} -
Float
# truncate(ndigits = 0) -> Integer | Float (9607.0) -
小数点以下を切り捨てて値を整数に変換します。
...。
@param ndigits 10進数での小数点以下の有効桁数を整数で指定します。
正の整数を指定した場合、Float を返します。
小数点以下を、最大 n 桁にします。
負の整数を指定した場合、Integer を返... -
Float
# ceil(ndigits = 0) -> Integer | Float (607.0) -
自身と等しいかより大きな整数のうち最小のものを返します。
...。
@param ndigits 10進数での小数点以下の有効桁数を整数で指定します。
正の整数を指定した場合、Float を返します。
小数点以下を、最大 n 桁にします。
負の整数を指定した場合、Integer を返......34567.89.ceil(-4) # => 40000
34567.89.ceil(-3) # => 35000
34567.89.ceil(-2) # => 34600
34567.89.ceil(-1) # => 34570
34567.89.ceil(0) # => 34568
34567.89.ceil(1) # => 34567.9
34567.89.ceil(2) # => 34567.89
34567.89.ceil(3) # => 34567.89
//}
@see Float#floor, Float#round, Float#truncate...