[Date Index] [Thread Index] [Author Index]
Re: bug in IntegerPart ?
Andrzej Kozlowski <akoz at mimuw.edu.pl> wrote in message news:<c6l7kr$ink$1 at smc.vnet.net>... > 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! Binary representations of decimal numbers existed long before Mathematica was inception. Prof. Kozlowski, would you please prove, without using Mathematica, that the binary representations of 1.65-1.3 and .35 are indeed different? I claim that they are IDENTICAL and only Mathematica MAKES them different because it transforms 1.65 and 1.3 into truncated binary representations BEFORE subtraction. AC > > In:= > FullForm[BaseForm[0.35, 2]] > > Out//FullForm= > BaseForm[0.35`,2] > > In:= > FullForm[BaseForm[1.65 - 1.3, 2]] > > Out//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/