src/libm/math.h
author Sam Lantinga <slouken@libsdl.org>
Sun, 12 Oct 2008 16:30:42 +0000
changeset 2769 2a46b5912665
parent 2768 26861c61142a
child 2859 99210400e8b9
permissions -rw-r--r--
Added missing math.h functionality for SDL_audiocvt.c
slouken@2756
     1
/*
slouken@2756
     2
    SDL - Simple DirectMedia Layer
slouken@2756
     3
    Copyright (C) 1997-2006 Sam Lantinga
slouken@2756
     4
slouken@2756
     5
    This library is free software; you can redistribute it and/or
slouken@2756
     6
    modify it under the terms of the GNU Lesser General Public
slouken@2756
     7
    License as published by the Free Software Foundation; either
slouken@2756
     8
    version 2.1 of the License, or (at your option) any later version.
slouken@2756
     9
slouken@2756
    10
    This library is distributed in the hope that it will be useful,
slouken@2756
    11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
slouken@2756
    12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
slouken@2756
    13
    Lesser General Public License for more details.
slouken@2756
    14
slouken@2756
    15
    You should have received a copy of the GNU Lesser General Public
slouken@2756
    16
    License along with this library; if not, write to the Free Software
slouken@2756
    17
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
slouken@2756
    18
slouken@2756
    19
    Sam Lantinga
slouken@2756
    20
    slouken@libsdl.org
slouken@2756
    21
*/
slouken@2756
    22
#include "SDL_config.h"
slouken@2756
    23
slouken@2756
    24
#ifdef HAVE_MATH_H
slouken@2768
    25
#define _USE_MATH_DEFINES
slouken@2756
    26
#include <math.h>
slouken@2756
    27
#else
slouken@2756
    28
slouken@2760
    29
/* Math routines from uClibc: http://www.uclibc.org */
slouken@2760
    30
slouken@2769
    31
#define M_PI    3.14159265358979323846264338327950288   /* pi */
slouken@2769
    32
slouken@2756
    33
extern double __ieee754_log(double x);
slouken@2756
    34
extern double __ieee754_pow(double x, double y);
slouken@2756
    35
extern double __ieee754_sqrt(double x);
slouken@2756
    36
slouken@2756
    37
#define log(x)      __ieee754_log(x)
slouken@2756
    38
#define pow(x, y)   __ieee754_pow(x, y)
slouken@2756
    39
#define sqrt(x)     __ieee754_sqrt(x)
slouken@2756
    40
slouken@2756
    41
extern double copysign(double x, double y);
slouken@2756
    42
extern double cos(double x);
slouken@2756
    43
extern double fabs(double x);
slouken@2759
    44
extern double floor(double x);
slouken@2756
    45
extern double scalbn(double x, int n);
slouken@2756
    46
extern double sin(double x);
slouken@2756
    47
slouken@2769
    48
#define sinf(x) (float)sin((double)x)
slouken@2769
    49
#define cosf(x) (float)cos((double)x)
slouken@2769
    50
slouken@2756
    51
#endif /* HAVE_MATH_H */
slouken@2756
    52
slouken@2756
    53
/* vi: set ts=4 sw=4 expandtab: */