Module: MPC::Math
- Defined in:
- ext/mpc/ruby_mpc.c
Class Method Summary collapse
-
.acos ⇒ Object
mpc_acos(ret, p1, rnd).
-
.acosh ⇒ Object
mpc_acosh(ret, p1, rnd).
-
.add(*args) ⇒ Object
Return self + p1.
-
.asin ⇒ Object
mpc_asin(ret, p1, rnd).
-
.asinh ⇒ Object
mpc_asinh(ret, p1, rnd).
-
.atan ⇒ Object
mpc_atan(ret, p1, rnd).
-
.atanh ⇒ Object
mpc_atanh(ret, p1, rnd).
-
.cos ⇒ Object
mpc_cos(ret, p1, rnd).
-
.cosh ⇒ Object
mpc_cosh(ret, p1, rnd).
-
.div(*args) ⇒ Object
Return self / p1.
-
.div_2exp ⇒ Object
mpc_div_2exp(ret, p1, p2, rnd).
-
.exp ⇒ Object
mpc_exp(ret, p1, rnd).
-
.log ⇒ Object
mpc_log(ret, p1, rnd).
-
.mul(*args) ⇒ Object
Return self * p1.
-
.mul_2exp ⇒ Object
mpc_mul_2exp(ret, p1, p2, rnd).
-
.pow(*args) ⇒ Object
mpc_pow(ret, p1, p2, rnd), mpc_pow_fr(ret, p1, p2, rnd) etc.
-
.sin ⇒ Object
mpc_sin(ret, p1, rnd).
-
.sinh ⇒ Object
mpc_sinh(ret, p1, rnd).
-
.sqr ⇒ Object
mpc_sqr(ret, p1, rnd).
-
.sqrt ⇒ Object
mpc_sqrt(ret, p1, rnd).
-
.sub(*args) ⇒ Object
Return self - p1.
-
.tan ⇒ Object
mpc_tan(ret, p1, rnd).
-
.tanh ⇒ Object
mpc_tanh(ret, p1, rnd).
Class Method Details
.acos ⇒ Object
mpc_acos(ret, p1, rnd)
868 869 870 871 872 873 874 875 876 877 878 879 880 881 |
# File 'ext/mpc/ruby_mpc.c', line 868
static VALUE r_mpc_math_acos (int argc, VALUE *argv, VALUE self)
{
mpc_rnd_t rnd;
mp_prec_t prec;
MPC *ptr_arg, *ptr_return;
VALUE val_ret;
volatile VALUE tmp_argv0;
r_mpc_get_rnd_prec_from_optional_arguments(&rnd, &prec, 1, 3, argc, argv);
tmp_argv0 = r_mpc_new_c_obj(argv[0]);
r_mpc_get_struct(ptr_arg, tmp_argv0);
r_mpc_make_struct_init2(val_ret, ptr_return, prec);
r_mpc_set_c_function_state(mpc_acos(ptr_return, ptr_arg, rnd));
return val_ret;
}
|
.acosh ⇒ Object
mpc_acosh(ret, p1, rnd)
916 917 918 919 920 921 922 923 924 925 926 927 928 929 |
# File 'ext/mpc/ruby_mpc.c', line 916
static VALUE r_mpc_math_acosh (int argc, VALUE *argv, VALUE self)
{
mpc_rnd_t rnd;
mp_prec_t prec;
MPC *ptr_arg, *ptr_return;
VALUE val_ret;
volatile VALUE tmp_argv0;
r_mpc_get_rnd_prec_from_optional_arguments(&rnd, &prec, 1, 3, argc, argv);
tmp_argv0 = r_mpc_new_c_obj(argv[0]);
r_mpc_get_struct(ptr_arg, tmp_argv0);
r_mpc_make_struct_init2(val_ret, ptr_return, prec);
r_mpc_set_c_function_state(mpc_acosh(ptr_return, ptr_arg, rnd));
return val_ret;
}
|
.add(*args) ⇒ Object
Return self + p1.
497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 |
# File 'ext/mpc/ruby_mpc.c', line 497
static VALUE r_mpc_math_add(int argc, VALUE *argv, VALUE self)
{
mp_rnd_t rnd;
mp_prec_t prec;
MPC *ptr_arg1, *ptr_return;
VALUE val_ret;
volatile VALUE tmp_argv0;
r_mpc_get_rnd_prec_from_optional_arguments(&rnd, &prec, 2, 4, argc, argv);
tmp_argv0 = r_mpc_new_c_obj(argv[0]);
r_mpc_get_struct(ptr_arg1, tmp_argv0);
r_mpc_make_struct_init2(val_ret, ptr_return, prec);
if(RTEST(rb_funcall(__mpc_class__, eqq, 1, argv[1]))){
MPC *ptr_arg2;
r_mpc_get_struct(ptr_arg2, argv[1]);
mpc_add(ptr_return, ptr_arg1, ptr_arg2, rnd);
}else if(RTEST(rb_funcall(__mpfr_class__, eqq, 1, argv[1]))){
MPFR *ptr_arg2;
r_mpfr_get_struct(ptr_arg2, argv[1]);
r_mpc_set_c_function_state(mpc_add_fr(ptr_return, ptr_arg1, ptr_arg2, rnd));
}else if(TYPE(argv[1]) == T_FIXNUM){
mpc_add_si(ptr_return, ptr_arg1, FIX2LONG(argv[1]), rnd);
}else{
MPC *ptr_arg2;
r_mpc_get_struct(ptr_arg2, rb_funcall(__mpc_class__, new, 1, argv[1]));
mpc_add(ptr_return, ptr_arg1, ptr_arg2, rnd);
}
return val_ret;
}
|
.asin ⇒ Object
mpc_asin(ret, p1, rnd)
852 853 854 855 856 857 858 859 860 861 862 863 864 865 |
# File 'ext/mpc/ruby_mpc.c', line 852
static VALUE r_mpc_math_asin (int argc, VALUE *argv, VALUE self)
{
mpc_rnd_t rnd;
mp_prec_t prec;
MPC *ptr_arg, *ptr_return;
VALUE val_ret;
volatile VALUE tmp_argv0;
r_mpc_get_rnd_prec_from_optional_arguments(&rnd, &prec, 1, 3, argc, argv);
tmp_argv0 = r_mpc_new_c_obj(argv[0]);
r_mpc_get_struct(ptr_arg, tmp_argv0);
r_mpc_make_struct_init2(val_ret, ptr_return, prec);
r_mpc_set_c_function_state(mpc_asin(ptr_return, ptr_arg, rnd));
return val_ret;
}
|
.asinh ⇒ Object
mpc_asinh(ret, p1, rnd)
900 901 902 903 904 905 906 907 908 909 910 911 912 913 |
# File 'ext/mpc/ruby_mpc.c', line 900
static VALUE r_mpc_math_asinh (int argc, VALUE *argv, VALUE self)
{
mpc_rnd_t rnd;
mp_prec_t prec;
MPC *ptr_arg, *ptr_return;
VALUE val_ret;
volatile VALUE tmp_argv0;
r_mpc_get_rnd_prec_from_optional_arguments(&rnd, &prec, 1, 3, argc, argv);
tmp_argv0 = r_mpc_new_c_obj(argv[0]);
r_mpc_get_struct(ptr_arg, tmp_argv0);
r_mpc_make_struct_init2(val_ret, ptr_return, prec);
r_mpc_set_c_function_state(mpc_asinh(ptr_return, ptr_arg, rnd));
return val_ret;
}
|
.atan ⇒ Object
mpc_atan(ret, p1, rnd)
884 885 886 887 888 889 890 891 892 893 894 895 896 897 |
# File 'ext/mpc/ruby_mpc.c', line 884
static VALUE r_mpc_math_atan (int argc, VALUE *argv, VALUE self)
{
mpc_rnd_t rnd;
mp_prec_t prec;
MPC *ptr_arg, *ptr_return;
VALUE val_ret;
volatile VALUE tmp_argv0;
r_mpc_get_rnd_prec_from_optional_arguments(&rnd, &prec, 1, 3, argc, argv);
tmp_argv0 = r_mpc_new_c_obj(argv[0]);
r_mpc_get_struct(ptr_arg, tmp_argv0);
r_mpc_make_struct_init2(val_ret, ptr_return, prec);
r_mpc_set_c_function_state(mpc_atan(ptr_return, ptr_arg, rnd));
return val_ret;
}
|
.atanh ⇒ Object
mpc_atanh(ret, p1, rnd)
932 933 934 935 936 937 938 939 940 941 942 943 944 945 |
# File 'ext/mpc/ruby_mpc.c', line 932
static VALUE r_mpc_math_atanh (int argc, VALUE *argv, VALUE self)
{
mpc_rnd_t rnd;
mp_prec_t prec;
MPC *ptr_arg, *ptr_return;
VALUE val_ret;
volatile VALUE tmp_argv0;
r_mpc_get_rnd_prec_from_optional_arguments(&rnd, &prec, 1, 3, argc, argv);
tmp_argv0 = r_mpc_new_c_obj(argv[0]);
r_mpc_get_struct(ptr_arg, tmp_argv0);
r_mpc_make_struct_init2(val_ret, ptr_return, prec);
r_mpc_set_c_function_state(mpc_atanh(ptr_return, ptr_arg, rnd));
return val_ret;
}
|
.cos ⇒ Object
mpc_cos(ret, p1, rnd)
772 773 774 775 776 777 778 779 780 781 782 783 784 785 |
# File 'ext/mpc/ruby_mpc.c', line 772
static VALUE r_mpc_math_cos (int argc, VALUE *argv, VALUE self)
{
mpc_rnd_t rnd;
mp_prec_t prec;
MPC *ptr_arg, *ptr_return;
VALUE val_ret;
volatile VALUE tmp_argv0;
r_mpc_get_rnd_prec_from_optional_arguments(&rnd, &prec, 1, 3, argc, argv);
tmp_argv0 = r_mpc_new_c_obj(argv[0]);
r_mpc_get_struct(ptr_arg, tmp_argv0);
r_mpc_make_struct_init2(val_ret, ptr_return, prec);
r_mpc_set_c_function_state(mpc_cos(ptr_return, ptr_arg, rnd));
return val_ret;
}
|
.cosh ⇒ Object
mpc_cosh(ret, p1, rnd)
820 821 822 823 824 825 826 827 828 829 830 831 832 833 |
# File 'ext/mpc/ruby_mpc.c', line 820
static VALUE r_mpc_math_cosh (int argc, VALUE *argv, VALUE self)
{
mpc_rnd_t rnd;
mp_prec_t prec;
MPC *ptr_arg, *ptr_return;
VALUE val_ret;
volatile VALUE tmp_argv0;
r_mpc_get_rnd_prec_from_optional_arguments(&rnd, &prec, 1, 3, argc, argv);
tmp_argv0 = r_mpc_new_c_obj(argv[0]);
r_mpc_get_struct(ptr_arg, tmp_argv0);
r_mpc_make_struct_init2(val_ret, ptr_return, prec);
r_mpc_set_c_function_state(mpc_cosh(ptr_return, ptr_arg, rnd));
return val_ret;
}
|
.div(*args) ⇒ Object
Return self / p1.
595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 |
# File 'ext/mpc/ruby_mpc.c', line 595
static VALUE r_mpc_math_div(int argc, VALUE *argv, VALUE self)
{
mp_rnd_t rnd;
mp_prec_t prec;
MPC *ptr_arg1, *ptr_return;
VALUE val_ret;
volatile VALUE tmp_argv0;
r_mpc_get_rnd_prec_from_optional_arguments(&rnd, &prec, 2, 4, argc, argv);
tmp_argv0 = r_mpc_new_c_obj(argv[0]);
r_mpc_get_struct(ptr_arg1, tmp_argv0);
r_mpc_make_struct_init2(val_ret, ptr_return, prec);
if(RTEST(rb_funcall(__mpc_class__, eqq, 1, argv[1]))){
MPC *ptr_arg2;
r_mpc_get_struct(ptr_arg2, argv[1]);
mpc_div(ptr_return, ptr_arg1, ptr_arg2, rnd);
}else if(RTEST(rb_funcall(__mpfr_class__, eqq, 1, argv[1]))){
MPFR *ptr_arg2;
r_mpfr_get_struct(ptr_arg2, argv[1]);
r_mpc_set_c_function_state(mpc_div_fr(ptr_return, ptr_arg1, ptr_arg2, rnd));
}else{
MPC *ptr_arg2;
r_mpc_get_struct(ptr_arg2, rb_funcall(__mpc_class__, new, 1, argv[1]));
mpc_div(ptr_return, ptr_arg1, ptr_arg2, rnd);
}
return val_ret;
}
|
.div_2exp ⇒ Object
mpc_div_2exp(ret, p1, p2, rnd)
641 642 643 644 645 646 647 648 649 650 651 652 653 654 |
# File 'ext/mpc/ruby_mpc.c', line 641
static VALUE r_mpc_math_div_2exp (int argc, VALUE *argv, VALUE self)
{
mpc_rnd_t rnd;
mp_prec_t prec;
MPC *ptr_arg, *ptr_return;
VALUE val_ret;
volatile VALUE tmp_argv0;
r_mpc_get_rnd_prec_from_optional_arguments(&rnd, &prec, 2, 4, argc, argv);
tmp_argv0 = r_mpc_new_c_obj(argv[0]);
r_mpc_get_struct(ptr_arg, tmp_argv0);
r_mpc_make_struct_init2(val_ret, ptr_return, prec);
r_mpc_set_c_function_state(mpc_div_2exp(ptr_return, ptr_arg, NUM2LONG(argv[1]), rnd));
return val_ret;
}
|
.exp ⇒ Object
mpc_exp(ret, p1, rnd)
724 725 726 727 728 729 730 731 732 733 734 735 736 737 |
# File 'ext/mpc/ruby_mpc.c', line 724
static VALUE r_mpc_math_exp (int argc, VALUE *argv, VALUE self)
{
mpc_rnd_t rnd;
mp_prec_t prec;
MPC *ptr_arg, *ptr_return;
VALUE val_ret;
volatile VALUE tmp_argv0;
r_mpc_get_rnd_prec_from_optional_arguments(&rnd, &prec, 1, 3, argc, argv);
tmp_argv0 = r_mpc_new_c_obj(argv[0]);
r_mpc_get_struct(ptr_arg, tmp_argv0);
r_mpc_make_struct_init2(val_ret, ptr_return, prec);
r_mpc_set_c_function_state(mpc_exp(ptr_return, ptr_arg, rnd));
return val_ret;
}
|
.log ⇒ Object
mpc_log(ret, p1, rnd)
740 741 742 743 744 745 746 747 748 749 750 751 752 753 |
# File 'ext/mpc/ruby_mpc.c', line 740
static VALUE r_mpc_math_log (int argc, VALUE *argv, VALUE self)
{
mpc_rnd_t rnd;
mp_prec_t prec;
MPC *ptr_arg, *ptr_return;
VALUE val_ret;
volatile VALUE tmp_argv0;
r_mpc_get_rnd_prec_from_optional_arguments(&rnd, &prec, 1, 3, argc, argv);
tmp_argv0 = r_mpc_new_c_obj(argv[0]);
r_mpc_get_struct(ptr_arg, tmp_argv0);
r_mpc_make_struct_init2(val_ret, ptr_return, prec);
r_mpc_set_c_function_state(mpc_log(ptr_return, ptr_arg, rnd));
return val_ret;
}
|
.mul(*args) ⇒ Object
Return self * p1.
564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 |
# File 'ext/mpc/ruby_mpc.c', line 564
static VALUE r_mpc_math_mul(int argc, VALUE *argv, VALUE self)
{
mp_rnd_t rnd;
mp_prec_t prec;
MPC *ptr_arg1, *ptr_return;
VALUE val_ret;
volatile VALUE tmp_argv0;
r_mpc_get_rnd_prec_from_optional_arguments(&rnd, &prec, 2, 4, argc, argv);
tmp_argv0 = r_mpc_new_c_obj(argv[0]);
r_mpc_get_struct(ptr_arg1, tmp_argv0);
r_mpc_make_struct_init2(val_ret, ptr_return, prec);
if(RTEST(rb_funcall(__mpc_class__, eqq, 1, argv[1]))){
MPC *ptr_arg2;
r_mpc_get_struct(ptr_arg2, argv[1]);
mpc_mul(ptr_return, ptr_arg1, ptr_arg2, rnd);
}else if(RTEST(rb_funcall(__mpfr_class__, eqq, 1, argv[1]))){
MPFR *ptr_arg2;
r_mpfr_get_struct(ptr_arg2, argv[1]);
r_mpc_set_c_function_state(mpc_mul_fr(ptr_return, ptr_arg1, ptr_arg2, rnd));
}else if(TYPE(argv[1]) == T_FIXNUM){
mpc_mul_si(ptr_return, ptr_arg1, FIX2LONG(argv[1]), rnd);
}else{
MPC *ptr_arg2;
r_mpc_get_struct(ptr_arg2, rb_funcall(__mpc_class__, new, 1, argv[1]));
mpc_mul(ptr_return, ptr_arg1, ptr_arg2, rnd);
}
return val_ret;
}
|
.mul_2exp ⇒ Object
mpc_mul_2exp(ret, p1, p2, rnd)
625 626 627 628 629 630 631 632 633 634 635 636 637 638 |
# File 'ext/mpc/ruby_mpc.c', line 625
static VALUE r_mpc_math_mul_2exp (int argc, VALUE *argv, VALUE self)
{
mpc_rnd_t rnd;
mp_prec_t prec;
MPC *ptr_arg, *ptr_return;
VALUE val_ret;
volatile VALUE tmp_argv0;
r_mpc_get_rnd_prec_from_optional_arguments(&rnd, &prec, 2, 4, argc, argv);
tmp_argv0 = r_mpc_new_c_obj(argv[0]);
r_mpc_get_struct(ptr_arg, tmp_argv0);
r_mpc_make_struct_init2(val_ret, ptr_return, prec);
r_mpc_set_c_function_state(mpc_mul_2exp(ptr_return, ptr_arg, NUM2LONG(argv[1]), rnd));
return val_ret;
}
|
.pow(*args) ⇒ Object
mpc_pow(ret, p1, p2, rnd), mpc_pow_fr(ret, p1, p2, rnd) etc.
690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 |
# File 'ext/mpc/ruby_mpc.c', line 690
static VALUE r_mpc_math_pow(int argc, VALUE *argv, VALUE self)
{
mp_rnd_t rnd;
mp_prec_t prec;
MPC *ptr_arg1, *ptr_return;
VALUE val_ret;
volatile VALUE tmp_argv0;
r_mpc_get_rnd_prec_from_optional_arguments(&rnd, &prec, 2, 4, argc, argv);
tmp_argv0 = r_mpc_new_c_obj(argv[0]);
r_mpc_get_struct(ptr_arg1, tmp_argv0);
r_mpc_make_struct_init2(val_ret, ptr_return, prec);
if(RTEST(rb_funcall(__mpc_class__, eqq, 1, argv[1]))){
MPC *ptr_arg2;
r_mpc_get_struct(ptr_arg2, argv[1]);
mpc_pow(ptr_return, ptr_arg1, ptr_arg2, rnd);
}else if(RTEST(rb_funcall(__mpfr_class__, eqq, 1, argv[1]))){
MPFR *ptr_arg2;
r_mpfr_get_struct(ptr_arg2, argv[1]);
r_mpc_set_c_function_state(mpc_pow_fr(ptr_return, ptr_arg1, ptr_arg2, rnd));
}else if(TYPE(argv[1]) == T_FLOAT){
mpc_pow_d(ptr_return, ptr_arg1, NUM2DBL(argv[1]), rnd);
}else if(TYPE(argv[1]) == T_FIXNUM){
mpc_pow_si(ptr_return, ptr_arg1, FIX2LONG(argv[1]), rnd);
}else{
MPC *ptr_arg2;
r_mpc_get_struct(ptr_arg2, rb_funcall(__mpc_class__, new, 1, argv[1]));
mpc_pow(ptr_return, ptr_arg1, ptr_arg2, rnd);
}
return val_ret;
}
|
.sin ⇒ Object
mpc_sin(ret, p1, rnd)
756 757 758 759 760 761 762 763 764 765 766 767 768 769 |
# File 'ext/mpc/ruby_mpc.c', line 756
static VALUE r_mpc_math_sin (int argc, VALUE *argv, VALUE self)
{
mpc_rnd_t rnd;
mp_prec_t prec;
MPC *ptr_arg, *ptr_return;
VALUE val_ret;
volatile VALUE tmp_argv0;
r_mpc_get_rnd_prec_from_optional_arguments(&rnd, &prec, 1, 3, argc, argv);
tmp_argv0 = r_mpc_new_c_obj(argv[0]);
r_mpc_get_struct(ptr_arg, tmp_argv0);
r_mpc_make_struct_init2(val_ret, ptr_return, prec);
r_mpc_set_c_function_state(mpc_sin(ptr_return, ptr_arg, rnd));
return val_ret;
}
|
.sinh ⇒ Object
mpc_sinh(ret, p1, rnd)
804 805 806 807 808 809 810 811 812 813 814 815 816 817 |
# File 'ext/mpc/ruby_mpc.c', line 804
static VALUE r_mpc_math_sinh (int argc, VALUE *argv, VALUE self)
{
mpc_rnd_t rnd;
mp_prec_t prec;
MPC *ptr_arg, *ptr_return;
VALUE val_ret;
volatile VALUE tmp_argv0;
r_mpc_get_rnd_prec_from_optional_arguments(&rnd, &prec, 1, 3, argc, argv);
tmp_argv0 = r_mpc_new_c_obj(argv[0]);
r_mpc_get_struct(ptr_arg, tmp_argv0);
r_mpc_make_struct_init2(val_ret, ptr_return, prec);
r_mpc_set_c_function_state(mpc_sinh(ptr_return, ptr_arg, rnd));
return val_ret;
}
|
.sqr ⇒ Object
mpc_sqr(ret, p1, rnd)
658 659 660 661 662 663 664 665 666 667 668 669 670 671 |
# File 'ext/mpc/ruby_mpc.c', line 658
static VALUE r_mpc_math_sqr (int argc, VALUE *argv, VALUE self)
{
mpc_rnd_t rnd;
mp_prec_t prec;
MPC *ptr_arg, *ptr_return;
VALUE val_ret;
volatile VALUE tmp_argv0;
r_mpc_get_rnd_prec_from_optional_arguments(&rnd, &prec, 1, 3, argc, argv);
tmp_argv0 = r_mpc_new_c_obj(argv[0]);
r_mpc_get_struct(ptr_arg, tmp_argv0);
r_mpc_make_struct_init2(val_ret, ptr_return, prec);
r_mpc_set_c_function_state(mpc_sqr(ptr_return, ptr_arg, rnd));
return val_ret;
}
|
.sqrt ⇒ Object
mpc_sqrt(ret, p1, rnd)
674 675 676 677 678 679 680 681 682 683 684 685 686 687 |
# File 'ext/mpc/ruby_mpc.c', line 674
static VALUE r_mpc_math_sqrt (int argc, VALUE *argv, VALUE self)
{
mpc_rnd_t rnd;
mp_prec_t prec;
MPC *ptr_arg, *ptr_return;
VALUE val_ret;
volatile VALUE tmp_argv0;
r_mpc_get_rnd_prec_from_optional_arguments(&rnd, &prec, 1, 3, argc, argv);
tmp_argv0 = r_mpc_new_c_obj(argv[0]);
r_mpc_get_struct(ptr_arg, tmp_argv0);
r_mpc_make_struct_init2(val_ret, ptr_return, prec);
r_mpc_set_c_function_state(mpc_sqrt(ptr_return, ptr_arg, rnd));
return val_ret;
}
|
.sub(*args) ⇒ Object
Return self - p1.
528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 |
# File 'ext/mpc/ruby_mpc.c', line 528
static VALUE r_mpc_math_sub(int argc, VALUE *argv, VALUE self)
{
mp_rnd_t rnd;
mp_prec_t prec;
MPC *ptr_arg1, *ptr_return;
VALUE val_ret;
volatile VALUE tmp_argv0;
r_mpc_get_rnd_prec_from_optional_arguments(&rnd, &prec, 2, 4, argc, argv);
tmp_argv0 = r_mpc_new_c_obj(argv[0]);
r_mpc_get_struct(ptr_arg1, tmp_argv0);
r_mpc_make_struct_init2(val_ret, ptr_return, prec);
if(RTEST(rb_funcall(__mpc_class__, eqq, 1, argv[1]))){
MPC *ptr_arg2;
r_mpc_get_struct(ptr_arg2, argv[1]);
mpc_sub(ptr_return, ptr_arg1, ptr_arg2, rnd);
}else if(RTEST(rb_funcall(__mpfr_class__, eqq, 1, argv[1]))){
MPFR *ptr_arg2;
r_mpfr_get_struct(ptr_arg2, argv[1]);
r_mpc_set_c_function_state(mpc_sub_fr(ptr_return, ptr_arg1, ptr_arg2, rnd));
}else if(TYPE(argv[1]) == T_FIXNUM){
int other = FIX2LONG(argv[1]);
if (other >= 0) {
mpc_sub_ui(ptr_return, ptr_arg1, other, rnd);
} else {
mpc_add_ui(ptr_return, ptr_arg1, -other, rnd);
}
}else{
MPC *ptr_arg2;
r_mpc_get_struct(ptr_arg2, rb_funcall(__mpc_class__, new, 1, argv[1]));
mpc_sub(ptr_return, ptr_arg1, ptr_arg2, rnd);
}
return val_ret;
}
|
.tan ⇒ Object
mpc_tan(ret, p1, rnd)
788 789 790 791 792 793 794 795 796 797 798 799 800 801 |
# File 'ext/mpc/ruby_mpc.c', line 788
static VALUE r_mpc_math_tan (int argc, VALUE *argv, VALUE self)
{
mpc_rnd_t rnd;
mp_prec_t prec;
MPC *ptr_arg, *ptr_return;
VALUE val_ret;
volatile VALUE tmp_argv0;
r_mpc_get_rnd_prec_from_optional_arguments(&rnd, &prec, 1, 3, argc, argv);
tmp_argv0 = r_mpc_new_c_obj(argv[0]);
r_mpc_get_struct(ptr_arg, tmp_argv0);
r_mpc_make_struct_init2(val_ret, ptr_return, prec);
r_mpc_set_c_function_state(mpc_tan(ptr_return, ptr_arg, rnd));
return val_ret;
}
|
.tanh ⇒ Object
mpc_tanh(ret, p1, rnd)
836 837 838 839 840 841 842 843 844 845 846 847 848 849 |
# File 'ext/mpc/ruby_mpc.c', line 836
static VALUE r_mpc_math_tanh (int argc, VALUE *argv, VALUE self)
{
mpc_rnd_t rnd;
mp_prec_t prec;
MPC *ptr_arg, *ptr_return;
VALUE val_ret;
volatile VALUE tmp_argv0;
r_mpc_get_rnd_prec_from_optional_arguments(&rnd, &prec, 1, 3, argc, argv);
tmp_argv0 = r_mpc_new_c_obj(argv[0]);
r_mpc_get_struct(ptr_arg, tmp_argv0);
r_mpc_make_struct_init2(val_ret, ptr_return, prec);
r_mpc_set_c_function_state(mpc_tanh(ptr_return, ptr_arg, rnd));
return val_ret;
}
|