doc support
This commit is contained in:
83
C/eval.c
83
C/eval.c
@@ -18,10 +18,16 @@
|
||||
static char SccsId[] = "%W% %G%";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This file implements arithmetic operations
|
||||
*
|
||||
*/
|
||||
/**
|
||||
@file eval.c
|
||||
|
||||
@defgroup arithmetic_preds Arithmetic Predicates
|
||||
@ingroup arithmetic
|
||||
|
||||
@{
|
||||
*/
|
||||
|
||||
|
||||
#include "Yap.h"
|
||||
#include "Yatom.h"
|
||||
#include "YapHeap.h"
|
||||
@@ -184,6 +190,23 @@ BEAM_is(void)
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
@class is_2
|
||||
@anchor is_2
|
||||
@brief evaluation of arithmetic expressions
|
||||
|
||||
<b>? _X_:number is + _Y_:ground is det</b>
|
||||
|
||||
This predicate succeeds iff the result of evaluating the expression
|
||||
_Y_ unifies with _X_. This is the predicate normally used to
|
||||
perform evaluation of arithmetic expressions:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
X is 2+3*4
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
succeeds with `X = 14`.
|
||||
|
||||
*/
|
||||
|
||||
static Int
|
||||
p_is( USES_REGS1 )
|
||||
{ /* X is Y */
|
||||
@@ -204,6 +227,16 @@ p_is( USES_REGS1 )
|
||||
return Yap_unify_constant(ARG1,out);
|
||||
}
|
||||
|
||||
/**
|
||||
@class isnan_1
|
||||
@anchor isnan_1
|
||||
@brief True if _X_ is not a number
|
||||
|
||||
<b> isnan(? _X_:float) is det</b>
|
||||
|
||||
Interface to the IEE754 `isnan` test.
|
||||
*/
|
||||
|
||||
static Int
|
||||
p_isnan( USES_REGS1 )
|
||||
{ /* X is Y */
|
||||
@@ -232,6 +265,17 @@ p_isnan( USES_REGS1 )
|
||||
return isnan(FloatOfTerm(out));
|
||||
}
|
||||
|
||||
/**
|
||||
@class isinf_1
|
||||
@anchor isinf_1
|
||||
@brief True if _X_ is infinity
|
||||
|
||||
<b> isnan(? _X_:float) is det</b>
|
||||
|
||||
Interface to the IEE754 `isinf` test.
|
||||
*/
|
||||
|
||||
|
||||
static Int
|
||||
p_isinf( USES_REGS1 )
|
||||
{ /* X is Y */
|
||||
@@ -260,6 +304,18 @@ p_isinf( USES_REGS1 )
|
||||
return isinf(FloatOfTerm(out));
|
||||
}
|
||||
|
||||
/**
|
||||
@class logsum_3
|
||||
@anchor logsum_3
|
||||
@brief sum of two logarithms
|
||||
|
||||
<b> logsum(+ _Log1_, + _Log2_, - _Out_ ) is det </b>
|
||||
|
||||
True if _Log1_ is the logarithm of the positive number _A1_,
|
||||
_Log2_ is the logarithm of the positive number _A2_, and
|
||||
_Out_ is the logarithm of the sum of the numbers _A1_ and
|
||||
_A2_. Useful in probability computation.
|
||||
*/
|
||||
static Int
|
||||
p_logsum( USES_REGS1 )
|
||||
{ /* X is Y */
|
||||
@@ -391,6 +447,25 @@ static Int cont_between( USES_REGS1 )
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@class between_3
|
||||
@anchor between_3
|
||||
@brief sequence of numbers
|
||||
|
||||
between(+ _Low_:int, + _High_:int, ? _Value_:int) is nondet
|
||||
|
||||
_Low_ and _High_ are integers, _High_ \>= _Low_. If
|
||||
_Value_ is an integer, _Low_ =\< _Value_
|
||||
=\< _High_. When _Value_ is a variable it is successively
|
||||
bound to all integers between _Low_ and _High_. If
|
||||
_High_ is inf or infinite [between/3](@ref between_3) is true iff
|
||||
_Value_ \>= _Low_, a feature that is particularly interesting
|
||||
for generating integers from a certain value.
|
||||
|
||||
@}
|
||||
|
||||
*/
|
||||
|
||||
static Int
|
||||
init_between( USES_REGS1 )
|
||||
{
|
||||
|
Reference in New Issue
Block a user