MathGroup Archive 2006

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

Search the Archive

Re: Re: SetPrecision causes logical comparisons to fail in Mathematica 5.1 on Mac OS X?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg64013] Re: [mg63982] Re: [mg63967] SetPrecision causes logical comparisons to fail in Mathematica 5.1 on Mac OS X?
  • From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
  • Date: Fri, 27 Jan 2006 05:13:29 -0500 (EST)
  • References: <200601251345.IAA25867@smc.vnet.net> <200601260843.DAA22198@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

On 26 Jan 2006, at 08:43, Pratik Desai wrote:

> In[321]:=
> Clear[x]
> SetAttributes[FixedPrecisionEvaluate,HoldFirst]
> FixedPrecisionEvaluate[x_,p_?NumberQ]:=Block[{$MinPrecision=p, 
> $MaxPrecision=p},x];
> x:=FixedPrecisionEvaluate[1.101,2]
> x==1.0
> x==0.0
>
>
> Out[325]=
> False
>
> Out[326]=
> False
>


Unfortunately this really does not do anything. The original number  
1.101 was a MachinePrecision number and when you apply  
FixedPrecisionEvaluate to it you again get a MachinePrecision number.  
Nothing has changed. It is not surprising then that 1.101 is not  
equal to 1.0 or 0.0 since this is simply machine arithmetic, in other  
words, all you are doing is:


1.101==1.0


False


1.101==0.0


False


Andrzej Kozlowski


  • Prev by Date: Combining Graphics and Graphics3D objects (something akin to Shadow)
  • Next by Date: Re: Separation of variables scheme
  • Previous by thread: Re: SetPrecision causes logical comparisons to fail in Mathematica 5.1 on Mac OS X?
  • Next by thread: Re: SetPrecision causes logical comparisons to fail in Mathematica 5.1 on Mac OS X?