Panda3D
 All Classes Functions Variables Enumerations
cmath.h
1 // Filename: cmath.h
2 // Created by: drose (19May00)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef CMATH_H
16 #define CMATH_H
17 
18 // This file declares a number of C++-style overloading wrappers
19 // around the standard math library functions, so we can use
20 // overloading to differentiate on type instead of having to know
21 // explicitly whether we need to call, for instance, sqrtf() or
22 // sqrt().
23 
24 #include "dtoolbase.h"
25 
26 #include <cmath>
27 #include <cfloat>
28 #include <limits>
29 
30 INLINE float csqrt(float v);
31 INLINE float csin(float v);
32 INLINE float ccos(float v);
33 INLINE float ctan(float v);
34 INLINE void csincos(float v, float *sin_result, float *cos_result);
35 INLINE float csin_over_x(float v);
36 INLINE float cabs(float v);
37 INLINE float catan(float v);
38 INLINE float catan2(float y, float x);
39 INLINE float casin(float v);
40 INLINE float cacos(float v);
41 INLINE float cmod(float x, float y);
42 INLINE float cpow(float x, float y);
43 
44 INLINE double cfloor(double f);
45 INLINE double cceil(double f);
46 INLINE double cfrac(double f);
47 INLINE double csqrt(double v);
48 INLINE double csin(double v);
49 INLINE double ccos(double v);
50 INLINE double ctan(double v);
51 INLINE void csincos(double v, double *sin_result, double *cos_result);
52 INLINE double cabs(double v);
53 INLINE double catan(double v);
54 INLINE double catan2(double y, double x);
55 INLINE double casin(double v);
56 INLINE double cacos(double v);
57 INLINE double cmod(double x, double y);
58 INLINE double cpow(double x, double y);
59 
60 INLINE int cpow(int x, int y);
61 
62 // Returns true if the number is NaN, false if it's a genuine number
63 // or infinity.
64 INLINE bool cnan(float v);
65 INLINE bool cnan(double v);
66 
67 // Returns true if the number is infinity.
68 INLINE bool cinf(float v);
69 INLINE bool cinf(double v);
70 
71 // Return NaN and infinity, respectively.
72 INLINE float make_nan(float);
73 INLINE double make_nan(double);
74 INLINE float make_inf(float);
75 INLINE double make_inf(double);
76 
77 INLINE int cmod(int x, int y);
78 
79 #include "cmath.I"
80 
81 #endif