summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--hash.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/hash.c b/hash.c
index d71f0e20..7f0f0b6a 100644
--- a/hash.c
+++ b/hash.c
@@ -291,10 +291,12 @@ static ucnum hash_double(double n)
ucnum h = 0;
unsigned i;
- u.d = n;
+ if (n != 0.0) {
+ u.d = n;
- for (i = 0; i < sizeof u.a / sizeof u.a[0]; i++)
- h += u.a[i];
+ for (i = 0; i < sizeof u.a / sizeof u.a[0]; i++)
+ h += u.a[i];
+ }
return h;
}