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


Groups > comp.soft-sys.math.mathematica > #16331

Re: gives 919.8359999999999?`

From Murray Eisenberg <murray@math.umass.edu>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: gives 919.8359999999999?`
Date 2013-12-08 09:37 +0000
Message-ID <l81el9$90p$1@smc.vnet.net> (permalink)
References <l7pbp3$gbk$1@smc.vnet.net> <20131206071706.6DBB46A41@smc.vnet.net>
Organization Time-Warner Telecom

Show all headers | View raw


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





Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

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

csiph-web