1/5^k cannot be represented exactly as a binary floating-point number for
k>0. For example, 0.2 is actually represented as 3602879701896397/2^54.
Javascript floating point is not exact, either, it is simply rounding to
fewer digits when printing.
To round to fewer digits when printing in Maxima, use fpprintprec;
e.g. fpprintprec:14
to round to 14 digits.
-s
On Wed, May 16, 2012 at 4:05 AM, Evgeniy Maevskiy <emaevskiy at e-math.ru>wrote:
> In floats (i.e. numer:true) we have:
>
> (%i1) x:makelist(1/5^k,k,1,7);
> (%o1) [0.2,0.04,0.008,0.0016,3.2000000000000003E-4,6.3999999999999997E-5,
> 1.2799999999999999E-5]
>
> but Firefox-javascript (for example) returns precise values:
>
> 0.2
> 0.04
> 0.008
> 0.0016
> 0.00032
>
> etc. (at least up to k=20)
>
> Limits of the FLOAT in Maxima and Firefox are the same: 1e-324 - 1e309
>
> (Windows XP, Maxima 5.27.0, Firefox 11.0)
>
>
>
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>