[ruby-trunk - Bug #5699][Open] Windowsで一部のFloat値が正しく扱えない

Issue #5699 has been reported by 剛 奥山.


Bug #5699: Windowsで一部のFloat値が正しく扱えない

Author: 剛 奥山
Status: Open
Priority: Normal
Assignee:
Category:
Target version: 1.9.2
ruby -v: ruby 1.9.2p290 (2011-07-09) [i386-mingw32]

Windows XP SP3にて、

ruby 1.9.2p290 (2011-07-09) [i386-mingw32] で、
x = 0.002877 #=> 0.0028770000000000002
となってしまいます。

ruby 1.8.7 (2011-06-30 patchlevel 352) [i386-mingw32] では、
x = 0.002877 #=> 0.002877
となります。

Issue #5699 has been updated by ujihisa …

浮動小数点数の計算には誤差があります。参考サイト:

http://download.oracle.com/docs/cd/E19957-01/806-4847/ncg_goldberg.html
*
http://wiki.github.com/rdp/ruby_tutorials_core/ruby-talk-faq#floats_imprecise


Bug #5699: Windowsで一部のFloat値が正しく扱えない

Author: 剛 奥山
Status: Open
Priority: Normal
Assignee:
Category:
Target version: 1.9.2
ruby -v: ruby 1.9.2p290 (2011-07-09) [i386-mingw32]

Windows XP SP3にて、

ruby 1.9.2p290 (2011-07-09) [i386-mingw32] で、
x = 0.002877 #=> 0.0028770000000000002
となってしまいます。

ruby 1.8.7 (2011-06-30 patchlevel 352) [i386-mingw32] では、
x = 0.002877 #=> 0.002877
となります。

Issue #5699 has been updated by ujihisa …

Status changed from Open to Rejected


Bug #5699: Windowsで一部のFloat値が正しく扱えない

Author: 剛 奥山
Status: Rejected
Priority: Normal
Assignee:
Category:
Target version: 1.9.2
ruby -v: ruby 1.9.2p290 (2011-07-09) [i386-mingw32]

Windows XP SP3にて、

ruby 1.9.2p290 (2011-07-09) [i386-mingw32] で、
x = 0.002877 #=> 0.0028770000000000002
となってしまいます。

ruby 1.8.7 (2011-06-30 patchlevel 352) [i386-mingw32] では、
x = 0.002877 #=> 0.002877
となります。

Issue #5699 has been updated by 剛 奥山.

FAQでした、すみません。

1.9.2 は、より正しく表示出来るようになったということで
納得しました。

1.1
=> 1.1 # in reality this probably doesn’t equal exactly 1.1 deep
down–but it’s equal to 1.1’s default so ruby 1.9.2 will display it as
1.1
0.9
=> 0.9
1.1-0.9
=> 0.20000000000000007 # now ruby 1.9.2 notices that “this 0.2 is not
the same as the default float for 0.2” so it displays its full version
to remind us of this fact.


Bug #5699: Windowsで一部のFloat値が正しく扱えない

Author: 剛 奥山
Status: Open
Priority: Normal
Assignee:
Category:
Target version: 1.9.2
ruby -v: ruby 1.9.2p290 (2011-07-09) [i386-mingw32]

Windows XP SP3にて、

ruby 1.9.2p290 (2011-07-09) [i386-mingw32] で、
x = 0.002877 #=> 0.0028770000000000002
となってしまいます。

ruby 1.8.7 (2011-06-30 patchlevel 352) [i386-mingw32] では、
x = 0.002877 #=> 0.002877
となります。