************************************************************************
*                               BEGIN                                  *
*                                                                      *
*              Definitions of NUM_ UNSIGNED BYTE functions             *
*              -------------------------------------------             *
*                                                                      *
*                               BEGIN                                  *
************************************************************************
*
*    Authors :
*     R.F. Warren-Smith (DUVAD::RFWS)
*
*    History :
*     16-AUG-1988:  Original version (DUVAD::RFWS)
*    endhistory
*
 
 
****************************************************
*   Arithmetic between two UNSIGNED BYTE numbers   *
****************************************************
 

*   Add.
      NUM_ADDUB( NUM_ARGUB1, NUM_ARGUB2 ) = NUM_WTOUB(
     :                          NUM_UBTOW( NUM_ARGUB1 ) +
     :                          NUM_UBTOW( NUM_ARGUB2 ) )
 
*   Subtract.
      NUM_SUBUB( NUM_ARGUB1, NUM_ARGUB2 ) = NUM_WTOUB(
     :                          NUM_UBTOW( NUM_ARGUB1 ) -
     :                          NUM_UBTOW( NUM_ARGUB2 ) )
 
*   Floating multiply.
      NUM_MULUB( NUM_ARGUB1, NUM_ARGUB2 ) = NUM_WTOUB(
     :                          NUM_UBTOW( NUM_ARGUB1 ) *
     :                          NUM_UBTOW( NUM_ARGUB2 ) )
 
*   Floating divide.
      NUM_DIVUB( NUM_ARGUB1, NUM_ARGUB2 ) = NUM_RTOUB(
     :                          NUM_UBTOR( NUM_ARGUB1 ) /
     :                          NUM_UBTOR( NUM_ARGUB2 ) )
 
*   Integer divide.
      NUM_IDVUB( NUM_ARGUB1, NUM_ARGUB2 ) = NUM_WTOUB(
     :                          NUM_UBTOW( NUM_ARGUB1 ) /
     :                          NUM_UBTOW( NUM_ARGUB2 ) )

*   Raise to power.
      NUM_PWRUB( NUM_ARGUB1, NUM_ARGUB2 ) = NUM_ITOUB(
     :                          NUM_UBTOI( NUM_ARGUB1 ) **
     :                          NUM_UBTOI( NUM_ARGUB2 ) )
 

 
********************************************************************
*   UNSIGNED BYTE functions with a single UNSIGNED BYTE argument   *
********************************************************************

 
*   Negate argument.
      NUM_NEGUB( NUM_ARGUB ) = NUM_ITOUB( - NUM_UBTOI( NUM_ARGUB ) )
 
*   Square root.
      NUM_SQRTUB( NUM_ARGUB ) = NUM_RTOB( SQRT(
     :                          NUM_UBTOR( NUM_ARGUB ) ) )
 
*   Natural logarithm (base e).
      NUM_LOGUB( NUM_ARGUB ) = NUM_RTOB( LOG(
     :                          NUM_UBTOR( NUM_ARGUB ) ) )
 
*   Common logarithm (base 10).
      NUM_LG10UB( NUM_ARGUB ) = NUM_RTOB( LOG10(
     :                          NUM_UBTOR( NUM_ARGUB ) ) )
 
*   Exponential function.
      NUM_EXPUB( NUM_ARGUB ) = NUM_RTOUB( EXP(
     :                          NUM_UBTOR( NUM_ARGUB ) ) )
 
*   Absolute (positive) value.
      NUM_ABSUB( NUM_ARGUB ) = NUM_ARGUB
 
*   Nearest integer.
      NUM_NINTUB( NUM_ARGUB ) = NUM_ARGUB

*   Truncation to integer.
      NUM_INTUB( NUM_ARGUB ) = NUM_ARGUB

 
 
***************************************************************
*  UNSIGNED BYTE functions with two UNSIGNED BYTE arguments   *
***************************************************************

 
*   Minimum of two numbers.
      NUM_MINUB( NUM_ARGUB1, NUM_ARGUB2 ) = NUM_WTOUB( MIN(
     :                          NUM_UBTOW( NUM_ARGUB1 ),
     :                          NUM_UBTOW( NUM_ARGUB2 ) ) )
 
*   Maximum of two numbers.
      NUM_MAXUB( NUM_ARGUB1, NUM_ARGUB2 ) = NUM_WTOUB( MAX(
     :                          NUM_UBTOW( NUM_ARGUB1 ),
     :                          NUM_UBTOW( NUM_ARGUB2 ) ) )
 
*   Fortran DIM (positive difference) function.
      NUM_DIMUB( NUM_ARGUB1, NUM_ARGUB2 ) = NUM_WTOUB( DIM(
     :                          NUM_UBTOW( NUM_ARGUB1 ),
     :                          NUM_UBTOW( NUM_ARGUB2 ) ) )
 
*   Fortran MOD (remainder) function.
      NUM_MODUB( NUM_ARGUB1, NUM_ARGUB2 ) = NUM_WTOUB( MOD(
     :                          NUM_UBTOW( NUM_ARGUB1 ),
     :                          NUM_UBTOW( NUM_ARGUB2 ) ) )
 
*   Fortran SIGN (transfer of sign) function.
      NUM_SIGNUB( NUM_ARGUB1, NUM_ARGUB2 ) = NUM_ARGUB1
 

 
*************************************************************
*   Logical functions comparing two UNSIGNED BYTE numbers   *
*************************************************************

 
*   Equality.
      NUM_EQUB( NUM_ARGUB1, NUM_ARGUB2 ) =
     :                          NUM_ARGUB1 .EQ. NUM_ARGUB2
 
*   Inequality.
      NUM_NEUB( NUM_ARGUB1, NUM_ARGUB2 ) =
     :                          NUM_ARGUB1 .NE. NUM_ARGUB2
 
*   Greater than.
      NUM_GTUB( NUM_ARGUB1, NUM_ARGUB2 ) =
     :                          NUM_UBTOW( NUM_ARGUB1 ) .GT.
     :                          NUM_UBTOW( NUM_ARGUB2 )
 
*   Greater than or equal.
      NUM_GEUB( NUM_ARGUB1, NUM_ARGUB2 ) =
     :                          NUM_UBTOW( NUM_ARGUB1 ) .GE.
     :                          NUM_UBTOW( NUM_ARGUB2 )
 
*   Less than.
      NUM_LTUB( NUM_ARGUB1, NUM_ARGUB2 ) =
     :                          NUM_UBTOW( NUM_ARGUB1 ) .LT.
     :                          NUM_UBTOW( NUM_ARGUB2 )
 
*   Less than or equal.
      NUM_LEUB( NUM_ARGUB1, NUM_ARGUB2 ) =
     :                          NUM_UBTOW( NUM_ARGUB1 ) .LE.
     :                          NUM_UBTOW( NUM_ARGUB2 )
 

 
************************************************************************
*                               END                                    *
*                                                                      *
*              Definitions of NUM_ UNSIGNED BYTE functions             *
*                                                                      *
*                               END                                    *
************************************************************************
