aboutsummaryrefslogtreecommitdiff
path: root/src/misc.c
diff options
context:
space:
mode:
authortlatorre <tlatorre@uchicago.edu>2019-07-29 12:23:30 -0500
committertlatorre <tlatorre@uchicago.edu>2019-07-29 12:23:30 -0500
commit92a5425aaa49d90d4d4c1e88e8595ce932c1ad9b (patch)
tree56e9bb4d541c1b3a5df34edae5742699dd2f41ff /src/misc.c
parentebc0f100371942e99c433cf967b55524a9765c87 (diff)
downloadsddm-92a5425aaa49d90d4d4c1e88e8595ce932c1ad9b.tar.gz
sddm-92a5425aaa49d90d4d4c1e88e8595ce932c1ad9b.tar.bz2
sddm-92a5425aaa49d90d4d4c1e88e8595ce932c1ad9b.zip
fast_sqrt -> sqrt
After some testing, I realized that the fast_sqrt() function wasn't really faster than the native sqrt function.
Diffstat (limited to 'src/misc.c')
-rw-r--r--src/misc.c22
1 files changed, 0 insertions, 22 deletions
diff --git a/src/misc.c b/src/misc.c
index 003b170..f705c74 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -881,25 +881,3 @@ double fast_acos(double x)
return interp1d(x,xs,ys,LEN(xs));
}
-
-/* Fast version of sqrt() for `x` between 0 and 1 which uses a lookup table
- * computed on the first call. */
-double fast_sqrt(double x)
-{
- size_t i;
- static int initialized = 0;
- static double xs[N_SQRT];
- static double ys[N_SQRT];
-
- if (!initialized) {
- for (i = 0; i < LEN(xs); i++) {
- xs[i] = 1.0*i/(LEN(xs)-1);
- ys[i] = sqrt(xs[i]);
- }
- initialized = 1;
- }
-
- if (x > 1.0) return sqrt(x);
-
- return interp1d(x,xs,ys,LEN(xs));
-}