A Discrete-Event Network Simulator
API
math.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License version 2 as
4  * published by the Free Software Foundation;
5  *
6  * This program is distributed in the hope that it will be useful,
7  * but WITHOUT ANY WARRANTY; without even the implied warranty of
8  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9  * GNU General Public License for more details.
10  *
11  * You should have received a copy of the GNU General Public License
12  * along with this program; if not, write to the Free Software
13  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
14  *
15  *
16  * FreeBSD log2 patch from graphviz port to FreeBSD 9, courtesy of
17  * Christoph Moench-Tegeder <cmt@burggraben.net>
18  */
19 
20 // It is recommended to include this header instead of <math.h> or
21 // <cmath> whenever the log2(x) function is needed. See bug 1467.
22 
23 #ifndef MATH_H
24 #define MATH_H
25 
32 #include <cmath>
33 
34 #ifdef __FreeBSD__
35 
36 #if __FreeBSD_version <= 704101 || (__FreeBSD_version >= 800000 && __FreeBSD_version < 802502) || \
37  (__FreeBSD_version >= 900000 && __FreeBSD_version < 900027)
38 #define log2(x) (std::log(x) / M_LN2)
39 #endif /* __FreeBSD_version */
40 
41 #endif /* __FreeBSD__ */
42 
43 #endif /* MATH_H */