This removes the use of some double literals with implicit conversion to floats,
squashing some -Wfloat-conversion compiler warnings. It also makes the resulting
code clearer. The compiler constant-folds these at -O1 and above, so there is no
loss of performance. The resulting expressions are slightly different to the
original, but if anything they are a more accurate representation of the intent
here.
## [Unreleased]
+### Changed
+
+- marginally more accurate computations in Smyrna sphere projection
+
## [2.47.2] - 2021-05-26
### Added
float d, t, z;
d = hypotf(x, y);
- if (d < r * 0.70710678118654752440) { /* Inside sphere */
+ if (d < r * (1.0f / sqrtf(2.0f))) { /* Inside sphere */
z = sqrt(r * r - d * d);
} else { /* On hyperbola */
- t = r / 1.41421356237309504880;
+ t = r / sqrtf(2.0f);
z = t * t / d;
}
return z;