fix truncate
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@565 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
d0a4007160
commit
e5d7edf852
33
C/arith1.c
33
C/arith1.c
@ -101,7 +101,6 @@ typedef struct init_un_eval {
|
||||
#undef HAVE_ASINH
|
||||
#undef HAVE_ACOSH
|
||||
#undef HAVE_ATANH
|
||||
#undef HAVE_ARINT
|
||||
#undef HAVE_FINITE
|
||||
#endif
|
||||
|
||||
@ -114,24 +113,6 @@ typedef struct init_un_eval {
|
||||
#if !HAVE_ATANH
|
||||
#define atanh(F) (log((1+(F))/(1-(F)))/2)
|
||||
#endif
|
||||
#if !HAVE_RINT
|
||||
inline static double
|
||||
rint(double x) {
|
||||
double d = x - floor(x);
|
||||
if (d > 0.5) {
|
||||
return(ceil(x));
|
||||
} else if (d > 0.5) {
|
||||
return(floor(x));
|
||||
} else {
|
||||
double z = floor(x);
|
||||
if ((z/2)*2 == z) {
|
||||
return(z);
|
||||
} else {
|
||||
return(ceil(x));
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
do nothing...
|
||||
@ -1480,10 +1461,18 @@ p_truncate(Term t E_ARGS)
|
||||
}
|
||||
}
|
||||
|
||||
if (yap_flags[LANGUAGE_MODE_FLAG] == 1) { /* iso */
|
||||
RBIG_FL(rint(dbl));
|
||||
if (dbl >= 0 ) {
|
||||
if (yap_flags[LANGUAGE_MODE_FLAG] == 1) { /* iso */
|
||||
RBIG_FL(floor(dbl));
|
||||
} else {
|
||||
RFLOAT(floor(dbl));
|
||||
}
|
||||
} else {
|
||||
RFLOAT(rint(dbl));
|
||||
if (yap_flags[LANGUAGE_MODE_FLAG] == 1) { /* iso */
|
||||
RBIG_FL(ceil(dbl));
|
||||
} else {
|
||||
RFLOAT(ceil(dbl));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
<h2>Yap-4.3.23:</h2>
|
||||
<ul>
|
||||
<li>FIXED: rint is not truncate/1 (Paulo Moura).</li>
|
||||
<li>FIXED: recent change broke debugger help message (Nuno Fonseca).</li>
|
||||
<li>UPDATE: new Logtalk version (2.14.1).</li>
|
||||
<li>NEW: <code>call_with_args/n</code> simulates <code>call/n</code>.</li>
|
||||
|
@ -175,7 +175,6 @@
|
||||
#undef HAVE_READLINK
|
||||
#undef HAVE_REGEXEC
|
||||
#undef HAVE_RENAME
|
||||
#undef HAVE_RINT
|
||||
#undef HAVE_RL_SET_PROMPT
|
||||
#undef HAVE_SBRK
|
||||
#undef HAVE_SELECT
|
||||
|
@ -794,7 +794,7 @@ AC_CHECK_FUNCS(gethrtime getpwnam getrusage gettimeofday getwd)
|
||||
AC_CHECK_FUNCS(isatty isnan kill labs link localtime lstat)
|
||||
AC_CHECK_FUNCS(memcpy memmove mkstemp mktemp mmap opendir)
|
||||
AC_CHECK_FUNCS(popen putenv rand random readlink regexec)
|
||||
AC_CHECK_FUNCS(rename rint rl_set_prompt sbrk select)
|
||||
AC_CHECK_FUNCS(rename rl_set_prompt sbrk select)
|
||||
AC_CHECK_FUNCS(setbuf setlinebuf shmat sigaction siggetmask siginterrupt)
|
||||
AC_CHECK_FUNCS(signal sigprocmask sleep snprintf socket stat)
|
||||
AC_CHECK_FUNCS(strchr strerror strncat strncpy strtod system)
|
||||
|
Reference in New Issue
Block a user