This commit is contained in:
Vítor Santos Costa 2014-05-06 13:58:08 +01:00
parent df7425922a
commit 2dc4d66bb9
3 changed files with 86 additions and 2 deletions

View File

@ -24,7 +24,23 @@ static char SccsId[] = "%W% %G%";
@defgroup arithmetic_operators Arithmetic Functions @defgroup arithmetic_operators Arithmetic Functions
@ingroup arithmetic @ingroup arithmetic
YAP implements several arithmetic functions. Arithmetic expressions YAP implements several arithmetic functions, they are defined as
fields in three enumerations, such that there is one enumeration
per each different arity:
- #arith0_op defines constants and arity 0 arithmetic functions
@copydoc #arith0_op
- #arith1_op defines single argument arithmetic functions
@copydoc #arith1_op
- #arith2_op defines binary arithmetic functions
@copydoc #arith2_op
Arithmetic expressions
in YAP may use the following operators: in YAP may use the following operators:
- <b>pi [ISO]</b><p> @anchor pi_0 - <b>pi [ISO]</b><p> @anchor pi_0

View File

@ -127,10 +127,39 @@ exceptions:
#define PLMAXINT Int_MAX #define PLMAXINT Int_MAX
#define PLMININT Int_MIN #define PLMININT Int_MIN
/**
* @addtogroup arithmetic_operators
* @enum arith0_op constant operators
* @brief specifies the available unary arithmetic operators
*/
typedef enum { typedef enum {
/** pi [ISO]
An approximation to the value of <em>pi</em>, that is, the ratio of a circle's circumference to its diameter.
*
*/
op_pi, op_pi,
/** e
Euler's number, the base of the natural logarithms.
*
*/
op_e, op_e,
/** epsilon
The difference between the float `1.0` and the next largest floating point number.
*
*/
op_epsilon, op_epsilon,
/** inf
Infinity according to the IEEE Floating-Point standard. Note that evaluating this term will generate a domain error in the `iso` language mode. Also note that
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.prolog}
* ?- +inf =:= -inf.
* false.
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*
*/
op_inf, op_inf,
op_nan, op_nan,
op_random, op_random,
@ -144,10 +173,44 @@ typedef enum {
op_stackfree op_stackfree
} arith0_op; } arith0_op;
/**
* @addtogroup arithmetic_operators
* @enum arith1_op unary operators
* @brief specifies the available unary arithmetic operators
*/
typedef enum { typedef enum {
/** \+ _X_: the value of _X_.
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.prolog}
* X =:= +X.
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
op_uplus, op_uplus,
/** \- _X_: the complement of _X_.
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.prolog}
* 0-X =:= -X.
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
*/
op_uminus, op_uminus,
/** \\ _X_, The bitwise negation of _X_.
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.prolog}
* \X /\ X =:= =:= 0.
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*
* Note that the number of bits of an integer is at least the size in bitsof a Prolog term cell.
*/
op_unot, op_unot,
/** \\ _X_, The bitwise negation of _X_.
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.prolog}
* \X /\ X =:= =:= 0.
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*
* Note that the number of bits of an integer is at least the size in bitsof a Prolog term cell.
*/
op_exp, op_exp,
op_log, op_log,
op_log10, op_log10,
@ -185,6 +248,11 @@ typedef enum {
op_random1 op_random1
} arith1_op; } arith1_op;
/**
* @addtogroup arithmetic_operators
* @enum arith2_op binary operators
* @brief specifies the available unary arithmetic operators
*/
typedef enum { typedef enum {
op_plus, op_plus,
op_minus, op_minus,

View File

@ -760,7 +760,7 @@ WARN_LOGFILE =
# spaces. # spaces.
# Note: If this tag is empty the current directory is searched. # Note: If this tag is empty the current directory is searched.
INPUT = docs/yap.md pl/absf.yap C/cmppreds.c C/eval.c H/eval.h C/arith0.c C/arith1.c C/arith2.c pl/arithpreds.yap INPUT = docs/yap.md pl/absf.yap C/cmppreds.c C/eval.c H/eval.h C/arith0.c C/arith1.c C/arith2.c pl/arithpreds.yap CXX
# This tag can be used to specify the character encoding of the source files # This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses