Changeset 2328 for trunk/MagicSoft/Mars/mdata
- Timestamp:
- 09/10/03 13:38:45 (21 years ago)
- Location:
- trunk/MagicSoft/Mars/mdata
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mdata/MDataChain.cc
r2173 r2328 58 58 // log(x) natural logarithm of x 59 59 // pow10(x) 10^x 60 // log2(x) logarithm of x to base two 60 61 // log10(x) logarithm of x to base ten 61 62 // cos(x) cosine of x … … 65 66 // sinh(x) hyperbolic sine of x 66 67 // tanh(x) hyperbolic tangent of x 68 // acosh(x) arc hyperbolic cosine of x 69 // asinh(x) arc hyperbolic sine of x 70 // atanh(x) arc hyperbolic tangent of x 67 71 // acos(x) arc cosine (inverse cosine) of x 68 72 // asin(x) arc sine (inverse sine) of x … … 72 76 // abs(x) absolute value of x, |x| 73 77 // floor(x) round down to the nearest integer (floor(9.9)=9) 78 // ceil(x) round up to the nearest integer (floor(9.1)=10) 74 79 // r2d(x) transform radians to degrees 75 80 // d2r(x) transform degrees to radians … … 81 86 // randg(x) returns gRandom->Gaus(0, x) 82 87 // randl(x) returns gRandom->Landau(0, x) 83 // 88 // isnan(x) return 1 if x is NaN (Not a Number) otherwise 0 89 // finite(x) return 1 if the number is a valid double (not NaN, inf) 90 // 91 // NaN (Not a Number) means normally a number which is to small to be 92 // stored in a floating point variable (eg. 0<x<1e-56 or similar) or 93 // a number which function is not defined (like asin(1.5)) 94 // 95 // inf is the symbol for an infinite number. 84 96 // 85 97 // Constants are implemented in ParseDataMember, namely: … … 110 122 #include "MDataChain.h" 111 123 112 #include <math.h> // fabs on Alpha113 124 #include <ctype.h> // isalnum, ... 114 125 #include <stdlib.h> // strtod, ... … … 236 247 txt.ToLower(); 237 248 238 if (txt=="abs") return kEAbs; 239 if (txt=="fabs") return kEAbs; 240 if (txt=="log") return kELog; 241 if (txt=="log10") return kELog10; 242 if (txt=="sin") return kESin; 243 if (txt=="cos") return kECos; 244 if (txt=="tan") return kETan; 245 if (txt=="sinh") return kESinH; 246 if (txt=="cosh") return kECosH; 247 if (txt=="tanh") return kETanH; 248 if (txt=="asin") return kEASin; 249 if (txt=="acos") return kEACos; 250 if (txt=="atan") return kEATan; 251 if (txt=="sqrt") return kESqrt; 252 if (txt=="sqr") return kESqr; 253 if (txt=="exp") return kEExp; 254 if (txt=="pow10") return kEPow10; 255 if (txt=="sgn") return kESgn; 256 if (txt=="floor") return kEFloor; 257 if (txt=="r2d") return kERad2Deg; 258 if (txt=="d2r") return kEDeg2Rad; 259 if (txt=="rand") return kERandom; 260 if (txt=="randp") return kERandomP; 261 if (txt=="rande") return kERandomE; 262 if (txt=="randi") return kERandomI; 263 if (txt=="randg") return kERandomG; 264 if (txt=="randl") return kERandomL; 265 if (txt[0]=='-') return kENegative; 266 if (txt[0]=='+') return kEPositive; 249 if (txt=="abs") return kEAbs; 250 if (txt=="fabs") return kEAbs; 251 if (txt=="log") return kELog; 252 if (txt=="log2") return kELog2; 253 if (txt=="log10") return kELog10; 254 if (txt=="sin") return kESin; 255 if (txt=="cos") return kECos; 256 if (txt=="tan") return kETan; 257 if (txt=="sinh") return kESinH; 258 if (txt=="cosh") return kECosH; 259 if (txt=="tanh") return kETanH; 260 if (txt=="asin") return kEASin; 261 if (txt=="acos") return kEACos; 262 if (txt=="atan") return kEATan; 263 if (txt=="asinh") return kEASinH; 264 if (txt=="acosh") return kEACosH; 265 if (txt=="atanh") return kEATanH; 266 if (txt=="sqrt") return kESqrt; 267 if (txt=="sqr") return kESqr; 268 if (txt=="exp") return kEExp; 269 if (txt=="pow10") return kEPow10; 270 if (txt=="sgn") return kESgn; 271 if (txt=="floor") return kEFloor; 272 if (txt=="r2d") return kERad2Deg; 273 if (txt=="d2r") return kEDeg2Rad; 274 if (txt=="rand") return kERandom; 275 if (txt=="randp") return kERandomP; 276 if (txt=="rande") return kERandomE; 277 if (txt=="randi") return kERandomI; 278 if (txt=="randg") return kERandomG; 279 if (txt=="randl") return kERandomL; 280 if (txt=="isnan") return kEIsNaN; 281 if (txt=="finite") return kEFinite; 282 if (txt[0]=='-') return kENegative; 283 if (txt[0]=='+') return kEPositive; 267 284 268 285 return kENoop; … … 523 540 switch (fOperatorType) 524 541 { 525 case kEAbs: return fabs(val); 526 case kELog: return log(val); 527 case kELog10: return log10(val); 528 case kESin: return sin(val); 529 case kECos: return cos(val); 530 case kETan: return tan(val); 531 case kESinH: return sinh(val); 532 case kECosH: return cosh(val); 533 case kETanH: return tanh(val); 534 case kEASin: return asin(val); 535 case kEACos: return acos(val); 536 case kEATan: return atan(val); 537 case kESqrt: return sqrt(val); 542 case kEAbs: return TMath::Abs(val); 543 case kELog: return TMath::Log(val); 544 case kELog2: return TMath::Log2(val); 545 case kELog10: return TMath::Log10(val); 546 case kESin: return TMath::Sin(val); 547 case kECos: return TMath::Cos(val); 548 case kETan: return TMath::Tan(val); 549 case kESinH: return TMath::SinH(val); 550 case kECosH: return TMath::CosH(val); 551 case kETanH: return TMath::TanH(val); 552 case kEASin: return TMath::ASin(val); 553 case kEACos: return TMath::ACos(val); 554 case kEATan: return TMath::ATan(val); 555 case kEASinH: return TMath::ASinH(val); 556 case kEACosH: return TMath::ACosH(val); 557 case kEATanH: return TMath::ATanH(val); 558 case kESqrt: return TMath::Sqrt(val); 538 559 case kESqr: return val*val; 539 case kEExp: return exp(val);540 case kEPow10: return pow(10, val);560 case kEExp: return TMath::Exp(val); 561 case kEPow10: return TMath::Power(10, val); 541 562 case kESgn: return val<0 ? -1 : 1; 542 563 case kENegative: return -val; 543 564 case kEPositive: return val; 544 case kEFloor: return floor(val); 565 case kEFloor: return TMath::Floor(val); 566 case kECeil: return TMath::Ceil(val); 545 567 case kERad2Deg: return val*180/TMath::Pi(); 546 568 case kEDeg2Rad: return val*TMath::Pi()/180; … … 551 573 case kERandomG: return gRandom ? gRandom->Gaus(0, val) : 0; 552 574 case kERandomL: return gRandom ? gRandom->Landau(0, val) : 0; 575 case kEIsNaN: return TMath::IsNaN(val); 576 case kEFinite: return TMath::Finite(val); 553 577 case kENoop: return val; 554 578 } … … 615 639 switch (fOperatorType) 616 640 { 617 case kEAbs: str += "abs" ; break; 618 case kELog: str += "log" ; break; 619 case kELog10: str += "log10"; break; 620 case kESin: str += "sin" ; break; 621 case kECos: str += "cos" ; break; 622 case kETan: str += "tan" ; break; 623 case kESinH: str += "sinh" ; break; 624 case kECosH: str += "cosh" ; break; 625 case kETanH: str += "tanh" ; break; 626 case kEASin: str += "asin" ; break; 627 case kEACos: str += "acos" ; break; 628 case kEATan: str += "atan" ; break; 629 case kESqrt: str += "sqrt" ; break; 630 case kESqr: str += "sqr" ; break; 631 case kEExp: str += "exp" ; break; 632 case kEPow10: str += "pow10"; break; 633 case kESgn: str += "sgn" ; break; 634 case kENegative: str += "-" ; break; 635 case kEPositive: str += "+" ; break; 636 case kEFloor: str += "floor"; break; 637 case kERad2Deg: str += "r2d" ; break; 638 case kEDeg2Rad: str += "d2r" ; break; 639 case kERandom: str += "rand" ; break; 640 case kERandomP: str += "randp"; break; 641 case kERandomE: str += "rande"; break; 642 case kERandomI: str += "randi"; break; 643 case kERandomG: str += "randg"; break; 644 case kERandomL: str += "randl"; break; 641 case kEAbs: str += "abs" ; break; 642 case kELog: str += "log" ; break; 643 case kELog2: str += "log2" ; break; 644 case kELog10: str += "log10" ; break; 645 case kESin: str += "sin" ; break; 646 case kECos: str += "cos" ; break; 647 case kETan: str += "tan" ; break; 648 case kESinH: str += "sinh" ; break; 649 case kECosH: str += "cosh" ; break; 650 case kETanH: str += "tanh" ; break; 651 case kEASin: str += "asin" ; break; 652 case kEACos: str += "acos" ; break; 653 case kEATan: str += "atan" ; break; 654 case kEASinH: str += "asinh" ; break; 655 case kEACosH: str += "acosh" ; break; 656 case kEATanH: str += "atanh" ; break; 657 case kESqrt: str += "sqrt" ; break; 658 case kESqr: str += "sqr" ; break; 659 case kEExp: str += "exp" ; break; 660 case kEPow10: str += "pow10" ; break; 661 case kESgn: str += "sgn" ; break; 662 case kENegative: str += "-" ; break; 663 case kEPositive: str += "+" ; break; 664 case kEFloor: str += "floor" ; break; 665 case kECeil: str += "ceil" ; break; 666 case kERad2Deg: str += "r2d" ; break; 667 case kEDeg2Rad: str += "d2r" ; break; 668 case kERandom: str += "rand" ; break; 669 case kERandomP: str += "randp" ; break; 670 case kERandomE: str += "rande" ; break; 671 case kERandomI: str += "randi" ; break; 672 case kERandomG: str += "randg" ; break; 673 case kERandomL: str += "randl" ; break; 674 case kEIsNaN: str += "isnan" ; break; 675 case kEFinite: str += "finite"; break; 645 676 case kENoop: 646 677 break; -
trunk/MagicSoft/Mars/mdata/MDataChain.h
r2117 r2328 19 19 MData *fMember; // Filter 20 20 21 // PLEASE, always add new enums to the end of the enumeration, 22 // otherwise you would break loading old data chains... 21 23 typedef enum { 22 24 kENoop, 23 kELog10, 24 kELog, 25 kELog, kELog2, kELog10, 25 26 kEAbs, 26 kESin, 27 kECos, 28 kETan, 29 kESinH, 30 kECosH, 31 kETanH, 32 kEASin, 33 kEACos, 34 kEATan, 35 kESqrt, 36 kESqr, 37 kEPow10, 38 kEExp, 27 kESin, kECos, kETan, kESinH, kECosH, kETanH, 28 kEASin, kEACos, kEATan, kEASinH, kEACosH, kEATanH, 29 kESqrt, kESqr, kEPow10, kEExp, 39 30 kESgn, 40 31 kEPositive, 41 32 kENegative, 42 kEFloor, 43 kERad2Deg, 44 kEDeg2Rad, 45 kERandom, 46 kERandomP, 47 kERandomE, 48 kERandomI, 49 kERandomG, 50 kERandomL 33 kEFloor, kECeil, 34 kERad2Deg, kEDeg2Rad, kERandom, 35 kERandomP, kERandomE, kERandomI, kERandomG, kERandomL, 36 kEIsNaN, kEFinite 51 37 } OperatorType_t; 52 38
Note:
See TracChangeset
for help on using the changeset viewer.