AngouriMath
ConstantsAreEqual(AngouriMath.Entity,AngouriMath.Entity)
Method (no overloads)
Summary
Decides equality of two constants.
Remarks
Comparing the separately evaluated values for exact digit equality is not
enough. sqrt(i) and (1 + i) / sqrt(2) are the same number, but evaluating
each of them rounds independently, so the results disagree in the last few
digits and the comparison used to answer False. Their difference, on the
other hand, cancels, and Real's factory maps anything
below PrecisionErrorZeroRange onto an exact
zero -- so testing the difference is both more robust and consistent with
how the rest of the library already decides what counts as zero.
enough. sqrt(i) and (1 + i) / sqrt(2) are the same number, but evaluating
each of them rounds independently, so the results disagree in the last few
digits and the comparison used to answer False. Their difference, on the
other hand, cancels, and Real's factory maps anything
below PrecisionErrorZeroRange onto an exact
zero -- so testing the difference is both more robust and consistent with
how the rest of the library already decides what counts as zero.
Angouri © 2019-2023 · Project's repo · Site's repo · Octicons · Transparency · 1953 pages online