CEIL rounds up, FLOOR rounds down, ROUND goes to the closet integer .... none
of which is a TRUNC function. OpenSCAD does not have a trunc function, but
it is easy to make one:
function trunc(x=0) = ( x > 0 ? floor (x) : ceil(x) );
Then call it like: echo (trunc(4.3));
Given inputs of:
x = -4.9, -4.5, -4.1, 0.232, 5.1, 5.5, 5.9
TRUNC: -4, -4, -4, 0, 5, 5, 5
CEIL: -4, -4, -4, 1, 6, 6, 6
ROUND: -5, -5, -4, 0, 5, 6, 6
FLOOR: -5, -5, -5, 0, 5, 5, 5
--
Sent from:
http://forum.openscad.org/_______________________________________________
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org