diff options
author | Daniel Wilhelm <shieldwed@outlook.com> | 2020-03-20 22:34:51 +0000 |
---|---|---|
committer | Daniel Wilhelm <shieldwed@outlook.com> | 2020-03-20 22:34:51 +0000 |
commit | 543ddcd795ba2fa44676b59135a745f51f28a8da (patch) | |
tree | 5c378aa54f4bb65c081cf9a92530d8af1f1f53dd /zen/basic_math.h | |
parent | Merge branch '10.20' into 'master' (diff) | |
parent | add upstream 10.21 (diff) | |
download | FreeFileSync-543ddcd795ba2fa44676b59135a745f51f28a8da.tar.gz FreeFileSync-543ddcd795ba2fa44676b59135a745f51f28a8da.tar.bz2 FreeFileSync-543ddcd795ba2fa44676b59135a745f51f28a8da.zip |
Merge branch '10.21' into 'master'10.21
add upstream 10.21
See merge request opensource-tracking/FreeFileSync!18
Diffstat (limited to 'zen/basic_math.h')
-rw-r--r-- | zen/basic_math.h | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/zen/basic_math.h b/zen/basic_math.h index 8a32ee69..26dda9a6 100644 --- a/zen/basic_math.h +++ b/zen/basic_math.h @@ -14,6 +14,7 @@ #include <functional> #include <cassert> #include "type_traits.h" +#include "legacy_compiler.h" namespace numeric @@ -53,17 +54,6 @@ double mad(RandomAccessIterator first, RandomAccessIterator last); //note: inval template <class InputIterator> double norm2(InputIterator first, InputIterator last); -//constants -const double pi = 3.14159265358979323846; -const double e = 2.71828182845904523536; -const double sqrt2 = 1.41421356237309504880; -const double ln2 = 0.693147180559945309417; - -#if __cpp_lib_math_constants //C++20 - #error implement math constants from <numbers> header -#endif -//static_assert(pi + e + sqrt2 + ln2 == 7.9672352249818781, "whoopsie"); - //---------------------------------------------------------------------------------- @@ -213,14 +203,14 @@ T power(T value) inline double radToDeg(double rad) { - return rad * 180.0 / numeric::pi; + return rad * (180.0 / std::numbers::pi); } inline double degToRad(double degree) { - return degree * numeric::pi / 180.0; + return degree / (180.0 / std::numbers::pi); } |