]> granicus.if.org Git - graphviz/commitdiff
consistently use float arithmetic in tb_project_to_sphere
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Mon, 17 May 2021 02:37:25 +0000 (19:37 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 29 May 2021 00:58:18 +0000 (17:58 -0700)
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.

cmd/smyrna/trackball.c

index 041f1165ca47dec6a46810dbf715aec1f547ef5e..294756ec4b7be4bcaeb7811879509ed7f693b4bb 100644 (file)
@@ -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;