RE: Errors with decimal addition in Mathematica 5.0

• To: mathgroup at smc.vnet.net
• Subject: [mg47424] RE: [mg47416] Errors with decimal addition in Mathematica 5.0
• From: "David Park" <djmp at earthlink.net>
• Date: Sun, 11 Apr 2004 04:44:02 -0400 (EDT)
• Sender: owner-wri-mathgroup at wolfram.com

```A very frequent question.

Mathematica, by default, displays approximate numbers to 6 places of
precision. (Internally, they are stored to the machine precision. Any number
with a decimal point is an approximate number.) The purpose of N is to
convert EXACT numbers (like Pi or Sqrt[2]) to approximate numbers so it
doesn't help.

Use NumberForm to display to higher precision.

13505.5 - 244.91
NumberForm[%, 8]

13260.6
13260.59

You could also change the default display precision in the Options
Inspector:
FormattingOptions/Expression Formatting/Display Options/Print Precision.

David Park

From: Peng Yu [mailto:yupeng_ at hotmail.com]
To: mathgroup at smc.vnet.net

In[1]:= 13505.5 - 244.91
Out[1]= 13260.6

However,13505.5 - 244.91 = 13260.59. "N" doesn't help, either.

In[25]:= N[13505.50 - 244.91]
Out[25]= 13260.6

But the following command gives the correct answer.
In[26]:= 505.50 - 244.91
Out[26]= 260.59

How can I get the correct last digit? Thanks!

```

• Prev by Date: Re: Errors with decimal addition in Mathematica 5.0
• Next by Date: RE: Errors with decimal addition in Mathematica 5.0
• Previous by thread: Re: Errors with decimal addition in Mathematica 5.0
• Next by thread: RE: Errors with decimal addition in Mathematica 5.0