Add fuzzy floating point comparison macro

Desktop / GNOME / GLib - Emmanuele Bassi [gnome.org] - 29 May 2018 09:02 EDT

Add a test macro that allows comparing two floating point values for equality within a certain tolerance.

This macro has been independently reimplemented by various projects:

- Clutter
- Graphene
- colord

https://gitlab.gnome.org/GNOME/glib/issues/914

0b4c2eefc Add fuzzy floating point comparison macro
docs/reference/glib/glib-sections.txt | 1 +
glib/gtestutils.c | 26 ++++++++++++++++++++++----
glib/gtestutils.h | 7 +++++++
glib/tests/testing.c | 14 ++++++++++++++
4 files changed, 44 insertions(+), 4 deletions(-)

Upstream: git.gnome.org


  • Share