Class: Numeric
Instance Method Summary collapse
-
#nan? ⇒ false
The #nan? method for primitive.
-
#reciprocal(prec) ⇒ BigDecimal, Complex
Returns the reciprocal of itself with
precas decimal precision.
Instance Method Details
#nan? ⇒ false
The #nan? method for primitive. Always return false.
19 20 21 22 23 |
# File 'ext/bigdecimal/math_r/overrides.c', line 19
static VALUE
numeric_nan_p(VALUE self)
{
return Qfalse;
}
|
#reciprocal(prec) ⇒ BigDecimal, Complex
Returns the reciprocal of itself with prec as decimal precision.
If it is a complex number, computes (x / ||w||) - (y / ||w||) * i).
Where ||w|| = x^2 + y^2.
75 76 77 78 79 80 81 82 |
# File 'ext/bigdecimal/math_r/overrides.c', line 75
static VALUE
__impl_numeric_reciprocal(VALUE self, VALUE prec)
{
if (rb_num_real_p(self))
return rb_num_canonicalize(self, prec, ARG_REAL, ARG_RECIPROCAL);
else
return rb_num_canonicalize(self, prec, ARG_COMPLEX, ARG_RECIPROCAL);
}
|