summaryrefslogtreecommitdiff
path: root/math.c
diff options
context:
space:
mode:
Diffstat (limited to 'math.c')
-rw-r--r--math.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/math.c b/math.c
index 77c0173..8d7bd8c 100644
--- a/math.c
+++ b/math.c
@@ -271,6 +271,22 @@ math_hypot(obj, x, y)
return rb_float_new(hypot(RFLOAT(x)->value, RFLOAT(y)->value));
}
+static VALUE
+math_erf(obj, x)
+ VALUE obj, x;
+{
+ Need_Float(x);
+ return rb_float_new(erf(RFLOAT(x)->value));
+}
+
+static VALUE
+math_erfc(obj, x)
+ VALUE obj, x;
+{
+ Need_Float(x);
+ return rb_float_new(erfc(RFLOAT(x)->value));
+}
+
void
Init_Math()
{
@@ -314,4 +330,7 @@ Init_Math()
rb_define_module_function(rb_mMath, "ldexp", math_ldexp, 2);
rb_define_module_function(rb_mMath, "hypot", math_hypot, 2);
+
+ rb_define_module_function(rb_mMath, "erf", math_erf, 1);
+ rb_define_module_function(rb_mMath, "erfc", math_erfc, 1);
}