Commit 90e14b83 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

compat: add sincos() and sincosf() replacements

parent eac6a8ea
/*****************************************************************************
* sincos.c: GNU sincos() & sincosf() replacements
*****************************************************************************
* Copyright © 2016 Rémi Denis-Courmont
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <math.h>
void sincos(double r, double *restrict sr, double *restrict cr)
{
*sr = sin(r);
*cr = cos(r);
}
void sincosf(float r, float *restrict sr, float *restrict cr)
{
*sr = sinf(r);
*cr = cosf(r);
}
......@@ -751,6 +751,11 @@ AC_CHECK_LIB(m,lrintf, [
AC_CHECK_LIB(m,nanf,
AC_DEFINE(HAVE_NANF, 1, [Define to 1 if you have the NANF function])
)
AC_CHECK_LIB(m,sincos, [
AC_DEFINE(HAVE_SINCOS, 1, [Define to 1 if you have the sincos function.])
], [
AC_LIBOBJ([sincos])
])
dnl Check for dynamic plugins
LIBDL=""
......
......@@ -481,6 +481,11 @@ void freeaddrinfo (struct addrinfo *res);
#define nanf(tagp) NAN
#endif
#ifndef HAVE_SINCOS
void sincos(double, double *, double *);
void sincosf(float, float *, float *);
#endif
#ifndef HAVE_REALPATH
char *realpath(const char * restrict pathname, char * restrict resolved_path);
#endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment