[#32945] Shift_JIS variants and UTF-16 support — "U.Nakamura" <usa@...>

こんにちは、なかむら(う)です。

22 messages 2008/01/07
[#32953] Re: Shift_JIS variants and UTF-16 support — Martin Duerst <duerst@...> 2008/01/07

中村さん、こんにちは。

[#32955] Re: Shift_JIS variants and UTF-16 support — Yukihiro Matsumoto <matz@...> 2008/01/07

まつもと ゆきひろです

[#32959] Re: Shift_JIS variants and UTF-16 support — "NARUSE, Yui" <naruse@...> 2008/01/07

成瀬です。

[#32960] Re: Shift_JIS variants and UTF-16 support — Yukihiro Matsumoto <matz@...> 2008/01/07

まつもと ゆきひろです

[#32992] ASCII is alias of US-ASCII; replica of dummy encoding is not a dummy — "NARUSE, Yui" <naruse@...>

成瀬です。

18 messages 2008/01/08
[#32994] Re: ASCII is alias of US-ASCII; replica of dummy encoding is not a dummy — Yukihiro Matsumoto <matz@...> 2008/01/09

まつもと ゆきひろです

[#32995] Re: ASCII is alias of US-ASCII; replica of dummy encoding is not a dummy — Martin Duerst <duerst@...> 2008/01/09

At 18:13 08/01/09, Yukihiro Matsumoto wrote:

[#33011] Re: ASCII is alias of US-ASCII; replica of dummy encoding is not a dummy — "NARUSE, Yui" <naruse@...> 2008/01/11

成瀬です。

[#33012] Re: ASCII is alias of US-ASCII; replica of dummy encoding is not a dummy — Yukihiro Matsumoto <matz@...> 2008/01/11

まつもと ゆきひろです

[#33014] Re: ASCII is alias of US-ASCII; replica of dummy encoding is not a dummy — "NARUSE, Yui" <naruse@...> 2008/01/11

成瀬です。

[#33015] Re: ASCII is alias of US-ASCII; replica of dummy encoding is not a dummy — Yukihiro Matsumoto <matz@...> 2008/01/11

まつもと ゆきひろです

[#33239] Re: [ruby-cvs:22386] Ruby:r15149 (trunk): * string.c (rb_str_each_char): move forward. — Tanaka Akira <akr@...>

In article <200801210259.m0L2x3CW017171@ci.ruby-lang.org>,

11 messages 2008/01/21
[#33240] Re: [ruby-cvs:22386] Ruby:r15149 (trunk): * string.c (rb_str_each_char): move forward. — Nobuyoshi Nakada <nobu@...> 2008/01/21

なかだです。

[#33303] Time#strftimeのエンコーディング — rubikitch@...

るびきちです。

13 messages 2008/01/23
[#33305] Re: Time#strftimeのエンコーディング — Yukihiro Matsumoto <matz@...> 2008/01/23

まつもと ゆきひろです

[#33368] summary of script encoding — "U.Nakamura" <usa@...>

こんにちは、なかむら(う)です。

22 messages 2008/01/25
[#33375] Re: summary of script encoding — Yukihiro Matsumoto <matz@...> 2008/01/25

まつもと ゆきひろです

[#33376] Re: summary of script encoding — "U.Nakamura" <usa@...> 2008/01/25

こんにちは、なかむら(う)です。

[#33387] HashからStructを作る — rubikitch@...

るびきちです。

19 messages 2008/01/25
[#33455] Re: HashからStructを作る — Yukihiro Matsumoto <matz@...> 2008/01/28

まつもと ゆきひろです

[#33505] Re: HashからStructを作る — rubikitch@... 2008/01/29

From: Yukihiro Matsumoto <matz@ruby-lang.org>

[#33507] Re: HashからStructを作る — Yukihiro Matsumoto <matz@...> 2008/01/29

まつもと ゆきひろです

[#33508] Re: HashからStructを作る — rubikitch@... 2008/01/29

From: Yukihiro Matsumoto <matz@ruby-lang.org>

[#33433] Win32OLE: set encoding to OLE string — "U.Nakamura" <usa@...>

こんにちは、なかむら(う)です。

16 messages 2008/01/28

[#33461] Failed to make ruby-1.8.6-p111 on MacOSX 10.5(Leopard) — MORITA Hideyuki <h-morita@...>

=1B$B?9ED$H?=3D$7$^$9!#=1B(B

19 messages 2008/01/28
[#33473] Re: Failed to make ruby-1.8.6-p111 on MacOSX 10.5(Leopard) — Nobuyoshi Nakada <nobu@...> 2008/01/28

なかだです。

[#33503] Re: Failed to make ruby-1.8.6-p111 on MacOSX 10.5(Leopard) — MORITA Hideyuki <h-morita@...> 2008/01/29

森田です。

[#33514] Re: Failed to make ruby-1.8.6-p111 on MacOSX 10.5(Leopard) — Nobuyoshi Nakada <nobu@...> 2008/01/29

なかだです。

[#33518] Re: Failed to make ruby-1.8.6-p111 on MacOSX 10.5(Leopard) — MORITA Hideyuki <h-morita@...> 2008/01/30

森田です。

[#33545] Re: Failed to make ruby-1.8.6-p111 on MacOSX 10.5(Leopard) — Ryutaro Amano <wn9r-amn@...> 2008/01/31

天野竜太郎と申します。

[#33546] Re: Failed to make ruby-1.8.6-p111 on MacOSX 10.5(Leopard) — MORITA Hideyuki <h-morita@...> 2008/01/31

森田です。

[#33547] Re: Failed to make ruby-1.8.6-p111 on MacOSX 10.5(Leopard) — Ryutaro Amano <wn9r-amn@...> 2008/01/31

天野です。

[#33551] Re: Failed to make ruby-1.8.6-p111 on MacOSX 10.5(Leopard) — MORITA Hideyuki <h-morita@...> 2008/01/31

森田です。

[#33488] 現在の script encoding の値を得る方法は? — Hidetoshi NAGAI <nagai@...>

永井@知能.九工大です.

20 messages 2008/01/29
[#33491] Re: 現在の script encoding の値を得る方法は? — Yukihiro Matsumoto <matz@...> 2008/01/29

まつもと ゆきひろです

[#33500] Re: 現在の script encoding の値を得る方法は? — Hidetoshi NAGAI <nagai@...> 2008/01/29

永井@知能.九工大です.

[#33501] Re: 現在の script encoding の値を得る方法は? — "NARUSE, Yui" <naruse@...> 2008/01/29

成瀬です。

[#33515] Re: 現在の script encoding の値を得る方法は? — Hidetoshi NAGAI <nagai@...> 2008/01/30

永井@知能.九工大です.

[#33516] Re: 現在の script encoding の値を得る方法は? — "NARUSE, Yui" <naruse@...> 2008/01/30

成瀬です。

[#33519] Re: 現在の script encoding の値を得る方法は? — Hidetoshi NAGAI <nagai@...> 2008/01/30

永井@知能.九工大です.

[#33522] Re: 現在の script encoding の値を得る方法は? — "NARUSE, Yui" <naruse@...> 2008/01/30

成瀬です。

[ruby-dev:33280] exhaustive tests for struct.c, sprintf.c and math.c

From: "Yusuke ENDOH" <mame@...>
Date: 2008-01-22 15:03:52 UTC
List: ruby-dev #33280
遠藤と申します。

test_struct.rb と test_sprintf.rb と test_math.rb にもテストを追加
しました。gcov でのカバレッジが以下のように上がります。

struct.c  : 55.87% -> 94.60%
sprintf.c : 70.45% -> 97.50%
math.c    : 28.36% -> 98.51%

これもコミットしてよろしいでしょうか。よければそのうち他でもやろうと
思います。


Index: test/ruby/test_struct.rb
===================================================================
--- test/ruby/test_struct.rb	(revision 15173)
+++ test/ruby/test_struct.rb	(working copy)
@@ -49,4 +49,162 @@
       }
     }
   end
+
+  def test_inherit
+    klass = Struct.new(:a)
+    klass2 = Class.new(klass)
+    o = klass2.new(1)
+    assert_equal(1, o.a)
+  end
+
+  def test_members
+    klass = Struct.new(:a)
+    o = klass.new(1)
+    assert_equal([:a], klass.members)
+    assert_equal([:a], o.members)
+  end
+
+  def test_ref
+    klass = Struct.new(:a)
+    o = klass.new(1)
+    assert_equal(1, o[:a])
+    assert_raise(NameError) { o[:b] }
+  end
+
+  def test_modify
+    klass = Struct.new(:a)
+    o = klass.new(1)
+    assert_raise(SecurityError) do
+      Thread.new do
+        $SAFE = 4
+        o.a = 2
+      end.value
+    end
+  end
+
+  def test_set
+    klass = Struct.new(:a)
+    o = klass.new(1)
+    o[:a] = 2
+    assert_equal(2, o[:a])
+    assert_raise(NameError) { o[:b] = 3 }
+  end
+
+  def test_struct_new
+    Struct.instance_eval { const_set(:Foo, nil) }
+    assert_raise(NameError) { Struct.new("foo") }
+    assert_nothing_raised { Struct.new("Foo") }
+    Struct.instance_eval { remove_const(:Foo) }
+    assert_nothing_raised { Struct.new(:a) { } }
+    assert_raise(RuntimeError) { Struct.new(:a) { raise } }
+
+    assert_equal([:utime, :stime, :cutime, :cstime], Process.times.members)
+  end
+
+  def test_initialize
+    klass = Struct.new(:a)
+    assert_raise(ArgumentError) { klass.new(1, 2) }
+  end
+
+  def test_each
+    klass = Struct.new(:a, :b)
+    o = klass.new(1, 2)
+    assert_equal([1, 2], o.each.to_a)
+  end
+
+  def test_each_pair
+    klass = Struct.new(:a, :b)
+    o = klass.new(1, 2)
+    assert_equal([[:a, 1], [:b, 2]], o.each_pair.to_a)
+  end
+
+  def test_inspect
+    klass = Struct.new(:a)
+    o = klass.new(1)
+    assert_equal("#<struct a=1>", o.inspect)
+    o.a = o
+    assert(o.inspect =~ /^#<struct a=#<struct #<.*?>:...>>$/)
+
+    Struct.new("Foo", :a)
+    o = Struct::Foo.new(1)
+    assert_equal("#<struct Struct::Foo a=1>", o.inspect)
+    Struct.instance_eval { remove_const(:Foo) }
+
+    klass = Struct.new(:a, :b)
+    o = klass.new(1, 2)
+    assert_equal("#<struct a=1, b=2>", o.inspect)
+
+    klass = Struct.new(:@a)
+    o = klass.new(1)
+    assert_equal("#<struct :@a=1>", o.inspect)
+  end
+
+  def test_init_copy
+    klass = Struct.new(:a)
+    o = klass.new(1)
+    assert_equal(o, o.dup)
+  end
+
+  def test_aref
+    klass = Struct.new(:a)
+    o = klass.new(1)
+    assert_equal(1, o[0])
+    assert_raise(IndexError) { o[-2] }
+    assert_raise(IndexError) { o[1] }
+  end
+
+  def test_aset
+    klass = Struct.new(:a)
+    o = klass.new(1)
+    o[0] = 2
+    assert_equal(2, o[:a])
+    assert_raise(IndexError) { o[-2] = 3 }
+    assert_raise(IndexError) { o[1] = 3 }
+  end
+
+  def test_values_at
+    klass = Struct.new(:a, :b, :c, :d, :e, :f)
+    o = klass.new(1, 2, 3, 4, 5, 6)
+    assert_equal([2, 4, 6], o.values_at(1, 3, 5))
+    assert_equal([2, 3, 4, 3, 4, 5], o.values_at(1..3, 2...5))
+  end
+
+  def test_select
+    klass = Struct.new(:a, :b, :c, :d, :e, :f)
+    o = klass.new(1, 2, 3, 4, 5, 6)
+    assert_equal([1, 3, 5], o.select {|v| v % 2 != 0 })
+    assert_raise(ArgumentError) { o.select(1) }
+  end
+
+  def test_equal
+    klass1 = Struct.new(:a)
+    klass2 = Struct.new(:a, :b)
+    o1 = klass1.new(1)
+    o2 = klass1.new(1)
+    o3 = klass2.new(1)
+    assert(o1.==(o2))
+    assert(o1 != o3)
+  end
+
+  def test_hash
+    klass = Struct.new(:a)
+    o = klass.new(1)
+    assert(o.hash.is_a?(Fixnum))
+  end
+
+  def test_eql
+    klass1 = Struct.new(:a)
+    klass2 = Struct.new(:a, :b)
+    o1 = klass1.new(1)
+    o2 = klass1.new(1)
+    o3 = klass2.new(1)
+    assert(o1.eql?(o2))
+    assert(!(o1.eql?(o3)))
+  end
+
+  def test_size
+    klass = Struct.new(:a)
+    o = klass.new(1)
+    assert_equal(1, o.size)
+  end
 end
Index: test/ruby/test_sprintf.rb
===================================================================
--- test/ruby/test_sprintf.rb	(revision 15173)
+++ test/ruby/test_sprintf.rb	(working copy)
@@ -173,10 +173,88 @@
     assert_equal("%\0x hello", sprintf("%\0x hello"), "[ruby-core:11571]")

     assert_raise(ArgumentError, "[ruby-core:11573]")
{sprintf("%.25555555555555555555555555555555555555s", "hello")}
+
+    assert_raise(ArgumentError) { sprintf("%\1", 1) }
+    assert_raise(ArgumentError) { sprintf("%!", 1) }
+    assert_raise(ArgumentError) { sprintf("%1$1$d", 1) }
+    assert_raise(ArgumentError) { sprintf("%0%") }
+    assert_nothing_raised { sprintf("", 1) }
   end

   def test_float
     assert_equal("36893488147419111424",
                  sprintf("%20.0f", 36893488147419107329.0))
   end
+
+  BSIZ = 120
+
+  def test_skip
+    assert_equal(" " * BSIZ + "1", sprintf(" " * BSIZ + "%d", 1))
+  end
+
+  def test_char
+    assert_equal("a", sprintf("%c", 97))
+    assert_equal("a", sprintf("%c", ?a))
+    assert_raise(ArgumentError) { sprintf("%c", sprintf("%c%c", ?a, ?a)) }
+    assert_equal(" " * (BSIZ - 1) + "a", sprintf(" " * (BSIZ - 1) + "%c", ?a))
+    assert_equal(" " * (BSIZ - 1) + "a", sprintf(" " * (BSIZ - 1) +
"%-1c", ?a))
+    assert_equal(" " * BSIZ + "a", sprintf("%#{ BSIZ + 1 }c", ?a))
+    assert_equal("a" + " " * BSIZ, sprintf("%-#{ BSIZ + 1 }c", ?a))
+  end
+
+  def test_string
+    assert_equal("foo", sprintf("%s", "foo"))
+    assert_equal("fo", sprintf("%.2s", "foo"))
+    assert_equal(" " * BSIZ, sprintf("%s", " " * BSIZ))
+    assert_equal(" " * (BSIZ - 1) + "foo", sprintf("%#{ BSIZ - 1 + 3
}s", "foo"))
+    assert_equal(" " * BSIZ + "foo", sprintf("%#{ BSIZ + 3 }s", "foo"))
+    assert_equal("foo" + " " * BSIZ, sprintf("%-#{ BSIZ + 3 }s", "foo"))
+  end
+
+  def test_integer
+    assert_equal("01", sprintf("%#o", 1))
+    assert_equal("0x1", sprintf("%#x", 1))
+    assert_equal("0X1", sprintf("%#X", 1))
+    assert_equal("0b1", sprintf("%#b", 1))
+    assert_equal("0B1", sprintf("%#B", 1))
+    assert_equal("1", sprintf("%d", 1.0))
+    assert_equal("4294967296", sprintf("%d", (2**32).to_f))
+    assert_equal("1", sprintf("%d", "1"))
+    o = Object.new; def o.to_int; 1; end
+    assert_equal("1", sprintf("%d", o))
+    assert_equal("+1", sprintf("%+d", 1))
+    assert_equal(" 1", sprintf("% d", 1))
+    assert_equal("..f", sprintf("%x", -1))
+    assert_equal("..7", sprintf("%o", -1))
+    one = (2**32).coerce(1).first
+    mone = (2**32).coerce(-1).first
+    assert_equal("+1", sprintf("%+d", one))
+    assert_equal(" 1", sprintf("% d", one))
+    assert_equal("..f", sprintf("%x", mone))
+    assert_equal("..7", sprintf("%o", mone))
+    assert_equal(" " * BSIZ + "1", sprintf("%#{ BSIZ + 1 }d", one))
+    assert_equal(" " * (BSIZ - 1) + "1", sprintf(" " * (BSIZ - 1) + "%d", 1))
+  end
+
+  def test_float2
+    inf = 1.0 / 0.0
+    assert_equal(" " * BSIZ + "Inf", sprintf("%#{ BSIZ + 3 }.1f", inf))
+    assert_equal("+Inf", sprintf("%+-f", inf))
+    assert_equal(" " * BSIZ + "1.0", sprintf("%#{ BSIZ + 3 }.1f", 1.0))
+  end
+
+  class T012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
+  end
+
+  def test_star
+    assert_equal("-1 ", sprintf("%*d", -3, -1))
+  end
+
+  def test_escape
+    assert_equal("%" * BSIZ, sprintf("%%" * BSIZ))
+  end
+
+  def test_rb_sprintf
+    assert(T012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789.new.inspect
=~ /^#<TestSprintf::T012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789:0x[0-9a-f]+>$/)
+  end
 end
Index: test/ruby/test_math.rb
===================================================================
--- test/ruby/test_math.rb	(revision 15173)
+++ test/ruby/test_math.rb	(working copy)
@@ -1,12 +1,173 @@
 require 'test/unit'

 class TestMath < Test::Unit::TestCase
-  def test_math
-    assert_equal(2, Math.sqrt(4))
+  def check(a, b)
+    assert(a - b < Float::EPSILON * 3)
+  end

-    self.class.class_eval {
-      include Math
-    }
-    assert_equal(2, sqrt(4))
+  def test_atan2
+    check(Math.atan2(0, 1), 0)
+    check(Math.atan2(1, 1), Math::PI / 4)
+    check(Math.atan2(1, 0), Math::PI / 2)
   end
+
+  def test_cos
+    check(Math.cos(0 * Math::PI / 4),  1.0)
+    check(Math.cos(1 * Math::PI / 4),  1.0 / Math.sqrt(2))
+    check(Math.cos(2 * Math::PI / 4),  0.0)
+    check(Math.cos(4 * Math::PI / 4), -1.0)
+    check(Math.cos(6 * Math::PI / 4),  0.0)
+  end
+
+  def test_sin
+    check(Math.sin(0 * Math::PI / 4),  0.0)
+    check(Math.sin(1 * Math::PI / 4),  1.0 / Math.sqrt(2))
+    check(Math.sin(2 * Math::PI / 4),  1.0)
+    check(Math.sin(4 * Math::PI / 4),  0.0)
+    check(Math.sin(6 * Math::PI / 4), -1.0)
+  end
+
+  def test_tan
+    check(Math.tan(0 * Math::PI / 4),  0.0)
+    check(Math.tan(1 * Math::PI / 4),  1.0)
+    assert(Math.tan(2 * Math::PI / 4).abs > 1024)
+    check(Math.tan(4 * Math::PI / 4),  0.0)
+    assert(Math.tan(6 * Math::PI / 4).abs > 1024)
+  end
+
+  def test_acos
+    check(0 * Math::PI / 4, Math.acos( 1.0))
+    check(1 * Math::PI / 4, Math.acos( 1.0 / Math.sqrt(2)))
+    check(2 * Math::PI / 4, Math.acos( 0.0))
+    check(4 * Math::PI / 4, Math.acos(-1.0))
+    assert_raise(Errno::EDOM, Errno::ERANGE) { Math.acos(2.0) }
+  end
+
+  def test_asin
+    check( 0 * Math::PI / 4, Math.asin( 0.0))
+    check( 1 * Math::PI / 4, Math.asin( 1.0 / Math.sqrt(2)))
+    check( 2 * Math::PI / 4, Math.asin( 1.0))
+    check(-2 * Math::PI / 4, Math.asin(-1.0))
+    assert_raise(Errno::EDOM, Errno::ERANGE) { Math.asin(2.0) }
+  end
+
+  def test_atan
+    check( 0 * Math::PI / 4, Math.atan( 0.0))
+    check( 1 * Math::PI / 4, Math.atan( 1.0))
+    check( 2 * Math::PI / 4, Math.atan(1.0 / 0.0))
+    check(-1 * Math::PI / 4, Math.atan(-1.0))
+  end
+
+  def test_cosh
+    check(1, Math.cosh(0))
+    check((Math::E ** 1 + Math::E ** -1) / 2, Math.cosh(1))
+    check((Math::E ** 2 + Math::E ** -2) / 2, Math.cosh(2))
+  end
+
+  def test_sinh
+    check(0, Math.sinh(0))
+    check((Math::E ** 1 - Math::E ** -1) / 2, Math.sinh(1))
+    check((Math::E ** 2 - Math::E ** -2) / 2, Math.sinh(2))
+  end
+
+  def test_tanh
+    check(Math.sinh(0) / Math.cosh(0), Math.tanh(0))
+    check(Math.sinh(1) / Math.cosh(1), Math.tanh(1))
+    check(Math.sinh(2) / Math.cosh(2), Math.tanh(2))
+  end
+
+  def test_acosh
+    check(Math.acosh(1), 0)
+    check(Math.acosh((Math::E ** 1 + Math::E ** -1) / 2), 1)
+    check(Math.acosh((Math::E ** 2 + Math::E ** -2) / 2), 2)
+    assert_raise(Errno::EDOM, Errno::ERANGE) { Math.acosh(0) }
+  end
+
+  def test_asinh
+    check(Math.asinh(0), 0)
+    check(Math.asinh((Math::E ** 1 - Math::E ** -1) / 2), 1)
+    check(Math.asinh((Math::E ** 2 - Math::E ** -2) / 2), 2)
+  end
+
+  def test_atanh
+    check(Math.atanh(Math.sinh(0) / Math.cosh(0)), 0)
+    check(Math.atanh(Math.sinh(1) / Math.cosh(1)), 1)
+    check(Math.atanh(Math.sinh(2) / Math.cosh(2)), 2)
+    assert_raise(Errno::EDOM, Errno::ERANGE) { Math.atanh(-1) }
+  end
+
+  def test_exp
+    check(1, Math.exp(0))
+    check(Math.sqrt(Math::E), Math.exp(0.5))
+    check(Math::E, Math.exp(1))
+    check(Math::E ** 2, Math.exp(2))
+  end
+
+  def test_log
+    check(0, Math.log(1))
+    check(1, Math.log(Math::E))
+    check(0, Math.log(1, 10))
+    check(1, Math.log(10, 10))
+    check(2, Math.log(100, 10))
+    assert_raise(Errno::EDOM, Errno::ERANGE) { Math.log(0) }
+    assert_raise(Errno::EDOM, Errno::ERANGE) { Math.log(-1) }
+  end
+
+  def test_log2
+    check(0, Math.log2(1))
+    check(1, Math.log2(2))
+    check(2, Math.log2(4))
+    assert_raise(Errno::EDOM, Errno::ERANGE) { Math.log2(0) }
+    assert_raise(Errno::EDOM, Errno::ERANGE) { Math.log2(-1) }
+  end
+
+  def test_log10
+    check(0, Math.log10(1))
+    check(1, Math.log10(10))
+    check(2, Math.log10(100))
+    assert_raise(Errno::EDOM, Errno::ERANGE) { Math.log10(0) }
+    assert_raise(Errno::EDOM, Errno::ERANGE) { Math.log10(-1) }
+  end
+
+  def test_sqrt
+    check(0, Math.sqrt(0))
+    check(1, Math.sqrt(1))
+    check(2, Math.sqrt(4))
+    assert_raise(Errno::EDOM, Errno::ERANGE) { Math.sqrt(-1) }
+  end
+
+  def test_frexp
+    check(0.0, Math.frexp(0.0).first)
+    assert_equal(0, Math.frexp(0).last)
+    check(0.5, Math.frexp(0.5).first)
+    assert_equal(0, Math.frexp(0.5).last)
+    check(0.5, Math.frexp(1.0).first)
+    assert_equal(1, Math.frexp(1.0).last)
+    check(0.5, Math.frexp(2.0).first)
+    assert_equal(2, Math.frexp(2.0).last)
+    check(0.75, Math.frexp(3.0).first)
+    assert_equal(2, Math.frexp(3.0).last)
+  end
+
+  def test_ldexp
+    check(0.0, Math.ldexp(0.0, 0.0))
+    check(0.5, Math.ldexp(0.5, 0.0))
+    check(1.0, Math.ldexp(0.5, 1.0))
+    check(2.0, Math.ldexp(0.5, 2.0))
+    check(3.0, Math.ldexp(0.75, 2.0))
+  end
+
+  def test_hypot
+    check(5, Math.hypot(3, 4))
+  end
+
+  def test_erf
+    check(0, Math.erf(0))
+    check(1, Math.erf(1.0 / 0.0))
+  end
+
+  def test_erfc
+    check(1, Math.erfc(0))
+    check(0, Math.erfc(1.0 / 0.0))
+  end
 end

-- 
Yusuke ENDOH <mame@tsg.ne.jp>

In This Thread

Prev Next