| 1 |
/* |
| 2 |
* Copyright (C) 2020 Linux Studio Plugins Project <https://lsp-plug.in/> |
| 3 |
* (C) 2020 Vladimir Sadovnikov <[email protected]> |
| 4 |
* |
| 5 |
* This file is part of lsp-common-lib |
| 6 |
* Created on: 2 апр. 2020 г. |
| 7 |
* |
| 8 |
* lsp-common-lib is free software: you can redistribute it and/or modify |
| 9 |
* it under the terms of the GNU Lesser General Public License as published by |
| 10 |
* the Free Software Foundation, either version 3 of the License, or |
| 11 |
* any later version. |
| 12 |
* |
| 13 |
* lsp-common-lib is distributed in the hope that it will be useful, |
| 14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 |
* GNU Lesser General Public License for more details. |
| 17 |
* |
| 18 |
* You should have received a copy of the GNU Lesser General Public License |
| 19 |
* along with lsp-common-lib. If not, see <https://www.gnu.org/licenses/>. |
| 20 |
*/ |
| 21 |
|
| 22 |
#ifndef LSP_PLUG_IN_STDLIB_MATH_H_ |
| 23 |
#define LSP_PLUG_IN_STDLIB_MATH_H_ |
| 24 |
|
| 25 |
#include <lsp-plug.in/common/version.h> |
| 26 |
#include <lsp-plug.in/common/types.h> |
| 27 |
|
| 28 |
#include <math.h> |
| 29 |
|
| 30 |
// Define missing constants |
| 31 |
#ifndef M_E |
| 32 |
#define M_E 2.7182818284590452354 /* e */ |
| 33 |
#endif |
| 34 |
|
| 35 |
#ifndef M_LOG2E |
| 36 |
#define M_LOG2E 1.4426950408889634074 /* log_2 e */ |
| 37 |
#endif |
| 38 |
|
| 39 |
#ifndef M_LOG10E |
| 40 |
#define M_LOG10E 0.43429448190325182765 /* log_10 e */ |
| 41 |
#endif |
| 42 |
|
| 43 |
#ifndef M_LOG10_2 |
| 44 |
#define M_LOG10_2 0.301029995664 /* log10(2) */ |
| 45 |
#endif |
| 46 |
|
| 47 |
#ifndef M_LN2 |
| 48 |
#define M_LN2 0.69314718055994530942 /* log_e 2 */ |
| 49 |
#endif |
| 50 |
|
| 51 |
#ifndef M_LN10 |
| 52 |
#define M_LN10 2.30258509299404568402 /* log_e 10 */ |
| 53 |
#endif |
| 54 |
|
| 55 |
#ifndef M_PI |
| 56 |
#define M_PI 3.14159265358979323846 /* pi */ |
| 57 |
#endif |
| 58 |
|
| 59 |
#ifndef M_PI_2 |
| 60 |
#define M_PI_2 1.57079632679489661923 /* pi/2 */ |
| 61 |
#endif |
| 62 |
|
| 63 |
#ifndef M_PI_4 |
| 64 |
#define M_PI_4 0.78539816339744830962 /* pi/4 */ |
| 65 |
#endif |
| 66 |
|
| 67 |
#ifndef M_1_PI |
| 68 |
#define M_1_PI 0.31830988618379067154 /* 1/pi */ |
| 69 |
#endif |
| 70 |
|
| 71 |
#ifndef M_2_PI |
| 72 |
#define M_2_PI 0.63661977236758134308 /* 2/pi */ |
| 73 |
#endif |
| 74 |
|
| 75 |
#ifndef M_2_SQRTPI |
| 76 |
#define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */ |
| 77 |
#endif |
| 78 |
|
| 79 |
#ifndef M_SQRT2 |
| 80 |
#define M_SQRT2 1.41421356237309504880 /* sqrt(2) */ |
| 81 |
#endif |
| 82 |
|
| 83 |
#ifndef M_SQRT1_2 |
| 84 |
#define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */ |
| 85 |
#endif |
| 86 |
|
| 87 |
// Additional extensions |
| 88 |
#ifndef M_GOLD_RATIO |
| 89 |
#define M_GOLD_RATIO 1.61803398875 |
| 90 |
#endif /* M_GOLD_RATIO */ |
| 91 |
|
| 92 |
#ifndef M_RGOLD_RATIO |
| 93 |
#define M_RGOLD_RATIO 0.61803398875 |
| 94 |
#endif /* M_RGOLD_RATIO */ |
| 95 |
|
| 96 |
#endif /* LSP_PLUG_IN_STDLIB_MATH_H_ */ |