scientific notation - truncation



Most of the output of printf depends on the underlying Lisp. E.g. in GCL we
have

(%i1) num: 0.00000017$
(%i2) printf(false,"~f~%",num);
(%o2) 0.00000016999999999999999
(%i3) printf(false,"~e~%",num);
(%o3) 1.6999999999999999E-7
(%i4) printf(false,"~g~%",num);
(%o4) 1.6999999999999999E-7

~f, ~e and ~g just pass through what the Lisp function 'format' results.

(%i5) printf(false,"~h~%",num);
(%o5) 0.00000017
(%i6) bfloat(num);
(%o6)                               1.7b-7

The specifier ~h for bigfloats (~h causes conversion) is more or less
independend from 'format' and should result the same in all Lisps.

FWIW

Volker


2013/4/4 Pepe Sanchez <jose.sanchez at uv.es>

> Hi!
>
> printf seems a good try ....  look at the manual for details....
>
> (%i1)  num: 0.00000017$
> printf(false,"~f",num);
> printf(false,"~e",num);
> printf(false,"~g",num);
>
> output---->
>
> (%o2) "0.00000017"
> (%o3) "1.6999999999999998e-7"
> (%o4) "1.70000000e-7"
>
> Best
>
> *sorry I looked into the manual but I cannot find a solution:*>>**>>*     (%i74) 0.0017;*>>*     (%o74)            0.0017*>>*     (%i75) 0.00017;*>>*     (%o75)       1.7000000000000001E-4*
>
>
>
> ________________________________________________________________
> Jose Sanchez-Marin.
>  Universitat de Valencia.
>  Spain       e-mail: Jose.Sanchez at uv.es
>  _________________________________________________________________
>
>
>
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>
>