Value and Digits are the paameters passed to the routine
Code: Select all
If Digits > 0 then
Ans = FIX(Value, Digits)
End Else
Ans = FIX(Value/100,50)*100
End
Code: Select all
PRECISION 14
If Digits > 0 then
Ans = FIX(Value, Digits)
End Else
Ans = FIX(Value/100,50)*100
End
Example 1:
Value = 123456789.789947874545
Digit = 10
Result = 123456789.789948
The routine rounds of at the 6th position.
I was expecting result to be 123456789.7899478745 (round at the 10th position)
Example 2:
Value = 123456.789947874545
Digit = 10
Result = 123456.789947875
The routine rounds of at the 9th position.
I was expecting result to be 123456.7899478745 (round at the 10th position)
Example 3:
Value = 12345.789947874545
Digit = 10
Result = 12345.7899478745
The routine rounds of at the 10th position.
The result is as expected 123456789.7899478745 (round at the 10th position)
Looks like it it something to do with the Integer part of the Decimal value, when the value was increased from 12345.789947874545 to 123456.7899478745, there was a difference in rounding.
Is there any other optional way to make the Round work the way i want.