るりまサーチ

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

別のキーワード

  1. _builtin float
  2. float to_d
  3. json float
  4. float rationalize
  5. fiddle type_float

ライブラリ

クラス

モジュール

キーワード

検索結果

<< 1 2 3 ... > >>

Float#*(other) -> Float (27208.0)

算術演算子。積を計算します。

...算術演算子。積を計算します。

@param other 二項演算の右側の引数(対象)

//emlist[例][ruby]{
# 積
2.4 * 3 # => 7.2
//}...

Rational#*(other) -> Rational | Float (18238.0)

積を計算します。

...

@param other 自身に掛ける数

other に Float を指定した場合は、計算結果を Float で返しま
す。

//emlist[例][ruby]{
r = Rational(3, 4)
r * 2 # => (3/2)
r * 4 # => (3/1)
r * 0.5 # => 0.375
r * Rational(1, 2) # => (3/8)
//}...

Bignum#*(other) -> Fixnum | Bignum | Float (18202.0)

算術演算子。積を計算します。

算術演算子。積を計算します。

@param other 二項演算の右側の引数(対象)
@return 計算結果

Fixnum#*(other) -> Fixnum | Bignum | Float (18202.0)

算術演算子。積を計算します。

算術演算子。積を計算します。

@param other 二項演算の右側の引数(対象)
@return 計算結果

Benchmark::Tms#*(x) -> Benchmark::Tms (18107.0)

self と x の乗算を計算します。

...self と x の乗算を計算します。

@param x Benchmark::Tms のオブジェクトか Float に暗黙の変換ができるオブジェクトです。

@return 計算結果は新しい Benchmark::Tms オブジェクトです。

@see Benchmark::Tms#memberwise...

絞り込み条件を変える

Float#**(other) -> Float (15208.0)

算術演算子。冪を計算します。

...算術演算子。冪を計算します。

@param other 二項演算の右側の引数(対象)

//emlist[例][ruby]{
# 冪
1.2 ** 3.0 # => 1.7279999999999998
3.0 + 4.5 - 1.3 / 2.4 * 3 % 1.2 ** 3.0 # => 5.875
0.0 ** 0 # => 1.0
//}...

Float#round(ndigits = 0) -> Integer | Float (9139.0)

自身ともっとも近い整数もしくは実数を返します。

...方を指定します。
サポートされている値は以下の通りです。

*
:up or nil: 0から遠い方に丸められます。
*
:even: もっとも近い偶数に丸められます。
*
:down: 0に近い方に丸められます。

@return 指定された引数に応じて、...
....round # => -1
(-1.5).round # => -2

t = Math::PI # => 3.141592653589793
t.round(3) # => 3.142
t.round(0) # => 3
t.round(1) # => 3.1

t = t**10 # => 93648.04747608298
t.round(-0) # => 93648
t.round(-1) # => 93650
t.round(-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 (9139.0)

自身ともっとも近い整数もしくは実数を返します。

...方を指定します。
サポートされている値は以下の通りです。

*
:up or nil: 0から遠い方に丸められます。
*
:even: もっとも近い偶数に丸められます。
*
:down: 0に近い方に丸められます。

@return 指定された引数に応じて、...
....round # => -1
(-1.5).round # => -2

t = Math::PI # => 3.141592653589793
t.round(3) # => 3.142
t.round(0) # => 3
t.round(1) # => 3.1

t = t**10 # => 93648.04747608298
t.round(-0) # => 93648
t.round(-1) # => 93650
t.round(-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] (9031.0)

self を other で割った商 q と余り r を、 [q, r] という 2 要素の配列にして返します。 商 q は常に整数ですが、余り r は整数であるとは限りません。

...余り r は整数であるとは限りません。

ここで、商 q と余り r は、

*
self == other * q + r

*
other > 0 のとき: 0 <= r < other
*
other < 0 のとき: other < r <= 0
*
q は整数
をみたす数です。
このメソッドは、メソッド / と % によ...

Rational#**(other) -> Rational | Float (6220.0)

冪(べき)乗を計算します。

...r に Float を指定した場合は、計算結果を Float で返しま
す。other が有理数であっても、計算結果が無理数だった場合は Float
を返します。

//emlist[例][ruby]{
r = Rational(3, 4)
r ** Rational(2, 1) # => (9/16)
r ** 2 # => (9/16)
r ** 2.0...
...# => 0.5625
r ** Rational(1, 2) # => 0.866025403784439
//}...

絞り込み条件を変える

Bignum#**(other) -> Fixnum | Bignum | Float (6202.0)

算術演算子。冪(べき乗)を計算します。

...算術演算子。冪(べき乗)を計算します。

@param other 二項演算の右側の引数(対象)
@return 計算結果

2 ** 3 # => 8
2 ** 0 # => 1
0 ** 0 # => 1...

Fixnum#**(other) -> Fixnum | Bignum | Float (6202.0)

算術演算子。冪(べき乗)を計算します。

...算術演算子。冪(べき乗)を計算します。

@param other 二項演算の右側の引数(対象)
@return 計算結果

2 ** 3 # => 8
2 ** 0 # => 1
0 ** 0 # => 1...

Integer#**(other) -> Numeric (6113.0)

算術演算子。冪(べき乗)を計算します。

...elf**other) % modulo と同じ結果を返します。
@return 計算結果
@raise TypeError 2引数 pow で Integer 以外を指定した場合に発生します。
@raise RangeError 2引数 pow で other に負の数を指定した場合に発生します。

//emlist[][ruby]{
2 ** 3 # => 8
2 ** 0...
...# => 1
0 ** 0 # => 1
3.pow(3, 8) # => 3
3.pow(3, -8) # => -5
3.pow(2, -2) # => -1
-3.pow(3, 8) # => 5
-3.pow(3, -8) # => -3
5.pow(2, -8) # => -7
//}

結果が巨大すぎる整数になりそうなとき、警告を出したうえで Float::INFINITY を返します。

//emlist[計算を...
...放棄して Float::INFINITY を返す例][ruby]{
p 100**9999999
# => warning: in a**b, b may be too big
# Infinity
//}

判定の閾値は変わりえます。

@see BigDecimal#power...
<< 1 2 3 ... > >>