Skip to content

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

Description

@JoePS1000

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 .

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions