I am working with an external api in a Ruby on Rails application. I need to send floats to this company, but they only accept values ββsuch as 1.0 , 1.25 , 1.5 , 1.75 , 2.0 , etc.
I may have a value like 1.34 or 1.80 . Ideally, I need to round them to the nearest 0.25 . What is the best way to do this? if I do 1.34.round(0) , it will give me 1.0 , which is lower than what I need.
Thanks!
source share