NoisyArithmetic.cpp File Reference

Go to the source code of this file.

Functions

 FENNEL_BEGIN_CPPFILE ("$Id: //open/dev/fennel/calculator/NoisyArithmetic.cpp#3 $")
static void Raise (TExceptionCBData *pData, TProgramCounter pc, const char *pMsg) throw (CalcMessage)
 DO (char) DO(signed char) DO(unsigned char) DO(short) DO(unsigned short) DO(int) DO(unsigned int) DO(long int) DO(long unsigned int) DO(long long int) DO(long long unsigned int) DO(float) DO(double) DO(long double) inline void maybe_raise_fe_exception(TExceptionCBData *pExData
TProgramCounter pc throw (CalcMessage)
template<typename TYPE>
OP_FN_PROLOG na_add (TYPE &res, const TYPE &r, const TYPE &l)
template<typename TYPE>
OP_FN_PROLOG na_sub (TYPE &res, const TYPE &r, const TYPE &l)
template<typename TYPE>
OP_FN_PROLOG na_mul (TYPE &res, const TYPE &r, const TYPE &l)
template<typename TYPE>
OP_FN_PROLOG na_div (TYPE &res, const TYPE &r, const TYPE &l)
template<typename TYPE>
OP_FN_PROLOG na_neg (TYPE &res, const TYPE &r)


Function Documentation

DO ( char   ) 

FENNEL_BEGIN_CPPFILE ( "$Id: //open/dev/fennel/calculator/NoisyArithmetic.cpp#3 $"   ) 

template<typename TYPE>
OP_FN_PROLOG na_add ( TYPE &  res,
const TYPE &  r,
const TYPE &  l 
)

Definition at line 391 of file NoisyArithmetic.cpp.

00393 {
00394     res = r + l;
00395 }

template<typename TYPE>
OP_FN_PROLOG na_div ( TYPE &  res,
const TYPE &  r,
const TYPE &  l 
)

Definition at line 409 of file NoisyArithmetic.cpp.

00411 {
00412     res = r / l;
00413 }

template<typename TYPE>
OP_FN_PROLOG na_mul ( TYPE &  res,
const TYPE &  r,
const TYPE &  l 
)

Definition at line 403 of file NoisyArithmetic.cpp.

00405 {
00406     res = r * l;
00407 }

template<typename TYPE>
OP_FN_PROLOG na_neg ( TYPE &  res,
const TYPE &  r 
)

Definition at line 415 of file NoisyArithmetic.cpp.

00416 {
00417     res = -r;
00418 }

template<typename TYPE>
OP_FN_PROLOG na_sub ( TYPE &  res,
const TYPE &  r,
const TYPE &  l 
)

Definition at line 397 of file NoisyArithmetic.cpp.

00399 {
00400     res = r - l;
00401 }

static void Raise ( TExceptionCBData pData,
TProgramCounter  pc,
const char *  pMsg 
) throw (CalcMessage) [static]

Definition at line 74 of file NoisyArithmetic.cpp.

Referenced by throw().

00079 {
00080     if (pData) {
00081         assert(pData->fnCB);
00082         (pData->fnCB)(pMsg, pData->pData);
00083     }
00084     throw CalcMessage(pMsg, pc);
00085 }

TProgramCounter pc throw ( CalcMessage   ) 

Definition at line 349 of file NoisyArithmetic.cpp.

References Raise().

00350 {
00351     int fe = ::fetestexcept(FE_ALL_EXCEPT);
00352     if (0) {
00353     } else if (fe & FE_DIVBYZERO) {
00354         Raise(pExData, pc, S_DIV0);
00355     } else if (fe & FE_UNDERFLOW) {
00356         Raise(pExData, pc, S_UNDR);
00357     } else if (fe & FE_OVERFLOW) {
00358         Raise(pExData, pc, S_OVER);
00359     } else if (fe & FE_INVALID) {
00360         Raise(pExData, pc, S_INVL);
00361 
00362     /* leave this last because it occurs in conjunction with other
00363         flags */
00364     } else if (fe & FE_INEXACT) {
00365 /* disabling inexact. for <float> 200.0 + 0.3 == 200.300003 and S_INEX
00366  gets set., so is too pedestrian a case to raise an error for
00367         Raise(pExData, pc, S_INEX); */
00368         }
00369 }


Generated on Mon Jun 22 04:00:22 2009 for Fennel by  doxygen 1.5.1