Référence du fichier P:/wx_LIB/Dcml/DecFloat.hpp

#include <cstring>
#include <stdlib.h>
#include <iostream>
#include <sstream>
#include <Dcml/decNumber.c>
#include <Dcml/decContext.c>

Aller au code source de ce fichier.

Espaces de nommage

namespace  std

Classes

class  DecFloatContext
class  DecFloat_

Macros

#define DECNUMDIGITS   128
#define DEC_English   56
#define DEC_French   78

Définition de type

typedef DecFloat_ DCML

Fonctions

string DecContextStatusString ()
bool DecErrStatus ()
bool operator== (const DecFloat_ &lhs, const DecFloat_ &rhs)
bool operator< (const DecFloat_ &lhs, const DecFloat_ &rhs)
bool operator!= (const DecFloat_ &x, const DecFloat_ &y)
bool operator> (const DecFloat_ &x, const DecFloat_ &y)
bool operator<= (const DecFloat_ &x, const DecFloat_ &y)
bool operator>= (const DecFloat_ &x, const DecFloat_ &y)
DecFloat_ operator+ (const DecFloat_ &a, const DecFloat_ &b)
DecFloat_ operator * (const DecFloat_ &a, const DecFloat_ &b)
DecFloat_ operator- (const DecFloat_ &a, const DecFloat_ &b)
DecFloat_ operator/ (const DecFloat_ &a, const DecFloat_ &b)
DecFloat_ operator% (const DecFloat_ &a, const DecFloat_ &b)
DecFloat_ abs (const DecFloat_ &a)
DecFloat_ pow (const DecFloat_ &x, const DecFloat_ &y)
DecFloat_ DivideInteger (const DecFloat_ &x, const DecFloat_ &y)
DecFloat_ RemainderNear (const DecFloat_ &x, const DecFloat_ &y)
DecFloat_ min (const DecFloat_ &x, const DecFloat_ &y)
DecFloat_ max (const DecFloat_ &x, const DecFloat_ &y)
DecFloat_ sqrt (const DecFloat_ &x)
ostream & operator<< (ostream &f, const DecFloat_ &b)
istream & operator>> (istream &f, DecFloat_ &b)

Variables

int _EnFr_ = DEC_English
DecFloatContext Context (DEC_INIT_DECIMAL128)


Documentation des macros

#define DEC_English   56

Définition à la ligne 38 du fichier DecFloat.hpp.

Référencé par DecFloat_::DecFloat_(), decNumberFromString(), DecFloat_::operator=(), DecFloat_::ToChar(), et DecFloat_::ToStr().

#define DEC_French   78

Définition à la ligne 39 du fichier DecFloat.hpp.

Référencé par DecFloat_::DecFloat_(), decNumberFromString(), DecFloat_::operator=(), DecFloat_::ToChar(), et DecFloat_::ToStr().

#define DECNUMDIGITS   128

Définition à la ligne 37 du fichier DecFloat.hpp.

Référencé par DecFloatContext::DecFloatContext(), DecFloat_::ToChar(), et DecFloat_::ToStr().


Documentation des définition de type

typedef DecFloat_ DCML

Définition à la ligne 642 du fichier DecFloat.hpp.


Documentation des fonctions

DecFloat_ abs ( const DecFloat_ a  )  [inline]

Définition à la ligne 578 du fichier DecFloat.hpp.

Références Context, DecFloat_::d, decNumberAbs(), et DecFloatContext::get().

Référencé par decNumberRotate(), decNumberScaleB(), et decNumberShift().

00579 {
00580 DecFloat_ result, x=a;
00581 decNumberAbs(&(result.d), &(x.d), Context.get());
00582 return result;
00583 }

string DecContextStatusString (  ) 

Définition à la ligne 131 du fichier DecFloat.hpp.

Références Context, DEC_Clamped, DEC_Condition_CS, DEC_Condition_DI, DEC_Condition_DU, DEC_Condition_DZ, DEC_Condition_IC, DEC_Condition_IE, DEC_Condition_IO, DEC_Condition_IS, DEC_Condition_OV, DEC_Condition_PA, DEC_Condition_RO, DEC_Condition_SU, DEC_Condition_UN, DEC_Conversion_syntax, DEC_Division_by_zero, DEC_Division_impossible, DEC_Division_undefined, DEC_Inexact, DEC_Insufficient_storage, DEC_Invalid_context, DEC_Invalid_operation, DEC_Overflow, DEC_Rounded, DEC_Subnormal, DEC_Underflow, et DecFloatContext::status().

00132 {
00133 int status=Context.status();
00134 string result;
00135 if (status&DEC_Conversion_syntax    ) result+=string(DEC_Condition_CS)+"; ";
00136 if (status&DEC_Division_by_zero     ) result+=string(DEC_Condition_DZ)+"; ";
00137 if (status&DEC_Division_impossible  ) result+=string(DEC_Condition_DI)+"; ";
00138 if (status&DEC_Division_undefined   ) result+=string(DEC_Condition_DU)+"; ";
00139 if (status&DEC_Inexact              ) result+=string(DEC_Condition_IE)+"; ";
00140 if (status&DEC_Insufficient_storage ) result+=string(DEC_Condition_IS)+"; ";
00141 if (status&DEC_Invalid_context      ) result+=string(DEC_Condition_IC)+"; ";
00142 if (status&DEC_Invalid_operation    ) result+=string(DEC_Condition_IO)+"; ";
00143 #if DECSUBSET
00144 if (status&DEC_Lost_digits          ) result+=string(DEC_Condition_LD)+"; ";
00145 #endif
00146 if (status&DEC_Overflow             ) result+=string(DEC_Condition_OV)+"; ";
00147 if (status&DEC_Clamped              ) result+=string(DEC_Condition_PA)+"; ";
00148 if (status&DEC_Rounded              ) result+=string(DEC_Condition_RO)+"; ";
00149 if (status&DEC_Subnormal            ) result+=string(DEC_Condition_SU)+"; ";
00150 if (status&DEC_Underflow            ) result+=string(DEC_Condition_UN)+"; ";
00151 //if (status&0                        ) result+=string(DEC_Condition_ZE)+";;
00152 return result;
00153 }

bool DecErrStatus (  ) 

Définition à la ligne 157 du fichier DecFloat.hpp.

Références Context, DEC_Clamped, DEC_Conversion_syntax, DEC_Division_by_zero, DEC_Division_impossible, DEC_Division_undefined, DEC_Inexact, DEC_Insufficient_storage, DEC_Invalid_context, DEC_Invalid_operation, DEC_Overflow, DEC_Rounded, DEC_Subnormal, DEC_Underflow, et DecFloatContext::status().

00158 {
00159 int status=Context.status();
00160 bool err = false;
00161 if (status&DEC_Conversion_syntax    ) err = true;
00162 if (status&DEC_Division_by_zero     ) err = true;
00163 if (status&DEC_Division_impossible  ) err = true;
00164 if (status&DEC_Division_undefined   ) err = true;
00165 if (status&DEC_Inexact              ) err = true;
00166 if (status&DEC_Insufficient_storage ) err = true;
00167 if (status&DEC_Invalid_context      ) err = true;
00168 if (status&DEC_Invalid_operation    ) err = true;
00169 
00170 #if DECSUBSET
00171 if (status&DEC_Lost_digits          ) err = true;
00172 #endif
00173 if (status&DEC_Overflow             ) err = true;
00174 if (status&DEC_Clamped              ) err = true;
00175 if (status&DEC_Rounded              ) err = true;
00176 if (status&DEC_Subnormal            ) err = true;
00177 if (status&DEC_Underflow            ) err = true;
00178 //if (status&0                        ) result+=string(DEC_Condition_ZE)+";;
00179 return err;
00180 }

DecFloat_ DivideInteger ( const DecFloat_ x,
const DecFloat_ y 
) [inline]

Définition à la ligne 592 du fichier DecFloat.hpp.

Références Context, DecFloat_::d, decNumberDivideInteger(), et DecFloatContext::get().

00593 {
00594 DecFloat_ result, a=x, b=y;
00595 decNumberDivideInteger(&(result.d), &(a.d), &(b.d), Context.get());
00596 return result;
00597 }

DecFloat_ max ( const DecFloat_ x,
const DecFloat_ y 
) [inline]

Définition à la ligne 613 du fichier DecFloat.hpp.

Références Context, DecFloat_::d, decNumberMax(), et DecFloatContext::get().

00614 {
00615 DecFloat_ result, a=x, b=y;
00616 decNumberMax(&(result.d), &(a.d), &(b.d), Context.get());
00617 return result;
00618 }

DecFloat_ min ( const DecFloat_ x,
const DecFloat_ y 
) [inline]

Définition à la ligne 606 du fichier DecFloat.hpp.

Références Context, DecFloat_::d, decNumberMin(), et DecFloatContext::get().

00607 {
00608 DecFloat_ result, a=x, b=y;
00609 decNumberMin(&(result.d), &(a.d), &(b.d), Context.get());
00610 return result;
00611 }

DecFloat_ operator * ( const DecFloat_ a,
const DecFloat_ b 
) [inline]

Définition à la ligne 554 du fichier DecFloat.hpp.

00555 {
00556 DecFloat_ x=a;
00557 return x*=b;
00558 }

bool operator!= ( const DecFloat_ x,
const DecFloat_ y 
) [inline]

Définition à la ligne 526 du fichier DecFloat.hpp.

00527 {
00528 return !(x == y);
00529 }

DecFloat_ operator% ( const DecFloat_ a,
const DecFloat_ b 
) [inline]

Définition à la ligne 572 du fichier DecFloat.hpp.

00573 {
00574 DecFloat_ x=a;
00575 return x%=b;
00576 }

DecFloat_ operator+ ( const DecFloat_ a,
const DecFloat_ b 
) [inline]

Définition à la ligne 548 du fichier DecFloat.hpp.

00549 {
00550 DecFloat_ x=a;
00551 return x+=b;
00552 }

DecFloat_ operator- ( const DecFloat_ a,
const DecFloat_ b 
) [inline]

Définition à la ligne 560 du fichier DecFloat.hpp.

00561 {
00562 DecFloat_ x=a;
00563 return x-=b;
00564 }

DecFloat_ operator/ ( const DecFloat_ a,
const DecFloat_ b 
) [inline]

Définition à la ligne 566 du fichier DecFloat.hpp.

00567 {
00568 DecFloat_ x=a;
00569 return x/=b;
00570 }

bool operator< ( const DecFloat_ lhs,
const DecFloat_ rhs 
) [inline]

Définition à la ligne 511 du fichier DecFloat.hpp.

Références Context, DecFloat_::d, decNumberCompare(), decNumberCopy_(), decNumberIsNegative, decNumberIsZero, et DecFloatContext::get().

00512 {
00513 
00514 decNumber d, a=lhs.d, b=rhs.d; // // nur notwendig, weil Parameter nicht const
00515 // Is decNumberCopy necessary here?
00516 decNumberCopy_(&a,&(lhs.d));
00517 decNumberCopy_(&b,&(rhs.d));
00518 // decNumberCompare(&d, &a, &b, lhs.context.get());
00519 decNumberCompare(&d, &a, &b, Context.get());
00520 // returns 0, if a==b
00521 return (decNumberIsNegative(&d)==1) && (decNumberIsZero(&d)!=1); // returns 1 if d==0
00522 }

ostream& operator<< ( ostream &  f,
const DecFloat_ b 
) [inline]

Définition à la ligne 627 du fichier DecFloat.hpp.

Références DecFloat_::ToStr().

00628 {
00629 
00630 return f<<b.ToStr();
00631 }

bool operator<= ( const DecFloat_ x,
const DecFloat_ y 
) [inline]

Définition à la ligne 536 du fichier DecFloat.hpp.

00537 {
00538 return !(y < x);
00539 }

bool operator== ( const DecFloat_ lhs,
const DecFloat_ rhs 
) [inline]

Définition à la ligne 497 du fichier DecFloat.hpp.

Références Context, DecFloat_::d, decNumberCompare(), decNumberCopy_(), decNumberIsZero, et DecFloatContext::get().

00498 {
00499 decNumber d, a=lhs.d, b=rhs.d; // // nur notwendig, weil Parameter nicht const
00500 // Is decNumberCopy necessary here?
00501 decNumberCopy_(&a,&(lhs.d));
00502 decNumberCopy_(&b,&(rhs.d));
00503 // Must lhs and rhs have the same context???
00504 decNumberCompare(&d, &a, &b, Context.get());
00505 // returns 0, if a==b
00506 return decNumberIsZero(&d)==1; // returns 1 if d==0
00507 
00508 
00509 }

bool operator> ( const DecFloat_ x,
const DecFloat_ y 
) [inline]

Définition à la ligne 531 du fichier DecFloat.hpp.

00532 {
00533 return y < x;
00534 }

bool operator>= ( const DecFloat_ x,
const DecFloat_ y 
) [inline]

Définition à la ligne 541 du fichier DecFloat.hpp.

00542 {
00543 return !(x < y);
00544 }

istream& operator>> ( istream &  f,
DecFloat_ b 
) [inline]

Définition à la ligne 633 du fichier DecFloat.hpp.

Références Context, DecFloat_::d, decNumberFromString(), et DecFloatContext::get().

00634 {
00635 string s;
00636 f>>s;
00637 char* ps=(char*)s.c_str(); // nur notwendig, weil Parameter nicht const
00638 decNumberFromString(&(b.d), ps, Context.get()); // cast -- nicht gut ???
00639 return f;
00640 }

DecFloat_ pow ( const DecFloat_ x,
const DecFloat_ y 
) [inline]

Définition à la ligne 585 du fichier DecFloat.hpp.

Références Context, DecFloat_::d, decNumberPower(), et DecFloatContext::get().

Référencé par decDivideOp(), decGetDigits(), et decToString().

00586 {
00587 DecFloat_ result, a=x, b=y;
00588 decNumberPower(&(result.d), &(a.d), &(b.d), Context.get());
00589 return result;
00590 }

DecFloat_ RemainderNear ( const DecFloat_ x,
const DecFloat_ y 
) [inline]

Définition à la ligne 599 du fichier DecFloat.hpp.

Références Context, DecFloat_::d, decNumberRemainderNear(), et DecFloatContext::get().

00600 {
00601 DecFloat_ result, a=x, b=y;
00602 decNumberRemainderNear(&(result.d), &(a.d), &(b.d), Context.get());
00603 return result;
00604 }

DecFloat_ sqrt ( const DecFloat_ x  )  [inline]

Définition à la ligne 620 du fichier DecFloat.hpp.

Références Context, DecFloat_::d, decNumberSquareRoot(), et DecFloatContext::get().

00621 {
00622 DecFloat_ result, a=x;
00623 decNumberSquareRoot(&(result.d), &(a.d), Context.get());
00624 return result;
00625 }


Documentation des variables

int _EnFr_ = DEC_English

Définition à la ligne 40 du fichier DecFloat.hpp.

Référencé par DecFloat_::DecFloat_(), decNumberFromString(), DecFloat_::operator=(), DecFloat_::ToChar(), et DecFloat_::ToStr().

DecFloatContext Context(DEC_INIT_DECIMAL128)

Référencé par abs(), DecContextStatusString(), DecErrStatus(), DecFloat_::DecFloat_(), DivideInteger(), max(), min(), DecFloat_::Normalize(), DecFloat_::operator *=(), DecFloat_::operator%=(), DecFloat_::operator+(), DecFloat_::operator+=(), DecFloat_::operator-(), DecFloat_::operator-=(), DecFloat_::operator/=(), operator<(), DecFloat_::operator=(), operator==(), operator>>(), pow(), DecFloat_::Quantize(), RemainderNear(), DecFloat_::Rescale(), sqrt(), DecFloat_::ToChar(), et DecFloat_::ToIntegralValue().


Généré le Mon Jul 20 18:22:14 2009 pour Decimal par  doxygen 1.5.1-p1