diff options
| author | Jay Belanger | 2007-06-22 05:45:52 +0000 |
|---|---|---|
| committer | Jay Belanger | 2007-06-22 05:45:52 +0000 |
| commit | a8775b6dcf9bcf193fe040b2eb9c7825e9c370c1 (patch) | |
| tree | c8dc77c0f0f9598e232ee4950f071bf835ffca7c | |
| parent | 3b6d80bc94a396997cdeab4706fa3373a6cc9fb5 (diff) | |
| download | emacs-a8775b6dcf9bcf193fe040b2eb9c7825e9c370c1.tar.gz emacs-a8775b6dcf9bcf193fe040b2eb9c7825e9c370c1.zip | |
(math-besJ0,math-besJ1,math-besY0,math-besY1,math-bernoulli-b-cache):
Use math-read-number to insert bignums.
| -rw-r--r-- | lisp/calc/calc-funcs.el | 230 |
1 files changed, 143 insertions, 87 deletions
diff --git a/lisp/calc/calc-funcs.el b/lisp/calc/calc-funcs.el index 479116b0c76..00cadf69920 100644 --- a/lisp/calc/calc-funcs.el +++ b/lisp/calc/calc-funcs.el | |||
| @@ -567,42 +567,54 @@ | |||
| 567 | ((Math-lessp '(float 8 0) (math-abs-approx x)) | 567 | ((Math-lessp '(float 8 0) (math-abs-approx x)) |
| 568 | (let* ((z (math-div '(float 8 0) x)) | 568 | (let* ((z (math-div '(float 8 0) x)) |
| 569 | (y (math-sqr z)) | 569 | (y (math-sqr z)) |
| 570 | (xx (math-add x '(float (bigneg 164 398 785) -9))) | 570 | (xx (math-add x |
| 571 | (eval-when-compile | ||
| 572 | (math-read-number-simple "-0.785398164")))) | ||
| 571 | (a1 (math-poly-eval y | 573 | (a1 (math-poly-eval y |
| 572 | '((float (bigpos 211 887 093 2) -16) | 574 | (eval-when-compile |
| 573 | (float (bigneg 639 370 073 2) -15) | 575 | (list |
| 574 | (float (bigpos 407 510 734 2) -14) | 576 | (math-read-number-simple "0.0000002093887211") |
| 575 | (float (bigneg 627 628 098 1) -12) | 577 | (math-read-number-simple "-0.000002073370639") |
| 576 | (float 1 0)))) | 578 | (math-read-number-simple "0.00002734510407") |
| 579 | (math-read-number-simple "-0.001098628627") | ||
| 580 | '(float 1 0))))) | ||
| 577 | (a2 (math-poly-eval y | 581 | (a2 (math-poly-eval y |
| 578 | '((float (bigneg 152 935 934) -16) | 582 | (eval-when-compile |
| 579 | (float (bigpos 161 095 621 7) -16) | 583 | (list |
| 580 | (float (bigneg 651 147 911 6) -15) | 584 | (math-read-number-simple "-0.0000000934935152") |
| 581 | (float (bigpos 765 488 430 1) -13) | 585 | (math-read-number-simple "0.0000007621095161") |
| 582 | (float (bigneg 995 499 562 1) -11)))) | 586 | (math-read-number-simple "-0.000006911147651") |
| 587 | (math-read-number-simple "0.0001430488765") | ||
| 588 | (math-read-number-simple "-0.01562499995"))))) | ||
| 583 | (sc (math-sin-cos-raw xx))) | 589 | (sc (math-sin-cos-raw xx))) |
| 584 | (if yflag | 590 | (if yflag |
| 585 | (setq sc (cons (math-neg (cdr sc)) (car sc)))) | 591 | (setq sc (cons (math-neg (cdr sc)) (car sc)))) |
| 586 | (math-mul (math-sqrt | 592 | (math-mul (math-sqrt |
| 587 | (math-div '(float (bigpos 722 619 636) -9) x)) | 593 | (math-div (eval-when-compile |
| 594 | (math-read-number-simple "0.636619722")) | ||
| 595 | x)) | ||
| 588 | (math-sub (math-mul (cdr sc) a1) | 596 | (math-sub (math-mul (cdr sc) a1) |
| 589 | (math-mul (car sc) (math-mul z a2)))))) | 597 | (math-mul (car sc) (math-mul z a2)))))) |
| 590 | (t | 598 | (t |
| 591 | (let ((y (math-sqr x))) | 599 | (let ((y (math-sqr x))) |
| 592 | (math-div (math-poly-eval y | 600 | (math-div (math-poly-eval y |
| 593 | '((float (bigneg 456 052 849 1) -7) | 601 | (eval-when-compile |
| 594 | (float (bigpos 017 233 739 7) -5) | 602 | (list |
| 595 | (float (bigneg 418 442 121 1) -2) | 603 | (math-read-number "-184.9052456") |
| 596 | (float (bigpos 407 196 516 6) -1) | 604 | (math-read-number "77392.33017") |
| 597 | (float (bigneg 354 590 362 13) 0) | 605 | (math-read-number "-11214424.18") |
| 598 | (float (bigpos 574 490 568 57) 0))) | 606 | (math-read-number "651619640.7") |
| 607 | (math-read-number "-13362590354.0") | ||
| 608 | (math-read-number "57568490574.0")))) | ||
| 599 | (math-poly-eval y | 609 | (math-poly-eval y |
| 600 | '((float 1 0) | 610 | (eval-when-compile |
| 601 | (float (bigpos 712 532 678 2) -7) | 611 | (list |
| 602 | (float (bigpos 853 264 927 5) -5) | 612 | '(float 1 0) |
| 603 | (float (bigpos 718 680 494 9) -3) | 613 | (math-read-number "267.8532712") |
| 604 | (float (bigpos 985 532 029 1) 0) | 614 | (math-read-number "59272.64853") |
| 605 | (float (bigpos 411 490 568 57) 0)))))))) | 615 | (math-read-number "9494680.718") |
| 616 | (math-read-number "1029532985.0") | ||
| 617 | (math-read-number "57568490411.0"))))))))) | ||
| 606 | 618 | ||
| 607 | (defun math-besJ1 (x &optional yflag) | 619 | (defun math-besJ1 (x &optional yflag) |
| 608 | (cond ((and (math-negp (calcFunc-re x)) (not yflag)) | 620 | (cond ((and (math-negp (calcFunc-re x)) (not yflag)) |
| @@ -610,25 +622,33 @@ | |||
| 610 | ((Math-lessp '(float 8 0) (math-abs-approx x)) | 622 | ((Math-lessp '(float 8 0) (math-abs-approx x)) |
| 611 | (let* ((z (math-div '(float 8 0) x)) | 623 | (let* ((z (math-div '(float 8 0) x)) |
| 612 | (y (math-sqr z)) | 624 | (y (math-sqr z)) |
| 613 | (xx (math-add x '(float (bigneg 491 194 356 2) -9))) | 625 | (xx (math-add x (eval-when-compile |
| 626 | (math-read-number "-2.356194491")))) | ||
| 614 | (a1 (math-poly-eval y | 627 | (a1 (math-poly-eval y |
| 615 | '((float (bigneg 019 337 240) -15) | 628 | (eval-when-compile |
| 616 | (float (bigpos 174 520 457 2) -15) | 629 | (list |
| 617 | (float (bigneg 496 396 516 3) -14) | 630 | (math-read-number "-0.000000240337019") |
| 618 | (float 183105 -8) | 631 | (math-read-number "0.000002457520174") |
| 619 | (float 1 0)))) | 632 | (math-read-number "-0.00003516396496") |
| 633 | '(float 183105 -8) | ||
| 634 | '(float 1 0))))) | ||
| 620 | (a2 (math-poly-eval y | 635 | (a2 (math-poly-eval y |
| 621 | '((float (bigpos 412 787 105) -15) | 636 | (eval-when-compile |
| 622 | (float (bigneg 987 228 88) -14) | 637 | (list |
| 623 | (float (bigpos 096 199 449 8) -15) | 638 | (math-read-number "0.000000105787412") |
| 624 | (float (bigneg 873 690 002 2) -13) | 639 | (math-read-number "-0.00000088228987") |
| 625 | (float (bigpos 995 499 687 4) -11)))) | 640 | (math-read-number "0.000008449199096") |
| 641 | (math-read-number "-0.0002002690873") | ||
| 642 | (math-read-number "0.04687499995"))))) | ||
| 626 | (sc (math-sin-cos-raw xx))) | 643 | (sc (math-sin-cos-raw xx))) |
| 627 | (if yflag | 644 | (if yflag |
| 628 | (setq sc (cons (math-neg (cdr sc)) (car sc))) | 645 | (setq sc (cons (math-neg (cdr sc)) (car sc))) |
| 629 | (if (math-negp x) | 646 | (if (math-negp x) |
| 630 | (setq sc (cons (math-neg (car sc)) (math-neg (cdr sc)))))) | 647 | (setq sc (cons (math-neg (car sc)) (math-neg (cdr sc)))))) |
| 631 | (math-mul (math-sqrt (math-div '(float (bigpos 722 619 636) -9) x)) | 648 | (math-mul (math-sqrt (math-div |
| 649 | (eval-when-compile | ||
| 650 | (math-read-number "0.636619722")) | ||
| 651 | x)) | ||
| 632 | (math-sub (math-mul (cdr sc) a1) | 652 | (math-sub (math-mul (cdr sc) a1) |
| 633 | (math-mul (car sc) (math-mul z a2)))))) | 653 | (math-mul (car sc) (math-mul z a2)))))) |
| 634 | (t | 654 | (t |
| @@ -636,20 +656,23 @@ | |||
| 636 | (math-mul | 656 | (math-mul |
| 637 | x | 657 | x |
| 638 | (math-div (math-poly-eval y | 658 | (math-div (math-poly-eval y |
| 639 | '((float (bigneg 606 036 016 3) -8) | 659 | (eval-when-compile |
| 640 | (float (bigpos 826 044 157) -4) | 660 | (list |
| 641 | (float (bigneg 439 611 972 2) -3) | 661 | (math-read-number "-30.16036606") |
| 642 | (float (bigpos 531 968 423 2) -1) | 662 | (math-read-number "15704.4826") |
| 643 | (float (bigneg 235 059 895 7) 0) | 663 | (math-read-number "-2972611.439") |
| 644 | (float (bigpos 232 614 362 72) 0))) | 664 | (math-read-number "242396853.1") |
| 665 | (math-read-number "-7895059235.0") | ||
| 666 | (math-read-number "72362614232.0")))) | ||
| 645 | (math-poly-eval y | 667 | (math-poly-eval y |
| 646 | '((float 1 0) | 668 | (eval-when-compile |
| 647 | (float (bigpos 397 991 769 3) -7) | 669 | (list |
| 648 | (float (bigpos 394 743 944 9) -5) | 670 | '(float 1 0) |
| 649 | (float (bigpos 474 330 858 1) -2) | 671 | (math-read-number "376.9991397") |
| 650 | (float (bigpos 178 535 300 2) 0) | 672 | (math-read-number "99447.43394") |
| 651 | (float (bigpos 442 228 725 144) | 673 | (math-read-number "18583304.74") |
| 652 | 0))))))))) | 674 | (math-read-number "2300535178.0") |
| 675 | (math-read-number "144725228442.0")))))))))) | ||
| 653 | 676 | ||
| 654 | (defun calcFunc-besY (v x) | 677 | (defun calcFunc-besY (v x) |
| 655 | (math-inexact-result) | 678 | (math-inexact-result) |
| @@ -690,20 +713,25 @@ | |||
| 690 | (let ((y (math-sqr x))) | 713 | (let ((y (math-sqr x))) |
| 691 | (math-add | 714 | (math-add |
| 692 | (math-div (math-poly-eval y | 715 | (math-div (math-poly-eval y |
| 693 | '((float (bigpos 733 622 284 2) -7) | 716 | (eval-when-compile |
| 694 | (float (bigneg 757 792 632 8) -5) | 717 | (list |
| 695 | (float (bigpos 129 988 087 1) -2) | 718 | (math-read-number "228.4622733") |
| 696 | (float (bigneg 036 598 123 5) -1) | 719 | (math-read-number "-86327.92757") |
| 697 | (float (bigpos 065 834 062 7) 0) | 720 | (math-read-number "10879881.29") |
| 698 | (float (bigneg 389 821 957 2) 0))) | 721 | (math-read-number "-512359803.6") |
| 722 | (math-read-number "7062834065.0") | ||
| 723 | (math-read-number "-2957821389.0")))) | ||
| 699 | (math-poly-eval y | 724 | (math-poly-eval y |
| 700 | '((float 1 0) | 725 | (eval-when-compile |
| 701 | (float (bigpos 244 030 261 2) -7) | 726 | (list |
| 702 | (float (bigpos 647 472 474) -4) | 727 | '(float 1 0) |
| 703 | (float (bigpos 438 466 189 7) -3) | 728 | (math-read-number "226.1030244") |
| 704 | (float (bigpos 648 499 452 7) -1) | 729 | (math-read-number "47447.2647") |
| 705 | (float (bigpos 269 544 076 40) 0)))) | 730 | (math-read-number "7189466.438") |
| 706 | (math-mul '(float (bigpos 772 619 636) -9) | 731 | (math-read-number "745249964.8") |
| 732 | (math-read-number "40076544269.0"))))) | ||
| 733 | (math-mul (eval-when-compile | ||
| 734 | (math-read-number "0.636619772")) | ||
| 707 | (math-mul (math-besJ0 x) (math-ln-raw x)))))) | 735 | (math-mul (math-besJ0 x) (math-ln-raw x)))))) |
| 708 | ((math-negp (calcFunc-re x)) | 736 | ((math-negp (calcFunc-re x)) |
| 709 | (math-add (math-besJ0 (math-neg x) t) | 737 | (math-add (math-besJ0 (math-neg x) t) |
| @@ -719,22 +747,26 @@ | |||
| 719 | (math-mul | 747 | (math-mul |
| 720 | x | 748 | x |
| 721 | (math-div (math-poly-eval y | 749 | (math-div (math-poly-eval y |
| 722 | '((float (bigpos 935 937 511 8) -6) | 750 | (eval-when-compile |
| 723 | (float (bigneg 726 922 237 4) -3) | 751 | (list |
| 724 | (float (bigpos 551 264 349 7) -1) | 752 | (math-read-number "8511.937935") |
| 725 | (float (bigneg 139 438 153 5) 1) | 753 | (math-read-number "-4237922.726") |
| 726 | (float (bigpos 439 527 127) 4) | 754 | (math-read-number "734926455.1") |
| 727 | (float (bigneg 943 604 900 4) 3))) | 755 | (math-read-number "-51534381390.0") |
| 756 | (math-read-number "1275274390000.0") | ||
| 757 | (math-read-number "-4900604943000.0")))) | ||
| 728 | (math-poly-eval y | 758 | (math-poly-eval y |
| 729 | '((float 1 0) | 759 | (eval-when-compile |
| 730 | (float (bigpos 885 632 549 3) -7) | 760 | (list |
| 731 | (float (bigpos 605 042 102) -3) | 761 | '(float 1 0) |
| 732 | (float (bigpos 002 904 245 2) -2) | 762 | (math-read-number "354.9632885") |
| 733 | (float (bigpos 367 650 733 3) 0) | 763 | (math-read-number "102042.605") |
| 734 | (float (bigpos 664 419 244 4) 2) | 764 | (math-read-number "22459040.02") |
| 735 | (float (bigpos 057 958 249) 5))))) | 765 | (math-read-number "3733650367.0") |
| 736 | (math-mul '(float (bigpos 772 619 636) -9) | 766 | (math-read-number "424441966400.0") |
| 737 | (math-sub (math-mul (math-besJ1 x) (math-ln-raw x)) | 767 | (math-read-number "24995805700000.0")))))) |
| 768 | (math-mul (eval-when-compile (math-read-number "0.636619772")) | ||
| 769 | (math-sub (math-mul (math-besJ1 x) (math-ln-raw x)) | ||
| 738 | (math-div 1 x)))))) | 770 | (math-div 1 x)))))) |
| 739 | ((math-negp (calcFunc-re x)) | 771 | ((math-negp (calcFunc-re x)) |
| 740 | (math-neg | 772 | (math-neg |
| @@ -799,16 +831,40 @@ | |||
| 799 | (calcFunc-euler n '(float 5 -1))) | 831 | (calcFunc-euler n '(float 5 -1))) |
| 800 | (calcFunc-euler n '(frac 1 2)))))) | 832 | (calcFunc-euler n '(frac 1 2)))))) |
| 801 | 833 | ||
| 802 | (defvar math-bernoulli-b-cache '((frac -174611 | 834 | (defvar math-bernoulli-b-cache |
| 803 | (bigpos 0 200 291 698 662 857 802)) | 835 | (eval-when-compile |
| 804 | (frac 43867 (bigpos 0 944 170 217 94 109 5)) | 836 | (list |
| 805 | (frac -3617 (bigpos 0 880 842 622 670 10)) | 837 | (list 'frac |
| 806 | (frac 1 (bigpos 600 249 724 74)) | 838 | -174611 |
| 807 | (frac -691 (bigpos 0 368 674 307 1)) | 839 | (math-read-number "802857662698291200000")) |
| 808 | (frac 1 (bigpos 160 900 47)) | 840 | (list 'frac |
| 809 | (frac -1 (bigpos 600 209 1)) | 841 | 43867 |
| 810 | (frac 1 30240) (frac -1 720) | 842 | (math-read-number "5109094217170944000")) |
| 811 | (frac 1 12) 1 )) | 843 | (list 'frac |
| 844 | -3617 | ||
| 845 | (math-read-number "10670622842880000")) | ||
| 846 | (list 'frac | ||
| 847 | 1 | ||
| 848 | (math-read-number "74724249600")) | ||
| 849 | (list 'frac | ||
| 850 | -691 | ||
| 851 | (math-read-number "1307674368000")) | ||
| 852 | (list 'frac | ||
| 853 | 1 | ||
| 854 | (math-read-number "47900160")) | ||
| 855 | (list 'frac | ||
| 856 | -1 | ||
| 857 | (math-read-number "1209600")) | ||
| 858 | (list 'frac | ||
| 859 | 1 | ||
| 860 | 30240) | ||
| 861 | (list 'frac | ||
| 862 | -1 | ||
| 863 | 720) | ||
| 864 | (list 'frac | ||
| 865 | 1 | ||
| 866 | 12) | ||
| 867 | 1 ))) | ||
| 812 | 868 | ||
| 813 | (defvar math-bernoulli-B-cache '((frac -174611 330) (frac 43867 798) | 869 | (defvar math-bernoulli-B-cache '((frac -174611 330) (frac 43867 798) |
| 814 | (frac -3617 510) (frac 7 6) (frac -691 2730) | 870 | (frac -3617 510) (frac 7 6) (frac -691 2730) |