Answers for "java math.round always up"

2

math round down java

Math.floor(num);
Posted by: Guest on May-11-2021
1

java round up

double test = 0.01;
// rounds up to the next INTEGER
test = Math.ceil(test);  // 1.0


double test2 = 1.0;
// does not round if decimal is 0
test2 = Math.ceil(test2);  // 1.0
Posted by: Guest on February-10-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language