diff options
| author | Amlal <amlal@el-mahrouss-logic.com> | 2024-10-25 16:52:55 +0200 |
|---|---|---|
| committer | Amlal <amlal@el-mahrouss-logic.com> | 2024-10-25 16:52:55 +0200 |
| commit | bde40a348877ff33649c5335a9ebe0502a606d7c (patch) | |
| tree | 0aaf2821c8436afd9ba7f74a28b6e97ae2a795d2 /dev/crt/math.h | |
| parent | 5c319a1b4d08ce784f164aa5d073af71336e1547 (diff) | |
IMP: Cleanup source code.
Signed-off-by: Amlal <amlal@el-mahrouss-logic.com>
Diffstat (limited to 'dev/crt/math.h')
| -rw-r--r-- | dev/crt/math.h | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/dev/crt/math.h b/dev/crt/math.h deleted file mode 100644 index fd948d63..00000000 --- a/dev/crt/math.h +++ /dev/null @@ -1,62 +0,0 @@ -/* ------------------------------------------- - - Copyright ZKA Web Services Co. - -------------------------------------------- */ - -#pragma once - -#include <crt/defines.h> - -/// @file Math.h -/// @brief Math functions. - -#ifdef __ZKA_USE_DOUBLE__ -typedef double real_type; -#else -typedef float real_type; -#endif - -namespace std::math -{ - /// @brief Power function, with Repeat argument. - template <size_t Exponent> - inline real_type pow(real_type in) - { - if (Exponent == 0) - return 1; // Any number to the power of 0 is 1. - - if (Exponent == 1) - return in; // Any number to the power of 1 is itself. - - size_t cnt = Exponent; - - real_type result = 1; - - for (auto i = 0; i < cnt; ++i) - result *= in; - - return result; - } - - /// @brief Square of function, with Base template argument. - /// @param of Base argument to find sqquare of - template <size_t Base> - inline real_type sqr(real_type in) - { - if (in == 0) - return 0; - - return pow<1 / Base>(in); - } - - /// @brief Linear interpolation equation solver. - /// @param from where? - /// @param to to? - /// @param Updated diff value according to difference. - inline real_type lerp(real_type to, real_type from, real_type stat) - { - real_type diff = (to - from); - return from + (diff * stat); - } -} // namespace std::math |
