I have some abstract double interval, defining by step f.e.:
0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0 - where interval == 0.1
0.0, 0.25, 0.5, 0.75, 1.0 - where interval == 0.25
0.0, 0.5, 1.0 - where interval == 0.5
Does Java have some instrument to "round" some double to closest number, according to interval? f.e:
0.511111 - to 0.5
in first case
0.599999 - to 0.6
in first case
0.511111 - to 0.5
in second case
0.599999 - to 0.5
in second case
0.711111 - to 0.75
in second case
0.744444 - to 0.5
in third case
0.755555 - to 1.0
in third case
0.92222 - to 1.0
in third case