From 0ae0b36ebec7bd562ce63d0fc4149d53a26f2ab8 Mon Sep 17 00:00:00 2001 From: Dave Parker Date: Fri, 18 Nov 2011 21:58:47 +0000 Subject: [PATCH] Bug fix: stop a floating point exception (if enabled) (found by Christian von Essen). git-svn-id: https://www.prismmodelchecker.org/svn/prism/prism/trunk@4175 bbc10eb1-c90d-0410-af57-cb519fbb1720 --- cudd/cudd/cuddTable.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/cudd/cudd/cuddTable.c b/cudd/cudd/cuddTable.c index 369ba48f..51777ef5 100644 --- a/cudd/cudd/cuddTable.c +++ b/cudd/cudd/cuddTable.c @@ -1466,13 +1466,17 @@ cuddUniqueConst( // this is the new version... // (round off before doing hash function to ensure // close valued constants are in the same table) - trunc = 10000000000.0; // 10^10 - m = value * trunc; - n = floor(m); - if (m-n >= 0.5) - n = n + 1; - n = n / trunc; - split.value = n; + if (isfinite(value)) { + trunc = 10000000000.0; // 10^10 + m = value * trunc; + n = floor(m); + if (m-n >= 0.5) + n = n + 1; + n = n / trunc; + split.value = n; + } else { + split.value = value; + } pos = ddHash(split.bits[0], split.bits[1], unique->constants.shift); nodelist = unique->constants.nodelist;