some more tests.
This commit is contained in:
parent
21fb6091ea
commit
c6ad678174
33
C/arith1.c
33
C/arith1.c
@ -463,6 +463,17 @@ eval1(Int fi, Term t) {
|
||||
case db_ref_e:
|
||||
RERROR();
|
||||
}
|
||||
#if HAVE_ISNAN
|
||||
if (isnan(dbl)) {
|
||||
return Yap_ArithError(DOMAIN_ERROR_OUT_OF_RANGE, t, "integer(%f)", dbl);
|
||||
}
|
||||
#endif
|
||||
#if HAVE_ISNAN
|
||||
if (isinf(dbl)) {
|
||||
return Yap_ArithError(EVALUATION_ERROR_INT_OVERFLOW, MkFloatTerm(dbl), "integer\
|
||||
(%f)",dbl);
|
||||
}
|
||||
#endif
|
||||
RBIG_FL(floor(dbl));
|
||||
}
|
||||
case op_ceiling:
|
||||
@ -490,6 +501,17 @@ eval1(Int fi, Term t) {
|
||||
case db_ref_e:
|
||||
RERROR();
|
||||
}
|
||||
#if HAVE_ISNAN
|
||||
if (isnan(dbl)) {
|
||||
return Yap_ArithError(DOMAIN_ERROR_OUT_OF_RANGE, t, "integer(%f)", dbl);
|
||||
}
|
||||
#endif
|
||||
#if HAVE_ISNAN
|
||||
if (isinf(dbl)) {
|
||||
return Yap_ArithError(EVALUATION_ERROR_INT_OVERFLOW, MkFloatTerm(dbl), "integer\
|
||||
(%f)",dbl);
|
||||
}
|
||||
#endif
|
||||
RBIG_FL(ceil(dbl));
|
||||
}
|
||||
case op_round:
|
||||
@ -517,6 +539,17 @@ eval1(Int fi, Term t) {
|
||||
#endif
|
||||
RERROR();
|
||||
}
|
||||
#if HAVE_ISNAN
|
||||
if (isnan(dbl)) {
|
||||
return Yap_ArithError(DOMAIN_ERROR_OUT_OF_RANGE, t, "integer(%f)", dbl);
|
||||
}
|
||||
#endif
|
||||
#if HAVE_ISNAN
|
||||
if (isinf(dbl)) {
|
||||
return Yap_ArithError(EVALUATION_ERROR_INT_OVERFLOW, MkFloatTerm(dbl), "integer\
|
||||
(%f)",dbl);
|
||||
}
|
||||
#endif
|
||||
RBIG_FL(my_rint(dbl));
|
||||
}
|
||||
case op_truncate:
|
||||
|
Reference in New Issue
Block a user