aboutsummaryrefslogtreecommitdiffstats
path: root/missing/cbrt.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-02-09 09:36:03 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-02-09 09:36:03 +0000
commitb160d23c68e2e8fcd82b96fab0977be11c2b9ec6 (patch)
treed85dbe40e1b2ff4089f4c4f228e65e2eb09243b5 /missing/cbrt.c
parenta424741c8e73bbca5d893594abbdfda489794739 (diff)
downloadruby-b160d23c68e2e8fcd82b96fab0977be11c2b9ec6.tar.gz
* math.c (math_cbrt): new method Math.cbrt.
* configure.in (cbrt): check for replacement functions. * missing/cbrt.c: new file. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15416 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'missing/cbrt.c')
-rw-r--r--missing/cbrt.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/missing/cbrt.c b/missing/cbrt.c
new file mode 100644
index 0000000000..54db2703a0
--- /dev/null
+++ b/missing/cbrt.c
@@ -0,0 +1,10 @@
+#include <math.h>
+
+double cbrt(double x)
+{
+ if (x < 0)
+ return -pow(-x, 1/3.0);
+ else
+ return pow(x, 1/3.0);
+}
+