I am building an API and the system that I am using just uses midpoint rounding in PowerShell. I've come to find out that certain numbers still disobey this rule and my research as to why has proven futile. Basically, anything below 5 rounds down, and anything above 5 rounds up, except for certain situations I guess?
My scripts are included in this image if anybody would like to assist.
11.025 = 11.03
12.025 = 12.03
29.025 = 29.03
39.025 = 39.03
This values and everything in the script is expected EXCEPT for:
19.025 = 19.02
If somebody could explain what is going on that would be greatly appreciated.
I am using [float] variables, everything I have seen about rounding issues has been about [float] variables. I casted to [decimal] instead, and that cleared everything up. I guess there are bits in a [float] that sometimes prohibit it from rounding with MidpointRounding.