Skip to content

[API Proposal/Question]: IFloatingPoint<TSelf> is totally base 2 IEEE 1985 oriented. We also need the basics for base10/decimal and other rational/fraction/real like numbers #62293

@maxild

Description

@maxild

Background and motivation

I know IFloatingPoint<TSelf> has this covered, but the interface is MUCH too big for other floating/fixed point/fractional numbers to support it.

We need a more basic (more generic) fractional number abstraction for all "real" like types (IEEE, decimal, Rational/Fraction/FixedPointNumber etc).

Functions like

  • truncate
  • floor
  • ceil
  • round

are concepts of all fractional numbers (aka fractions).

For floating point types (decimal and IEEE types) you could add

  • nextUp (BitIncremenet in BCL)
  • nextDown (BitDecrement in BCL)
  • epsilon (why is epsilon defined as the smallest denormalized number in the BCL???, when it is defined as the distance between numbers in the [1,2), for base 2, and [1,10) , for base 10, segments in the academic litterature. The number important for relative errors and ulps (unit in last place, nextUp(x) - x, x > 0) around the number one)

I am guessing that System.Decimal (base 10) floating point numbers can be sorted (bit traversed), but I am not 100 pct sure, have to check the precise encoding used in Decimal.cs!?!

Before a more precise API proposal. Is this an oversight? Are you working on something without NaN, Denormalized/Subnormal, +/- infinity , +/-zero, and all the other IEEE 1985 related static methods that can be used with (supported by) for example System.Decimal? And maybe something without the many trigonometric and logarithmic functions?

API Proposal

API Usage

Alternative Designs

No response

Risks

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions