diff options
author | B Stack <bgstack15@gmail.com> | 2020-03-18 08:59:09 -0400 |
---|---|---|
committer | B Stack <bgstack15@gmail.com> | 2020-03-18 08:59:09 -0400 |
commit | 2c4db439d235b68478d90c450289d2d0ba418547 (patch) | |
tree | 5c378aa54f4bb65c081cf9a92530d8af1f1f53dd /zen/basic_math.h | |
parent | Merge branch '10.20' into 'master' (diff) | |
download | FreeFileSync-2c4db439d235b68478d90c450289d2d0ba418547.tar.gz FreeFileSync-2c4db439d235b68478d90c450289d2d0ba418547.tar.bz2 FreeFileSync-2c4db439d235b68478d90c450289d2d0ba418547.zip |
add upstream 10.21
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); } |