/*
 * $Id: math.txt,v 1.1.1.1 2001/12/21 10:48:53 ronpinkas Exp $
 */

/*
 * The following parts are Copyright of the individual authors.
 * www - http://www.harbour-project.org
 *
 * Copyright 2000 Luiz Rafael Culik <culik@sl.conex.net>
 *    Documentation for: ABS(),EXP(),LOG(),INT(),MAX()
 *    MIN(),SQRT(),ROUND()
 * Copyright 2001 IntTec GmbH, Neunlindenstr 32, 79106 Freiburg, Germany
 *           Author: Martin Vogel <vogel@inttec.de>
 *    Documentation for Math API functions
 * See doc/license.txt for licensing terms.
 *
 */

/*  $DOC$
 *  $FUNCNAME$
 *      ABS()
 *  $CATEGORY$
 *      Math
 *  $ONELINER$
 *      Return the absolute value of a number.
 *  $SYNTAX$
 *      ABS(<nNumber>) --> <nAbsNumber>
 *  $ARGUMENTS$
 *      <nNumber> Any number.
 *  $RETURNS$
 *      <nAbsNumber> The absolute numeric value.
 *  $DESCRIPTION$
 *      This function yields the absolute value of the numeric value or
 *      expression <nNumber>.
 *  $EXAMPLES$
 *      Proc Main()
 *
 *      Local nNumber:=50
 *      Local nNumber1:=27
 *      cls
 *
 *      qout(nNumber-nNumber1)
 *      qout(nNumber1-nNumber)
 *      qout(ABS(nNumber-nNumber1))
 *      qout(ABSnNumber1-nNumber))
 *      qout(ABS( -1 * 345))
 *  </fixed>
 *  $STATUS$
 *      R
 *  $COMPLIANCE$
 *      This function is CA-Clipper compliant.
 *  $PLATFORMS$
 *      All
 *  $FILES$
 *      Library is rtl
 *  $SEEALSO$
 *      EXP()
 *  $END$
 */

/*  $DOC$
 *  $FUNCNAME$
 *      EXP()
 *  $CATEGORY$
 *      Math
 *  $ONELINER$
 *      Calculates the value of e raised to the passed power.
 *  $SYNTAX$
 *      EXP( <nNumber> ) --> <nValue>
 *  $ARGUMENTS$
 *      <nNumber> Any  real number.
 *  $RETURNS$
 *      <nValue>  The anti-logarithm of <nNumber>
 *  $DESCRIPTION$
 *      This function returns the value of e raised to the power of
 *      <nNumber>.  It is the inverse of LOG().
 *  $EXAMPLES$
 *      ? EXP(45)
 *      </fixed>
 *  $STATUS$
 *      R
 *  $COMPLIANCE$
 *      This function is CA-Clipper compliant.
 *  $PLATFORMS$
 *      All
 *  $FILES$
 *      Library is rtl
 *  $SEEALSO$
 *      LOG()
 *  $END$
 */

/*  $DOC$
 *  $FUNCNAME$
 *      INT()
 *  $CATEGORY$
 *      Math
 *  $ONELINER$
 *      Return the integer port of a numeric value.
 *  $SYNTAX$
 *      INT( <nNumber> ) --> <nIntNumber>
 *  $ARGUMENTS$
 *      <nNumber> Any  numeric value.
 *  $RETURNS$
 *      <nIntNumber> The integer portion of the numeric value.
 *  $DESCRIPTION$
 *      This function converts a numeric expression to an integer. All
 *      decimal digits are truncated. This function does not round a value
 *      upward or downward; it merely truncates a number at the decimal point.
 *  $EXAMPLES$
 *      SET Decimal to 5
 *      ? INT(632512.62541)
 *      ? INT(845414111.91440)
 *      </fixed>
 *  $STATUS$
 *      R
 *  $COMPLIANCE$
 *      This function is CA-Clipper compliant.
 *  $PLATFORMS$
 *      All
 *  $FILES$
 *      Library is rtl
 *  $SEEALSO$
 *      ROUND(),STRZERO()
 *  $END$
 */

/*  $DOC$
 *  $FUNCNAME$
 *      LOG()
 *  $CATEGORY$
 *      Math
 *  $ONELINER$
 *      Returns the natural logarithm of a number.
 *  $SYNTAX$
 *      LOG( <nNumber> ) --> <nLog>
 *  $ARGUMENTS$
 *      <nNumber> Any numeric expression.
 *  $RETURNS$
 *      <nExponent> The natural logarithm of <nNumber>.
 *  $DESCRIPTION$
 *      This function returns the natural logarithm of the number <nNumber>.
 *      If <nNumber> is 0 or less than 0, a numeric overflow occurs,
 *      which is depicted on the display device as a series of asterisks.
 *      This function is the inverse of EXP().
 *  $EXAMPLES$
 *      ? LOG(632512)
 *      </fixed>
 *  $STATUS$
 *      R
 *  $COMPLIANCE$
 *      This function is CA-Clipper compliant.
 *  $PLATFORMS$
 *      All
 *  $FILES$
 *      Library is rtl
 *  $SEEALSO$
 *      EXP()
 *  $END$
 */


/*  $DOC$
 *  $FUNCNAME$
 *      MAX()
 *  $CATEGORY$
 *      Math
 *  $ONELINER$
 *      Returns the maximum of two numbers or dates.
 *  $SYNTAX$
 *      MAX(<xValue>,<xValue1>)  --> <xMax>
 *  $ARGUMENTS$
 *      <xValue>  Any date or numeric value.
 *
 *      <xValue1> Any date or numeric value (same type as <xValue>).
 *  $RETURNS$
 *      <xMax> The larger numeric (or later date) value.
 *  $DESCRIPTION$
 *      This function returns the larger of the two passed espressions. If
 *      <xValue> and <xValue1> are numeric data types, the value returned by
 *      this function will be a numeric data type as well and will be the
 *      larger of the two numbers passed to it. If <xValue> and <xValue1> are
 *      date data types, the return value will be a date data
 *      type as well. It will be the later of the two dates passed to it.
 *  $EXAMPLES$
 *      ? MAX(214514214,6251242142)
 *      ? MAX(CTOD('11/11/2000'),CTOD('21/06/2014')
 *  </fixed>
 *  $STATUS$
 *      R
 *  $COMPLIANCE$
 *      This function is Ca-Clipper compliant.
 *  $PLATFORMS$
 *      All
 *  $FILES$
 *      Library is rtl
 *  $SEEALSO$
 *      Min()
 *  $END$
 */

/*  $DOC$
 *  $FUNCNAME$
 *      MIN()
 *  $CATEGORY$
 *      Math
 *  $ONELINER$
 *      Determines the minumum of two numbers or dates.
 *  $SYNTAX$
 *      MIN(<xValue>,<xValue1>)  --> <xMin>
 *  $ARGUMENTS$
 *      <xValue>  Any date or numeric value.
 *
 *      <xValue1> Any date or numeric value.
 *  $RETURNS$
 *      <xMin>  The smaller numeric (or earlier date) value.
 *  $DESCRIPTION$
 *      This function returns the smaller of the two passed espressions.
 *      <xValue> and <xValue1> must be the same data type. If numeric, the
 *      smaller number is returned. If dates, the earlier date is returned.
 *  $EXAMPLES$
 *      ? MIN(214514214,6251242142)
 *      ? MIN(CTOD('11/11/2000'),CTOD('21/06/2014')
 *  </fixed>
 *  $STATUS$
 *      R
 *  $COMPLIANCE$
 *      This function is Ca-Clipper compliant.
 *  $PLATFORMS$
 *      All
 *  $FILES$
 *      Library is rtl
 *  $SEEALSO$
 *      MAX()
 *  $END$
 */

/*  $DOC$
 *  $FUNCNAME$
 *      MOD()
 *  $CATEGORY$
 *      Math
 *  $ONELINER$
 *      Return the modulus of two numbers.
 *  $SYNTAX$
 *      MOD( <nNumber>,<nNumber1>) -->  <nRemainder>
 *  $ARGUMENTS$
 *      <nNumber>  Numerator in a divisional expression.
 *
 *      <nNumber1> Denominator in a divisional expression.
 *  $RETURNS$
 *      <nRemainder>  The remainder after the division operation.
 *  $DESCRIPTION$
 *      This functuion returns the remainder of one number divided by another.
 *  $EXAMPLES$
 *      ? MOD(12,8.521)
 *      ? Mod(12,0)
 *      ? Mod(62412.5142,4522114.12014)
 *  </fixed>
 *  $STATUS$
 *      R
 *  $COMPLIANCE$
 *      This Function is Ca-Clipper compliant.
 *  $PLATFORMS$
 *      All
 *  $FILES$
 *      Library is rtl
 *  $SEEALSO$
 *      %
 *  $END$
 */

/*  $DOC$
 *  $FUNCNAME$
 *      SQRT()
 *  $CATEGORY$
 *      Math
 *  $ONELINER$
 *      Calculates the square root of a number.
 *  $SYNTAX$
 *      SQRT( <nNumber> ) --> <nSqrt>
 *  $ARGUMENTS$
 *      <nNumber> Any  numeric value.
 *  $RETURNS$
 *      <nSqrt>   The square root of <number>.
 *  $DESCRIPTION$
 *      This function returns the square root of <nNumber>. The precision of
 *      this evaluation is based solely on the settings of the SET DECIMAL TO
 *      command. Any negative number passed as <nNumber> will always return a 0.
 *  $EXAMPLES$
 *      SET Decimal to 5
 *      ? SQRT(632512.62541)
 *      ? SQRT(845414111.91440)
 *  $STATUS$
 *      R
 *  $COMPLIANCE$
 *      This function is CA-Clipper compliant.
 *  $PLATFORMS$
 *      All
 *  $FILES$
 *      Library is rtl
 *  $SEEALSO$
 *      ROUND()
 *  $END$
 */

/*  $DOC$
 *  $FUNCNAME$
 *      ROUND()
 *  $CATEGORY$
 *      Math
 *  $ONELINER$
 *      Rounds off a numeric expression.
 *  $SYNTAX$
 *      ROUND( <nNumber>,<nPlace> ) --> <nResult>
 *  $ARGUMENTS$
 *      <nNumber> Any numeric value.
 *
 *      <nPlace>  The number of places to round to.
 *  $RETURNS$
 *      <nResult> The rounded number.
 *  $DESCRIPTION$
 *      This function rounds off the value of <nNumber> to the number of
 *      decimal places specified by <nPlace>. If the value of <nPlace> is a
 *      negative number, the function will attempt to round <nNumber> in whole
 *      numbers. Numbers from 5 through 9 will be rounded up, all others will
 *      be rounded down.
 *  $EXAMPLES$
 *      ? ROUND(632512.62541,5)
 *      ? ROUND(845414111.91440,3)
 *  $STATUS$
 *      R
 *  $COMPLIANCE$
 *      This function is CA-Clipper compliant.
 *  $PLATFORMS$
 *      All
 *  $FILES$
 *      Library is rtl
 *  $SEEALSO$
 *      INT(),STR(),VAL(),SET FIXED
 *  $END$
 */

/*  $DOC$
 *  $FUNCNAME$
 *      hb_getMathError()
 *  $CATEGORY$
 *      Math API
 *  $ONELINER$
 *      get the last math lib error
 *  $SYNTAX$
 *      C Prototype
 *      
 *      #include <hbmath.h>
 *      hb_getMathError (void) --> int iMathError
 *  $ARGUMENTS$
 *      
 *  $RETURNS$
 *      
 *  $DESCRIPTION$
 *      
 *  $EXAMPLES$
 *      
 *  $STATUS$
 *      R
 *  $COMPLIANCE$
 *      Compliance is not applicable to API calls.
 *  $FILES$
 *      Library is rtl
 *  $PLATFORMS$
 *      All
 *  $SEEALSO$
 *      
 *  $END$
 */

/*  $DOC$
 *  $FUNCNAME$
 *      hb_resetMathError()
 *  $CATEGORY$
 *      Math API
 *  $ONELINER$
 *      reset the math error, i.e. set it to 0
 *  $SYNTAX$
 *      C Prototype
 *      
 *      #include <hbmath.h>
 *      hb_resetMathError (void) --> void
 *  $ARGUMENTS$
 *      
 *  $RETURNS$
 *      
 *  $DESCRIPTION$
 *      
 *  $EXAMPLES$
 *      
 *  $STATUS$
 *      R
 *  $COMPLIANCE$
 *      Compliance is not applicable to API calls.
 *  $FILES$
 *      Library is rtl
 *  $PLATFORMS$
 *      All
 *  $SEEALSO$
 *      
 *  $END$
 */

/*  $DOC$
 *  $FUNCNAME$
 *      hb_isMathHandler()
 *  $CATEGORY$
 *      Math API
 *  $ONELINER$
 *      check if harbour math error handler is available
 *  $SYNTAX$
 *      C Prototype
 *      
 *      #include <hbmath.h>
 *      hb_isMathHandler (void) --> int iIsMathHandler
 *  $ARGUMENTS$
 *      
 *  $RETURNS$
 *      
 *  $DESCRIPTION$
 *      
 *  $EXAMPLES$
 *      
 *  $STATUS$
 *      R
 *  $COMPLIANCE$
 *      Compliance is not applicable to API calls.
 *  $FILES$
 *      Library is rtl
 *  $PLATFORMS$
 *      All
 *  $SEEALSO$
 *      
 *  $END$
 */

/*  $DOC$
 *  $FUNCNAME$
 *      hb_installMathHandler()
 *  $CATEGORY$
 *      Math API
 *  $ONELINER$
 *      add a custom math handler to the math error handler chain
 *  $SYNTAX$
 *      C Prototype
 *      
 *      #include <hbmath.h>
 *      hb_installMathHandler (HB_MATH_HANDLERPROC handlerproc) --> HB_MATH_HANDLERHANDLE handle
 *  $ARGUMENTS$
 *      handlerproc   custom math handler 
 *  $RETURNS$
 *      handle        handle to handlerproc in handle chain 
 *  $DESCRIPTION$
 *      
 *  $EXAMPLES$
 *      
 *  $STATUS$
 *      R
 *  $COMPLIANCE$
 *      Compliance is not applicable to API calls.
 *  $FILES$
 *      Library is rtl
 *  $PLATFORMS$
 *      All
 *  $SEEALSO$
 *      
 *  $END$
 */

/*  $DOC$
 *  $FUNCNAME$
 *      hb_deinstallMathHandler()
 *  $CATEGORY$
 *      Math API
 *  $ONELINER$
 *      remove custom math handler from the math error handler chain
 *  $SYNTAX$
 *      C Prototype
 *      
 *      #include <hbmath.h>
 *      hb_deinstallMathHandler (HB_MATH_HANDLERHANDLE handle) --> int iSuccess
 *  $ARGUMENTS$
 *      handle        handle returned be hb_installMathHandler() 
 *  $RETURNS$
 *      iSuccess      success of operation 
 *  $DESCRIPTION$
 *      
 *  $EXAMPLES$
 *      
 *  $STATUS$
 *      R
 *  $COMPLIANCE$
 *      Compliance is not applicable to API calls.
 *  $FILES$
 *      Library is rtl
 *  $PLATFORMS$
 *      All
 *  $SEEALSO$
 *      
 *  $END$
 */

/*  $DOC$
 *  $FUNCNAME$
 *      hb_setMathHandlerStatus()
 *  $CATEGORY$
 *      Math API
 *  $ONELINER$
 *      set the status of a custom math handler in the math error handler chain
 *  $SYNTAX$
 *      C Prototype
 *      
 *      #include <hbmath.h>
 *      hb_setMathHandlerStatus (HB_MATH_HANDLERHANDLE handle, int status) --> int iSuccess
 *  $ARGUMENTS$
 *      handle        handle returned be hb_installMathHandler() 
 *      status        new status value, can be one of:
 *                       HB_MATH_HANDLER_STATUS_INACTIVE  
 *                         --> handler is present but not active
 *                       HB_MATH_HANDLER_STATUS_ACTIVE     
 *                         --> handler is present and active
 *  $RETURNS$
 *      iSuccess      success of operation 
 *  $DESCRIPTION$
 *      
 *  $EXAMPLES$
 *      
 *  $STATUS$
 *      R
 *  $COMPLIANCE$
 *      Compliance is not applicable to API calls.
 *  $FILES$
 *      Library is rtl
 *  $PLATFORMS$
 *      All
 *  $SEEALSO$
 *      
 *  $END$
 */

/*  $DOC$
 *  $FUNCNAME$
 *      hb_getMathHandlerStatus()
 *  $CATEGORY$
 *      Math API
 *  $ONELINER$
 *      get the status of a custom math handler in the math error handler chain
 *  $SYNTAX$
 *      C Prototype
 *      
 *      #include <hbmath.h>
 *      hb_getMathHandlerStatus (HB_MATH_HANDLERHANDLE handle) --> int iStatus
 *  $ARGUMENTS$
 *      handle        handle returned be hb_installMathHandler() 
 *  $RETURNS$
 *      iStatus       status of math handler
 *  $DESCRIPTION$
 *      
 *  $EXAMPLES$
 *      
 *  $STATUS$
 *      R
 *  $COMPLIANCE$
 *      Compliance is not applicable to API calls.
 *  $FILES$
 *      Library is rtl
 *  $PLATFORMS$
 *      All
 *  $SEEALSO$
 *      
 *  $END$
 */


