Use system copy of cbrt() if available.

Also move the replacement inline into miarc.c, since that's the only user.
This commit is contained in:
Adam Jackson
2007-05-09 21:49:44 -04:00
parent 8dcc37520d
commit 20c5250e48
5 changed files with 15 additions and 55 deletions

View File

@@ -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: