Mathematica 9 is now available
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: [mg47809] Re: bug in IntegerPart ?
  • From: Bill Rowe <readnewsciv at earthlink.net>
  • Date: Tue, 27 Apr 2004 04:47:51 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

On 4/26/04 at 2:41 AM, ancow65 at yahoo.com (AC) wrote:

>"DrBob" <drbob at bigfoot.com> wrote in message
>news:<c6g015$4lk$1 at smc.vnet.net>...
>>There's NO reason to be puzzled. 1.65 and 1.3 can't be represented
>>exactly in binary, so of course their difference may not be exact,
>>either. Hence the division problems have different numerators.
>
>Your 'explanation' makes no sense whatsoever. Mathematica's binary
>representations of 1.65-1.3 and 0.35 are the same. That can be seen
>by comparing BaseForm[1.65 - 1.3, 2] with BaseForm[0.35,2]

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.

>(n = 2^^0.010110011001100110011 )
> => 0.350000

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

> Notice the unussual display of trailing zeros. 

No, not unusual. Exactly as it should be. If I input 6 significant digits as

.35`6, I expect Mathematica to display 6 significant digits with the default settings.

>Additionally, a completely legitimate expression
>2^^BaseForm[0.35`, 2]
>produces a syntax error message.

The expression 2^^BaseForm[0.35, 2] isn't a legitimate expression. BaseForm puts a wrapper on the expression to control display. That is Head at BaseForm[0.35, 2] is BaseForm, not a sequence of binary digits.

--
To reply via email subtract one hundred and four


  • Prev by Date: i don't understand mapping function over a long list
  • Next by Date: RE: FindMaximum doesn't work?
  • Previous by thread: RE: bug in IntegerPart ?
  • Next by thread: RE: Re: bug in IntegerPart ?