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