Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: MachinePrecission and FPU

  • To: mathgroup at
  • Subject: [mg81535] Re: MachinePrecission and FPU
  • From: dh <dh at>
  • Date: Wed, 26 Sep 2007 06:55:22 -0400 (EDT)
  • References: <fcnl4n$s65$><> <fcqq33$1ap$>

Hi Mark,

thank's a lot for your reply. It solved the problem, although I would 

never have guessed the reason (Times Inverse[] instead of Divide). This 

code was inside a Floor what amplified the error from tiny to appreciable.

thank's again, Daniel

marks at wrote:

> There is currently no way to set the rounding mode at run-time.

> However this is not the cause of the issue at hand.


> The reason for the difference is that a/b does not parse

> to divide but rather multiplication by a reciprocal.


> In[1]:= FullForm[a/b]


> Out[1]//FullForm= Times[a, Power[b, -1]]


> Therefore there are two potential rounding errors here,

> one in reciprocation of 0.006 and one in the subsequent

> multiplication by 0.03.


> In[2]:= InputForm[0.03/0.006]


> Out[2]//InputForm= 4.999999999999999


> If this difference is important, it id possible to directly

> access floating point division by calling Divide:


> In[3]:= InputForm[Divide[0.03, 0.006]]


> Out[3]//InputForm= 5.


> Note that other differences between Mathematica and

> a C/C++ program may easily occur. These might

> arise from a different order of floating point operations

> or architectural subtleties - for example an optimizing

> compiler's use of Intel's extended (80 bit) double

> arithmetic being used instead of IEEE 64 bit double

> precision.


> Mark Sofroniou,

> Wolfram Research



  • Prev by Date: Re: Linux V6: slow input
  • Next by Date: Re: adding rows to a table of data by looking in the table
  • Previous by thread: Re: MachinePrecission and FPU
  • Next by thread: coupled map lattice problem