Algorithms_in_C++ 1.0.0
Set of algorithms implemented in C++.
|
Implementation of the inverse square root Root. More...
#include <cassert>
#include <cmath>
#include <iostream>
#include <limits>
Functions | |
template<typename T = double, char iterations = 2> | |
T | Fast_InvSqrt (T x) |
for numeric_limits | |
template<typename T = double> | |
T | Standard_InvSqrt (T number) |
This is the function that calculates the fast inverse square root. The following code is the fast inverse square root with standard lib (cmath) More information can be found at LinkedIn | |
static void | test () |
Self-test implementations. | |
int | main () |
Main function. | |
Implementation of the inverse square root Root.
Two implementation to calculate inverse inverse root, from Quake III Arena (C++ version) and with a standard library (cmath
). This algorithm is used to calculate shadows in Quake III Arena.
|
inline |
for numeric_limits
for assert for std::sqrt
for IO operations
This is the function that calculates the fast inverse square root. The following code is the fast inverse square root implementation from Quake III Arena (Adapted for C++). More information can be found at Wikipedia
T | floating type |
iterations | inverse square root, the greater the number of iterations, the more exact the result will be (1 or 2). |
x | value to calculate |
int main | ( | void | ) |
Main function.
T Standard_InvSqrt | ( | T | number | ) |
This is the function that calculates the fast inverse square root. The following code is the fast inverse square root with standard lib (cmath) More information can be found at LinkedIn
T | floating type |
number | value to calculate |
|
static |
Self-test implementations.