1) Multiply by 4 <== Where did that come from?
2) Add just short of your machine value of 1. I used 0.9999999999. It did NOT work when I used 0.999999999999999. It may take some experimentation to find the right value.
3) Truncate to integer
4) Divide by 4.