るりまサーチ

最速Rubyリファレンスマニュアル検索!
132件ヒット [1-100件を表示] (0.038秒)
トップページ > クエリ:new[x] > クエリ:Float[x] > 種類:インスタンスメソッド[x]

別のキーワード

  1. openssl new
  2. _builtin new
  3. rexml/document new
  4. resolv new
  5. socket new

ライブラリ

クラス

キーワード

検索結果

<< 1 2 > >>

JSON::Generator::GeneratorMethods::Float#to_json(state_or_hash = nil) -> String (3007.0)

自身から生成した JSON 形式の文字列を返します。

...る JSON 形式の文字列をカスタマイズするため
に JSON::State のインスタンスか、
JSON::State.new の引数と同じ Hash を
指定します。

//emlist[例][ruby]{
require "json"

(1.0).to_json # => "1.0"
//}...

Random#rand -> Float (170.0)

一様な擬似乱数を発生させます。

...は数値である必要があり、
range.begin + 数値 が適切な値を返す必要があります。

@raise Errno::EDOM rand(1..Float::INFINITY) などのように範囲に問題があるときに発生します。
@raise ArgumentError 引数の数が0または1では無い時、...
...が存在しない範囲を渡した時などに発生します。

//emlist[例][ruby]{
# Kernel.#rand とほぼ同様の使い勝手
prng = Random.new(1234)
prng.rand # => 0.1915194503788923
srand(1234)
rand # => 0.1915194503788923

# max に実数も指定出来る
prng...
...
prng.rand(Time.new(2012, 1, 1) ... Time.new(2013,1,1)) # => 2012-02-25 03:11:42 +0900
require 'date'
prng.rand(Date.new(2012, 1, 1) ... Date.new(2013,1,1)) # => #<Date: 2012-01-31 ((2455958j,0s,0n),+0s,2299161j)>
# Kernel.#rand とほぼ同様の使い勝手
prng = Random.new(1234)
prng.rand...

Random#rand(max) -> Integer | Float (170.0)

一様な擬似乱数を発生させます。

...は数値である必要があり、
range.begin + 数値 が適切な値を返す必要があります。

@raise Errno::EDOM rand(1..Float::INFINITY) などのように範囲に問題があるときに発生します。
@raise ArgumentError 引数の数が0または1では無い時、...
...が存在しない範囲を渡した時などに発生します。

//emlist[例][ruby]{
# Kernel.#rand とほぼ同様の使い勝手
prng = Random.new(1234)
prng.rand # => 0.1915194503788923
srand(1234)
rand # => 0.1915194503788923

# max に実数も指定出来る
prng...
...
prng.rand(Time.new(2012, 1, 1) ... Time.new(2013,1,1)) # => 2012-02-25 03:11:42 +0900
require 'date'
prng.rand(Date.new(2012, 1, 1) ... Date.new(2013,1,1)) # => #<Date: 2012-01-31 ((2455958j,0s,0n),+0s,2299161j)>
# Kernel.#rand とほぼ同様の使い勝手
prng = Random.new(1234)
prng.rand...

Random#rand(range) -> Integer | Float (170.0)

一様な擬似乱数を発生させます。

...は数値である必要があり、
range.begin + 数値 が適切な値を返す必要があります。

@raise Errno::EDOM rand(1..Float::INFINITY) などのように範囲に問題があるときに発生します。
@raise ArgumentError 引数の数が0または1では無い時、...
...が存在しない範囲を渡した時などに発生します。

//emlist[例][ruby]{
# Kernel.#rand とほぼ同様の使い勝手
prng = Random.new(1234)
prng.rand # => 0.1915194503788923
srand(1234)
rand # => 0.1915194503788923

# max に実数も指定出来る
prng...
...
prng.rand(Time.new(2012, 1, 1) ... Time.new(2013,1,1)) # => 2012-02-25 03:11:42 +0900
require 'date'
prng.rand(Date.new(2012, 1, 1) ... Date.new(2013,1,1)) # => #<Date: 2012-01-31 ((2455958j,0s,0n),+0s,2299161j)>
# Kernel.#rand とほぼ同様の使い勝手
prng = Random.new(1234)
prng.rand...

Enumerator#size -> Integer | Float::INFINITY | nil (126.0)

self の要素数を返します。

...self の要素数を返します。

要素数が無限の場合は Float::INFINITY を返します。
Enumerator.new に Proc オブジェクトを指定していた場合はその
実行結果を返します。呼び出した時に要素数が不明であった場合は nil を返し
ます。

/...
.../emlist[例][ruby]{
(1..100).to_a.permutation(4).size # => 94109400
loop.size # => Float::INFINITY
(1..100).drop_while.size # => nil
//}

@see Enumerator.new...

絞り込み条件を変える

WIN32OLE_TYPELIB#version -> Float (114.0)

TypeLibのバージョン番号を取得します。

...号、小数点
数部にマイナーバージョン番号を設定したFloatで返します。
@raise WIN32OLERuntimeError TypeLibの属性が読み取れない場合に通知します。

tlib = WIN32OLE_TYPELIB.new('Microsoft Excel 14.0 Object Library')
puts tlib.version # => 1.7...

Numeric#coerce(other) -> [Numeric] (31.0)

自身と other が同じクラスになるよう、自身か other を変換し [other, self] という配列にして返します。

...スになるよう、自身か other を変換し [other, self] という配列にして返します。

デフォルトでは self と other を Float に変換して [other, self] という配列にして返します。
Numeric のサブクラスは、このメソッドを適切に再定義しな...
...て下さい。


//emlist[例][ruby]{
# lib/rational.rb より

def coerce(other)
if other.kind_of?(Float)
return other, self.to_f
elsif other.kind_of?(Integer)
return Rational.new!(other, 1), self
else
super
end
end
//}

数値クラスの算術演算子は通常自分と演算...
...b/rational.rb より

def + (a)
if a.kind_of?(Rational)
# 長いので省略
elsif a.kind_of?(Integer)
# 長いので省略
elsif a.kind_of?(Float)
Float
(self) + a
else
x, y = a.coerce(self)
x + y
end
end
//}

@param other オペランドを数値で指定します。...

CSV#converters -> Array (25.0)

現在の変換器のリストを返します。

...在の変換器のリストを返します。

//emlist[例][ruby]{
require "csv"

csv = CSV.new("header1,header2\nrow1_1,row1_2", converters: CSV::Converters.keys)
csv.converters # => [:integer, :float, :integer, :float, :date, :date_time, :date_time, :integer, :float]
//}

@see CSV::Converters...

Fiddle::Function#call(*args) -> Integer|DL::CPtr|nil (19.0)

関数を呼び出します。

...関数を呼び出します。

Fiddle::Function.new で指定した引数と返り値の型に基いて
Ruby のオブジェクトを適切に C のデータに変換して C の関数を呼び出し、
その返り値を Ruby のオブジェクトに変換して返します。

引数の変換は...
...
アドレスと見なします

: (unsigned) char/short/int/long/long long
Ruby の整数を C の整数に変換します。

: double/float
Ruby の整数 or 浮動小数点数を C の浮動小数点数に変換します

返り値の変換は以下の通りです。

: void
nil...
...を返します

: (unsigned) char/short/int/long/long long
C の整数を Ruby の整数に変換します

: void*(つまり任意のポインタ型)
C のポインタを保持した Fiddle::Pointer を返します。

@param args 関数の引数
@see Fiddle::Function.new...

String#parse_csv(**options) -> [String] (19.0)

CSV.parse_line(self, options) と同様です。

...ptions) と同様です。

1 行の CSV 文字列を、文字列の配列に変換するためのショートカットです。

@param options CSV.new と同様のオプションを指定します。

//emlist[][ruby]{
require "csv"

p "Matz,Ruby\n".parse_csv # =>...
...by"]
//}

Ruby 2.6 (CSV 3.0.2) から、次のオプションが使えるようになりました。

//emlist[][ruby]{
require 'csv'

p "1,,3\n".parse_csv # => ["1", nil, "3"]
p "1,,3\n".parse_csv(nil_value: Float::NAN) # => ["1", NaN, "3"]
//}


@see CSV.new, CSV.parse_line...

絞り込み条件を変える

<< 1 2 > >>