From c004ecfa1ecc447b764d1ab91cbf9a23c2ed79ca Mon Sep 17 00:00:00 2001 From: matz Date: Thu, 5 Jun 2003 06:40:42 +0000 Subject: * math.c (math_erf,math_erfc): new function. [ruby-list:37753] * eval.c (ruby_finalize): no longer need to turn off $DEBUG in the finalizer. (ruby-bugs-ja PR#473) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3907 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 9 +++++++++ LEGAL | 1 + MANIFEST | 1 + configure.in | 2 +- eval.c | 1 - math.c | 19 +++++++++++++++++++ missing.h | 5 +++++ 7 files changed, 36 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1d923f6fc2..a2598f2c8e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Thu Jun 5 15:09:06 2003 Yukihiro Matsumoto + + * math.c (math_erf,math_erfc): new function. [ruby-list:37753] + Thu Jun 5 05:49:43 2003 why the lucky stiff * ext/syck/rubyext.c: using GC nodes caused segfault. [ruby-core:1071] @@ -11,6 +15,11 @@ Thu Jun 5 04:48:57 2003 why the lucky stiff * ext/syck/handler.c, ext/syck/syck.c: ensure a fresh strtable between parser iterations. +Wed Jun 4 12:06:59 2003 Yukihiro Matsumoto + + * eval.c (ruby_finalize): no longer need to turn off $DEBUG in the + finalizer. (ruby-bugs-ja PR#473) + Tue Jun 3 22:20:49 2003 Yukihiro Matsumoto * eval.c (rb_call_super): should search superclass method based on diff --git a/LEGAL b/LEGAL index 8a87bfa668..dce7c1acbf 100644 --- a/LEGAL +++ b/LEGAL @@ -134,6 +134,7 @@ st.[ch]: x68/*: missing/alloca.c: missing/dup2.c: +missing/erf.c: missing/finite.c: missing/hypot.c: missing/isinf.c: diff --git a/MANIFEST b/MANIFEST index d7bb8dfbdf..f69aaab2a9 100644 --- a/MANIFEST +++ b/MANIFEST @@ -262,6 +262,7 @@ missing/acosh.c missing/alloca.c missing/crypt.c missing/dup2.c +missing/erf.c missing/file.h missing/fileblocks.c missing/finite.c diff --git a/configure.in b/configure.in index 7bf4e39a86..c922fabb52 100644 --- a/configure.in +++ b/configure.in @@ -371,7 +371,7 @@ AC_FUNC_FSEEKO AC_CHECK_FUNCS(ftello) AC_REPLACE_FUNCS(dup2 memmove mkdir strcasecmp strncasecmp strerror strftime\ strchr strstr strtoul crypt flock vsnprintf\ - isinf isnan finite hypot acosh) + isinf isnan finite hypot acosh erf) AC_CHECK_FUNCS(fmod killpg wait4 waitpid syscall chroot fsync\ truncate chsize times utimes fcntl lockf lstat symlink readlink\ setitimer setruid seteuid setreuid setresuid setproctitle\ diff --git a/eval.c b/eval.c index f4b4f897c2..46245360c6 100644 --- a/eval.c +++ b/eval.c @@ -1313,7 +1313,6 @@ ruby_finalize() { int state; - ruby_debug = Qfalse; PUSH_TAG(PROT_NONE); if ((state = EXEC_TAG()) == 0) { rb_trap_exit(); diff --git a/math.c b/math.c index 77c0173a5e..8d7bd8c53f 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); } diff --git a/missing.h b/missing.h index df4cecc916..5416500cb0 100644 --- a/missing.h +++ b/missing.h @@ -54,6 +54,11 @@ extern double frexp _((double, int *)); extern double hypot _((double, double)); #endif +#ifndef HAVE_ERF +extern double erf _((double, double)); +extern double erfc _((double, double)); +#endif + #ifndef HAVE_ISINF extern int isinf _((double)); #endif -- cgit v1.2.3