Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
108
rated 0 times [  110] [ 2]  / answers: 1 / hits: 27713  / 15 Years ago, mon, october 12, 2009, 12:00:00

I want to convert all numbers to the nearest .25


So...


5 becomes 5.00
2.25 becomes 2.25
4 becomes 4.00
3.5 becomes 3.50

More From » rounding

 Answers
33

Here’s an implementation of what rslite said:



var number = 5.12345;
number = (Math.round(number * 4) / 4).toFixed(2);

[#98528] Thursday, October 8, 2009, 15 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ronans

Total Points: 460
Total Questions: 109
Total Answers: 108

Location: Slovenia
Member since Sat, Sep 11, 2021
3 Years ago
;