Hi all,
As a follow up to something that was asked in May 2005 but not answered
(as far as I can tell). fpprec doesn't seem to provide consistent
output, particularly with scientific notation and tex(). Please review
these examples of what I consider to be strange behavior.
(%i75) fpprec:4;
(%o75) 4
(%i76) tex(5.0011613);
$$5.001$$
(%o76) false
(%i77) tex(5.0011613e-5);
$$5.0011613 \times 10^{-5}$$
(%o77) false
(%i78) tex(5.0011613e5);
$$500116.$$
(%o78) false
(%i79) 5.0011613e5;
(%o79) 500116.
(%i80) 5.0011613e-5;
(%o80) 5.0012E-5
(%i81) 5.0011613;
(%o81) 5.001
Is there a way to have consistent output, and by consistent I mean
report a specific number of significant figures in all output,
regardless of the input style? Perhaps I am making assumptions about
fpprec, and there is something else available for this purpose? Thanks
a bunch,
Pete
PS
Below is the previous question:
----------------------------------
Like this:
(%i2360) FPPREC:6;
(%o2360) 6
(%i2361) tex(float(1/3));
$$0.3333$$
(%o2361) FALSE
(%i2362) tex(float(1/3*10^-24));
$$3.3333333333333335 \times 10^{-25}$$
(%o2362) FALSE
(%i2363) tex(float(1/3*10^-2));
$$0.0033$$
(%o2363) FALSE
The output of (%i2362) is not wanted. Why the setting
of FPPREC doesn't work when the value is too little?
However,
(%i2364) float(1/3*10^-24);
(%o2364) 3.33333E-25
It works without "tex"!
Is there any other way to make the "tex"ed value to be
shorter. It is for the convenience of reading.
Thanks for consideration.
YC Zou