diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-09-16 01:12:46 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-09-16 01:12:46 +0000 |
commit | 23d472165f401e28bc2128f74a964c438cf3ced4 (patch) | |
tree | 30e5f9d087d6d65ada24ee18e8272dfc57dd56e2 | |
parent | f6b16290174a77ff43243709820d087ceca7bf76 (diff) | |
download | ruby-23d472165f401e28bc2128f74a964c438cf3ced4.tar.gz |
Revert "* numeric.c (ruby_float_step): Avoid error on i386 and amd64."
r33282 challenged the precision of floating point but:
* Ruby keeps it as platform dependent
* amd64 won't get this issue because compilers for amd64 uses SSE2 to
calculate floating point numbers instead of x87 FPU.
* this change won't fix the issue under -O
* this commit has no test for the changed behavior
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33284 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | numeric.c | 4 |
2 files changed, 1 insertions, 8 deletions
@@ -1,8 +1,3 @@ -Fri Sep 16 02:05:44 2011 Marc-Andre Lafortune <ruby-core@marc-andre.ca> - - * numeric.c (ruby_float_step): Avoid error on i386 and amd64. - Patch by Vit Ondruch. Issue #4576. - Thu Sep 15 11:39:43 2011 Nobuyoshi Nakada <nobu@ruby-lang.org> * gc.c (mark_entry, mark_key, mark_keyvalue): adjust callback @@ -1683,7 +1683,6 @@ ruby_float_step(VALUE from, VALUE to, VALUE step, int excl) double unit = NUM2DBL(step); double n = (end - beg)/unit; double err = (fabs(beg) + fabs(end) + fabs(end-beg)) / fabs(unit) * epsilon; - double im = 0.0; long i; if (isinf(unit)) { @@ -1692,8 +1691,7 @@ ruby_float_step(VALUE from, VALUE to, VALUE step, int excl) else { if (err>0.5) err=0.5; n = floor(n + err); - im = ((long)n)*unit+beg; - if (!excl || im < end) n++; + if (!excl || ((long)n)*unit+beg < end) n++; for (i=0; i<n; i++) { rb_yield(DBL2NUM(i*unit+beg)); } |