From: Matthew Fernandez Date: Mon, 17 May 2021 02:37:25 +0000 (-0700) Subject: consistently use float arithmetic in tb_project_to_sphere X-Git-Tag: 2.47.3~24^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d66084a303911642844a54e0a65d06e6228c2a0e;p=graphviz consistently use float arithmetic in tb_project_to_sphere By avoiding mixing doubles and floats, we avoid ever down-converting from a float to a double and losing precision. Squashes a -Wfloat-conversion warning. --- diff --git a/cmd/smyrna/trackball.c b/cmd/smyrna/trackball.c index 041f1165c..294756ec4 100644 --- a/cmd/smyrna/trackball.c +++ b/cmd/smyrna/trackball.c @@ -209,7 +209,7 @@ static float tb_project_to_sphere(float r, float x, float y) d = hypotf(x, y); if (d < r * (1.0f / sqrtf(2.0f))) { /* Inside sphere */ - z = sqrt(r * r - d * d); + z = sqrtf(r * r - d * d); } else { /* On hyperbola */ t = r / sqrtf(2.0f); z = t * t / d;