javascript - rounding to two decimals for classification -


i have set of classes ranges used classification of dataset.

dataset: [ 0.44531, 0.79456, 1.47574, 4.53429]  //the classes ranges min1 = 0.44531  max1 = 1.23355 min2 = 1.23355  max2 = 4.53429 

if use math.round() or .tofixed() round ranges data thrown outside of ranges of min1 , max2

is there way round 2 decimals , sure no data outside?

value = math.floor(value * 100) / 100; 

that should trick, works math.round , math.ceil. (i don't guaranty works 100% numbers, decimal values strangely stored in computer memory, don't know how javascript in these cases.)


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -