Re: bug in IntegerPart ?

*To*: mathgroup at smc.vnet.net*Subject*: [mg47969] Re: bug in IntegerPart ?*From*: Bill Rowe <readnewsciv at earthlink.net>*Date*: Tue, 4 May 2004 01:08:50 -0400 (EDT)*Sender*: owner-wri-mathgroup at wolfram.com

On 5/2/04 at 4:51 AM, ancow65 at yahoo.com (AC) wrote: >Daniel Lichtblau <danl at wolfram.com> wrote in message >news:<c6vhrn$gcq$1 at smc.vnet.net>... >>We have agreed to no such thing. By universal convention (okay, >>universal - 1), 1.65 is an approximate number. >Ok, I will agree (for a moment :-)). What is that something that >you are approximating with 0.35? Is that >NumberForm[0.35, 100] => 0.35 >or >NumberForm[1.65-1.3,15] => 0.35 0.35 >or >NumberForm[1.65 - 1.3, 16] => 0.3499999999999999 0.3499999999999999 >Oops, it looks like I came accross a bug. What bug? Mathematica as designed converts the numbers 1.65 and 1.3 to finite binary representations. These representations are the closest finite binary representations to the given decimal numbers. Mathematica then performs the subtraction. But because the finite binary representations cannot exactly represent the input, the result is not exactly the same as if the subtraction was done in decimal arithmetic. At the end of all this, you use NumberForm to control the number of digits displayed. When you chose to display a sufficient number of digits, then it becomes apparent the binary number resulting from 1.65 - 1.3 differs from the closest binary representation of 0.35. A bug is an operation that performs differently than design or documentation. A difference in performance from *your* expectation is not necessarily a bug. >Do you claim that 'approximate' are decimals that don't have finite >binary representation or all decimals? Just asking. :-) I doubt Daniel Lichtblau makes any such claim as there are clearly an infinite set of decimals that have finite binary representation. For example, 0.5 has the finite binary representation 0.1 -- To reply via email subtract one hundred and four

**Re: usage logs from mathlm**

**Re: on ColorFunction and combined images?**

**Re: Re: bug in IntegerPart ?**

**Re: bug in IntegerPart ?**