るりまサーチ

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

別のキーワード

  1. openssl integer
  2. asn1 integer
  3. _builtin integer
  4. integer chr
  5. integer upto

ライブラリ

キーワード

検索結果

<< < 1 2 3 4 5 ... > >>

Integer#denominator -> Integer (9215.0)

分母(常に1)を返します。

...分母(常に1)を返します。

@return 分母を返します。

//emlist[][ruby]{
10.denominator # => 1
-
10.denominator # => 1
//}

@see Integer#numerator...

Integer#floor(ndigits = 0) -> Integer | Float (9215.0)

self と等しいかより小さな整数のうち最大のものを返します。

...負の整数を指定した場合、Integer を返します。
小数点位置から左に少なくとも n 個の 0 が並びます。

//emlist[][ruby]{
1.floor # => 1
1.floor(2) # => 1.0
18.floor(-1) # => 10
(-18).floor(-1) # => -20
//}

@see Numeric#floor...

Integer#gcd(n) -> Integer (9215.0)

自身と整数 n の最大公約数を返します。

...gcd(-7) # => 1
((1<<31)-1).gcd((1<<61)-1) # => 1
//}

また、self や n が 0 だった場合は、0 ではない方の整数の絶対値を返します。

//emlist[][ruby]{
3.gcd(0) # => 3
0.gcd(-7) # => 7
//}

@see Integer#lcm, Integer#gcd...

Integer#gcdlcm(n) -> [Integer] (9215.0)

自身と整数 n の最大公約数と最小公倍数の配列 [self.gcd(n), self.lcm(n)] を返します。

...@raise ArgumentError n に整数以外のものを指定すると発生します。

//emlist[][ruby]{
2.gcdlcm(2) # => [2, 2]
3.gcdlcm(-7) # => [1, 21]
((1<<31)-1).gcdlcm((1<<61)-1) # => [1, 4951760154835678088235319297]
//}

@see Integer#gcd, Integer#lcm...

Integer#lcm(n) -> Integer (9215.0)

自身と整数 n の最小公倍数を返します。

...2
3.lcm(-7) # => 21
((1<<31)-1).lcm((1<<61)-1) # => 4951760154835678088235319297
//}

また、self や n が 0 だった場合は、0 を返します。

//emlist[][ruby]{
3.lcm(0) # => 0
0.lcm(-7) # => 0
//}

@see Integer#gcd, Integer#gcdlcm...

絞り込み条件を変える

Integer#truncate(ndigits = 0) -> Integer | Float (9215.0)

0 から self までの整数で、自身にもっとも近い整数を返します。

...を指定した場合、Integer を返します。
小数点位置から左に少なくとも n 個の 0 が並びます。

//emlist[][ruby]{
1.truncate # => 1
1.truncate(2) # => 1.0
18.truncate(-1) # => 10
(-18).truncate(-1) # => -10
//}

@see Numeric#trunca...

Integer#upto(max) {|n| ... } -> Integer (9215.0)

self から max まで 1 ずつ増やしながら繰り返します。 self > max であれば何もしません。

...self から max まで 1 ずつ増やしながら繰り返します。
self > max であれば何もしません。

@param max 数値
@return self を返します。

//emlist[][ruby]{
5.upto(10) {|i| print i, " " } # => 5 6 7 8 9 10
//}

@see Integer#downto, Numeric#step, Integer#times...

Integer#~ -> Integer (9215.0)

ビット演算子。否定を計算します。

...ビット演算子。否定を計算します。

//emlist[][ruby]{
~1 # => -2
~3 # => -4
~-4 # => 3
//}...

Integer#digits -> [Integer] (9210.0)

base を基数として self を位取り記数法で表記した数値を配列で返します。 base を指定しない場合の基数は 10 です。

...//}

self は非負整数でなければいけません。非負整数でない場合は、Math::DomainErrorが発生します。

//emlist[][ruby]{
-
10.digits # Math::DomainError: out of domain が発生
//}

@return 位取り記数法で表した時の数値の配列
@param base 基数とな...

Integer#digits(base) -> [Integer] (9210.0)

base を基数として self を位取り記数法で表記した数値を配列で返します。 base を指定しない場合の基数は 10 です。

...//}

self は非負整数でなければいけません。非負整数でない場合は、Math::DomainErrorが発生します。

//emlist[][ruby]{
-
10.digits # Math::DomainError: out of domain が発生
//}

@return 位取り記数法で表した時の数値の配列
@param base 基数とな...

絞り込み条件を変える

Integer#next -> Integer (9210.0)

self の次の整数を返します。

...self の次の整数を返します。

//emlist[][ruby]{
1.next #=> 2
(-1).next #=> 0
1.succ #=> 2
(-1).succ #=> 0
//}

@see Integer#pred...
<< < 1 2 3 4 5 ... > >>