3 * Implementation of several small and furry utilities needed within GiNaC
4 * but not of any interest to the user of the library. */
7 * GiNaC Copyright (C) 1999-2001 Johannes Gutenberg University Mainz, Germany
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
31 /* Version information buried into the library */
32 const int version_major = GINACLIB_MAJOR_VERSION;
33 const int version_minor = GINACLIB_MINOR_VERSION;
34 const int version_micro = GINACLIB_MICRO_VERSION;
37 /** ctor for pole_error exception class. */
38 pole_error::pole_error(const std::string& what_arg, int degree)
39 : domain_error(what_arg)
44 /** Return the degree of the pole_error exception class. */
45 int pole_error::degree(void) const
50 // some compilers (e.g. cygwin) define a macro log2, causing confusion
52 /** Integer binary logarithm */
53 unsigned log2(unsigned n)
56 for (k = 0; n > 1; n >>= 1)
63 // `construct on first use' chest of numbers
67 const numeric & _num_120(void)
69 const static ex e = ex(numeric(-120));
70 const static numeric * n = static_cast<const numeric *>(e.bp);
74 const ex & _ex_120(void)
76 static ex * e = new ex(_num_120());
81 const numeric & _num_60(void)
83 const static ex e = ex(numeric(-60));
84 const static numeric * n = static_cast<const numeric *>(e.bp);
88 const ex & _ex_60(void)
90 static ex * e = new ex(_num_60());
95 const numeric & _num_48(void)
97 const static ex e = ex(numeric(-48));
98 const static numeric * n = static_cast<const numeric *>(e.bp);
102 const ex & _ex_48(void)
104 static ex * e = new ex(_num_48());
109 const numeric & _num_30(void)
111 const static ex e = ex(numeric(-30));
112 const static numeric * n = static_cast<const numeric *>(e.bp);
116 const ex & _ex_30(void)
118 static ex * e = new ex(_num_30());
123 const numeric & _num_25(void)
125 const static ex e = ex(numeric(-25));
126 const static numeric * n = static_cast<const numeric *>(e.bp);
130 const ex & _ex_25(void)
132 static ex * e = new ex(_num_25());
137 const numeric & _num_24(void)
139 const static ex e = ex(numeric(-24));
140 const static numeric * n = static_cast<const numeric *>(e.bp);
144 const ex & _ex_24(void)
146 static ex * e = new ex(_num_24());
151 const numeric & _num_20(void)
153 const static ex e = ex(numeric(-20));
154 const static numeric * n = static_cast<const numeric *>(e.bp);
158 const ex & _ex_20(void)
160 static ex * e = new ex(_num_20());
165 const numeric & _num_18(void)
167 const static ex e = ex(numeric(-18));
168 const static numeric * n = static_cast<const numeric *>(e.bp);
172 const ex & _ex_18(void)
174 static ex * e = new ex(_num_18());
179 const numeric & _num_15(void)
181 const static ex e = ex(numeric(-15));
182 const static numeric * n = static_cast<const numeric *>(e.bp);
186 const ex & _ex_15(void)
188 static ex * e = new ex(_num_15());
193 const numeric & _num_12(void)
195 const static ex e = ex(numeric(-12));
196 const static numeric * n = static_cast<const numeric *>(e.bp);
200 const ex & _ex_12(void)
202 static ex * e = new ex(_num_12());
207 const numeric & _num_11(void)
209 const static ex e = ex(numeric(-11));
210 const static numeric * n = static_cast<const numeric *>(e.bp);
214 const ex & _ex_11(void)
216 static ex * e = new ex(_num_11());
221 const numeric & _num_10(void)
223 const static ex e = ex(numeric(-10));
224 const static numeric * n = static_cast<const numeric *>(e.bp);
228 const ex & _ex_10(void)
230 static ex * e = new ex(_num_10());
235 const numeric & _num_9(void)
237 const static ex e = ex(numeric(-9));
238 const static numeric * n = static_cast<const numeric *>(e.bp);
242 const ex & _ex_9(void)
244 static ex * e = new ex(_num_9());
249 const numeric & _num_8(void)
251 const static ex e = ex(numeric(-8));
252 const static numeric * n = static_cast<const numeric *>(e.bp);
256 const ex & _ex_8(void)
258 static ex * e = new ex(_num_8());
263 const numeric & _num_7(void)
265 const static ex e = ex(numeric(-7));
266 const static numeric * n = static_cast<const numeric *>(e.bp);
270 const ex & _ex_7(void)
272 static ex * e = new ex(_num_7());
277 const numeric & _num_6(void)
279 const static ex e = ex(numeric(-6));
280 const static numeric * n = static_cast<const numeric *>(e.bp);
284 const ex & _ex_6(void)
286 static ex * e = new ex(_num_6());
291 const numeric & _num_5(void)
293 const static ex e = ex(numeric(-5));
294 const static numeric * n = static_cast<const numeric *>(e.bp);
298 const ex & _ex_5(void)
300 static ex * e = new ex(_num_5());
305 const numeric & _num_4(void)
307 const static ex e = ex(numeric(-4));
308 const static numeric * n = static_cast<const numeric *>(e.bp);
312 const ex & _ex_4(void)
314 static ex * e = new ex(_num_4());
319 const numeric & _num_3(void)
321 const static ex e = ex(numeric(-3));
322 const static numeric * n = static_cast<const numeric *>(e.bp);
326 const ex & _ex_3(void)
328 static ex * e = new ex(_num_3());
333 const numeric & _num_2(void)
335 const static ex e = ex(numeric(-2));
336 const static numeric * n = static_cast<const numeric *>(e.bp);
340 const ex & _ex_2(void)
342 static ex * e = new ex(_num_2());
347 const numeric & _num_1(void)
349 const static ex e = ex(numeric(-1));
350 const static numeric * n = static_cast<const numeric *>(e.bp);
354 const ex & _ex_1(void)
356 static ex * e = new ex(_num_1());
361 const numeric & _num_1_2(void)
363 const static ex e = ex(numeric(-1,2));
364 const static numeric * n = static_cast<const numeric *>(e.bp);
368 const ex & _ex_1_2(void)
370 static ex * e = new ex(_num_1_2());
375 const numeric & _num_1_3(void)
377 const static ex e = ex(numeric(-1,3));
378 const static numeric * n = static_cast<const numeric *>(e.bp);
382 const ex & _ex_1_3(void)
384 static ex * e = new ex(_num_1_3());
389 const numeric & _num_1_4(void)
391 const static ex e = ex(numeric(-1,4));
392 const static numeric * n = static_cast<const numeric *>(e.bp);
396 const ex & _ex_1_4(void)
398 static ex * e = new ex(_num_1_4());
403 const numeric & _num0(void)
405 const static ex e = ex(numeric(0));
406 const static numeric * n = static_cast<const numeric *>(e.bp);
410 const ex & _ex0(void)
412 static ex * e = new ex(_num0());
417 const numeric & _num1_4(void)
419 const static ex e = ex(numeric(1,4));
420 const static numeric * n = static_cast<const numeric *>(e.bp);
424 const ex & _ex1_4(void)
426 static ex * e = new ex(_num1_4());
431 const numeric & _num1_3(void)
433 const static ex e = ex(numeric(1,3));
434 const static numeric * n = static_cast<const numeric *>(e.bp);
438 const ex & _ex1_3(void)
440 static ex * e = new ex(_num1_3());
445 const numeric & _num1_2(void)
447 const static ex e = ex(numeric(1,2));
448 const static numeric * n = static_cast<const numeric *>(e.bp);
452 const ex & _ex1_2(void)
454 static ex * e = new ex(_num1_2());
459 const numeric & _num1(void)
461 const static ex e = ex(numeric(1));
462 const static numeric * n = static_cast<const numeric *>(e.bp);
466 const ex & _ex1(void)
468 static ex * e = new ex(_num1());
473 const numeric & _num2(void)
475 const static ex e = ex(numeric(2));
476 const static numeric * n = static_cast<const numeric *>(e.bp);
480 const ex & _ex2(void)
482 static ex * e = new ex(_num2());
487 const numeric & _num3(void)
489 const static ex e = ex(numeric(3));
490 const static numeric * n = static_cast<const numeric *>(e.bp);
494 const ex & _ex3(void)
496 static ex * e = new ex(_num3());
501 const numeric & _num4(void)
503 const static ex e = ex(numeric(4));
504 const static numeric * n = static_cast<const numeric *>(e.bp);
508 const ex & _ex4(void)
510 static ex * e = new ex(_num4());
515 const numeric & _num5(void)
517 const static ex e = ex(numeric(5));
518 const static numeric * n = static_cast<const numeric *>(e.bp);
522 const ex & _ex5(void)
524 static ex * e = new ex(_num5());
529 const numeric & _num6(void)
531 const static ex e = ex(numeric(6));
532 const static numeric * n = static_cast<const numeric *>(e.bp);
536 const ex & _ex6(void)
538 static ex * e = new ex(_num6());
543 const numeric & _num7(void)
545 const static ex e = ex(numeric(7));
546 const static numeric * n = static_cast<const numeric *>(e.bp);
550 const ex & _ex7(void)
552 static ex * e = new ex(_num7());
557 const numeric & _num8(void)
559 const static ex e = ex(numeric(8));
560 const static numeric * n = static_cast<const numeric *>(e.bp);
564 const ex & _ex8(void)
566 static ex * e = new ex(_num8());
571 const numeric & _num9(void)
573 const static ex e = ex(numeric(9));
574 const static numeric * n = static_cast<const numeric *>(e.bp);
578 const ex & _ex9(void)
580 static ex * e = new ex(_num9());
585 const numeric & _num10(void)
587 const static ex e = ex(numeric(10));
588 const static numeric * n = static_cast<const numeric *>(e.bp);
592 const ex & _ex10(void)
594 static ex * e = new ex(_num10());
599 const numeric & _num11(void)
601 const static ex e = ex(numeric(11));
602 const static numeric * n = static_cast<const numeric *>(e.bp);
606 const ex & _ex11(void)
608 static ex * e = new ex(_num11());
613 const numeric & _num12(void)
615 const static ex e = ex(numeric(12));
616 const static numeric * n = static_cast<const numeric *>(e.bp);
620 const ex & _ex12(void)
622 static ex * e = new ex(_num12());
627 const numeric & _num15(void)
629 const static ex e = ex(numeric(15));
630 const static numeric * n = static_cast<const numeric *>(e.bp);
634 const ex & _ex15(void)
636 static ex * e = new ex(_num15());
641 const numeric & _num18(void)
643 const static ex e = ex(numeric(18));
644 const static numeric * n = static_cast<const numeric *>(e.bp);
648 const ex & _ex18(void)
650 static ex * e = new ex(_num18());
655 const numeric & _num20(void)
657 const static ex e = ex(numeric(20));
658 const static numeric * n = static_cast<const numeric *>(e.bp);
662 const ex & _ex20(void)
664 static ex * e = new ex(_num20());
669 const numeric & _num24(void)
671 const static ex e = ex(numeric(24));
672 const static numeric * n = static_cast<const numeric *>(e.bp);
676 const ex & _ex24(void)
678 static ex * e = new ex(_num24());
683 const numeric & _num25(void)
685 const static ex e = ex(numeric(25));
686 const static numeric * n = static_cast<const numeric *>(e.bp);
690 const ex & _ex25(void)
692 static ex * e = new ex(_num25());
697 const numeric & _num30(void)
699 const static ex e = ex(numeric(30));
700 const static numeric * n = static_cast<const numeric *>(e.bp);
704 const ex & _ex30(void)
706 static ex * e = new ex(_num30());
711 const numeric & _num48(void)
713 const static ex e = ex(numeric(48));
714 const static numeric * n = static_cast<const numeric *>(e.bp);
718 const ex & _ex48(void)
720 static ex * e = new ex(_num48());
725 const numeric & _num60(void)
727 const static ex e = ex(numeric(60));
728 const static numeric * n = static_cast<const numeric *>(e.bp);
732 const ex & _ex60(void)
734 static ex * e = new ex(_num60());
739 const numeric & _num120(void)
741 const static ex e = ex(numeric(120));
742 const static numeric * n = static_cast<const numeric *>(e.bp);
746 const ex & _ex120(void)
748 static ex * e = new ex(_num120());
752 // comment skeleton for header files
757 // default ctor, dtor, copy ctor assignment operator and helpers
763 // functions overriding virtual functions from base classes
766 // new virtual functions which can be overridden by derived classes
769 // non-virtual functions in this class
777 // comment skeleton for implementation files
781 // default ctor, dtor, copy ctor assignment operator and helpers
795 // functions overriding virtual functions from base classes
803 // new virtual functions which can be overridden by derived classes
811 // non-virtual functions in this class
819 // static member variables