RE : get fpprintprec to round float inside function?




> -----Message d'origine-----
> De?: maxima-bounces at math.utexas.edu [mailto:maxima-bounces at math.utexas.edu] De la part de
> Dieter Kaiser
> Envoy??: jeudi 30 juin 2011 23:00
> ??: Edwin Woollett
> Cc?: maxima mailing list
> Objet?: Re: [Maxima] 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
> 
> 

There is also the function round.

(%i4) float(round(1234*100/1024)/100);
(%o4) 1.21

Laurent Couraud.

> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima