diff options
author | Thomas Haller <thaller@redhat.com> | 2017-03-23 13:35:02 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2017-03-23 19:06:02 +0100 |
commit | 2ad640af149d40194af6afe9df925c59b4cadb6f (patch) | |
tree | 26910058ee99f04907ca1170329cbf8411a8f69a /libnm-util | |
parent | 4561cb2dc821d493881ff24daccc09855bef49b0 (diff) |
build: don't link against libm.so
There are very few places where we actually use floating point
or #include <math.h>.
Drop that library, although we very likely still get it as indirect
dependency (e.g. on my system it is still dragged in by libsystemd.so,
libudev.so and libnl-3.so).
Diffstat (limited to 'libnm-util')
-rw-r--r-- | libnm-util/nm-param-spec-specialized.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/libnm-util/nm-param-spec-specialized.c b/libnm-util/nm-param-spec-specialized.c index 7021e108f..a4e01d8f5 100644 --- a/libnm-util/nm-param-spec-specialized.c +++ b/libnm-util/nm-param-spec-specialized.c @@ -30,7 +30,6 @@ struct _NMParamSpecSpecialized { }; #include <string.h> -#include <math.h> #include <netinet/in.h> #include <dbus/dbus-glib.h> @@ -157,15 +156,19 @@ _gvalues_compare_fixed (const GValue *value1, const GValue *value2) case G_TYPE_FLOAT: { gfloat val1 = g_value_get_float (value1); gfloat val2 = g_value_get_float (value2); + float diff = val1 - val2; + /* Can't use == or != here due to inexactness of FP */ - if (fabsf (val1 - val2) > FLOAT_FACTOR) + if (diff > FLOAT_FACTOR || diff < -FLOAT_FACTOR) ret = val1 < val2 ? -1 : val1 > val2; break; } case G_TYPE_DOUBLE: { gdouble val1 = g_value_get_double (value1); gdouble val2 = g_value_get_double (value2); - if (fabs (val1 - val2) > FLOAT_FACTOR) + double diff = val1 - val2; + + if (diff > FLOAT_FACTOR || diff < -FLOAT_FACTOR) ret = val1 < val2 ? -1 : val1 > val2; break; } |