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), deg(degree) { }
41 /** Return the degree of the pole_error exception class. */
42 int pole_error::degree(void) const
47 // some compilers (e.g. cygwin) define a macro log2, causing confusion
49 /** Integer binary logarithm */
50 unsigned log2(unsigned n)
53 for (k = 0; n > 1; n >>= 1)
60 // `construct on first use' chest of numbers
64 const numeric & _num_120(void)
66 const static ex e = ex(numeric(-120));
67 const static numeric &n = ex_to<numeric>(e);
71 const ex & _ex_120(void)
73 static ex * e = new ex(_num_120());
78 const numeric & _num_60(void)
80 const static ex e = ex(numeric(-60));
81 const static numeric &n = ex_to<numeric>(e);
85 const ex & _ex_60(void)
87 static ex * e = new ex(_num_60());
92 const numeric & _num_48(void)
94 const static ex e = ex(numeric(-48));
95 const static numeric &n = ex_to<numeric>(e);
99 const ex & _ex_48(void)
101 static ex * e = new ex(_num_48());
106 const numeric & _num_30(void)
108 const static ex e = ex(numeric(-30));
109 const static numeric &n = ex_to<numeric>(e);
113 const ex & _ex_30(void)
115 static ex * e = new ex(_num_30());
120 const numeric & _num_25(void)
122 const static ex e = ex(numeric(-25));
123 const static numeric &n = ex_to<numeric>(e);
127 const ex & _ex_25(void)
129 static ex * e = new ex(_num_25());
134 const numeric & _num_24(void)
136 const static ex e = ex(numeric(-24));
137 const static numeric &n = ex_to<numeric>(e);
141 const ex & _ex_24(void)
143 static ex * e = new ex(_num_24());
148 const numeric & _num_20(void)
150 const static ex e = ex(numeric(-20));
151 const static numeric &n = ex_to<numeric>(e);
155 const ex & _ex_20(void)
157 static ex * e = new ex(_num_20());
162 const numeric & _num_18(void)
164 const static ex e = ex(numeric(-18));
165 const static numeric &n = ex_to<numeric>(e);
169 const ex & _ex_18(void)
171 static ex * e = new ex(_num_18());
176 const numeric & _num_15(void)
178 const static ex e = ex(numeric(-15));
179 const static numeric &n = ex_to<numeric>(e);
183 const ex & _ex_15(void)
185 static ex * e = new ex(_num_15());
190 const numeric & _num_12(void)
192 const static ex e = ex(numeric(-12));
193 const static numeric &n = ex_to<numeric>(e);
197 const ex & _ex_12(void)
199 static ex * e = new ex(_num_12());
204 const numeric & _num_11(void)
206 const static ex e = ex(numeric(-11));
207 const static numeric &n = ex_to<numeric>(e);
211 const ex & _ex_11(void)
213 static ex * e = new ex(_num_11());
218 const numeric & _num_10(void)
220 const static ex e = ex(numeric(-10));
221 const static numeric &n = ex_to<numeric>(e);
225 const ex & _ex_10(void)
227 static ex * e = new ex(_num_10());
232 const numeric & _num_9(void)
234 const static ex e = ex(numeric(-9));
235 const static numeric &n = ex_to<numeric>(e);
239 const ex & _ex_9(void)
241 static ex * e = new ex(_num_9());
246 const numeric & _num_8(void)
248 const static ex e = ex(numeric(-8));
249 const static numeric &n = ex_to<numeric>(e);
253 const ex & _ex_8(void)
255 static ex * e = new ex(_num_8());
260 const numeric & _num_7(void)
262 const static ex e = ex(numeric(-7));
263 const static numeric &n = ex_to<numeric>(e);
267 const ex & _ex_7(void)
269 static ex * e = new ex(_num_7());
274 const numeric & _num_6(void)
276 const static ex e = ex(numeric(-6));
277 const static numeric &n = ex_to<numeric>(e);
281 const ex & _ex_6(void)
283 static ex * e = new ex(_num_6());
288 const numeric & _num_5(void)
290 const static ex e = ex(numeric(-5));
291 const static numeric &n = ex_to<numeric>(e);
295 const ex & _ex_5(void)
297 static ex * e = new ex(_num_5());
302 const numeric & _num_4(void)
304 const static ex e = ex(numeric(-4));
305 const static numeric &n = ex_to<numeric>(e);
309 const ex & _ex_4(void)
311 static ex * e = new ex(_num_4());
316 const numeric & _num_3(void)
318 const static ex e = ex(numeric(-3));
319 const static numeric &n = ex_to<numeric>(e);
323 const ex & _ex_3(void)
325 static ex * e = new ex(_num_3());
330 const numeric & _num_2(void)
332 const static ex e = ex(numeric(-2));
333 const static numeric &n = ex_to<numeric>(e);
337 const ex & _ex_2(void)
339 static ex * e = new ex(_num_2());
344 const numeric & _num_1(void)
346 const static ex e = ex(numeric(-1));
347 const static numeric &n = ex_to<numeric>(e);
351 const ex & _ex_1(void)
353 static ex * e = new ex(_num_1());
358 const numeric & _num_1_2(void)
360 const static ex e = ex(numeric(-1,2));
361 const static numeric &n = ex_to<numeric>(e);
365 const ex & _ex_1_2(void)
367 static ex * e = new ex(_num_1_2());
372 const numeric & _num_1_3(void)
374 const static ex e = ex(numeric(-1,3));
375 const static numeric &n = ex_to<numeric>(e);
379 const ex & _ex_1_3(void)
381 static ex * e = new ex(_num_1_3());
386 const numeric & _num_1_4(void)
388 const static ex e = ex(numeric(-1,4));
389 const static numeric &n = ex_to<numeric>(e);
393 const ex & _ex_1_4(void)
395 static ex * e = new ex(_num_1_4());
400 const numeric & _num0(void)
402 const static ex e = ex(numeric(0));
403 const static numeric &n = ex_to<numeric>(e);
407 const ex & _ex0(void)
409 static ex * e = new ex(_num0());
414 const numeric & _num1_4(void)
416 const static ex e = ex(numeric(1,4));
417 const static numeric &n = ex_to<numeric>(e);
421 const ex & _ex1_4(void)
423 static ex * e = new ex(_num1_4());
428 const numeric & _num1_3(void)
430 const static ex e = ex(numeric(1,3));
431 const static numeric &n = ex_to<numeric>(e);
435 const ex & _ex1_3(void)
437 static ex * e = new ex(_num1_3());
442 const numeric & _num1_2(void)
444 const static ex e = ex(numeric(1,2));
445 const static numeric &n = ex_to<numeric>(e);
449 const ex & _ex1_2(void)
451 static ex * e = new ex(_num1_2());
456 const numeric & _num1(void)
458 const static ex e = ex(numeric(1));
459 const static numeric &n = ex_to<numeric>(e);
463 const ex & _ex1(void)
465 static ex * e = new ex(_num1());
470 const numeric & _num2(void)
472 const static ex e = ex(numeric(2));
473 const static numeric &n = ex_to<numeric>(e);
477 const ex & _ex2(void)
479 static ex * e = new ex(_num2());
484 const numeric & _num3(void)
486 const static ex e = ex(numeric(3));
487 const static numeric &n = ex_to<numeric>(e);
491 const ex & _ex3(void)
493 static ex * e = new ex(_num3());
498 const numeric & _num4(void)
500 const static ex e = ex(numeric(4));
501 const static numeric &n = ex_to<numeric>(e);
505 const ex & _ex4(void)
507 static ex * e = new ex(_num4());
512 const numeric & _num5(void)
514 const static ex e = ex(numeric(5));
515 const static numeric &n = ex_to<numeric>(e);
519 const ex & _ex5(void)
521 static ex * e = new ex(_num5());
526 const numeric & _num6(void)
528 const static ex e = ex(numeric(6));
529 const static numeric &n = ex_to<numeric>(e);
533 const ex & _ex6(void)
535 static ex * e = new ex(_num6());
540 const numeric & _num7(void)
542 const static ex e = ex(numeric(7));
543 const static numeric &n = ex_to<numeric>(e);
547 const ex & _ex7(void)
549 static ex * e = new ex(_num7());
554 const numeric & _num8(void)
556 const static ex e = ex(numeric(8));
557 const static numeric &n = ex_to<numeric>(e);
561 const ex & _ex8(void)
563 static ex * e = new ex(_num8());
568 const numeric & _num9(void)
570 const static ex e = ex(numeric(9));
571 const static numeric &n = ex_to<numeric>(e);
575 const ex & _ex9(void)
577 static ex * e = new ex(_num9());
582 const numeric & _num10(void)
584 const static ex e = ex(numeric(10));
585 const static numeric &n = ex_to<numeric>(e);
589 const ex & _ex10(void)
591 static ex * e = new ex(_num10());
596 const numeric & _num11(void)
598 const static ex e = ex(numeric(11));
599 const static numeric &n = ex_to<numeric>(e);
603 const ex & _ex11(void)
605 static ex * e = new ex(_num11());
610 const numeric & _num12(void)
612 const static ex e = ex(numeric(12));
613 const static numeric &n = ex_to<numeric>(e);
617 const ex & _ex12(void)
619 static ex * e = new ex(_num12());
624 const numeric & _num15(void)
626 const static ex e = ex(numeric(15));
627 const static numeric &n = ex_to<numeric>(e);
631 const ex & _ex15(void)
633 static ex * e = new ex(_num15());
638 const numeric & _num18(void)
640 const static ex e = ex(numeric(18));
641 const static numeric &n = ex_to<numeric>(e);
645 const ex & _ex18(void)
647 static ex * e = new ex(_num18());
652 const numeric & _num20(void)
654 const static ex e = ex(numeric(20));
655 const static numeric &n = ex_to<numeric>(e);
659 const ex & _ex20(void)
661 static ex * e = new ex(_num20());
666 const numeric & _num24(void)
668 const static ex e = ex(numeric(24));
669 const static numeric &n = ex_to<numeric>(e);
673 const ex & _ex24(void)
675 static ex * e = new ex(_num24());
680 const numeric & _num25(void)
682 const static ex e = ex(numeric(25));
683 const static numeric &n = ex_to<numeric>(e);
687 const ex & _ex25(void)
689 static ex * e = new ex(_num25());
694 const numeric & _num30(void)
696 const static ex e = ex(numeric(30));
697 const static numeric &n = ex_to<numeric>(e);
701 const ex & _ex30(void)
703 static ex * e = new ex(_num30());
708 const numeric & _num48(void)
710 const static ex e = ex(numeric(48));
711 const static numeric &n = ex_to<numeric>(e);
715 const ex & _ex48(void)
717 static ex * e = new ex(_num48());
722 const numeric & _num60(void)
724 const static ex e = ex(numeric(60));
725 const static numeric &n = ex_to<numeric>(e);
729 const ex & _ex60(void)
731 static ex * e = new ex(_num60());
736 const numeric & _num120(void)
738 const static ex e = ex(numeric(120));
739 const static numeric &n = ex_to<numeric>(e);
743 const ex & _ex120(void)
745 static ex * e = new ex(_num120());
749 // comment skeleton for header files
754 // default ctor, dtor, copy ctor assignment operator and helpers
760 // functions overriding virtual functions from base classes
763 // new virtual functions which can be overridden by derived classes
766 // non-virtual functions in this class
774 // comment skeleton for implementation files
778 // default ctor, dtor, copy ctor assignment operator and helpers
792 // functions overriding virtual functions from base classes
800 // new virtual functions which can be overridden by derived classes
808 // non-virtual functions in this class
816 // static member variables