A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
math.h
Go to the documentation of this file.
1/*
2 * SPDX-License-Identifier: GPL-2.0-only
3 *
4 *
5 * FreeBSD log2 patch from graphviz port to FreeBSD 9, courtesy of
6 * Christoph Moench-Tegeder <cmt@burggraben.net>
7 */
8
9// It is recommended to include this header instead of <math.h> or
10// <cmath> whenever the log2(x) function is needed. See bug 1467.
11
12#ifndef MATH_H
13#define MATH_H
14
15/**
16 * \file
17 * \ingroup core
18 * log2() macro definition; to deal with \bugid{1467}.
19 */
20
21#include <cmath>
22
23#ifdef __FreeBSD__
24
25#if __FreeBSD_version <= 704101 || (__FreeBSD_version >= 800000 && __FreeBSD_version < 802502) || \
26 (__FreeBSD_version >= 900000 && __FreeBSD_version < 900027)
27#define log2(x) (std::log(x) / M_LN2)
28#endif /* __FreeBSD_version */
29
30#endif /* __FreeBSD__ */
31
32#endif /* MATH_H */