Skip to content

Are there ERounding modes which are equivalent to those in the IEEE 754 standard? #23

@JoePS1000

Description

@JoePS1000

This looks like a great library. I want to be able to round EFloats according to the rounding modes prescribed by the IEEE 754 standard, and described in https://en.wikipedia.org/wiki/IEEE_754#Rounding_rules .

You've got a variety of modes listed in https://github.com/peteroupc/Numbers/blob/master/docs/PeterO.Numbers.ERounding.md . As far as I can see from that Wikipedia link, they correspond as below. Am I right?

  • Round to nearest, ties to even — rounds to the nearest value; if the number falls midway, it is rounded to the nearest value with an even least significant digit: PeterO.Numbers.ERounding.HalfEven.

  • Round to nearest, ties away from zero: PeterO.Numbers.ERounding.HalfUp.

  • Round toward 0 — directed rounding towards zero (also known as truncation): PeterO.Numbers.ERounding.Down.

  • Round toward +∞ — directed rounding towards positive infinity (also known as rounding up or ceiling): PeterO.Numbers.ERounding.Ceiling .

  • Round toward −∞ — directed rounding towards negative infinity (also known as rounding down or floor): PeterO.Numbers.ERounding.Floor .

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