summaryrefslogtreecommitdiff
path: root/sample
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-04-18 18:05:11 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-04-18 18:05:11 +0000
commit6987b0806e970c7e4b19800c2a2effc290947b78 (patch)
tree79823d81475a9659b3c0e21988721c7d6b200d04 /sample
parent18cdaa6828045306da4aa95f3828f634a8c9d0ee (diff)
* struct.c (rb_struct_eql): should compare values with "eql?".
* range.c (range_check): <=> returns nil for invalid values; should check. * regex.c (re_compile_pattern): should not set RE_OPTIMIZE_ANCHOR, if anychar_repeat is enclosed by parentheses. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3695 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'sample')
-rw-r--r--sample/test.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/sample/test.rb b/sample/test.rb
index 0abf999e39..ebed593960 100644
--- a/sample/test.rb
+++ b/sample/test.rb
@@ -995,6 +995,9 @@ nan.test(-0.001);
nan.test(1.0/0);
nan.test(-1.0/0);
+s = "3.7517675036461267e+17"
+test_ok(s == sprintf("%.16e", s.to_f))
+
test_check "bignum"
def fact(n)
return 1 if n == 0
@@ -1550,6 +1553,13 @@ test_ok($x == Marshal.load($y))
StrClone=String.clone;
test_ok(Marshal.load(Marshal.dump(StrClone.new("abc"))).class == StrClone)
+[[1,2,3,4], [81, 2, 118, 3146]].each { |w,x,y,z|
+ a = (x.to_f + y.to_f / z.to_f) * Math.exp(w.to_f / (x.to_f + y.to_f / z.to_f))
+ ma = Marshal.dump(a)
+ b = Marshal.load(ma)
+ test_ok(a == b)
+}
+
test_check "pack"
$format = "c2x5CCxsdils_l_a6";