source: NonGTP/FLTK/include/fltk/math.h @ 773

Revision 773, 2.7 KB checked in by gumbau, 19 years ago (diff)

FLTK imported to SVN repository to be linked agains the GeoTool? application

RevLine 
[773]1//
2// "$Id: math.h 4303 2005-05-01 03:33:52Z spitzak $"
3//
4// The purpose of this header file is to make math.h look the same as
5// Unix on other operating systems.
6//
7// Copyright 1998-2003 by Bill Spitzak and others.
8//
9// This library is free software; you can redistribute it and/or
10// modify it under the terms of the GNU Library General Public
11// License as published by the Free Software Foundation; either
12// version 2 of the License, or (at your option) any later version.
13//
14// This library is distributed in the hope that it will be useful,
15// but WITHOUT ANY WARRANTY; without even the implied warranty of
16// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17// Library General Public License for more details.
18//
19// You should have received a copy of the GNU Library General Public
20// License along with this library; if not, write to the Free Software
21// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
22// USA.
23//
24// Please report all bugs and problems to "fltk-bugs@fltk.org".
25//
26
27#ifndef fl_math_h
28#define fl_math_h
29
30#include <math.h>
31
32#if defined(_WIN32) && !defined(__CYGWIN__)
33/* things missing from <math.h> on Windows: */
34# include <float.h>
35
36# ifndef M_PI
37#  define M_PI          3.14159265358979323846
38#  define M_PI_2        1.57079632679489661923
39#  define M_PI_4        0.78539816339744830962
40#  define M_1_PI        0.31830988618379067154
41#  define M_2_PI        0.63661977236758134308
42#  define M_SQRT2       1.41421356237309504880
43#  define M_SQRT1_2     0.70710678118654752440
44# endif
45
46# define rint(v)        floor((v)+.5)
47# define copysign       _copysign
48# define drand48()      ((double)rand()/RAND_MAX)
49# define srand48(n)     srand((n));
50
51#endif
52
53#ifdef __EMX__
54# include <float.h>
55#endif
56
57// define missing 'f' versions of functions:
58#if 1 // All systems seem to be missing rintf:
59# define rintf(v)       floorf((v)+.5f)
60#endif
61#if defined(__APPLE__) || defined(__sun__) || defined(__BORLANDC__)
62# define floorf(a)      ((float)floor(a))
63# define ceilf(a)       ((float)ceil(a))
64# define fmodf(a,b)     ((float)fmod(a,b))
65# undef fabsf
66# define fabsf(a)       ((float)fabs(a))
67# define sinf(a)        ((float)sin(a))
68# define cosf(a)        ((float)cos(a))
69# define tanf(a)        ((float)tan(a))
70# define asinf(a)       ((float)asin(a))
71# define acosf(a)       ((float)acos(a))
72# define atanf(a)       ((float)atan(a))
73# define atan2f(a,b)    ((float)atan2(a,b))
74# define expf(a)        ((float)exp(a))
75# define logf(a)        ((float)log(a))
76# define log10f(a)      ((float)log10(a))
77# undef sqrtf
78# define sqrtf(a)       ((float)sqrt(a))
79#endif
80#ifdef __alpha // powf is broken on alphas, at least in gcc
81# define powf(a,b)      ((float)pow(a,b))
82#endif
83#ifdef _WIN32
84# define expm1f(a)      ((float)expm1(a))
85# define log1pf(a)      ((float)log1p(a))
86#endif
87
88#endif
89
90//
91// End of "$Id: math.h 4303 2005-05-01 03:33:52Z spitzak $".
92//
Note: See TracBrowser for help on using the repository browser.