~ package:ieee754

An approximate equality comparison operator. For real IEEE types, two values are approximately equal in the following cases:
  • at least half of their significand bits agree;
  • both values are less than epsilon;
  • both values are NaN.
For complex IEEE types, two values are approximately equal in the followiing cases:
  • their magnitudes are approximately equal and the angle between them is less than 32*epsilon;
  • both magnitudes are less than epsilon;
  • both have a NaN real or imaginary part.
Admitedly, the 32 is a bit of a hack. Future versions of the library may switch to a more principled test of the angle.