#include <DecFloat.hpp>
Définition à la ligne 183 du fichier DecFloat.hpp.
DecFloat_::DecFloat_ | ( | ) | [inline] |
Définition à la ligne 189 du fichier DecFloat.hpp.
Références d, et decNumberZero().
00191 { 00192 decNumberZero(&d); 00193 }
DecFloat_::DecFloat_ | ( | const char * | _X_ | ) | [inline] |
Définition à la ligne 195 du fichier DecFloat.hpp.
Références _EnFr_, Context, d, DEC_English, DEC_French, decNumberFromString(), et DecFloatContext::get().
00196 { 00197 string Str; 00198 Str.assign(_X_); 00199 int loc ; 00200 loc = Str.rfind( ".", Str.length()); 00201 if(loc < 0) loc = Str.rfind( ",", Str.length()); 00202 if(loc > 0) { 00203 if ( _EnFr_ == DEC_English ) Str.replace(loc, 1, "."); 00204 if ( _EnFr_ == DEC_French ) Str.replace(loc, 1, ","); 00205 } 00206 decNumberFromString(&d, (char*)Str.c_str(), Context.get()); // cast -- nicht gut ??? 00207 }
DecFloat_::DecFloat_ | ( | const string & | _X_ | ) | [inline] |
Définition à la ligne 209 du fichier DecFloat.hpp.
Références _EnFr_, Context, d, DEC_English, DEC_French, decNumberFromString(), et DecFloatContext::get().
00210 { 00211 int loc ; 00212 string Str = _X_; 00213 loc = Str.rfind( ".", Str.length()); 00214 if(loc < 0) loc = Str.rfind( ",", Str.length()); 00215 if(loc > 0) { 00216 if ( _EnFr_ == DEC_English ) Str.replace(loc, 1, "."); 00217 if ( _EnFr_ == DEC_French ) Str.replace(loc, 1, ","); 00218 } 00219 00220 decNumberFromString(&d, (char*)Str.c_str(), Context.get()); // cast -- nicht gut ??? 00221 }
DecFloat_::~DecFloat_ | ( | ) | [inline] |
Définition à la ligne 226 du fichier DecFloat.hpp.
Références d, et decNumberCopy().
00227 { // is this necessary ??? 00228 if (this!=&_X_) 00229 { 00230 DecFloat_ a=_X_; // nur notwendig, weil Parameter nicht const 00231 decNumberCopy(&d,&(a.d)); 00232 00233 } 00234 return *this; 00235 }
DecFloat_& DecFloat_::operator= | ( | int | _X_ | ) | [inline] |
Définition à la ligne 237 du fichier DecFloat.hpp.
Références Context, d, decNumberFromString(), et DecFloatContext::get().
00238 { 00239 char *ps = (char*) malloc(10); 00240 sprintf( ps, "%d", _X_); 00241 00242 decNumberFromString(&d, ps, Context.get()); // cast -- nicht gut ??? 00243 00244 return *this; 00245 }
DecFloat_& DecFloat_::operator= | ( | double | _X_ | ) | [inline] |
Définition à la ligne 247 du fichier DecFloat.hpp.
Références _EnFr_, Context, d, DEC_English, DEC_French, decNumberFromString(), et DecFloatContext::get().
00248 { 00249 char *ps = (char*) malloc(30); 00250 sprintf( ps, "%f", _X_); 00251 string Str; 00252 Str.assign(ps); 00253 int loc ; 00254 loc = Str.rfind( ".", Str.length()); 00255 if(loc < 0) loc = Str.rfind( ",", Str.length()); 00256 if(loc > 0) { 00257 if ( _EnFr_ == DEC_English ) Str.replace(loc, 1, "."); 00258 if ( _EnFr_ == DEC_French ) Str.replace(loc, 1, ","); 00259 } 00260 00261 decNumberFromString(&d, ps, Context.get()); // cast -- nicht gut ??? 00262 00263 return *this; 00264 }
DecFloat_& DecFloat_::operator= | ( | const char * | _X_ | ) | [inline] |
Définition à la ligne 265 du fichier DecFloat.hpp.
Références _EnFr_, Context, d, DEC_English, DEC_French, decNumberFromString(), et DecFloatContext::get().
00266 { 00267 string Str; 00268 Str.assign(_X_); 00269 int loc ; 00270 loc = Str.rfind( ".", Str.length()); 00271 if(loc < 0) loc = Str.rfind( ",", Str.length()); 00272 if(loc > 0) { 00273 if ( _EnFr_ == DEC_English ) Str.replace(loc, 1, "."); 00274 if ( _EnFr_ == DEC_French ) Str.replace(loc, 1, ","); 00275 } 00276 00277 decNumberFromString(&d, (char*)Str.c_str(), Context.get()); // cast -- nicht gut ??? 00278 return *this; 00279 }
DecFloat_& DecFloat_::operator= | ( | const string | _X_ | ) | [inline] |
Définition à la ligne 280 du fichier DecFloat.hpp.
Références _EnFr_, Context, d, DEC_English, DEC_French, decNumberFromString(), et DecFloatContext::get().
00281 { 00282 int loc ; 00283 string Str = _X_; 00284 loc = Str.rfind( ".", Str.length()); 00285 if(loc < 0) loc = Str.rfind( ",", Str.length()); 00286 if(loc > 0) { 00287 if ( _EnFr_ == DEC_English ) Str.replace(loc, 1, "."); 00288 if ( _EnFr_ == DEC_French ) Str.replace(loc, 1, ","); 00289 } 00290 00291 decNumberFromString(&d, (char*)Str.c_str(), Context.get()); // cast -- nicht gut ??? 00292 return *this; 00293 }
char* DecFloat_::ToChar | ( | int | dec | ) | const [inline] |
Définition à la ligne 297 du fichier DecFloat.hpp.
Références _EnFr_, Context, d, DEC_English, DEC_French, decNumberFromString(), decNumberRescale(), decNumberToEngString(), DECNUMDIGITS, et DecFloatContext::get().
00298 { 00299 00300 char * value ; 00301 char chn[DECNUMDIGITS+14]; // conversion buffer 00302 decNumber p=d; // only necessary because of non const parameter 00303 /* rescale */ 00304 00305 if(dec >0) { 00306 DecFloat_ pp ; 00307 00308 char * s ; 00309 s = (char*) malloc(dec+1); 00310 sprintf(s,"%d",(dec*-1)); 00311 decNumberFromString(&pp.d,s , Context.get()); // cast 00312 decNumberRescale(&p, &d, &pp.d,Context.get()); 00313 } 00314 if(dec ==0) { 00315 DecFloat_ pp ; 00316 char * s ; 00317 s = (char*) malloc(dec+1); 00318 sprintf(s,"%d",dec); 00319 decNumberFromString(&pp.d,s , Context.get()); // cast 00320 decNumberRescale(&p, &d, &pp.d,Context.get()); 00321 } 00322 /* end rescale */ 00323 00324 decNumberToEngString(&p, chn); 00325 00326 string x =chn; 00327 int loc; 00328 loc = x.rfind( ".", strlen(chn) ); 00329 00330 00331 value = (char*) malloc( strlen(chn) ); 00332 if(dec >0 and loc > 0) { 00333 if ( _EnFr_ == DEC_English ) x.replace(loc, 1, "."); 00334 if ( _EnFr_ == DEC_French ) x.replace(loc, 1, ","); 00335 x.erase(loc+dec+1, x.length()-(loc+dec)); 00336 sprintf(value,"%s",x.data()); 00337 } else { 00338 if( loc > 0) { 00339 if ( _EnFr_ == DEC_English ) x.replace(loc, 1, "."); 00340 if ( _EnFr_ == DEC_French ) x.replace(loc, 1, ","); 00341 } 00342 if( dec == -1) x.erase(loc+dec+1, x.length()-(loc+dec)); // Tronc avec -1 00343 00344 strcpy(value, x.data()); 00345 } 00346 return value; 00347 }
char* DecFloat_::ToChar | ( | ) | const [inline] |
Définition à la ligne 351 du fichier DecFloat.hpp.
Références ToStr().
Référencé par ToStr().
00352 { 00353 char * value ; 00354 string x ; 00355 x = ToStr(); 00356 value = (char*) malloc( x.length()); 00357 sprintf(value,"%s",x.data()); 00358 return value; 00359 }
string DecFloat_::ToStr | ( | ) | const [inline] |
Définition à la ligne 363 du fichier DecFloat.hpp.
Références _EnFr_, d, DEC_English, DEC_French, decNumberToEngString(), et DECNUMDIGITS.
Référencé par operator<<(), et ToChar().
00364 { 00365 char str[DECNUMDIGITS+14]; // conversion buffer 00366 decNumber p=d; // only necessary because of non const parameter 00367 decNumberToEngString(&p, str); 00368 string value =str; 00369 int loc; 00370 loc = value.rfind( ".", strlen(str) ); 00371 if( loc > 0) { 00372 if ( _EnFr_ == DEC_English ) value.replace(loc, 1, "."); 00373 if ( _EnFr_ == DEC_French ) value.replace(loc, 1, ","); 00374 } 00375 return value; 00376 }
string DecFloat_::ToStr | ( | int | dec | ) | const [inline] |
Définition à la ligne 378 du fichier DecFloat.hpp.
Références ToChar().
00379 { 00380 string value ; 00381 value.append(ToChar(dec)); 00382 return value; 00383 00384 }
Définition à la ligne 388 du fichier DecFloat.hpp.
Références Context, d, decNumberAdd(), et DecFloatContext::get().
00389 { 00390 00391 DecFloat_ x=a; 00392 decNumberAdd(&d, &d, &(x.d), Context.get()); // a=a+b 00393 return *this; 00394 }
Définition à la ligne 396 du fichier DecFloat.hpp.
Références Context, d, decNumberSubtract(), et DecFloatContext::get().
00397 { 00398 DecFloat_ x=a; 00399 decNumberSubtract(&d, &d, &(x.d), Context.get()); // a=a-b 00400 return *this; 00401 }
Définition à la ligne 403 du fichier DecFloat.hpp.
Références Context, d, decNumberMultiply(), et DecFloatContext::get().
00404 { 00405 DecFloat_ x=a; 00406 decNumberMultiply(&d, &d, &(x.d), Context.get()); // a=a+b 00407 return *this; 00408 }
Définition à la ligne 410 du fichier DecFloat.hpp.
Références Context, d, decNumberDivide(), et DecFloatContext::get().
00411 { 00412 DecFloat_ x=a; 00413 decNumberDivide(&d, &d, &(x.d), Context.get()); // a=a/b 00414 return *this; 00415 }
Définition à la ligne 417 du fichier DecFloat.hpp.
Références Context, d, decNumberRemainder(), et DecFloatContext::get().
00418 { 00419 DecFloat_ x=a; 00420 decNumberRemainder(&d, &d, &(x.d), Context.get()); // a=a%b 00421 return *this; 00422 }
DecFloat_& DecFloat_::operator- | ( | ) | [inline] |
Définition à la ligne 424 du fichier DecFloat.hpp.
Références Context, d, decNumberMinus(), et DecFloatContext::get().
00425 { //??? member function or global function or both 00426 decNumber x=d; 00427 decNumberMinus(&d, &x, Context.get()); // -a 00428 return *this; 00429 }
DecFloat_& DecFloat_::operator+ | ( | ) | [inline] |
Définition à la ligne 431 du fichier DecFloat.hpp.
Références Context, d, decNumberPlus(), et DecFloatContext::get().
00432 { //??? member function or global function or both 00433 decNumber x=d; 00434 decNumberPlus(&d, &x, Context.get()); // +a 00435 return *this; 00436 }
void DecFloat_::Normalize | ( | ) | [inline] |
Définition à la ligne 438 du fichier DecFloat.hpp.
Références Context, d, decNumberNormalize(), et DecFloatContext::get().
00439 { // ??? member function or global function or both 00440 decNumber x=d; // necessary ??? 00441 decNumberNormalize(&d, &x, Context.get()); 00442 }
void DecFloat_::Quantize | ( | const DecFloat_ & | a | ) | [inline] |
Définition à la ligne 444 du fichier DecFloat.hpp.
Références Context, d, decNumberQuantize(), et DecFloatContext::get().
00445 { // ??? member function or global function or both 00446 decNumber x=d; 00447 decNumber y=a.d; 00448 decNumberQuantize(&d, &x, &y,Context.get()); 00449 }
void DecFloat_::Rescale | ( | int | a | ) | [inline] |
Définition à la ligne 451 du fichier DecFloat.hpp.
Références Context, d, decNumberRescale(), et DecFloatContext::get().
00452 { 00453 decNumber x=d; 00454 DecFloat_ y ; 00455 y = a; 00456 decNumberRescale(&d, &x, &y.d,Context.get()); 00457 }
bool DecFloat_::SameQuantum | ( | const DecFloat_ & | a | ) | [inline] |
Définition à la ligne 459 du fichier DecFloat.hpp.
Références d, decNumberIsZero, et decNumberSameQuantum().
00460 { // ??? member function or global function or both 00461 decNumber x=d; 00462 decNumber y=a.d, z; 00463 decNumberSameQuantum(&z, &x, &y); 00464 return !decNumberIsZero(&z); 00465 }
DecFloat_ DecFloat_::ToIntegralValue | ( | ) | [inline] |
Définition à la ligne 467 du fichier DecFloat.hpp.
Références Context, d, decNumberToIntegralValue(), et DecFloatContext::get().
00468 { // ??? member function or global function or both 00469 decNumber x=d; // necessary ??? 00470 decNumberToIntegralValue(&d, &x, Context.get()); 00471 return *this; 00472 }
void DecFloat_::Trim | ( | ) | [inline] |
Définition à la ligne 474 du fichier DecFloat.hpp.
Références d, et decNumberTrim().
00475 { 00476 decNumberTrim(&d); 00477 }
Définition à la ligne 497 du fichier DecFloat.hpp.
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 }
Définition à la ligne 511 du fichier DecFloat.hpp.
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 }
istream& operator>> | ( | istream & | f, | |
DecFloat_ & | b | |||
) | [friend] |
Définition à la ligne 633 du fichier DecFloat.hpp.
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 }
Définition à la ligne 578 du fichier DecFloat.hpp.
00579 { 00580 DecFloat_ result, x=a; 00581 decNumberAbs(&(result.d), &(x.d), Context.get()); 00582 return result; 00583 }
Définition à la ligne 585 du fichier DecFloat.hpp.
00586 { 00587 DecFloat_ result, a=x, b=y; 00588 decNumberPower(&(result.d), &(a.d), &(b.d), Context.get()); 00589 return result; 00590 }
Définition à la ligne 620 du fichier DecFloat.hpp.
00621 { 00622 DecFloat_ result, a=x; 00623 decNumberSquareRoot(&(result.d), &(a.d), Context.get()); 00624 return result; 00625 }
Définition à la ligne 606 du fichier DecFloat.hpp.
00607 { 00608 DecFloat_ result, a=x, b=y; 00609 decNumberMin(&(result.d), &(a.d), &(b.d), Context.get()); 00610 return result; 00611 }
Définition à la ligne 613 du fichier DecFloat.hpp.
00614 { 00615 DecFloat_ result, a=x, b=y; 00616 decNumberMax(&(result.d), &(a.d), &(b.d), Context.get()); 00617 return result; 00618 }
Définition à la ligne 592 du fichier DecFloat.hpp.
00593 { 00594 DecFloat_ result, a=x, b=y; 00595 decNumberDivideInteger(&(result.d), &(a.d), &(b.d), Context.get()); 00596 return result; 00597 }
Définition à la ligne 599 du fichier DecFloat.hpp.
00600 { 00601 DecFloat_ result, a=x, b=y; 00602 decNumberRemainderNear(&(result.d), &(a.d), &(b.d), Context.get()); 00603 return result; 00604 }
decNumber DecFloat_::d [private] |
Définition à la ligne 184 du fichier DecFloat.hpp.
Référencé par abs(), DecFloat_(), DivideInteger(), max(), min(), Normalize(), operator *=(), operator%=(), operator+(), operator+=(), operator-(), operator-=(), operator/=(), operator<(), operator=(), operator==(), operator>>(), pow(), Quantize(), RemainderNear(), Rescale(), SameQuantum(), sqrt(), ToChar(), ToIntegralValue(), ToStr(), et Trim().