ruby-core

Mailing list archive

[ruby-core:66801] [ruby-trunk - Bug #10592] Adding floats resluts in an incorrect result

From: recursive.madman@...
Date: 2014-12-12 09:12:04 UTC
List: ruby-core #66801
Issue #10592 has been updated by Recursive Madman.


This is not a ruby bug. See http://en.wikipedia.org/wiki/Floating_point#Accuracy_problems

----------------------------------------
Bug #10592: Adding floats resluts in an incorrect result
https://bugs.ruby-lang.org/issues/10592#change-50374

* Author: Domokos Molnar
* Status: Open
* Priority: Normal
* Assignee: 
* Category: 
* Target version: 
* ruby -v: ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-linux]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN
----------------------------------------
1.1+1.1+1.1 = 3.3

However in the current 2.1.5 this is what happens:

dmolnar@domalaptop:~> irb
2.1.5 :001 > 1.1+1.1+1.1
 => 3.3000000000000003 
2.1.5 :002 >


---Files--------------------------------
test_float.rb (17 Bytes)


-- 
https://bugs.ruby-lang.org/

In This Thread

Prev Next