Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is the default rounding for EFloat arithmetic the same as the default for C#'s built-in float types? #22

Open
JoePS1000 opened this issue Dec 1, 2022 · 0 comments

Comments

@JoePS1000
Copy link

JoePS1000 commented Dec 1, 2022

In https://github.com/peteroupc/Numbers/blob/master/Numbers/PeterO/Numbers/EFloat.cs , you set a default rounding mode for Add and other functions. This is given by EContext.UnlimitedHalfEven . Is this rounding mode the same as I'd get if I did arithmetic on C#'s built-in floats? I want to be able to change between those and EFloat, and know that arithmetic will behave the same way regardless.

Wikipedia on the IEEE 754 rounding rules ( https://en.wikipedia.org/wiki/IEEE_754#Rounding_rules ) says that "Round to nearest, ties to even is the default for binary floating point". By this, it means "rounds to the nearest value; if the number falls midway, it is rounded to the nearest value with an even least significant digit". As far as I can see, that's your PeterO.Numbers.ERounding.HalfEven .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant