[Maxima] Rounding

Stavros Macrakis macrakis at alum.mit.edu
Wed Jan 2 10:48:19 CST 2008


On Jan 2, 2008 5:45 AM, Holger Schulz <qdl at gmx.net> wrote:

> I haven't found functions for rounding/truncating rational numbers
> yet. Are there some? How are they called?
>

ceiling: next largest integer
floor: next smallest integer
truncate: next integer closer to 0
round: nearest integer, preferring evens to odds for ties
   (if you want old-fashioned rounding, use floor(x+1/2) )

x          -5/3 -1/2 -1/3   0   1/2  3/2  5/2  8/3
ceiling     -1    0    0    0    1    2    3    3
floor       -2   -1   -1    0    0    1    2    2
truncate    -1    0    0    0    0    1    2    2
round       -2    0    0    0    0    2    2    3
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.math.utexas.edu/pipermail/maxima/attachments/20080102/8fd32816/attachment.htm 


More information about the Maxima mailing list