/*----------------------------------------------------------------------------------*/
/* Filename :   SCA_sl.h                                                            */
/* Author   :   Frederic Philippe                                                   */
/*          :   Marc Trabucato                                                      */
/* Target   :   PC                                                                  */
/*----------------------------------------------------------------------------------*/
 
/* -----------------15/04/98 15:58-------------------
 * Conversion : OK (avec SCA_sl.h du 23.04.98 19:26 (18017))
 * --------------------------------------------------*/
 
#ifndef _SLREAL_H_
#define _SLREAL_H_
 
/*----------------------------------------------------------------------------------*/
 
/*-----------------*/
/* Fixed coma case */
/*-----------------*/
/* 1.31.0 */
 
/*---------------------------------*/
/* Specific Values for fixed point */
/*---------------------------------*/
#define SCA_td_sl   MTH_tdxReal
 
/*#define SCA_sl_C_slComaDecal 0*/
/*#define SCA_sl_C_slComaCoef 1*/
 
/*#define SCA_sl_C_dfMax        2147483648*/
/*#define SCA_sl_C_dfMin        (-SCA_sl_C_dfMax)*/
 
/*#define SCA_sl_C_slMax        (0x7FFFFFE0)*/
/*#define SCA_sl_C_slMin        (0xEFFFFFE0)*/
/*#define SCA_sl_C_slError      (0x7FFFFFFF)*/
 
/*#define SCA_sl_C_slNegMask (0x80000000)*/
/*#define SCA_sl_C_slPosMask (0x7FFFFFFF)*/
/*#define SCA_sl_C_slDecMask (0x00000000)*/
/*#define SCA_sl_C_slEntMask (0xFFFFFFFF)*/
 
/*--------------------------------------------------------*/
/* ----------------  Constants ---------------------------*/
/*--------------------------------------------------------*/
#define SCA_sl_C_ZERO     MTH_C_ZERO
#define SCA_sl_C_ONE      MTH_C_ONE
 
/*--------------------------------------------------------*/
/*                  Conversion functions                  */
/*--------------------------------------------------------*/
__inline SCA_td_sl SCA_sl_fn_slDouble2Real( double _dfValue )
{
  return MTH_M_xDoubleToReal( _dfValue );
}
/*--------------------------------------------------------*/
__inline double SCA_sl_fn_Real2Double( SCA_td_sl _xValue )
{
  return MTH_M_xRealToDouble( _xValue );
}
 
/*--------------------------------------------*/
/* Conversions : Macros definitions           */
/*--------------------------------------------*/
#define SCA_sl_M_slDoubleToReal(_dfValue) MTH_M_xDoubleToReal(_dfValue)
#define SCA_sl_M_slFloatToReal(_fValue)   MTH_M_xFloatToReal(_fValue)
#define SCA_sl_M_slIntToReal(_iValue)     MTH_M_xLongToReal(_iValue)  /*???*/
 
#define SCA_sl_M_RealToDouble(_xValue) MTH_M_xRealToDouble(_xValue)
#define SCA_sl_M_RealToFloat(_xValue)  MTH_M_xrealToFloat(_xValue)
#define SCA_sl_M_RealToInt(_xValue)    MTh_M_xRealToLong(_xValue) /*???*/
 
/*--------------------------------------------------------*/
/*                     Constantes                         */
/*--------------------------------------------------------*/
#define SCA_sl_C_slTwo      MTH_C_2
 
/* ##CONSTANTE#--------------------------------------------------------------------------
                          Real Constantes declaration
---------------------------------------------------------------------------------------*/
 
#define SCA_sl_C_InfinitPlus     MTH_C_InfinitPlus
#define SCA_sl_InfinitMinus      MTH_C_InfinitMinus
#define SCA_sl_EpsilonPlus       MTH_C_EpsilonPlus
#define SCA_sl_EpsilonMinus      MTH_C_EpsilonMinus
 
#define SCA_sl_Pi                MTH_C_Pi
#define SCA_sl_2Pi               MTH_C_2Pi
#define SCA_sl_PiBy2             MTH_C_PiBy2
#define SCA_sl_PiBy4             MTH_C_PiBy4
#define SCA_sl_PiBy8             MTH_C_PiBy8
#define SCA_sl_PiBy180           MTH_C_PiBy180
#define SCA_sl_180ByPi           MTH_C_180ByPi
#define SCA_sl_e                 MTH_C_e
 
#define SCA_sl_MinusONE          MTH_C_MinusONE
 
#define SCA_sl_2                 MTH_C_2
#define SCA_sl_3                 MTH_C_3
#define SCA_sl_4                 MTH_C_4
#define SCA_sl_5                 MTH_C_5
#define SCA_sl_8                 (double) 8.0
 
#define SCA_sl_Minus2            MTH_C_Minus2
#define SCA_sl_Minus3            MTH_C_Minus3
#define SCA_sl_Minus4            MTH_C_Minus4
#define SCA_sl_Minus5            MTH_C_Minus5
 
#define SCA_sl_Inv2              MTH_C_Inv2
#define SCA_sl_Inv3              MTH_C_Inv3
#define SCA_sl_Inv4              MTH_C_Inv4
#define SCA_sl_Inv5              MTH_C_Inv5
 
#define SCA_sl_MinusInv2         MTH_C_MinusInv2
#define SCA_sl_MinusInv3         MTH_C_MinusInv3
#define SCA_sl_MinusInv4         MTH_C_MinusInv4
#define SCA_sl_MinusInv5         MTH_C_MinusInv5
 
#define SCA_sl_Sqrt2             MTH_C_Sqrt2
#define SCA_sl_Sqrt3             MTH_C_Sqrt3
#define SCA_sl_Sqrt4             MTH_C_Sqrt4
#define SCA_sl_Sqrt5             MTH_C_Sqrt5
 
#define SCA_sl_MinusSqrt2        MTH_C_MinusSqrt2
#define SCA_sl_MinusSqrt3        MTH_C_MinusSqrt3
#define SCA_sl_MinusSqrt4        MTH_C_MinusSqrt4
#define SCA_sl_MinusSqrt5        MTH_C_MinusSqrt5
 
#define SCA_sl_InvSqrt2          MTH_C_InvSqrt2
#define SCA_sl_InvSqrt3          MTH_C_InvSqrt3
#define SCA_sl_InvSqrt4          MTH_C_InvSqrt4
#define SCA_sl_InvSqrt5          MTH_C_InvSqrt5
 
#define SCA_sl_MinusInvSqrt2     MTH_C_MinusInvSqrt2
#define SCA_sl_MinusInvSqrt3     MTH_C_MinusInvSqrt3
#define SCA_sl_MinusInvSqrt4     MTH_C_MinusInvSqrt4
#define SCA_sl_MinusInvSqrt5     MTH_C_MinusInvSqrt5
 
#define SCA_sl_MAX_UNSIGNED_CHAR MTH_C_MAX_UNSIGNED_CHAR
 
 
/*--------------------------------------------------------*/
/*                     Operations                         */
/*--------------------------------------------------------*/
/* Comparaisons */
#define SCA_sl_M_bIsNull(_xOp)               MTH_M_bIsNull(_xOp)
#define SCA_sl_M_bEqualZero(_xOp)            MTH_M_bEqualZero(_xOp)
#define SCA_sl_M_bIsNegative(_xOp)           MTH_M_bLessZero(_xOp)
#define SCA_sl_M_bIsPositive(_xOp)           MTH_M_bGreaterZero(_xOp)
#define SCA_sl_M_bGreater(_xOp1,_xOp2)       MTH_M_bGreater(_xOp1,_xOp2)
#define SCA_sl_M_bLess(_xOp1,_xOp2)          MTH_M_bLess_xOp1,_xOp2)
#define SCA_sl_M_bGreaterEqual(_xOp1,_xOp2)  MTH_M_bGreaterEqual(_xOp1,_xOp2)
#define SCA_sl_M_bLessEqual(_xOp1,_xOp2)     MTH_M_bLessEqual(_xOp1,_xOp2)
#define SCA_sl_M_bEqual(_xOp1,_xOp2)         MTH_M_bEqual(_xOp1,_xOp2)
#define SCA_sl_M_bDifferent(_xOp1,_xOp2)     MTH_M_bDifferent(_xOp1,_xOp2)
 
/* Operations */
#define SCA_sl_M_slNeg(_xOp)                MTH_M_xNeg(_xOp)
#define SCA_sl_M_slAdd(_xOp1,_xOp2)         MTH_M_xAdd(_xOp1,_xOp2)
#define SCA_sl_M_slSub(_xOp1,_xOp2)         MTH_M_xsub(_xOp1,_xOp2)
#define SCA_sl_M_slMul(_xOp1,_xOp2)         MTH_M_xMul(_xOp1,_xOp2)
#define SCA_sl_M_slDiv(_xOp1,_xOp2)         MTH_M_xDiv(_xOp1,_xOp2)
 
#define SCA_sl_M_slAbs(_xOp)                MTH_M_xAbs(_xOp)
#define SCA_sl_M_slNegAbs(_xOp)             MTH_M_xNegAbs(_xOp)
#define SCA_sl_M_slInv(_xOp)                MTH_M_xInv(_xOp)
#define SCA_sl_M_slSqr(_xOp)                MTH_M_xSqr(_xOp,_xOp)
#define SCA_sl_M_slCub(_xOp)                MTH_M_xMul(_xOp,MTH_M_xSqr(_xOp))
#define SCA_sl_M_slSqrt(_xOp)               MTH_M_xSqrt(_xOp)
#define SCA_sl_M_slInvSqrt(_xOp)            MTH_M_xInvSqrt(_xOp)
 
#define SCA_sl_M_slSin(_xOp)                MTH_M_xSin(_xOp)
#define SCA_sl_M_slCos(_xOp)                MTH_M_xSin(_xOp)
/*
#define sl_M_Tan(_xOp) (SCA_sl_fn_Tan(_xOp))
#define sl_M_ASin(_xOp) (SCA_sl_fn_ASin(_xOp))
#define sl_M_ACos(_xOp) (SCA_sl_fn_ACos(_xOp))
*/
/*
#define sl_M_Sin(_xOp) SCA_sl_M_slDoubleToReal(sin(sl_M_Real2Double(_xOp)))
#define sl_M_Cos(_xOp) SCA_sl_M_slDoubleToReal(cos(sl_M_Real2Double(_xOp)))
*/
 
#define SCA_sl_M_slTan(_xOp)  MTH_M_xTan(_xOp)
#define SCA_sl_M_slASin(_xOp) MTH_M_xASin(_xOp)
#define SCA_sl_M_slACos(_xOp) MTH_M_xACos(_xOp)
 
 
/* ##-##############################
   ## Tools for MulMatrixMatrix 3D
   ################################# */
 
/* ##M==================================================================================
NAME :          SCA_sl_M_slMulSubMul
DESCRIPTION :   Return the subtraction of two multiplications
INPUT :         a, b, c, d : SCA_td_sl
OUTPUT :        a*b - c*d  : SCA_td_sl
=======================================================================================*/
#define SCA_sl_M_slMulSubMul(a, b, c, d)                MTH_M_xMulSubMul(a, b, c, d)
 
/* ##M==================================================================================
NAME :          SCA_sl_M_slMulAddMulAddMul
DESCRIPTION :   Return the adition of three multiplications
INPUT :         a, b, c, d, e, f : SCA_td_sl
OUTPUT :        a*b + c*d + e*f  : SCA_td_sl
=======================================================================================*/
#define SCA_sl_M_slMulAddMulAddMul(a, b, c, d, e, f)    MTH_M_xMulAddMulAddMul(a, b, c, d, e, f)
 
/* ##M==================================================================================
NAME :          SCA_sl_M_slSqrAddSqrAddSqr
DESCRIPTION :   Return the adition of three squares
INPUT :         a, b, c         : SCA_td_sl
OUTPUT :        a*a + b*b + c*c : SCA_td_sl
=======================================================================================*/
#define SCA_sl_M_slSqrAddSqrAddSqr(a, b, c)             MTH_M_xSqrAddSqrAddSqr(a, b, c)
 
/* ##M==================================================================================
NAME :          SCA_sl_M_slMul3
DESCRIPTION :   Return the multiplication of three real numbers
INPUT :         a, b, c : SCA_td_sl
OUTPUT :        a*b*c   : SCA_td_sl
=======================================================================================*/
#define SCA_sl_M_slMul3(a, b, c)                        MTH_M_xMul3(a, b, c)
 
/* ##M==================================================================================
NAME :          SCA_sl_M_slAdd3
DESCRIPTION :   Return the addition of three real numbers
INPUT :         a, b, c : SCA_td_sl
OUTPUT :        a+b+c   : SCA_td_sl
=======================================================================================*/
#define SCA_sl_M_slAdd3(a, b, c)                        MTH_M_xAdd3(a, b, c)
 
/*----------------------------------------------------------------------------------*/
 
#endif /* _SLREAL_H_ */
