diff options
Diffstat (limited to 'mi')
-rw-r--r-- | mi/Makefile.am | 1 | ||||
-rw-r--r-- | mi/cbrt.c | 46 | ||||
-rw-r--r-- | mi/miarc.c | 19 |
3 files changed, 11 insertions, 55 deletions
diff --git a/mi/Makefile.am b/mi/Makefile.am index f262f4bff..06ce15a4e 100644 --- a/mi/Makefile.am +++ b/mi/Makefile.am @@ -9,7 +9,6 @@ endif AM_CFLAGS = $(DIX_CFLAGS) libmi_la_SOURCES = \ - cbrt.c \ mi.h \ miarc.c \ mibank.c \ diff --git a/mi/cbrt.c b/mi/cbrt.c deleted file mode 100644 index c703fd9d2..000000000 --- a/mi/cbrt.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - -Copyright 1990, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ - -/* simple cbrt, in case your math library doesn't have a good one */ - -/* - * Would normally include <math.h> for this, but for the sake of compiler - * warnings, we don't want to get duplicate declarations for cbrt(). - */ - -double pow(double, double); -double cbrt(double); - -double -cbrt(double x) -{ - if (x > 0.0) - return pow(x, 1.0/3.0); - else - return -pow(-x, 1.0/3.0); -} 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: |