This project is closed and read-only.
Actions
Feature #3894
closedBug in the method Float and/or puts
Feature #3894:
Bug in the method Float and/or puts
Status:
Rejected
Assignee:
-
Description
=begin
The bug is a problem in displaying a float, which can cause errors in calculating!!
example:
#ruby1.9.2 or ruby1.9.1 or ruby1.8.7
puts 2305843008139952128.0/23427.0
!= 98426730189096.005805267"¶
#Display 98426730189096.0 instead of 98426730189096.005805267
#This bug affects all versions, whatever the system x86 or x86_64 Linux
#Another error
puts 10.0/3.0
#ruby1.9.1 or ruby1.8.7
#good infinity
#3.33333333333333
#ruby1.9.2
#bad infinity
#3.3333333333333335
#ruby1.9.1 or ruby1.8.7
#good
puts 23427.0/17.0
#1378.05882352941
#ruby1.9.2
#No check, looks good!?
#1378.0588235294117
=end
Updated by nobu (Nobuyoshi Nakada) almost 16 years ago
- Status changed from Open to Rejected
=begin
Floating point has a different arithmetic and is a inexact number.
So you should know its esoteric system. see following:
- http://docs.sun.com/source/806-3568/ncg_goldberg.html
- http://wiki.github.com/rdp/ruby_tutorials_core/ruby-talk-faq#floats_imprecise
- http://en.wikipedia.org/wiki/Floating_point#Accuracy_problems
=end
Actions