Skip to content

Rewrite floating-point comparison

  • Use a fixed epsilon for small values
  • Use a scaled epsilon for bigger values
  • Handle NaN
  • Handle Inf
  • Fully constexpr capable
  • Make (almost) all operators constexpr capable

The epsilon can be supplied as a parameter to the comparison funcs. The default epsilon can be changed by defining MANTLE_API_DEFAULT_EPS before inclusion of MantleAPI headers. This allows for adjustment of the epsilon for operator==.

Relates to #18

The program was tested solely for our own use cases, which might differ from yours.

Martin Stump martin.stump@mercedes-benz.com on behalf of Mercedes-Benz Tech Innovation GmbH, Provider Information

Edited by Martin Stump

Merge request reports

Loading