Question Bankers Rounding - .NET vs. ABL

Cecil

19+ years progress programming and still learning.
So I have found out today that .NET round() function as different result to ABL round() function.

.NET round(1.785, 2) = 1.78

ABL round(1.785, 2) = 1.79

.NET uses Bankers Rounding which has slightly different rules to the rounding we all learnt in school.

Has anyone else come across this in the wild? How did you handle it in the wild?

REF:
VBA Bankers Rounding

 
.NET vs. ABL round() funnction



Code:
USING System.Math.

MESSAGE ".NET: " System.Math:ROUND(1.785,2) SKIP
         "ABL: " ROUND(1.785,2)
    VIEW-AS ALERT-BOX INFO TITLE ".NET vs. ABL ROUND".

1646373461137.png
 
About 6 years ago I was working on a project and I was collecting information and the reports were sometimes out by 1 or 2 cents when compared with my vendor's reports.

I was never able to quite able to work out why. But I believe the ABL round() function was the cause of it all. Ugh!
 
Last edited:
Back
Top