Distinguish between Math.rint( ) and Math.round( )
Answers
Answered by
0
Java Function: Math.rint() and Math.round() diffrence
- Math.rint(): changes the value to the nearest whole number
- rounds down the value
- it returns doubles value( a data type for decimal values)
- example: math.rint(4.5) = 4.0
math.rint(4.6) = 5.0
- Math.round(): will return a value near to the highest integer.
- rounds up the value
- example : math.round(4.5) = 5
Similar questions