るりまサーチ

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

別のキーワード

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

ライブラリ

クラス

検索結果

Integer#^(other) -> Integer (39213.0)

ビット二項演算子。排他的論理和を計算します。

...ビット二項演算子。排他的論理和を計算します。

@param other 数値

//emlist[][ruby]{
1 ^ 1 # => 0
2 ^ 3 # => 1
//}...

Numeric (82.0)

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

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

演算や比較を行うメソッド(+, -, *, /, <=>)は Numeric のサブクラスで定義されま
す。Numeric で定義されているメソッ...
...れのクラスを参照してください。


=> ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux]
Numeric Integer Fixnum Bignum Float Rational Complex
------------------------------------------------------------------------------...
...[] | - - o o - - -
^
| - - o o - - -
Numeric Integer Fixnum Bignum Float Rational Complex
-----------...
...クラスを参照してください。


=> ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-darwin15]
Numeric Integer Float Rational Complex
--------------------------------------------------------------------------------
% |...
...-
[] | - o - - -
^
| - o - - -
Numeric Integer Float Rational Complex
---------------------------------------------------...

ruby 1.6 feature (54.0)

ruby 1.6 feature ruby version 1.6 は安定版です。この版での変更はバグ修正がメイン になります。

...from -:2
ruby 1.6.7 (2002-07-30) [i586-linux]

: 2002-06-03 sprintf()

"%d" で引数を整数にするときに、((<組み込み関数/Integer>)) と同じ規則を
使用するようになりました。

p sprintf("%d", nil)

=> -:1:in `sprintf': no implicit conversio...
...:in `remove_instance_variable': instance variable @foo not defined (NameError)
ruby 1.6.7 (2002-04-10) [i586-linux]

: 2002-04-04: Integer#((<Integer/step>))

第二引数が 1 よりも小さい場合に 0 を指定したと見なされエラーになって
いました。

1.ste...
....7 (2002-03-01) [i586-linux]
#<MatchData:0x401b1be4>
-:3: wrong argument type nil (expected Match) (TypeError)
^
^^^^ MatchData の間違い
=> ruby 1.6.7 (2002-04-04) [i586-linux]
#<MatchData:0x401b1c98>
nil

: 2002-03-25...

Array#pack(template) -> String (30.0)

配列の内容を template で指定された文字列にしたがって、 バイナリとしてパックした文字列を返します。

...] # 仮数部
//}

そして、s, e, f の意味は以下の通りです。
//emlist[][ruby]{
sgn = s == "0" ? +1.0 : -1.0
exp = Integer("0b" + e)
fra = Integer("0b" + f)
if exp == 0
if fra == 0
sgn * 0 # ±0 (positive/negative zero)
else
sgn * fra * 2**(-126-23...
...,52] # 仮数部
//}

そして、s, e, f の意味は以下の通りです。
//emlist[][ruby]{
sgn = s == "0" ? +1.0 : -1.0
exp = Integer("0b" + e)
fra = Integer("0b" + f)
if exp == 0
if fra == 0
sgn * 0 # ±0 (positive/negative zero)
else
sgn * fra * 2**(-1022-5...
...
//}

: ネットワークバイトオーダの signed long
//emlist[][ruby]{
s = "\xFF\xFF\xFF\xFE"
n = s.unpack("N")[0]
if n[31] == 1
n = -((n ^ 0xffff_ffff) + 1)
end
n # => -2
//}

: ネットワークバイトオーダの signed long(その2)
//emlist[][ruby]{
s = "\xFF\xFF\xFF\xFE"
n = s.u...

Array#pack(template, buffer: String.new) -> String (30.0)

配列の内容を template で指定された文字列にしたがって、 バイナリとしてパックした文字列を返します。

...] # 仮数部
//}

そして、s, e, f の意味は以下の通りです。
//emlist[][ruby]{
sgn = s == "0" ? +1.0 : -1.0
exp = Integer("0b" + e)
fra = Integer("0b" + f)
if exp == 0
if fra == 0
sgn * 0 # ±0 (positive/negative zero)
else
sgn * fra * 2**(-126-23...
...,52] # 仮数部
//}

そして、s, e, f の意味は以下の通りです。
//emlist[][ruby]{
sgn = s == "0" ? +1.0 : -1.0
exp = Integer("0b" + e)
fra = Integer("0b" + f)
if exp == 0
if fra == 0
sgn * 0 # ±0 (positive/negative zero)
else
sgn * fra * 2**(-1022-5...
...
//}

: ネットワークバイトオーダの signed long
//emlist[][ruby]{
s = "\xFF\xFF\xFF\xFE"
n = s.unpack("N")[0]
if n[31] == 1
n = -((n ^ 0xffff_ffff) + 1)
end
n # => -2
//}

: ネットワークバイトオーダの signed long(その2)
//emlist[][ruby]{
s = "\xFF\xFF\xFF\xFE"
n = s.u...

絞り込み条件を変える

String#unpack(template) -> Array (30.0)

Array#pack で生成された文字列を テンプレート文字列 template にしたがってアンパックし、 それらの要素を含む配列を返します。

...] # 仮数部
//}

そして、s, e, f の意味は以下の通りです。
//emlist[][ruby]{
sgn = s == "0" ? +1.0 : -1.0
exp = Integer("0b" + e)
fra = Integer("0b" + f)
if exp == 0
if fra == 0
sgn * 0 # ±0 (positive/negative zero)
else
sgn * fra * 2**(-126-23...
...,52] # 仮数部
//}

そして、s, e, f の意味は以下の通りです。
//emlist[][ruby]{
sgn = s == "0" ? +1.0 : -1.0
exp = Integer("0b" + e)
fra = Integer("0b" + f)
if exp == 0
if fra == 0
sgn * 0 # ±0 (positive/negative zero)
else
sgn * fra * 2**(-1022-5...
...
//}

: ネットワークバイトオーダの signed long
//emlist[][ruby]{
s = "\xFF\xFF\xFF\xFE"
n = s.unpack("N")[0]
if n[31] == 1
n = -((n ^ 0xffff_ffff) + 1)
end
n # => -2
//}

: ネットワークバイトオーダの signed long(その2)
//emlist[][ruby]{
s = "\xFF\xFF\xFF\xFE"
n = s.u...

pack テンプレート文字列 (30.0)

pack テンプレート文字列

...] # 仮数部
//}

そして、s, e, f の意味は以下の通りです。
//emlist[][ruby]{
sgn = s == "0" ? +1.0 : -1.0
exp = Integer("0b" + e)
fra = Integer("0b" + f)
if exp == 0
if fra == 0
sgn * 0 # ±0 (positive/negative zero)
else
sgn * fra * 2**(-126-23...
...,52] # 仮数部
//}

そして、s, e, f の意味は以下の通りです。
//emlist[][ruby]{
sgn = s == "0" ? +1.0 : -1.0
exp = Integer("0b" + e)
fra = Integer("0b" + f)
if exp == 0
if fra == 0
sgn * 0 # ±0 (positive/negative zero)
else
sgn * fra * 2**(-1022-5...
...
//}

: ネットワークバイトオーダの signed long
//emlist[][ruby]{
s = "\xFF\xFF\xFF\xFE"
n = s.unpack("N")[0]
if n[31] == 1
n = -((n ^ 0xffff_ffff) + 1)
end
n # => -2
//}

: ネットワークバイトオーダの signed long(その2)
//emlist[][ruby]{
s = "\xFF\xFF\xFF\xFE"
n = s.u...

ruby 1.8.4 feature (30.0)

ruby 1.8.4 feature ruby 1.8.4 での ruby 1.8.3 からの変更点です。

...8.4 (2005-12-22) [i686-linux]
-:2: syntax error, unexpected tSTRING_CONTENT
alias :"foo" :"bar"
^

-:2: warning: unused literal ignored
# => ruby 1.9.0 (2005-12-10) [i686-linux]
"bar"...
...すると、それ以降の
バックトラックが効かなくなるバグの修正。((<ruby-list:41328>))

p(/^[a-z]+x[0-9]+$/ =~ "hogex111")
p(/^[\x61-\x7a]+x[0-9]+$/ =~ "hogex111")

# => ruby 1.8.3 (2005-09-21) [i686-linux]
0
nil
#...
...:35 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
#
# * sprintf.c (rb_str_format): integer overflow check added.
#
# * sprintf.c (GETASTER): ditto.

printfのフォーマット指定子にinteger overflowのバグがありました。
perl のそれとは違い、セキュリテ...

Marshal フォーマット (12.0)

Marshal フォーマット フォーマットバージョン 4.8 を元に記述しています。

...| n1) &
(0xffff00ff | n2 * 0x100) &
(0xff00ffff | n3 * 0x10000) &
(0x00ffffff | n4 * 0x1000000)
# p "%x" % n
n = -((n ^ 0xffff_ffff) + 1) if len < 0
n
end

p Marshal.dump(-125).unpack("x2 acC*") # => ["i", -1, 131]
p foo(-1, 131) # => -125...
...Array # (or String, Regexp, Hash)
end
p Marshal.dump(Foo.new([nil])).unpack("x2 a a c a3 aca*")
# => ["C", ":", 8, "Foo", "[", 6, "0"]
# ^^^ (or '"', '/', '{')
//}

==== String, Regexp, Array, Hash のサブクラス (インスタンス変数あり)

'I' で始まるデータ...
...存はなくなりました。

=== Bignum

'l' で始まるデータ構造になります。

32ビット環境で内部的に Bignum になる Integer
64ビット環境で Marshal.dump しても、この形式になります。

//emlist{
| 'l' | '+'/'-' | shortの個数(Fixnum形式) | ... |...