Representation of floats



       rationalize(0.2) - 1/5     => 1/90071992547409920      -- exact error

       factor(rationalize(0.2)-1/5)  =>    1/(2^54*5)    -- exact error,
perhaps more insight

       float(rationalize(0.2)-1/5) => 1.11...e-17           -- good
approximation

       bfloat(0.2) - 1/5, fpprec=20 => 1.11...b-17         -- good
approximation (bfloat is contagious)


On Thu, May 17, 2012 at 1:23 PM, Evgeniy Maevskiy <emaevskiy at e-math.ru>wrote:

> Thanks to all. Yes, it is the fact:
>
> numer:false$
> is(0.2=1/5);  /* false - it's clear */
>
> numer:true$
> is(0.2=1/5); /* true - and it's clear too */
>
> Now I'd like to compute the error:
>
> numer:false$
> 0.2-1/5;
>
> returns 0.0
>
> I think that the error must be about 1e-16. Can I compute it explicitly?
>
>
>
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>