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