Panda3D
Loading...
Searching...
No Matches
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
28INLINE float csqrt(float v);
29INLINE float csin(float v);
30INLINE float ccos(float v);
31INLINE float ctan(float v);
32INLINE void csincos(float v, float *sin_result, float *cos_result);
33INLINE float csin_over_x(float v);
34INLINE float cabs(float v);
35INLINE float catan(float v);
36INLINE float catan2(float y, float x);
37INLINE float casin(float v);
38INLINE float cacos(float v);
39INLINE float cmod(float x, float y);
40INLINE float cpow(float x, float y);
41
42INLINE double cfloor(double f);
43INLINE double cceil(double f);
44INLINE double cfrac(double f);
45INLINE double csqrt(double v);
46INLINE double csin(double v);
47INLINE double ccos(double v);
48INLINE double ctan(double v);
49INLINE void csincos(double v, double *sin_result, double *cos_result);
50INLINE double cabs(double v);
51INLINE double catan(double v);
52INLINE double catan2(double y, double x);
53INLINE double casin(double v);
54INLINE double cacos(double v);
55INLINE double cmod(double x, double y);
56INLINE double cpow(double x, double y);
57
58INLINE 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.
62INLINE bool cnan(float v);
63INLINE bool cnan(double v);
64
65// Returns true if the number is infinity.
66INLINE bool cinf(float v);
67INLINE bool cinf(double v);
68
69// Return NaN and infinity, respectively.
70INLINE float make_nan(float);
71INLINE double make_nan(double);
72INLINE float make_inf(float);
73INLINE double make_inf(double);
74
75INLINE int cmod(int x, int y);
76
77#include "cmath.I"
78
79#endif
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
float csin_over_x(float v)
Computes sin(x) / x, well-behaved as x approaches 0.
Definition cmath.I:77
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
double cfrac(double f)
Returns the fractional component of f: f - cfloor(f).
Definition cmath.I:183
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.