View source code Display the source code in std/math.d from which this page was generated on github. Improve this page Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using local clone. Page wiki View or edit the community-maintained wiki page associated with this page.

Function std.math.feqrel

To what precision is x equal to y?

Prototype

int feqrel(X)(
  X x,
  X y
) pure nothrow @nogc @trusted
if (isFloatingPoint!X);

Returns

the number of mantissa bits which are equal in x and y. eg, 0x1.F8p+60 and 0x1.F1p+60 are equal to 5 bits of precision.

x y feqrel(x, y) x x real.mant_dig x >= 2*x 0 x <= x/2 0 any 0 any 0

Authors

Walter Bright, Don Clugston, Conversion of CEPHES math library to D by Iain Buclaw

License

Boost License 1.0.

Comments