From: Matthew Fernandez Date: Tue, 15 Feb 2022 08:18:31 +0000 (+1100) Subject: neatogen: replace float-casted calls to 'sqrt' with calls to 'sqrtf' X-Git-Tag: 3.0.0~26^2~6 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6e299c3dcb81582d364357d18dd206448c0df859;p=graphviz neatogen: replace float-casted calls to 'sqrt' with calls to 'sqrtf' This is simpler, more efficient, and clearer to the compiler. --- diff --git a/lib/neatogen/matrix_ops.c b/lib/neatogen/matrix_ops.c index 85d8ab370..d13ced562 100644 --- a/lib/neatogen/matrix_ops.c +++ b/lib/neatogen/matrix_ops.c @@ -612,7 +612,7 @@ void sqrt_vec(int n, float *vec) { int i; for (i = 0; i < n; i++) { - vec[i] = (float) sqrt(vec[i]); + vec[i] = sqrtf(vec[i]); } } @@ -622,7 +622,7 @@ void sqrt_vecf(int n, float *source, float *target) float v; for (i = 0; i < n; i++) { if ((v = source[i]) >= 0.0) { - target[i] = (float) sqrt(v); + target[i] = sqrtf(v); } } } @@ -633,7 +633,7 @@ void invert_sqrt_vec(int n, float *vec) float v; for (i = 0; i < n; i++) { if ((v = vec[i]) > 0.0) { - vec[i] = 1.0f / (float) sqrt(v); + vec[i] = 1.0f / sqrtf(v); } } }