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: Re: bug in IntegerPart ?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg47797] Re: [mg47769] Re: bug in IntegerPart ?
  • From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
  • Date: Tue, 27 Apr 2004 04:46:47 -0400 (EDT)
  • References: <c6g015$4lk$1@smc.vnet.net> <200404260641.CAA06324@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

On 26 Apr 2004, at 15:41, 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]
>
It does make sense and certainly not the same!

In[23]:=
FullForm[BaseForm[0.35, 2]]

Out[23]//FullForm=
BaseForm[0.35`,2]

In[24]:=
FullForm[BaseForm[1.65 - 1.3, 2]]

Out[24]//FullForm=
BaseForm[0.34999999999999987`,2]

Or just evaluate BaseForm using INputform for output. You should not 
trust in such cases  what you see in StandardForm or TraditionalForm. 
In fact RealDigits[,2] gives you the relevant information.


Andrzej Kozlowski
Chiba, Japan
http://www.mimuw.edu.pl/~akoz/


  • Prev by Date: RE: Question on pattern matching
  • Next by Date: Re: undocumented function StringQ
  • Previous by thread: Re: bug in IntegerPart ?
  • Next by thread: Re: Re: bug in IntegerPart ?