[Date Index] [Thread Index] [Author Index]
Re: Off by 0.00000001, Why?
On Friday, October 25, 2002, at 02:48 AM, Steven T. Hatton wrote: > I've Noticed that in a few instances my results differ slightly from > his. I'm > wondering why this is happeneing. One would expect that the same > algorithm > would produce identical results regardless of the system on which it > was run. > I'm running on 4.2, and it's certain Dr M¡î¡×der was using an earlier > version. > Could that be the cause of the descrepency? > This is not surprising. First of all as you correctly pointed out the Mathematica routines you are calling may have changed and therefore produce different results. Secondly your OS and hardware platform may not be identical and in my experience the same compiler may produce different results on different hardware and OS combinations due to different optimizations applied to floating point expressions. Finally, Intel chips have floating point registers that are actually 80 bits wide. Thus they perform some floating point operations differently than a pure 64 bit machine because they may use 80 bits for intermediate results. See http://www.validlab.com/goldberg/addendum.html for a reasonable summary of the issues with floating point computations on different architectures. > Any thoughts on this? > If your floating point calculations are mission critical you have to use a compiler which allows you to control whether floating point expressions are optimized. Also you have to use a CPU architecture whose behavior you understand. Finally all of your algorithms must be analyzed to guarantee you understand and have compensated for the floating point model of your compiler and CPU. This is why mission critical code such as for NASA is typically audited by a team before being committed to production code. Regards, Ssezi