Site Tools
Sidebar
User's Manual
t2:round
round
round — Rounds a fix32 number
Description
fix32 round(fix32 num);
Returns the rounded value of num to the closest integer (as fix32).
Parameters
- num: The numeric value to round.
Return Value
The rounded value. The return value of round() is still of type fix32 because the value range of fix32 is usually bigger than that of integer.
Examples
Example #1 round() example
init { printf("%.2f", round(3.4)); // 3.00 printf("%.2f", round(3.5)); // 4.00 printf("%.2f", round(3.6)); // 4.00 printf("%.2f", round(-3.4)); //-3.00 }
See Also
t2/round.txt · Last modified: 2016/11/13 02:49 by J2Kbr