From: matt@... (matt neuburg) Date: 2007-08-20T04:14:58+09:00 Subject: Re: Float addition problem / Processor bug? Christian Luginbuehl wrote: > Hi, > > Check out this weird IRB output: > > === START === > irb(main):001:0> a = 2.95 + 2.95 + 2.95 > => 8.85 > irb(main):002:0> puts 8.85 - a > -1.77635683940025e-15 > => nil > === END === > > I'm running "ruby 1.8.6 (2007-06-07 patchlevel 36) [i486-linux]" on > Xubuntu beta with this processor: > > === START cat /proc/cpuinfo === > processor : 0 > vendor_id : GenuineIntel > cpu family : 15 > model : 2 > model name : Intel(R) Pentium(R) 4 CPU 2.26GHz > stepping : 4 > cpu MHz : 2271.951 > cache size : 512 KB > fdiv_bug : no > hlt_bug : no > f00f_bug : no > coma_bug : no > fpu : yes > fpu_exception : yes > cpuid level : 2 > wp : yes > flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge > mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm up > bogomips : 4547.85 > clflush size : 64 > === END cat /proc/cpuinfo === > > Is it a processor bug, a simple rounding problem or a ruby error? Good reading: m. -- matt neuburg, phd = matt@tidbits.com, http://www.tidbits.com/matt/ Tiger - http://www.takecontrolbooks.com/tiger-customizing.html AppleScript - http://www.amazon.com/gp/product/0596102119 Read TidBITS! It's free and smart. http://www.tidbits.com