I'm glad this strange work around was helpful.
It is NOT the floor function causing the trouble, it is the multiplication! If you add a Math.Round() statement, you don't have to convert the number to a string and convert the string to a number:
Code:
Hours = 2.0125;
Min = Hours * 60 -- = 120.75
Min = Math.Round(Min, 7); -- = 120.75
WholeMin = Math.Floor(Min); -- = 120
MinFxn = Min - WholeMin; -- 120.75 - 120 = 0.75
-- Without tha Math.Round() MinFxn would equal 0.75000000000001 [ 11 x zero ]
You can do the rounding with 2 – 7 decimal places. If you increase the number to 8, the "fun" starts:
DecimalPlaces/Result MinFxn
7 = 0.75
8 = 0.90098113
9 = 0.490915713
10 = 0.0614189825
I should like the BRAIN TRUST to tell me why it is like that, and why converting back and forth gives another result.