Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #16317 > unrolled thread

Why FullForm[916.536 + 3.3] gives 919.8359999999999?`

Started byGuillermo Sanchez <guillermo.sanchez@hotmail.com>
First post2013-12-05 07:59 +0000
Last post2013-12-08 09:37 +0000
Articles 3 — 3 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Why FullForm[916.536 + 3.3] gives 919.8359999999999?` Guillermo Sanchez <guillermo.sanchez@hotmail.com> - 2013-12-05 07:59 +0000
    Re: Why FullForm[916.536 + 3.3] gives 919.8359999999999?` "Nasser M. Abbasi" <nma@12000.org> - 2013-12-06 07:12 +0000
    Re: gives 919.8359999999999?` Murray Eisenberg <murray@math.umass.edu> - 2013-12-08 09:37 +0000

#16317 — Why FullForm[916.536 + 3.3] gives 919.8359999999999?`

FromGuillermo Sanchez <guillermo.sanchez@hotmail.com>
Date2013-12-05 07:59 +0000
SubjectWhy FullForm[916.536 + 3.3] gives 919.8359999999999?`
Message-ID<l7pbp3$gbk$1@smc.vnet.net>
FullForm[916.536 + 3.3] gives 919.8359999999999 instead of 919.836?

Guillermo

[toc] | [next] | [standalone]


#16329

From"Nasser M. Abbasi" <nma@12000.org>
Date2013-12-06 07:12 +0000
Message-ID<l7rtcd$o5d$1@smc.vnet.net>
In reply to#16317
On 12/5/2013 1:59 AM, Guillermo Sanchez wrote:
> FullForm[916.536 + 3.3] gives 919.8359999999999 instead of 919.836?
>
> Guillermo
>

computers use computation using floating points. And the above is
the result of adding large floating point to small floating point.  

Same result in Mat*ab

---------------------
EDU>> format long
EDU>> 916.536 + 3.3

      9.198359999999999e+02
--------------------

What you see on the screen with:

---------------------
916.536 + 3.3
     919.836  <------------- OUT
---------------------

Then the 919.836 is not the actual value inside the computer. If
you point the mouse to the end of the outout cell above and hit
enter, you'll get the actual value

     919.8359999999999`

which is the FullForm

--Nasser


[toc] | [prev] | [next] | [standalone]


#16331 — Re: gives 919.8359999999999?`

FromMurray Eisenberg <murray@math.umass.edu>
Date2013-12-08 09:37 +0000
SubjectRe: gives 919.8359999999999?`
Message-ID<l81el9$90p$1@smc.vnet.net>
In reply to#16317
Adding large floating point to small floating point hardly seems relevant here, given that the the larger number is only on the order of 3*10^2 times as large as the smaller.  Floating point errors in addition (and, more often perhaps, subtraction) due to relative differences in size typically arise when the ratio of orders of magnitude is much larger.

On the other hand, roundoff error in converting from decimal to internal binary, limitation of machine precision for the binary operation, and finally roundoff error in converting back to decimal, are surely the essential explanation here.

Or am I seriously wrong in this?

On Dec 6, 2013, at 2:17 AM, Nasser M. Abbasi <nma@12000.org> wrote:

> On 12/5/2013 1:59 AM, Guillermo Sanchez wrote:
>> FullForm[916.536 + 3.3] gives 919.8359999999999 instead of 919.836?
>>
>> Guillermo
>>
>
> computers use computation using floating points. And the above is
> the result of adding large floating point to small floating point. 
>
> Same result in Mat*ab
>
> ---------------------
> EDU>> format long
> EDU>> 916.536 + 3.3
>
>      9.198359999999999e+02
> --------------------
>
> What you see on the screen with:
>
> ---------------------
> 916.536 + 3.3
>     919.836  <------------- OUT
> ---------------------
>
> Then the 919.836 is not the actual value inside the computer. If
> you point the mouse to the end of the outout cell above and hit
> enter, you'll get the actual value
>
>     919.8359999999999`
>
> which is the FullForm
>
> --Nasser
>
>
>

---
Murray Eisenberg                                    
murray@math.umass.edu
Mathematics & Statistics Dept.      
Lederle Graduate Research Tower           
University of Massachusetts 
710 North Pleasant Street  
Amherst, MA 01003-9305





[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web