get fpprintprec to round float inside function?



Am Donnerstag, den 30.06.2011, 13:24 -0700 schrieb Edwin Woollett:
> I would like to use fpprintprec (or is there another
> way?)  to round bytes to KB inside a function
> folder_info, using code like:

I had no look at the problem with the option variable fpprintprec, but I
would use the function truncate to get the desired number of digits,
e.g.

(%i13) float(truncate(1234/100)/10);
(%o13) 1.2
(%i14) float(truncate(1234/10)/100);
(%o14) 1.23
(%i15) float(truncate(34/10)/100);
(%o15) 0.03

This approach can be generalized.

Dieter Kaiser