Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

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

Search the Archive

Re: bug in IntegerPart ?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg47879] Re: bug in IntegerPart ?
  • From: Bill Rowe <readnewsciv at earthlink.net>
  • Date: Thu, 29 Apr 2004 03:06:15 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

On 4/28/04 at 6:56 AM, ancow65 at yahoo.com (AC) wrote:

>Bill Rowe <readnewsciv at earthlink.net> wrote in message
>news:<c6l8dj$isr$1 at smc.vnet.net>...

>>BaseForm isn't doing what you think and will not show the difference.
>>BaseForm controls only the display of a number. By default
>>Mathematica displays a number to 6 significant digits. Both 1.65 -
>>1.3 and .35 are the same to 6 significant digits. Consequently, these
>>will display the same when using BaseForm.

>>To see the difference use RealDigits or FullForm. Both of these
>>clearly show the difference between 1.65 - 1.3 and .35.

I only seen one "computer" system where this is a true statement. That was a HP-41 handheld calculator which used binary coded decimal arithmetic instead of true binary. In every other system the numbers 1.65 and 1.3 are transformed to a finite binary representation, then the subtraction is done. And since neither 1.65 nor 1.3 has a finite binary representation, the result you get from the subtraction is different than the closest machine number to .35. Or said differently, unless you are using a system such as that used on the HP-41 calculator, 1.65 - 1.3 is indeed not identical to 0.35

>The way Mathematica performs subtraction makes them different.

This is not an issue with Mathematica. Any machine using a standard IEEE floating point arithmetic will have the same issue. If you really need more details, look at any standard text on numerical analysis.

>>Right, here you've inputed a number accurate to 6 significant
>>digits. So, Mathematica displays 6 significant digits

>BaseForm[0.35, 2] might be wrong as argument for 2^^#& but still it
>is not a syntax error. 

By definition, it is improper syntax since you got an error.

>In better design 2^^BaseForm[0.35, 2] should return 0.35` or at
>minimum unchanged expression.

Perhaps. But that isn't the way Mathematica is designed. Additionally, the documentation does reasonably clearly indicate 2^^BaseForm[0.35, 2] isn't valid in Mathematica.
--
To reply via email subtract one hundred and four


  • Prev by Date: Re: FindRoot cannot find obvious solution
  • Next by Date: Re: Wrong Limit
  • Previous by thread: Re: bug in IntegerPart ?
  • Next by thread: RE: RE: Re: bug in IntegerPart ?