ruby-mpfi 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +13 -0
- data/Gemfile +4 -0
- data/README.rdoc +4 -4
- data/Rakefile +2 -45
- data/ext/mpfi/extconf.rb +11 -0
- data/ext/mpfi/ruby_mpfi.c +79 -63
- data/ext/mpfi_complex/mpfi/extconf.rb +11 -0
- data/ext/mpfi_complex/mpfi/ruby_mpfi_complex.c +14 -12
- data/ext/mpfi_matrix/mpfi/extconf.rb +14 -0
- data/ext/mpfi_matrix/mpfi/func_mpfi_matrix.c +17 -17
- data/ext/mpfi_matrix/mpfi/ruby_mpfi_matrix.c +91 -78
- data/lib/mpfi/version.rb +3 -1
- data/ruby-mpfi.gemspec +19 -31
- data/spec/mpfi/marshal_spec.rb +18 -0
- data/spec/mpfi_matrix/mpfi_matrix_marshal_spec.rb +65 -0
- metadata +65 -72
- data/.gemtest +0 -0
- data/Manifest.txt +0 -55
- data/PostInstall.txt +0 -7
- data/ext/mpfi/ruby_mpfr.h +0 -44
- data/ext/mpfi_complex/mpfi/ruby_mpfi.h +0 -42
- data/ext/mpfi_complex/mpfi/ruby_mpfr.h +0 -44
- data/ext/mpfi_matrix/mpfi/func_mpfr_matrix.h +0 -72
- data/ext/mpfi_matrix/mpfi/ruby_mpfi.h +0 -42
- data/ext/mpfi_matrix/mpfi/ruby_mpfr.h +0 -44
- data/ext/mpfi_matrix/mpfi/ruby_mpfr_matrix.h +0 -13
- data/tasks/extconf.rake +0 -36
    
        data/.gitignore
    ADDED
    
    
    
        data/Gemfile
    ADDED
    
    
    
        data/README.rdoc
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            = ruby-mpfi
         | 
| 2 2 |  | 
| 3 | 
            -
            *  | 
| 4 | 
            -
            * http:// | 
| 3 | 
            +
            * https://github.com/ytaka/ruby-mpfi/
         | 
| 4 | 
            +
            * http://rubygems.org/gems/ruby-mpfi/
         | 
| 5 5 |  | 
| 6 6 | 
             
            == Description:
         | 
| 7 7 |  | 
| @@ -27,7 +27,7 @@ You must require 'mpfr' to use 'mpfi'. | |
| 27 27 | 
             
            == Requirements:
         | 
| 28 28 |  | 
| 29 29 | 
             
            * Ruby[http://www.ruby-lang.org/] 1.9.1 or later
         | 
| 30 | 
            -
            * MPFR[http://www.mpfr.org/]  | 
| 30 | 
            +
            * MPFR[http://www.mpfr.org/] 3.0.0 or later
         | 
| 31 31 | 
             
            * MPFI[http://gforge.inria.fr/projects/mpfi/] 1.3.4 or later
         | 
| 32 32 | 
             
            * ruby-mpfr
         | 
| 33 33 |  | 
| @@ -36,7 +36,7 @@ The package of rubygems of ruby-mpfr is provided. | |
| 36 36 | 
             
            You can install ruby-mpfr with the following command
         | 
| 37 37 | 
             
            in the system satisfying the above requirements.
         | 
| 38 38 |  | 
| 39 | 
            -
             $  | 
| 39 | 
            +
             $ gem install ruby-mpfi
         | 
| 40 40 |  | 
| 41 41 | 
             
            == License:
         | 
| 42 42 |  | 
    
        data/Rakefile
    CHANGED
    
    | @@ -1,45 +1,2 @@ | |
| 1 | 
            -
            require  | 
| 2 | 
            -
             | 
| 3 | 
            -
            require 'hoe'
         | 
| 4 | 
            -
            require 'fileutils'
         | 
| 5 | 
            -
            require './lib/mpfi/version.rb'
         | 
| 6 | 
            -
             | 
| 7 | 
            -
            Hoe.plugin :newgem
         | 
| 8 | 
            -
            # Hoe.plugin :website
         | 
| 9 | 
            -
            # Hoe.plugin :cucumberfeatures
         | 
| 10 | 
            -
             | 
| 11 | 
            -
            # Generate all the Rake tasks
         | 
| 12 | 
            -
            # Run 'rake -T' to see list of generated tasks (from gem root directory)
         | 
| 13 | 
            -
            $hoe = Hoe.spec 'ruby-mpfi' do
         | 
| 14 | 
            -
              self.developer 'Takayuki YAMAGUCHI', 'd@ytak.info'
         | 
| 15 | 
            -
              self.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required
         | 
| 16 | 
            -
              self.rubyforge_name       = self.name # TODO this is default value
         | 
| 17 | 
            -
              self.extra_deps         = [['ruby-mpfr','>= 0.0.11']]
         | 
| 18 | 
            -
              self.spec_extras[:extensions] = ["ext/mpfi/extconf.rb", "ext/mpfi_complex/mpfi/extconf.rb", "ext/mpfi_matrix/mpfi/extconf.rb"]
         | 
| 19 | 
            -
              self.extra_rdoc_files << 'README.rdoc'
         | 
| 20 | 
            -
            end
         | 
| 21 | 
            -
             | 
| 22 | 
            -
            desc "Run 'make realclean' for extended libraries"
         | 
| 23 | 
            -
            task "ext:realclean" do
         | 
| 24 | 
            -
              Dir.glob("ext/**/Makefile").each do |path|
         | 
| 25 | 
            -
                system("cd #{File.dirname(path)}; make realclean")
         | 
| 26 | 
            -
              end
         | 
| 27 | 
            -
            end
         | 
| 28 | 
            -
             | 
| 29 | 
            -
            desc "Run 'make clean' for extended libraries"
         | 
| 30 | 
            -
            task "ext:clean" do
         | 
| 31 | 
            -
              Dir.glob("ext/**/Makefile").each do |path|
         | 
| 32 | 
            -
                system("cd #{File.dirname(path)}; make clean")
         | 
| 33 | 
            -
              end
         | 
| 34 | 
            -
            end
         | 
| 35 | 
            -
             | 
| 36 | 
            -
            desc "Run 'make realclean' for extended libraries"
         | 
| 37 | 
            -
            task 'ext:make' do
         | 
| 38 | 
            -
              Dir.glob("ext/**/extconf.rb").each do |path|
         | 
| 39 | 
            -
                system("cd #{File.dirname(path)}; ruby extconf.rb && make")
         | 
| 40 | 
            -
              end
         | 
| 41 | 
            -
            end
         | 
| 42 | 
            -
             | 
| 43 | 
            -
            # TODO - want other tests/tasks run by default? Add them to the list
         | 
| 44 | 
            -
            # remove_task :default
         | 
| 45 | 
            -
            # task :default => [:spec, :features]
         | 
| 1 | 
            +
            require "bundler/gem_tasks"
         | 
| 2 | 
            +
            require 'mpfr/rake_compile'
         | 
    
        data/ext/mpfi/extconf.rb
    CHANGED
    
    | @@ -20,5 +20,16 @@ dir_config("mpfr") | |
| 20 20 | 
             
            dir_config("mpfi")
         | 
| 21 21 | 
             
            dir_config("gmp")
         | 
| 22 22 | 
             
            if have_header('mpfr.h') && have_library('mpfr') && have_header('mpfi.h') && have_library('mpfi') && have_header('gmp.h') && have_library('gmp')
         | 
| 23 | 
            +
             | 
| 24 | 
            +
              ruby_mpfr_header_dir = nil
         | 
| 25 | 
            +
              begin
         | 
| 26 | 
            +
                require "rubygems"
         | 
| 27 | 
            +
                spec = Gem::Specification.find_by_name("ruby-mpfr")
         | 
| 28 | 
            +
                ruby_mpfr_header_dir = File.join(spec.full_gem_path, 'ext/mpfr')
         | 
| 29 | 
            +
              rescue LoadError
         | 
| 30 | 
            +
              end
         | 
| 31 | 
            +
              unless find_header("ruby_mpfr.h", ruby_mpfr_header_dir)
         | 
| 32 | 
            +
                header_not_found("ruby_mpfr.h")
         | 
| 33 | 
            +
              end
         | 
| 23 34 | 
             
              create_makefile("mpfi")
         | 
| 24 35 | 
             
            end
         | 
    
        data/ext/mpfi/ruby_mpfi.c
    CHANGED
    
    | @@ -74,11 +74,13 @@ static void r_mpfi_set_from_array (MPFI *ptr, VALUE obj) | |
| 74 74 | 
             
            static void r_mpfi_set_from_string (MPFI *ptr, VALUE obj)
         | 
| 75 75 | 
             
            {
         | 
| 76 76 | 
             
              char *str;
         | 
| 77 | 
            -
              if(RTEST(rb_funcall(rb_funcall(obj, class, 0), method_defined, 1, __sym_to_str__))){
         | 
| 77 | 
            +
              if (RTEST(rb_funcall(rb_funcall(obj, class, 0), method_defined, 1, __sym_to_str__))) {
         | 
| 78 78 | 
             
                str = StringValuePtr(obj);
         | 
| 79 | 
            -
              }else if(RTEST(rb_funcall(rb_funcall(obj, class, 0), method_defined, 1, __sym_to_s__))){
         | 
| 79 | 
            +
              } else if (RTEST(rb_funcall(rb_funcall(obj, class, 0), method_defined, 1, __sym_to_s__))){
         | 
| 80 80 | 
             
                VALUE tmp = rb_funcall(obj, to_s, 0);
         | 
| 81 81 | 
             
                str = StringValuePtr(tmp);
         | 
| 82 | 
            +
              } else {
         | 
| 83 | 
            +
                rb_raise(rb_eArgError, "Can not convert to strings.");
         | 
| 82 84 | 
             
              }
         | 
| 83 85 | 
             
              if(mpfi_set_str(ptr, str, 10) != 0) {
         | 
| 84 86 | 
             
                rb_raise(rb_eArgError, "Invalid string format of MPFI initialization: \"%s\"", str);
         | 
| @@ -232,9 +234,11 @@ char *r_mpfi_dump_to_string(MPFI *ptr_s) | |
| 232 234 | 
             
            static VALUE r_mpfi_marshal_dump(VALUE self)
         | 
| 233 235 | 
             
            {
         | 
| 234 236 | 
             
              MPFI *ptr_s;
         | 
| 237 | 
            +
              char *ret_str;
         | 
| 238 | 
            +
              VALUE ret_val;
         | 
| 235 239 | 
             
              r_mpfi_get_struct(ptr_s, self);
         | 
| 236 | 
            -
               | 
| 237 | 
            -
               | 
| 240 | 
            +
              ret_str = r_mpfi_dump_to_string(ptr_s);
         | 
| 241 | 
            +
              ret_val = rb_str_new2(ret_str);
         | 
| 238 242 | 
             
              mpfr_free_str(ret_str);
         | 
| 239 243 | 
             
              return ret_val;
         | 
| 240 244 | 
             
            }
         | 
| @@ -313,14 +317,15 @@ static VALUE r_mpfi_round_prec (VALUE self, VALUE prec) | |
| 313 317 | 
             
            static VALUE r_mpfi_inspect(VALUE self)
         | 
| 314 318 | 
             
            {
         | 
| 315 319 | 
             
              MPFI *ptr_s;
         | 
| 316 | 
            -
              r_mpfi_get_struct(ptr_s, self);
         | 
| 317 320 | 
             
              char *ret_str;
         | 
| 321 | 
            +
              VALUE ret_val;
         | 
| 322 | 
            +
              r_mpfi_get_struct(ptr_s, self);
         | 
| 318 323 | 
             
              if (!mpfr_asprintf(&ret_str, "#<MPFI:%lx,['%.Re %.Re'],%d>",
         | 
| 319 324 | 
             
            		    NUM2LONG(rb_funcall(self, object_id, 0)), r_mpfi_left_ptr(ptr_s),
         | 
| 320 325 | 
             
            		    r_mpfi_right_ptr(ptr_s), mpfi_get_prec(ptr_s))) {
         | 
| 321 326 | 
             
                rb_raise(rb_eFatal, "Can not allocate a string by mpfr_asprintf.");
         | 
| 322 327 | 
             
              }
         | 
| 323 | 
            -
               | 
| 328 | 
            +
              ret_val = rb_str_new2(ret_str);
         | 
| 324 329 | 
             
              mpfr_free_str(ret_str);
         | 
| 325 330 | 
             
              return ret_val;
         | 
| 326 331 | 
             
            }
         | 
| @@ -329,15 +334,17 @@ static VALUE r_mpfi_inspect(VALUE self) | |
| 329 334 | 
             
            static VALUE r_mpfi_to_str_ary(VALUE self)
         | 
| 330 335 | 
             
            {
         | 
| 331 336 | 
             
              MPFI *ptr_self;
         | 
| 332 | 
            -
              r_mpfi_get_struct(ptr_self, self);
         | 
| 333 337 | 
             
              char *ret_str1, *ret_str2;
         | 
| 338 | 
            +
              VALUE str1, str2;
         | 
| 339 | 
            +
              r_mpfi_get_struct(ptr_self, self);
         | 
| 334 340 | 
             
              if (!mpfr_asprintf(&ret_str1, "%.Re", r_mpfi_left_ptr(ptr_self))) {
         | 
| 335 341 | 
             
                rb_raise(rb_eFatal, "Can not allocate a string by mpfr_asprintf.");
         | 
| 336 342 | 
             
              }
         | 
| 337 343 | 
             
              if (!mpfr_asprintf(&ret_str2, "%.Re", r_mpfi_right_ptr(ptr_self))) {
         | 
| 338 344 | 
             
                rb_raise(rb_eFatal, "Can not allocate a string by mpfr_asprintf.");
         | 
| 339 345 | 
             
              }
         | 
| 340 | 
            -
               | 
| 346 | 
            +
              str1 = rb_str_new2(ret_str1);
         | 
| 347 | 
            +
              str2 = rb_str_new2(ret_str2);
         | 
| 341 348 | 
             
              mpfr_free_str(ret_str1);
         | 
| 342 349 | 
             
              mpfr_free_str(ret_str2);
         | 
| 343 350 | 
             
              return rb_ary_new3(2, str1, str2);
         | 
| @@ -347,16 +354,18 @@ static VALUE r_mpfi_to_str_ary(VALUE self) | |
| 347 354 | 
             
            static VALUE r_mpfi_to_strf_ary(VALUE self, VALUE format_str)
         | 
| 348 355 | 
             
            {
         | 
| 349 356 | 
             
              MPFI *ptr_self;
         | 
| 357 | 
            +
              char *format, *ret_str1, *ret_str2;
         | 
| 358 | 
            +
              VALUE str1, str2;
         | 
| 350 359 | 
             
              r_mpfi_get_struct(ptr_self, self);
         | 
| 351 | 
            -
               | 
| 352 | 
            -
              char *ret_str1, *ret_str2;
         | 
| 360 | 
            +
              format = StringValuePtr(format_str);
         | 
| 353 361 | 
             
              if (!mpfr_asprintf(&ret_str1, format, r_mpfi_left_ptr(ptr_self))) {
         | 
| 354 362 | 
             
                rb_raise(rb_eFatal, "Can not allocate a string by mpfr_asprintf.");
         | 
| 355 363 | 
             
              }
         | 
| 356 364 | 
             
              if (!mpfr_asprintf(&ret_str2, format, r_mpfi_right_ptr(ptr_self))) {
         | 
| 357 365 | 
             
                rb_raise(rb_eFatal, "Can not allocate a string by mpfr_asprintf.");
         | 
| 358 366 | 
             
              }
         | 
| 359 | 
            -
               | 
| 367 | 
            +
              str1 = rb_str_new2(ret_str1);
         | 
| 368 | 
            +
              str2 = rb_str_new2(ret_str2);
         | 
| 360 369 | 
             
              mpfr_free_str(ret_str1);
         | 
| 361 370 | 
             
              mpfr_free_str(ret_str2);
         | 
| 362 371 | 
             
              return rb_ary_new3(2, str1, str2);
         | 
| @@ -486,8 +495,8 @@ static VALUE r_mpfi_div (VALUE self, VALUE other) | |
| 486 495 | 
             
            static VALUE r_mpfi_mul_2si (int argc, VALUE *argv, VALUE self)
         | 
| 487 496 | 
             
            {
         | 
| 488 497 | 
             
              MPFI *ptr_self, *ptr_ret;
         | 
| 489 | 
            -
              r_mpfi_get_struct(ptr_self, self);
         | 
| 490 498 | 
             
              VALUE val_ret;
         | 
| 499 | 
            +
              r_mpfi_get_struct(ptr_self, self);
         | 
| 491 500 | 
             
              r_mpfi_make_struct_init2(val_ret, ptr_ret, r_mpfr_prec_from_optional_argument(1, 2, argc, argv));
         | 
| 492 501 | 
             
              mpfi_mul_2si(ptr_ret, ptr_self, NUM2INT(argv[0]));
         | 
| 493 502 | 
             
              return val_ret;
         | 
| @@ -497,8 +506,8 @@ static VALUE r_mpfi_mul_2si (int argc, VALUE *argv, VALUE self) | |
| 497 506 | 
             
            static VALUE r_mpfi_div_2si (int argc, VALUE *argv, VALUE self)
         | 
| 498 507 | 
             
            {
         | 
| 499 508 | 
             
              MPFI *ptr_self, *ptr_ret;
         | 
| 500 | 
            -
              r_mpfi_get_struct(ptr_self, self);
         | 
| 501 509 | 
             
              VALUE val_ret;
         | 
| 510 | 
            +
              r_mpfi_get_struct(ptr_self, self);
         | 
| 502 511 | 
             
              r_mpfi_make_struct_init2(val_ret, ptr_ret, r_mpfr_prec_from_optional_argument(1, 2, argc, argv));
         | 
| 503 512 | 
             
              mpfi_div_2si(ptr_ret, ptr_self, NUM2INT(argv[0]));
         | 
| 504 513 | 
             
              return val_ret;
         | 
| @@ -508,8 +517,8 @@ static VALUE r_mpfi_div_2si (int argc, VALUE *argv, VALUE self) | |
| 508 517 | 
             
            static VALUE r_mpfi_neg(int argc, VALUE *argv, VALUE self)
         | 
| 509 518 | 
             
            {
         | 
| 510 519 | 
             
              MPFI *ptr_self, *ptr_ret;
         | 
| 511 | 
            -
              r_mpfi_get_struct(ptr_self, self);
         | 
| 512 520 | 
             
              VALUE val_ret;
         | 
| 521 | 
            +
              r_mpfi_get_struct(ptr_self, self);
         | 
| 513 522 | 
             
              r_mpfi_make_struct_init2(val_ret, ptr_ret, r_mpfr_prec_from_optional_argument(0, 1, argc, argv));
         | 
| 514 523 | 
             
              mpfi_neg(ptr_ret, ptr_self);
         | 
| 515 524 | 
             
              return val_ret;
         | 
| @@ -519,8 +528,8 @@ static VALUE r_mpfi_neg(int argc, VALUE *argv, VALUE self) | |
| 519 528 | 
             
            static VALUE r_mpfi_inv(int argc, VALUE *argv, VALUE self)
         | 
| 520 529 | 
             
            {
         | 
| 521 530 | 
             
              MPFI *ptr_self, *ptr_ret;
         | 
| 522 | 
            -
              r_mpfi_get_struct(ptr_self, self);
         | 
| 523 531 | 
             
              VALUE val_ret;
         | 
| 532 | 
            +
              r_mpfi_get_struct(ptr_self, self);
         | 
| 524 533 | 
             
              r_mpfi_make_struct_init2(val_ret, ptr_ret, r_mpfr_prec_from_optional_argument(0, 1, argc, argv));
         | 
| 525 534 | 
             
              mpfi_inv(ptr_ret, ptr_self);
         | 
| 526 535 | 
             
              return val_ret;
         | 
| @@ -530,8 +539,8 @@ static VALUE r_mpfi_inv(int argc, VALUE *argv, VALUE self) | |
| 530 539 | 
             
            static VALUE r_mpfi_abs(int argc, VALUE *argv, VALUE self)
         | 
| 531 540 | 
             
            {
         | 
| 532 541 | 
             
              MPFI *ptr_self, *ptr_ret;
         | 
| 533 | 
            -
              r_mpfi_get_struct(ptr_self, self);
         | 
| 534 542 | 
             
              VALUE val_ret;
         | 
| 543 | 
            +
              r_mpfi_get_struct(ptr_self, self);
         | 
| 535 544 | 
             
              r_mpfi_make_struct_init2(val_ret, ptr_ret, r_mpfr_prec_from_optional_argument(0, 1, argc, argv));
         | 
| 536 545 | 
             
              mpfi_abs(ptr_ret, ptr_self);
         | 
| 537 546 | 
             
              return val_ret;
         | 
| @@ -545,8 +554,8 @@ static VALUE r_mpfi_abs(int argc, VALUE *argv, VALUE self) | |
| 545 554 | 
             
            static VALUE r_mpfi_cmp (VALUE self, VALUE other)
         | 
| 546 555 | 
             
            {
         | 
| 547 556 | 
             
              MPFI *ptr_self;
         | 
| 548 | 
            -
              r_mpfi_get_struct(ptr_self, self);
         | 
| 549 557 | 
             
              int ret;
         | 
| 558 | 
            +
              r_mpfi_get_struct(ptr_self, self);
         | 
| 550 559 |  | 
| 551 560 | 
             
              if(RTEST(rb_funcall(__mpfi_class__, eqq, 1, other))){
         | 
| 552 561 | 
             
                MPFI *ptr_other;
         | 
| @@ -726,9 +735,9 @@ static VALUE r_mpfi_equal_p (VALUE self, VALUE other) | |
| 726 735 | 
             
            static VALUE r_mpfi_diam_abs (int argc, VALUE *argv, VALUE self)
         | 
| 727 736 | 
             
            {
         | 
| 728 737 | 
             
              MPFI *ptr_self;
         | 
| 729 | 
            -
              r_mpfi_get_struct(ptr_self, self);
         | 
| 730 738 | 
             
              VALUE val_ret;
         | 
| 731 739 | 
             
              MPFR *ptr_ret;
         | 
| 740 | 
            +
              r_mpfi_get_struct(ptr_self, self);
         | 
| 732 741 | 
             
              r_mpfr_make_struct_init2(val_ret, ptr_ret, r_mpfr_prec_from_optional_argument(0, 1, argc, argv));
         | 
| 733 742 | 
             
              r_mpfi_set_function_state(mpfi_diam_abs(ptr_ret, ptr_self));
         | 
| 734 743 | 
             
              return val_ret;
         | 
| @@ -738,9 +747,9 @@ static VALUE r_mpfi_diam_abs (int argc, VALUE *argv, VALUE self) | |
| 738 747 | 
             
            static VALUE r_mpfi_diam_rel (int argc, VALUE *argv, VALUE self)
         | 
| 739 748 | 
             
            {
         | 
| 740 749 | 
             
              MPFI *ptr_self;
         | 
| 741 | 
            -
              r_mpfi_get_struct(ptr_self, self);
         | 
| 742 750 | 
             
              VALUE val_ret;
         | 
| 743 751 | 
             
              MPFR *ptr_ret;
         | 
| 752 | 
            +
              r_mpfi_get_struct(ptr_self, self);
         | 
| 744 753 | 
             
              r_mpfr_make_struct_init2(val_ret, ptr_ret, r_mpfr_prec_from_optional_argument(0, 1, argc, argv));
         | 
| 745 754 | 
             
              r_mpfi_set_function_state(mpfi_diam_rel(ptr_ret, ptr_self));
         | 
| 746 755 | 
             
              return val_ret;
         | 
| @@ -750,9 +759,9 @@ static VALUE r_mpfi_diam_rel (int argc, VALUE *argv, VALUE self) | |
| 750 759 | 
             
            static VALUE r_mpfi_diam (int argc, VALUE *argv, VALUE self)
         | 
| 751 760 | 
             
            {
         | 
| 752 761 | 
             
              MPFI *ptr_self;
         | 
| 753 | 
            -
              r_mpfi_get_struct(ptr_self, self);
         | 
| 754 762 | 
             
              VALUE val_ret;
         | 
| 755 763 | 
             
              MPFR *ptr_ret;
         | 
| 764 | 
            +
              r_mpfi_get_struct(ptr_self, self);
         | 
| 756 765 | 
             
              r_mpfr_make_struct_init2(val_ret, ptr_ret, r_mpfr_prec_from_optional_argument(0, 1, argc, argv));
         | 
| 757 766 | 
             
              r_mpfi_set_function_state(mpfi_diam(ptr_ret, ptr_self));
         | 
| 758 767 | 
             
              return val_ret;
         | 
| @@ -762,9 +771,9 @@ static VALUE r_mpfi_diam (int argc, VALUE *argv, VALUE self) | |
| 762 771 | 
             
            static VALUE r_mpfi_mag (int argc, VALUE *argv, VALUE self)
         | 
| 763 772 | 
             
            {
         | 
| 764 773 | 
             
              MPFI *ptr_self;
         | 
| 765 | 
            -
              r_mpfi_get_struct(ptr_self, self);
         | 
| 766 774 | 
             
              VALUE val_ret;
         | 
| 767 775 | 
             
              MPFR *ptr_ret;
         | 
| 776 | 
            +
              r_mpfi_get_struct(ptr_self, self);
         | 
| 768 777 | 
             
              r_mpfr_make_struct_init2(val_ret, ptr_ret, r_mpfr_prec_from_optional_argument(0, 1, argc, argv));
         | 
| 769 778 | 
             
              r_mpfi_set_function_state(mpfi_mag(ptr_ret, ptr_self));
         | 
| 770 779 | 
             
              return val_ret;
         | 
| @@ -774,9 +783,9 @@ static VALUE r_mpfi_mag (int argc, VALUE *argv, VALUE self) | |
| 774 783 | 
             
            static VALUE r_mpfi_mig (int argc, VALUE *argv, VALUE self)
         | 
| 775 784 | 
             
            {
         | 
| 776 785 | 
             
              MPFI *ptr_self;
         | 
| 777 | 
            -
              r_mpfi_get_struct(ptr_self, self);
         | 
| 778 786 | 
             
              VALUE val_ret;
         | 
| 779 787 | 
             
              MPFR *ptr_ret;
         | 
| 788 | 
            +
              r_mpfi_get_struct(ptr_self, self);
         | 
| 780 789 | 
             
              r_mpfr_make_struct_init2(val_ret, ptr_ret, r_mpfr_prec_from_optional_argument(0, 1, argc, argv));
         | 
| 781 790 | 
             
              r_mpfi_set_function_state(mpfi_mig(ptr_ret, ptr_self));
         | 
| 782 791 | 
             
              return val_ret;
         | 
| @@ -786,9 +795,9 @@ static VALUE r_mpfi_mig (int argc, VALUE *argv, VALUE self) | |
| 786 795 | 
             
            static VALUE r_mpfi_mid (int argc, VALUE *argv, VALUE self)
         | 
| 787 796 | 
             
            {
         | 
| 788 797 | 
             
              MPFI *ptr_self;
         | 
| 789 | 
            -
              r_mpfi_get_struct(ptr_self, self);
         | 
| 790 798 | 
             
              VALUE val_ret;
         | 
| 791 799 | 
             
              MPFR *ptr_ret;
         | 
| 800 | 
            +
              r_mpfi_get_struct(ptr_self, self);
         | 
| 792 801 | 
             
              r_mpfr_make_struct_init2(val_ret, ptr_ret, r_mpfr_prec_from_optional_argument(0, 1, argc, argv));
         | 
| 793 802 | 
             
              r_mpfi_set_function_state(mpfi_mid(ptr_ret, ptr_self));
         | 
| 794 803 | 
             
              return val_ret;
         | 
| @@ -798,8 +807,8 @@ static VALUE r_mpfi_mid (int argc, VALUE *argv, VALUE self) | |
| 798 807 | 
             
            static VALUE r_mpfi_mid_interval (int argc, VALUE *argv, VALUE self)
         | 
| 799 808 | 
             
            {
         | 
| 800 809 | 
             
              MPFI *ptr_self, *ptr_ret;
         | 
| 801 | 
            -
              r_mpfi_get_struct(ptr_self, self);
         | 
| 802 810 | 
             
              VALUE val_ret;
         | 
| 811 | 
            +
              r_mpfi_get_struct(ptr_self, self);
         | 
| 803 812 | 
             
              r_mpfi_make_struct_init2(val_ret, ptr_ret, r_mpfr_prec_from_optional_argument(0, 1, argc, argv));
         | 
| 804 813 | 
             
              mpfi_mid_interval(ptr_ret, ptr_self);
         | 
| 805 814 | 
             
              return val_ret;
         | 
| @@ -809,9 +818,9 @@ static VALUE r_mpfi_mid_interval (int argc, VALUE *argv, VALUE self) | |
| 809 818 | 
             
            static VALUE r_mpfi_alea (int argc, VALUE *argv, VALUE self)
         | 
| 810 819 | 
             
            {
         | 
| 811 820 | 
             
              MPFI *ptr_self;
         | 
| 812 | 
            -
              r_mpfi_get_struct(ptr_self, self);
         | 
| 813 821 | 
             
              VALUE val_ret;
         | 
| 814 822 | 
             
              MPFR *ptr_ret;
         | 
| 823 | 
            +
              r_mpfi_get_struct(ptr_self, self);
         | 
| 815 824 | 
             
              r_mpfr_make_struct_init2(val_ret, ptr_ret, r_mpfr_prec_from_optional_argument(0, 1, argc, argv));
         | 
| 816 825 | 
             
              mpfi_alea(ptr_ret, ptr_self);
         | 
| 817 826 | 
             
              return val_ret;
         | 
| @@ -833,9 +842,9 @@ static VALUE r_mpfi_get_d(VALUE self) | |
| 833 842 | 
             
            static VALUE r_mpfi_get_fr(VALUE self)
         | 
| 834 843 | 
             
            {
         | 
| 835 844 | 
             
              MPFI *ptr_self;
         | 
| 836 | 
            -
              r_mpfi_get_struct(ptr_self, self);
         | 
| 837 845 | 
             
              VALUE val_ret;
         | 
| 838 846 | 
             
              MPFR *ptr_ret;
         | 
| 847 | 
            +
              r_mpfi_get_struct(ptr_self, self);
         | 
| 839 848 | 
             
              r_mpfr_make_struct_init2(val_ret, ptr_ret, mpfi_get_prec(ptr_self));
         | 
| 840 849 | 
             
              mpfi_get_fr(ptr_ret, ptr_self);
         | 
| 841 850 | 
             
              return val_ret;
         | 
| @@ -961,8 +970,8 @@ static VALUE r_mpfi_strictly_include (VALUE self, VALUE other) | |
| 961 970 | 
             
            static VALUE r_mpfi_include (VALUE self, VALUE other)
         | 
| 962 971 | 
             
            {
         | 
| 963 972 | 
             
              MPFI *ptr_self;
         | 
| 964 | 
            -
              r_mpfi_get_struct(ptr_self, self);
         | 
| 965 973 | 
             
              int result;
         | 
| 974 | 
            +
              r_mpfi_get_struct(ptr_self, self);
         | 
| 966 975 | 
             
              if(RTEST(rb_funcall(__mpfi_class__, eqq, 1, other))){
         | 
| 967 976 | 
             
                MPFI *ptr_other;
         | 
| 968 977 | 
             
                r_mpfi_get_struct(ptr_other, other);
         | 
| @@ -1007,9 +1016,9 @@ static VALUE r_mpfi_is_empty (VALUE self) | |
| 1007 1016 | 
             
            static VALUE r_mpfi_intersect (int argc, VALUE *argv, VALUE self)
         | 
| 1008 1017 | 
             
            {
         | 
| 1009 1018 | 
             
              MPFI *ptr_self, *ptr_a0, *ptr_ret;
         | 
| 1019 | 
            +
              VALUE val_ret;
         | 
| 1010 1020 | 
             
              r_mpfi_get_struct(ptr_self, self);
         | 
| 1011 1021 | 
             
              r_mpfi_get_struct(ptr_a0, argv[0]);
         | 
| 1012 | 
            -
              VALUE val_ret;
         | 
| 1013 1022 | 
             
              r_mpfi_make_struct_init2(val_ret, ptr_ret, r_mpfr_prec_from_optional_argument(1, 2, argc, argv));
         | 
| 1014 1023 | 
             
              r_mpfi_set_function_state(mpfi_intersect(ptr_ret, ptr_self, ptr_a0));
         | 
| 1015 1024 | 
             
              if(mpfi_is_empty(ptr_ret) > 0){
         | 
| @@ -1026,9 +1035,9 @@ static VALUE r_mpfi_intersect (int argc, VALUE *argv, VALUE self) | |
| 1026 1035 | 
             
            static VALUE r_mpfi_intersect2 (int argc, VALUE *argv, VALUE self)
         | 
| 1027 1036 | 
             
            {
         | 
| 1028 1037 | 
             
              MPFI *ptr_self, *ptr_a0, *ptr_ret;
         | 
| 1038 | 
            +
              VALUE val_ret;
         | 
| 1029 1039 | 
             
              r_mpfi_get_struct(ptr_self, self);
         | 
| 1030 1040 | 
             
              r_mpfi_get_struct(ptr_a0, argv[0]);
         | 
| 1031 | 
            -
              VALUE val_ret;
         | 
| 1032 1041 | 
             
              r_mpfi_make_struct_init2(val_ret, ptr_ret, r_mpfr_prec_from_optional_argument(1, 2, argc, argv));
         | 
| 1033 1042 | 
             
              r_mpfi_set_function_state(mpfi_intersect(ptr_ret, ptr_self, ptr_a0));
         | 
| 1034 1043 | 
             
              return val_ret;
         | 
| @@ -1038,9 +1047,9 @@ static VALUE r_mpfi_intersect2 (int argc, VALUE *argv, VALUE self) | |
| 1038 1047 | 
             
            static VALUE r_mpfi_union (int argc, VALUE *argv, VALUE self)
         | 
| 1039 1048 | 
             
            {
         | 
| 1040 1049 | 
             
              MPFI *ptr_self, *ptr_a0, *ptr_ret;
         | 
| 1050 | 
            +
              VALUE val_ret;
         | 
| 1041 1051 | 
             
              r_mpfi_get_struct(ptr_self, self);
         | 
| 1042 1052 | 
             
              r_mpfi_get_struct(ptr_a0, argv[0]);
         | 
| 1043 | 
            -
              VALUE val_ret;
         | 
| 1044 1053 | 
             
              r_mpfi_make_struct_init2(val_ret, ptr_ret, r_mpfr_prec_from_optional_argument(1, 2, argc, argv));
         | 
| 1045 1054 | 
             
              r_mpfi_set_function_state(mpfi_union(ptr_ret, ptr_self, ptr_a0));
         | 
| 1046 1055 | 
             
              return val_ret;
         | 
| @@ -1054,9 +1063,10 @@ static VALUE r_mpfi_union (int argc, VALUE *argv, VALUE self) | |
| 1054 1063 | 
             
            static VALUE r_mpfi_increase (VALUE self, VALUE a0)
         | 
| 1055 1064 | 
             
            {
         | 
| 1056 1065 | 
             
              MPFI *ptr_self;
         | 
| 1057 | 
            -
              r_mpfi_get_struct(ptr_self, self);
         | 
| 1058 1066 | 
             
              MPFR *ptr_a0;
         | 
| 1059 | 
            -
              volatile VALUE tmp_a0 | 
| 1067 | 
            +
              volatile VALUE tmp_a0;
         | 
| 1068 | 
            +
              r_mpfi_get_struct(ptr_self, self);
         | 
| 1069 | 
            +
              tmp_a0 = r_mpfr_new_fr_obj(a0);
         | 
| 1060 1070 | 
             
              r_mpfr_get_struct(ptr_a0, tmp_a0);
         | 
| 1061 1071 | 
             
              r_mpfi_set_function_state(mpfi_increase(ptr_self, ptr_a0));
         | 
| 1062 1072 | 
             
              return self;
         | 
| @@ -1066,8 +1076,8 @@ static VALUE r_mpfi_increase (VALUE self, VALUE a0) | |
| 1066 1076 | 
             
            static VALUE r_mpfi_blow (int argc, VALUE *argv, VALUE self)
         | 
| 1067 1077 | 
             
            {
         | 
| 1068 1078 | 
             
              MPFI *ptr_self, *ptr_ret;
         | 
| 1069 | 
            -
              r_mpfi_get_struct(ptr_self, self);
         | 
| 1070 1079 | 
             
              VALUE val_ret;
         | 
| 1080 | 
            +
              r_mpfi_get_struct(ptr_self, self);
         | 
| 1071 1081 | 
             
              r_mpfi_make_struct_init2(val_ret, ptr_ret, r_mpfr_prec_from_optional_argument(1, 2, argc, argv));
         | 
| 1072 1082 | 
             
              r_mpfi_set_function_state(mpfi_blow(ptr_ret, ptr_self, NUM2DBL(argv[0])));
         | 
| 1073 1083 | 
             
              return val_ret;
         | 
| @@ -1077,9 +1087,10 @@ static VALUE r_mpfi_blow (int argc, VALUE *argv, VALUE self) | |
| 1077 1087 | 
             
            static VALUE r_mpfi_bisect (int argc, VALUE *argv, VALUE self)
         | 
| 1078 1088 | 
             
            {
         | 
| 1079 1089 | 
             
              MPFI *ptr_self, *ptr_ret1, *ptr_ret2;
         | 
| 1080 | 
            -
               | 
| 1081 | 
            -
              int prec = r_mpfr_prec_from_optional_argument(0, 1, argc, argv);
         | 
| 1090 | 
            +
              int prec;
         | 
| 1082 1091 | 
             
              VALUE val_ret1, val_ret2;
         | 
| 1092 | 
            +
              r_mpfi_get_struct(ptr_self, self);
         | 
| 1093 | 
            +
              prec = r_mpfr_prec_from_optional_argument(0, 1, argc, argv);
         | 
| 1083 1094 | 
             
              r_mpfi_make_struct_init2(val_ret1, ptr_ret1, prec);
         | 
| 1084 1095 | 
             
              r_mpfi_make_struct_init2(val_ret2, ptr_ret2, prec);
         | 
| 1085 1096 | 
             
              r_mpfi_set_function_state(mpfi_bisect(ptr_ret1, ptr_ret2, ptr_self));
         | 
| @@ -1092,10 +1103,10 @@ void r_mpfi_subdivision_func(int num, MPFI *ret[], mpfi_t x) | |
| 1092 1103 | 
             
            {
         | 
| 1093 1104 | 
             
              int i;
         | 
| 1094 1105 | 
             
              mpfr_t l;
         | 
| 1106 | 
            +
              mpfr_t x_diam;
         | 
| 1095 1107 | 
             
              mpfr_init(l);
         | 
| 1096 1108 | 
             
              mpfr_sub(l, r_mpfi_right_ptr(x), r_mpfi_left_ptr(x), GMP_RNDD);
         | 
| 1097 1109 | 
             
              mpfr_div_si(l, l, num, GMP_RNDD);
         | 
| 1098 | 
            -
              mpfr_t x_diam;
         | 
| 1099 1110 | 
             
              mpfr_init(x_diam);
         | 
| 1100 1111 | 
             
              mpfi_diam_abs(x_diam, x);
         | 
| 1101 1112 | 
             
              if(mpfr_cmp(x_diam, l) > 0 && num > 1){
         | 
| @@ -1121,9 +1132,10 @@ void r_mpfi_subdivision_func(int num, MPFI *ret[], mpfi_t x) | |
| 1121 1132 | 
             
            static VALUE r_mpfi_subdivision (int argc, VALUE *argv, VALUE self)
         | 
| 1122 1133 | 
             
            {
         | 
| 1123 1134 | 
             
              MPFI *ptr_self;
         | 
| 1135 | 
            +
              int i, num, prec;
         | 
| 1124 1136 | 
             
              r_mpfi_get_struct(ptr_self, self);
         | 
| 1125 | 
            -
               | 
| 1126 | 
            -
               | 
| 1137 | 
            +
              num = NUM2INT(argv[0]);
         | 
| 1138 | 
            +
              prec = r_mpfr_prec_from_optional_argument(1, 2, argc, argv);
         | 
| 1127 1139 | 
             
              MPFI *f[num];
         | 
| 1128 1140 | 
             
              VALUE vf[num];
         | 
| 1129 1141 | 
             
              for(i = 0; i < num; i++){
         | 
| @@ -1141,8 +1153,9 @@ static VALUE r_mpfi_math_add (int argc, VALUE *argv, VALUE self) | |
| 1141 1153 | 
             
            {
         | 
| 1142 1154 | 
             
              VALUE val_ret;
         | 
| 1143 1155 | 
             
              MPFI *ptr_a0, *ptr_ret;
         | 
| 1156 | 
            +
              volatile VALUE tmp_argv0;
         | 
| 1144 1157 | 
             
              r_mpfi_make_struct_init2(val_ret, ptr_ret, r_mpfr_prec_from_optional_argument(2, 3, argc, argv));
         | 
| 1145 | 
            -
               | 
| 1158 | 
            +
              tmp_argv0 = r_mpfi_new_fi_obj(argv[0]);
         | 
| 1146 1159 | 
             
              r_mpfi_get_struct(ptr_a0, tmp_argv0);
         | 
| 1147 1160 | 
             
              if(RTEST(rb_funcall(__mpfi_class__, eqq, 1, argv[1]))){
         | 
| 1148 1161 | 
             
                MPFI *ptr_other;
         | 
| @@ -1170,8 +1183,9 @@ static VALUE r_mpfi_math_sub (int argc, VALUE *argv, VALUE self) | |
| 1170 1183 | 
             
            {
         | 
| 1171 1184 | 
             
              VALUE val_ret;
         | 
| 1172 1185 | 
             
              MPFI *ptr_a0, *ptr_ret;
         | 
| 1186 | 
            +
              volatile VALUE tmp_argv0;
         | 
| 1173 1187 | 
             
              r_mpfi_make_struct_init2(val_ret, ptr_ret, r_mpfr_prec_from_optional_argument(2, 3, argc, argv));
         | 
| 1174 | 
            -
               | 
| 1188 | 
            +
              tmp_argv0 = r_mpfi_new_fi_obj(argv[0]);
         | 
| 1175 1189 | 
             
              r_mpfi_get_struct(ptr_a0, tmp_argv0);
         | 
| 1176 1190 | 
             
              if(RTEST(rb_funcall(__mpfi_class__, eqq, 1, argv[1]))){
         | 
| 1177 1191 | 
             
                MPFI *ptr_other;
         | 
| @@ -1199,8 +1213,9 @@ static VALUE r_mpfi_math_mul (int argc, VALUE *argv, VALUE self) | |
| 1199 1213 | 
             
            {
         | 
| 1200 1214 | 
             
              VALUE val_ret;
         | 
| 1201 1215 | 
             
              MPFI *ptr_a0, *ptr_ret;
         | 
| 1216 | 
            +
              volatile VALUE tmp_argv0;
         | 
| 1202 1217 | 
             
              r_mpfi_make_struct_init2(val_ret, ptr_ret, r_mpfr_prec_from_optional_argument(2, 3, argc, argv));
         | 
| 1203 | 
            -
               | 
| 1218 | 
            +
              tmp_argv0 = r_mpfi_new_fi_obj(argv[0]);
         | 
| 1204 1219 | 
             
              r_mpfi_get_struct(ptr_a0, tmp_argv0);
         | 
| 1205 1220 | 
             
              if(RTEST(rb_funcall(__mpfi_class__, eqq, 1, argv[1]))){
         | 
| 1206 1221 | 
             
                MPFI *ptr_other;
         | 
| @@ -1228,8 +1243,9 @@ static VALUE r_mpfi_math_div (int argc, VALUE *argv, VALUE self) | |
| 1228 1243 | 
             
            {
         | 
| 1229 1244 | 
             
              VALUE val_ret;
         | 
| 1230 1245 | 
             
              MPFI *ptr_a0, *ptr_ret;
         | 
| 1246 | 
            +
              volatile VALUE tmp_argv0;
         | 
| 1231 1247 | 
             
              r_mpfi_make_struct_init2(val_ret, ptr_ret, r_mpfr_prec_from_optional_argument(2, 3, argc, argv));
         | 
| 1232 | 
            -
               | 
| 1248 | 
            +
              tmp_argv0 = r_mpfi_new_fi_obj(argv[0]);
         | 
| 1233 1249 | 
             
              r_mpfi_get_struct(ptr_a0, tmp_argv0);
         | 
| 1234 1250 | 
             
              if(RTEST(rb_funcall(__mpfi_class__, eqq, 1, argv[1]))){
         | 
| 1235 1251 | 
             
                MPFI *ptr_other;
         | 
| @@ -1256,9 +1272,9 @@ static VALUE r_mpfi_math_div (int argc, VALUE *argv, VALUE self) | |
| 1256 1272 | 
             
            static VALUE r_mpfi_math_sqr (int argc, VALUE *argv, VALUE self)
         | 
| 1257 1273 | 
             
            {
         | 
| 1258 1274 | 
             
              MPFI *ptr_a0, *ptr_ret;
         | 
| 1275 | 
            +
              VALUE val_ret;
         | 
| 1259 1276 | 
             
              volatile VALUE tmp_argv0 = r_mpfi_new_fi_obj(argv[0]);
         | 
| 1260 1277 | 
             
              r_mpfi_get_struct(ptr_a0, tmp_argv0);
         | 
| 1261 | 
            -
              VALUE val_ret;
         | 
| 1262 1278 | 
             
              r_mpfi_make_struct_init2(val_ret, ptr_ret, r_mpfr_prec_from_optional_argument(1, 2, argc, argv));
         | 
| 1263 1279 | 
             
              r_mpfi_set_function_state(mpfi_sqr(ptr_ret, ptr_a0));
         | 
| 1264 1280 | 
             
              return val_ret;
         | 
| @@ -1268,9 +1284,9 @@ static VALUE r_mpfi_math_sqr (int argc, VALUE *argv, VALUE self) | |
| 1268 1284 | 
             
            static VALUE r_mpfi_math_sqrt (int argc, VALUE *argv, VALUE self)
         | 
| 1269 1285 | 
             
            {
         | 
| 1270 1286 | 
             
              MPFI *ptr_a0, *ptr_ret;
         | 
| 1287 | 
            +
              VALUE val_ret;
         | 
| 1271 1288 | 
             
              volatile VALUE tmp_argv0 = r_mpfi_new_fi_obj(argv[0]);
         | 
| 1272 1289 | 
             
              r_mpfi_get_struct(ptr_a0, tmp_argv0);
         | 
| 1273 | 
            -
              VALUE val_ret;
         | 
| 1274 1290 | 
             
              r_mpfi_make_struct_init2(val_ret, ptr_ret, r_mpfr_prec_from_optional_argument(1, 2, argc, argv));
         | 
| 1275 1291 | 
             
              r_mpfi_set_function_state(mpfi_sqrt(ptr_ret, ptr_a0));
         | 
| 1276 1292 | 
             
              return val_ret;
         | 
| @@ -1284,9 +1300,9 @@ static VALUE r_mpfi_math_sqrt (int argc, VALUE *argv, VALUE self) | |
| 1284 1300 | 
             
            static VALUE r_mpfi_math_log (int argc, VALUE *argv, VALUE self)
         | 
| 1285 1301 | 
             
            {
         | 
| 1286 1302 | 
             
              MPFI *ptr_a0, *ptr_ret;
         | 
| 1303 | 
            +
              VALUE val_ret;
         | 
| 1287 1304 | 
             
              volatile VALUE tmp_argv0 = r_mpfi_new_fi_obj(argv[0]);
         | 
| 1288 1305 | 
             
              r_mpfi_get_struct(ptr_a0, tmp_argv0);
         | 
| 1289 | 
            -
              VALUE val_ret;
         | 
| 1290 1306 | 
             
              r_mpfi_make_struct_init2(val_ret, ptr_ret, r_mpfr_prec_from_optional_argument(1, 2, argc, argv));
         | 
| 1291 1307 | 
             
              r_mpfi_set_function_state(mpfi_log(ptr_ret, ptr_a0));
         | 
| 1292 1308 | 
             
              return val_ret;
         | 
| @@ -1296,9 +1312,9 @@ static VALUE r_mpfi_math_log (int argc, VALUE *argv, VALUE self) | |
| 1296 1312 | 
             
            static VALUE r_mpfi_math_exp (int argc, VALUE *argv, VALUE self)
         | 
| 1297 1313 | 
             
            {
         | 
| 1298 1314 | 
             
              MPFI *ptr_a0, *ptr_ret;
         | 
| 1315 | 
            +
              VALUE val_ret;
         | 
| 1299 1316 | 
             
              volatile VALUE tmp_argv0 = r_mpfi_new_fi_obj(argv[0]);
         | 
| 1300 1317 | 
             
              r_mpfi_get_struct(ptr_a0, tmp_argv0);
         | 
| 1301 | 
            -
              VALUE val_ret;
         | 
| 1302 1318 | 
             
              r_mpfi_make_struct_init2(val_ret, ptr_ret, r_mpfr_prec_from_optional_argument(1, 2, argc, argv));
         | 
| 1303 1319 | 
             
              r_mpfi_set_function_state(mpfi_exp(ptr_ret, ptr_a0));
         | 
| 1304 1320 | 
             
              return val_ret;
         | 
| @@ -1308,9 +1324,9 @@ static VALUE r_mpfi_math_exp (int argc, VALUE *argv, VALUE self) | |
| 1308 1324 | 
             
            static VALUE r_mpfi_math_exp2 (int argc, VALUE *argv, VALUE self)
         | 
| 1309 1325 | 
             
            {
         | 
| 1310 1326 | 
             
              MPFI *ptr_a0, *ptr_ret;
         | 
| 1327 | 
            +
              VALUE val_ret;
         | 
| 1311 1328 | 
             
              volatile VALUE tmp_argv0 = r_mpfi_new_fi_obj(argv[0]);
         | 
| 1312 1329 | 
             
              r_mpfi_get_struct(ptr_a0, tmp_argv0);
         | 
| 1313 | 
            -
              VALUE val_ret;
         | 
| 1314 1330 | 
             
              r_mpfi_make_struct_init2(val_ret, ptr_ret, r_mpfr_prec_from_optional_argument(1, 2, argc, argv));
         | 
| 1315 1331 | 
             
              r_mpfi_set_function_state(mpfi_exp2(ptr_ret, ptr_a0));
         | 
| 1316 1332 | 
             
              return val_ret;
         | 
| @@ -1320,9 +1336,9 @@ static VALUE r_mpfi_math_exp2 (int argc, VALUE *argv, VALUE self) | |
| 1320 1336 | 
             
            static VALUE r_mpfi_math_cos (int argc, VALUE *argv, VALUE self)
         | 
| 1321 1337 | 
             
            {
         | 
| 1322 1338 | 
             
              MPFI *ptr_a0, *ptr_ret;
         | 
| 1339 | 
            +
              VALUE val_ret;
         | 
| 1323 1340 | 
             
              volatile VALUE tmp_argv0 = r_mpfi_new_fi_obj(argv[0]);
         | 
| 1324 1341 | 
             
              r_mpfi_get_struct(ptr_a0, tmp_argv0);
         | 
| 1325 | 
            -
              VALUE val_ret;
         | 
| 1326 1342 | 
             
              r_mpfi_make_struct_init2(val_ret, ptr_ret, r_mpfr_prec_from_optional_argument(1, 2, argc, argv));
         | 
| 1327 1343 | 
             
              r_mpfi_set_function_state(mpfi_cos(ptr_ret, ptr_a0));
         | 
| 1328 1344 | 
             
              return val_ret;
         | 
| @@ -1332,9 +1348,9 @@ static VALUE r_mpfi_math_cos (int argc, VALUE *argv, VALUE self) | |
| 1332 1348 | 
             
            static VALUE r_mpfi_math_sin (int argc, VALUE *argv, VALUE self)
         | 
| 1333 1349 | 
             
            {
         | 
| 1334 1350 | 
             
              MPFI *ptr_a0, *ptr_ret;
         | 
| 1351 | 
            +
              VALUE val_ret;
         | 
| 1335 1352 | 
             
              volatile VALUE tmp_argv0 = r_mpfi_new_fi_obj(argv[0]);
         | 
| 1336 1353 | 
             
              r_mpfi_get_struct(ptr_a0, tmp_argv0);
         | 
| 1337 | 
            -
              VALUE val_ret;
         | 
| 1338 1354 | 
             
              r_mpfi_make_struct_init2(val_ret, ptr_ret, r_mpfr_prec_from_optional_argument(1, 2, argc, argv));
         | 
| 1339 1355 | 
             
              r_mpfi_set_function_state(mpfi_sin(ptr_ret, ptr_a0));
         | 
| 1340 1356 | 
             
              return val_ret;
         | 
| @@ -1344,9 +1360,9 @@ static VALUE r_mpfi_math_sin (int argc, VALUE *argv, VALUE self) | |
| 1344 1360 | 
             
            static VALUE r_mpfi_math_tan (int argc, VALUE *argv, VALUE self)
         | 
| 1345 1361 | 
             
            {
         | 
| 1346 1362 | 
             
              MPFI *ptr_a0, *ptr_ret;
         | 
| 1363 | 
            +
              VALUE val_ret;
         | 
| 1347 1364 | 
             
              volatile VALUE tmp_argv0 = r_mpfi_new_fi_obj(argv[0]);
         | 
| 1348 1365 | 
             
              r_mpfi_get_struct(ptr_a0, tmp_argv0);
         | 
| 1349 | 
            -
              VALUE val_ret;
         | 
| 1350 1366 | 
             
              r_mpfi_make_struct_init2(val_ret, ptr_ret, r_mpfr_prec_from_optional_argument(1, 2, argc, argv));
         | 
| 1351 1367 | 
             
              r_mpfi_set_function_state(mpfi_tan(ptr_ret, ptr_a0));
         | 
| 1352 1368 | 
             
              return val_ret;
         | 
| @@ -1356,9 +1372,9 @@ static VALUE r_mpfi_math_tan (int argc, VALUE *argv, VALUE self) | |
| 1356 1372 | 
             
            static VALUE r_mpfi_math_acos (int argc, VALUE *argv, VALUE self)
         | 
| 1357 1373 | 
             
            {
         | 
| 1358 1374 | 
             
              MPFI *ptr_a0, *ptr_ret;
         | 
| 1375 | 
            +
              VALUE val_ret;
         | 
| 1359 1376 | 
             
              volatile VALUE tmp_argv0 = r_mpfi_new_fi_obj(argv[0]);
         | 
| 1360 1377 | 
             
              r_mpfi_get_struct(ptr_a0, tmp_argv0);
         | 
| 1361 | 
            -
              VALUE val_ret;
         | 
| 1362 1378 | 
             
              r_mpfi_make_struct_init2(val_ret, ptr_ret, r_mpfr_prec_from_optional_argument(1, 2, argc, argv));
         | 
| 1363 1379 | 
             
              r_mpfi_set_function_state(mpfi_acos(ptr_ret, ptr_a0));
         | 
| 1364 1380 | 
             
              return val_ret;
         | 
| @@ -1368,9 +1384,9 @@ static VALUE r_mpfi_math_acos (int argc, VALUE *argv, VALUE self) | |
| 1368 1384 | 
             
            static VALUE r_mpfi_math_asin (int argc, VALUE *argv, VALUE self)
         | 
| 1369 1385 | 
             
            {
         | 
| 1370 1386 | 
             
              MPFI *ptr_a0, *ptr_ret;
         | 
| 1387 | 
            +
              VALUE val_ret;
         | 
| 1371 1388 | 
             
              volatile VALUE tmp_argv0 = r_mpfi_new_fi_obj(argv[0]);
         | 
| 1372 1389 | 
             
              r_mpfi_get_struct(ptr_a0, tmp_argv0);
         | 
| 1373 | 
            -
              VALUE val_ret;
         | 
| 1374 1390 | 
             
              r_mpfi_make_struct_init2(val_ret, ptr_ret, r_mpfr_prec_from_optional_argument(1, 2, argc, argv));
         | 
| 1375 1391 | 
             
              r_mpfi_set_function_state(mpfi_asin(ptr_ret, ptr_a0));
         | 
| 1376 1392 | 
             
              return val_ret;
         | 
| @@ -1380,9 +1396,9 @@ static VALUE r_mpfi_math_asin (int argc, VALUE *argv, VALUE self) | |
| 1380 1396 | 
             
            static VALUE r_mpfi_math_atan (int argc, VALUE *argv, VALUE self)
         | 
| 1381 1397 | 
             
            {
         | 
| 1382 1398 | 
             
              MPFI *ptr_a0, *ptr_ret;
         | 
| 1399 | 
            +
              VALUE val_ret;
         | 
| 1383 1400 | 
             
              volatile VALUE tmp_argv0 = r_mpfi_new_fi_obj(argv[0]);
         | 
| 1384 1401 | 
             
              r_mpfi_get_struct(ptr_a0, tmp_argv0);
         | 
| 1385 | 
            -
              VALUE val_ret;
         | 
| 1386 1402 | 
             
              r_mpfi_make_struct_init2(val_ret, ptr_ret, r_mpfr_prec_from_optional_argument(1, 2, argc, argv));
         | 
| 1387 1403 | 
             
              r_mpfi_set_function_state(mpfi_atan(ptr_ret, ptr_a0));
         | 
| 1388 1404 | 
             
              return val_ret;
         | 
| @@ -1392,9 +1408,9 @@ static VALUE r_mpfi_math_atan (int argc, VALUE *argv, VALUE self) | |
| 1392 1408 | 
             
            static VALUE r_mpfi_math_cosh (int argc, VALUE *argv, VALUE self)
         | 
| 1393 1409 | 
             
            {
         | 
| 1394 1410 | 
             
              MPFI *ptr_a0, *ptr_ret;
         | 
| 1411 | 
            +
              VALUE val_ret;
         | 
| 1395 1412 | 
             
              volatile VALUE tmp_argv0 = r_mpfi_new_fi_obj(argv[0]);
         | 
| 1396 1413 | 
             
              r_mpfi_get_struct(ptr_a0, tmp_argv0);
         | 
| 1397 | 
            -
              VALUE val_ret;
         | 
| 1398 1414 | 
             
              r_mpfi_make_struct_init2(val_ret, ptr_ret, r_mpfr_prec_from_optional_argument(1, 2, argc, argv));
         | 
| 1399 1415 | 
             
              r_mpfi_set_function_state(mpfi_cosh(ptr_ret, ptr_a0));
         | 
| 1400 1416 | 
             
              return val_ret;
         | 
| @@ -1404,9 +1420,9 @@ static VALUE r_mpfi_math_cosh (int argc, VALUE *argv, VALUE self) | |
| 1404 1420 | 
             
            static VALUE r_mpfi_math_sinh (int argc, VALUE *argv, VALUE self)
         | 
| 1405 1421 | 
             
            {
         | 
| 1406 1422 | 
             
              MPFI *ptr_a0, *ptr_ret;
         | 
| 1423 | 
            +
              VALUE val_ret;
         | 
| 1407 1424 | 
             
              volatile VALUE tmp_argv0 = r_mpfi_new_fi_obj(argv[0]);
         | 
| 1408 1425 | 
             
              r_mpfi_get_struct(ptr_a0, tmp_argv0);
         | 
| 1409 | 
            -
              VALUE val_ret;
         | 
| 1410 1426 | 
             
              r_mpfi_make_struct_init2(val_ret, ptr_ret, r_mpfr_prec_from_optional_argument(1, 2, argc, argv));
         | 
| 1411 1427 | 
             
              r_mpfi_set_function_state(mpfi_sinh(ptr_ret, ptr_a0));
         | 
| 1412 1428 | 
             
              return val_ret;
         | 
| @@ -1416,9 +1432,9 @@ static VALUE r_mpfi_math_sinh (int argc, VALUE *argv, VALUE self) | |
| 1416 1432 | 
             
            static VALUE r_mpfi_math_tanh (int argc, VALUE *argv, VALUE self)
         | 
| 1417 1433 | 
             
            {
         | 
| 1418 1434 | 
             
              MPFI *ptr_a0, *ptr_ret;
         | 
| 1435 | 
            +
              VALUE val_ret;
         | 
| 1419 1436 | 
             
              volatile VALUE tmp_argv0 = r_mpfi_new_fi_obj(argv[0]);
         | 
| 1420 1437 | 
             
              r_mpfi_get_struct(ptr_a0, tmp_argv0);
         | 
| 1421 | 
            -
              VALUE val_ret;
         | 
| 1422 1438 | 
             
              r_mpfi_make_struct_init2(val_ret, ptr_ret, r_mpfr_prec_from_optional_argument(1, 2, argc, argv));
         | 
| 1423 1439 | 
             
              r_mpfi_set_function_state(mpfi_tanh(ptr_ret, ptr_a0));
         | 
| 1424 1440 | 
             
              return val_ret;
         | 
| @@ -1428,9 +1444,9 @@ static VALUE r_mpfi_math_tanh (int argc, VALUE *argv, VALUE self) | |
| 1428 1444 | 
             
            static VALUE r_mpfi_math_acosh (int argc, VALUE *argv, VALUE self)
         | 
| 1429 1445 | 
             
            {
         | 
| 1430 1446 | 
             
              MPFI *ptr_a0, *ptr_ret;
         | 
| 1447 | 
            +
              VALUE val_ret;
         | 
| 1431 1448 | 
             
              volatile VALUE tmp_argv0 = r_mpfi_new_fi_obj(argv[0]);
         | 
| 1432 1449 | 
             
              r_mpfi_get_struct(ptr_a0, tmp_argv0);
         | 
| 1433 | 
            -
              VALUE val_ret;
         | 
| 1434 1450 | 
             
              r_mpfi_make_struct_init2(val_ret, ptr_ret, r_mpfr_prec_from_optional_argument(1, 2, argc, argv));
         | 
| 1435 1451 | 
             
              r_mpfi_set_function_state(mpfi_acosh(ptr_ret, ptr_a0));
         | 
| 1436 1452 | 
             
              return val_ret;
         | 
| @@ -1440,9 +1456,9 @@ static VALUE r_mpfi_math_acosh (int argc, VALUE *argv, VALUE self) | |
| 1440 1456 | 
             
            static VALUE r_mpfi_math_asinh (int argc, VALUE *argv, VALUE self)
         | 
| 1441 1457 | 
             
            {
         | 
| 1442 1458 | 
             
              MPFI *ptr_a0, *ptr_ret;
         | 
| 1459 | 
            +
              VALUE val_ret;
         | 
| 1443 1460 | 
             
              volatile VALUE tmp_argv0 = r_mpfi_new_fi_obj(argv[0]);
         | 
| 1444 1461 | 
             
              r_mpfi_get_struct(ptr_a0, tmp_argv0);
         | 
| 1445 | 
            -
              VALUE val_ret;
         | 
| 1446 1462 | 
             
              r_mpfi_make_struct_init2(val_ret, ptr_ret, r_mpfr_prec_from_optional_argument(1, 2, argc, argv));
         | 
| 1447 1463 | 
             
              r_mpfi_set_function_state(mpfi_asinh(ptr_ret, ptr_a0));
         | 
| 1448 1464 | 
             
              return val_ret;
         | 
| @@ -1452,9 +1468,9 @@ static VALUE r_mpfi_math_asinh (int argc, VALUE *argv, VALUE self) | |
| 1452 1468 | 
             
            static VALUE r_mpfi_math_atanh (int argc, VALUE *argv, VALUE self)
         | 
| 1453 1469 | 
             
            {
         | 
| 1454 1470 | 
             
              MPFI *ptr_a0, *ptr_ret;
         | 
| 1471 | 
            +
              VALUE val_ret;
         | 
| 1455 1472 | 
             
              volatile VALUE tmp_argv0 = r_mpfi_new_fi_obj(argv[0]);
         | 
| 1456 1473 | 
             
              r_mpfi_get_struct(ptr_a0, tmp_argv0);
         | 
| 1457 | 
            -
              VALUE val_ret;
         | 
| 1458 1474 | 
             
              r_mpfi_make_struct_init2(val_ret, ptr_ret, r_mpfr_prec_from_optional_argument(1, 2, argc, argv));
         | 
| 1459 1475 | 
             
              r_mpfi_set_function_state(mpfi_atanh(ptr_ret, ptr_a0));
         | 
| 1460 1476 | 
             
              return val_ret;
         | 
| @@ -1464,9 +1480,9 @@ static VALUE r_mpfi_math_atanh (int argc, VALUE *argv, VALUE self) | |
| 1464 1480 | 
             
            static VALUE r_mpfi_math_log1p (int argc, VALUE *argv, VALUE self)
         | 
| 1465 1481 | 
             
            {
         | 
| 1466 1482 | 
             
              MPFI *ptr_a0, *ptr_ret;
         | 
| 1483 | 
            +
              VALUE val_ret;
         | 
| 1467 1484 | 
             
              volatile VALUE tmp_argv0 = r_mpfi_new_fi_obj(argv[0]);
         | 
| 1468 1485 | 
             
              r_mpfi_get_struct(ptr_a0, tmp_argv0);
         | 
| 1469 | 
            -
              VALUE val_ret;
         | 
| 1470 1486 | 
             
              r_mpfi_make_struct_init2(val_ret, ptr_ret, r_mpfr_prec_from_optional_argument(1, 2, argc, argv));
         | 
| 1471 1487 | 
             
              r_mpfi_set_function_state(mpfi_log1p(ptr_ret, ptr_a0));
         | 
| 1472 1488 | 
             
              return val_ret;
         | 
| @@ -1476,9 +1492,9 @@ static VALUE r_mpfi_math_log1p (int argc, VALUE *argv, VALUE self) | |
| 1476 1492 | 
             
            static VALUE r_mpfi_math_expm1 (int argc, VALUE *argv, VALUE self)
         | 
| 1477 1493 | 
             
            {
         | 
| 1478 1494 | 
             
              MPFI *ptr_a0, *ptr_ret;
         | 
| 1495 | 
            +
              VALUE val_ret;
         | 
| 1479 1496 | 
             
              volatile VALUE tmp_argv0 = r_mpfi_new_fi_obj(argv[0]);
         | 
| 1480 1497 | 
             
              r_mpfi_get_struct(ptr_a0, tmp_argv0);
         | 
| 1481 | 
            -
              VALUE val_ret;
         | 
| 1482 1498 | 
             
              r_mpfi_make_struct_init2(val_ret, ptr_ret, r_mpfr_prec_from_optional_argument(1, 2, argc, argv));
         | 
| 1483 1499 | 
             
              r_mpfi_set_function_state(mpfi_expm1(ptr_ret, ptr_a0));
         | 
| 1484 1500 | 
             
              return val_ret;
         | 
| @@ -1488,9 +1504,9 @@ static VALUE r_mpfi_math_expm1 (int argc, VALUE *argv, VALUE self) | |
| 1488 1504 | 
             
            static VALUE r_mpfi_math_log2 (int argc, VALUE *argv, VALUE self)
         | 
| 1489 1505 | 
             
            {
         | 
| 1490 1506 | 
             
              MPFI *ptr_a0, *ptr_ret;
         | 
| 1507 | 
            +
              VALUE val_ret;
         | 
| 1491 1508 | 
             
              volatile VALUE tmp_argv0 = r_mpfi_new_fi_obj(argv[0]);
         | 
| 1492 1509 | 
             
              r_mpfi_get_struct(ptr_a0, tmp_argv0);
         | 
| 1493 | 
            -
              VALUE val_ret;
         | 
| 1494 1510 | 
             
              r_mpfi_make_struct_init2(val_ret, ptr_ret, r_mpfr_prec_from_optional_argument(1, 2, argc, argv));
         | 
| 1495 1511 | 
             
              r_mpfi_set_function_state(mpfi_log2(ptr_ret, ptr_a0));
         | 
| 1496 1512 | 
             
              return val_ret;
         | 
| @@ -1500,9 +1516,9 @@ static VALUE r_mpfi_math_log2 (int argc, VALUE *argv, VALUE self) | |
| 1500 1516 | 
             
            static VALUE r_mpfi_math_log10 (int argc, VALUE *argv, VALUE self)
         | 
| 1501 1517 | 
             
            {
         | 
| 1502 1518 | 
             
              MPFI *ptr_a0, *ptr_ret;
         | 
| 1519 | 
            +
              VALUE val_ret;
         | 
| 1503 1520 | 
             
              volatile VALUE tmp_argv0 = r_mpfi_new_fi_obj(argv[0]);
         | 
| 1504 1521 | 
             
              r_mpfi_get_struct(ptr_a0, tmp_argv0);
         | 
| 1505 | 
            -
              VALUE val_ret;
         | 
| 1506 1522 | 
             
              r_mpfi_make_struct_init2(val_ret, ptr_ret, r_mpfr_prec_from_optional_argument(1, 2, argc, argv));
         | 
| 1507 1523 | 
             
              r_mpfi_set_function_state(mpfi_log10(ptr_ret, ptr_a0));
         | 
| 1508 1524 | 
             
              return val_ret;
         |