FLTK 1.4.0
Loading...
Searching...
No Matches
math.h
1//
2// Math header file for the Fast Light Tool Kit (FLTK).
3//
4// Copyright 1998-2020 by Bill Spitzak and others.
5//
6// This library is free software. Distribution and use rights are outlined in
7// the file "COPYING" which should have been included with this file. If this
8// file is missing or damaged, see the license at:
9//
10// https://www.fltk.org/COPYING.php
11//
12// Please see the following page on how to report bugs and issues:
13//
14// https://www.fltk.org/bugs.php
15//
16
17// Xcode on macOS includes files by recursing down into directories.
18// This code catches the cycle and directly includes the required file.
19#ifdef fl_math_h_cyclic_include
20# include "/usr/include/math.h"
21#endif
22
23#ifndef fl_math_h
24# define fl_math_h
25
26# define fl_math_h_cyclic_include
27# include <math.h>
28# undef fl_math_h_cyclic_include
29
30# ifndef M_PI
31# define M_PI 3.14159265358979323846
32# define M_PI_2 1.57079632679489661923
33# define M_PI_4 0.78539816339744830962
34# define M_1_PI 0.31830988618379067154
35# define M_2_PI 0.63661977236758134308
36# endif // !M_PI
37
38# ifndef M_SQRT2
39# define M_SQRT2 1.41421356237309504880
40# define M_SQRT1_2 0.70710678118654752440
41# endif // !M_SQRT2
42
43# if (defined(_WIN32) || defined(CRAY)) && !defined(__MINGW32__)
44
45inline double rint(double v) {return floor(v+.5);}
46inline double copysign(double a, double b) {return b<0 ? -a : a;}
47
48# endif // (_WIN32 || CRAY) && !__MINGW32__
49
50#endif // !fl_math_h