diff --git a/C/arith0.c b/C/arith0.c index 289447962..2e68c2375 100644 --- a/C/arith0.c +++ b/C/arith0.c @@ -49,6 +49,11 @@ static char SccsId[] = "%W% %G%"; #define NAN (0.0/0.0) #endif +/* copied from SWI-Prolog */ +#ifndef DBL_EPSILON /* normal for IEEE 64-bit double */ +#define DBL_EPSILON 0.00000000000000022204 +#endif + static Term eval0(Int fi) { arith0_op fop = fi; @@ -61,6 +66,10 @@ eval0(Int fi) { { RFLOAT(M_E); } + case op_epsilon: + { + RFLOAT(DBL_EPSILON); + } case op_inf: { #ifdef _MSC_VER /* Microsoft's Visual C++ Compiler */ @@ -152,6 +161,7 @@ typedef struct init_const_eval { static InitConstEntry InitConstTab[] = { {"pi", op_pi}, {"e", op_e}, + {"epsilon", op_epsilon}, {"inf", op_inf}, {"nan", op_nan}, {"random", op_random}, diff --git a/C/arith2.c b/C/arith2.c index 2e99a3b21..bbeb381d9 100644 --- a/C/arith2.c +++ b/C/arith2.c @@ -1093,6 +1093,7 @@ static InitBinEntry InitBinTab[] = { {"\\/", op_or}, {"#", op_xor}, {"><", op_xor}, + {"atan", op_atan2}, {"atan2", op_atan2}, /* C-Prolog exponentiation */ {"^", op_power}, diff --git a/H/eval.h b/H/eval.h index 7c87e06e2..e4e27e202 100644 --- a/H/eval.h +++ b/H/eval.h @@ -21,6 +21,9 @@ #if HAVE_MATH_H #include #endif +#ifdef HAVE_FLOAT_H +#include +#endif #ifdef HAVE_IEEEFP_H #include #endif @@ -42,6 +45,7 @@ typedef enum { op_pi, op_e, + op_epsilon, op_inf, op_nan, op_random, diff --git a/docs/yap.tex b/docs/yap.tex index 3ad036e35..fd967d673 100644 --- a/docs/yap.tex +++ b/docs/yap.tex @@ -3776,9 +3776,12 @@ Arc cosine. @item atan(@var{X}) [ISO] Arc tangent. -@item atan2(@var{X}) +@item atan(@var{X},@var{Y}) Four-quadrant arc tangent. +@item atan2(@var{X},@var{Y}) +Four-quadrant arc tangent, same as atan/2. + @item sinh(@var{X}) Hyperbolic sine. @@ -3930,6 +3933,10 @@ diameter. @item e The base of the natural logarithms. +@item epsilon +The difference between the float @code{1.0} and the first larger floating point +number. + @item inf Infinity according to the IEEE Floating-Point standard. Note that evaluating this term will generate a domain error in the @code{iso}