Module: GMP
- Defined in:
- ext/gmp.c,
ext/gmpf.c,
ext/gmpq.c,
ext/mprnd.c,
ext/gmpbench_timing.c
Defined Under Namespace
Classes: F, Q, RandState, Rnd, Z
Constant Summary collapse
- GMP_VERSION =
rb_str_new2(gmp_version)
- GMP_CC =
rb_str_new2(__GMP_CC)
- GMP_CFLAGS =
rb_str_new2(__GMP_CFLAGS)
- GMP_BITS_PER_LIMB =
INT2FIX(mp_bits_per_limb)
- MPFR_VERSION =
rb_str_new2(MPFR_VERSION_STRING)
- MPFR_PREC_MIN =
INT2FIX(MPFR_PREC_MIN)
- MPFR_PREC_MAX =
INT2FIX(MPFR_PREC_MAX)
- GMP_RNDN =
rb_funcall (cGMP_Rnd, new_id, 1, INT2FIX(0))
- GMP_RNDZ =
rb_funcall (cGMP_Rnd, new_id, 1, INT2FIX(1))
- GMP_RNDU =
rb_funcall (cGMP_Rnd, new_id, 1, INT2FIX(2))
- GMP_RNDD =
rb_funcall (cGMP_Rnd, new_id, 1, INT2FIX(3))
- MPFR_RNDN =
MPFR 3.0.0
rb_funcall (cGMP_Rnd, new_id, 1, INT2FIX(0))
- MPFR_RNDZ =
rb_funcall (cGMP_Rnd, new_id, 1, INT2FIX(1))
- MPFR_RNDU =
rb_funcall (cGMP_Rnd, new_id, 1, INT2FIX(2))
- MPFR_RNDD =
rb_funcall (cGMP_Rnd, new_id, 1, INT2FIX(3))
- MPFR_RNDA =
rb_funcall (cGMP_Rnd, new_id, 1, INT2FIX(4))
Class Method Summary collapse
- .cputime ⇒ Object
-
.F ⇒ Object
GMP Multiple Precision floating point numbers.
-
.GMP::Q(arg) ⇒ Object
A convenience method for GMP::Q.new(arg).
- .time ⇒ Object
Class Method Details
.cputime ⇒ Object
48 49 50 51 52 53 |
# File 'ext/gmpbench_timing.c', line 48
VALUE
r_gmpmod_cputime (VALUE self)
{
(void)self;
return INT2FIX (cputime ());
}
|
.F ⇒ Object
GMP Multiple Precision floating point numbers.
Instances of this class can store variables of the type mpf_t. This class also contains many methods that act as the functions for mpf_t variables, as well as a few methods that attempt to make this library more Ruby-ish.
The following list is just a simple checklist for me, really. A better reference should be found in the rdocs.
Ruby method C Extension function GMP function
to_d r_gmpf_to_d mpf_get_d
to_s r_gmpf_to_s mpf_get_s
+ r_gmpf_add mpf_add
- r_gmpf_sub mpf_sub
* r_gmpf_mul mpf_mul
/ r_gmpf_div mpf_div
.GMP::Q(arg) ⇒ Object
A convenience method for GMP::Q.new(arg).
91 92 93 94 95 |
# File 'ext/gmpq.c', line 91
VALUE r_gmpmod_q(int argc, VALUE *argv, VALUE module)
{
(void)module;
return r_gmpqsg_new(argc, argv, cGMP_Q);
}
|
.time ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'ext/gmpbench_timing.c', line 55
VALUE
r_gmpmod_time (VALUE self)
{
(void)self;
long int __t0, __times, __t, __tmp;
__times = 1;
rb_need_block();
rb_yield (Qnil);
do {
__times <<= 1;
__t0 = cputime ();
for (__t = 0; __t < __times; __t++)
{rb_yield (Qnil);}
__tmp = cputime () - __t0;
} while (__tmp < 250);
return rb_float_new ((double) __tmp / __times);
}
|