diff options
author | Adam Jackson <ajax@benzedrine.nwnk.net> | 2007-05-09 21:49:44 -0400 |
---|---|---|
committer | Adam Jackson <ajax@benzedrine.nwnk.net> | 2007-05-11 11:43:19 -0400 |
commit | 20c5250e487e032d392e2e4624021fccb1bfb72c (patch) | |
tree | ea0959971cabf3ce769f96cbeadd904171a38d92 /mi/miarc.c | |
parent | 8dcc37520d5e8c8b52cee81faa67fd5205548377 (diff) |
Use system copy of cbrt() if available.
Also move the replacement inline into miarc.c, since that's the only user.
Diffstat (limited to 'mi/miarc.c')
-rw-r--r-- | mi/miarc.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/mi/miarc.c b/mi/miarc.c index 69c5acdbc..3b77ce74a 100644 --- a/mi/miarc.c +++ b/mi/miarc.c @@ -51,14 +51,7 @@ SOFTWARE. #include <dix-config.h> #endif -#if defined(_XOPEN_SOURCE) || defined(__QNXNTO__) \ - || (defined(sun) && defined(__SVR4)) #include <math.h> -#else -#define _XOPEN_SOURCE /* to get prototype for hypot on some systems */ -#include <math.h> -#undef _XOPEN_SOURCE -#endif #include <X11/X.h> #include <X11/Xprotostr.h> #include "misc.h" @@ -75,7 +68,17 @@ static double miDsin(double a); static double miDcos(double a); static double miDasin(double v); static double miDatan2(double dy, double dx); -double cbrt(double); + +#ifndef HAVE_CBRT +static double +cbrt(double x) +{ + if (x > 0.0) + return pow(x, 1.0/3.0); + else + return -pow(-x, 1.0/3.0); +} +#endif /* * some interesting sematic interpretation of the protocol: |