From 463ab07f3c93ec91cf9d5570d4f519b96d0001a9 Mon Sep 17 00:00:00 2001 From: Vitor Santos Costa Date: Fri, 16 Apr 2010 10:32:36 +0100 Subject: [PATCH] fix error handling with nan (obs from Jose Santos). --- C/cmppreds.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/C/cmppreds.c b/C/cmppreds.c index 795b522c5..1c236b4d2 100644 --- a/C/cmppreds.c +++ b/C/cmppreds.c @@ -563,6 +563,9 @@ a_cmp(Term t1, Term t2) Float f2 = FloatOfTerm(t2); #if HAVE_ISNAN if (isnan(f2)) { + Yap_Error_TYPE = EVALUATION_ERROR_UNDEFINED; + Yap_Error_Term = t2; + Yap_ErrorMessage = "trying to evaluate nan"; ArithError = TRUE; } #endif @@ -579,6 +582,9 @@ a_cmp(Term t1, Term t2) Float f1 = FloatOfTerm(t1); #if HAVE_ISNAN if (isnan(f1)) { + Yap_Error_TYPE = EVALUATION_ERROR_UNDEFINED; + Yap_Error_Term = t1; + Yap_ErrorMessage = "trying to evaluate nan"; ArithError = TRUE; } #endif @@ -595,6 +601,9 @@ a_cmp(Term t1, Term t2) Float f2 = FloatOfTerm(t2); #if HAVE_ISNAN if (isnan(f2)) { + Yap_Error_TYPE = EVALUATION_ERROR_UNDEFINED; + Yap_Error_Term = t2; + Yap_ErrorMessage = "trying to evaluate nan"; ArithError = TRUE; } #endif @@ -620,6 +629,9 @@ a_cmp(Term t1, Term t2) Float f2 = FloatOfTerm(t2); #if HAVE_ISNAN if (isnan(f2)) { + Yap_Error_TYPE = EVALUATION_ERROR_UNDEFINED; + Yap_Error_Term = t2; + Yap_ErrorMessage = "trying to evaluate nan"; ArithError = TRUE; } #endif