Re: More rounding


[ Follow Ups ] [ Post Followup ] [ CS2704 Web Discussion Board ] [ FAQ ]

Posted by John Kugelman on March 23, 2001 at 05:34:28:

In Reply to: More rounding posted by Juan Romero Jr. on March 22, 2001 at 18:07:52:

: Unless someone knows of a better way to round integers from floats (instead of having them truncated) try to figure something with the modulus operator. This is how I solved that problem in an earlier post on rounding....

From you can use the functions 'floor' and 'ceil' to control the rounding. 'floor' rounds down, 'ceil' rounds up.

If you want to round naturally, use something like 'floor (x + 0.5)', which rounds to the closest integer.



Follow Ups:



Post a Followup

Name:
E-Mail:

Subject:

Comments:

Optional Link URL:
Link Title:
Optional Image URL:


[ Follow Ups ] [ Post Followup ] [ CS2704 Web Discussion Board ] [ FAQ ]