]> granicus.if.org Git - graphviz/commitdiff
consistently use float arithmetic in axis_to_quat
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Mon, 17 May 2021 02:33:11 +0000 (19:33 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 29 May 2021 00:57:39 +0000 (17:57 -0700)
By avoiding mixing doubles and floats, we avoid ever down-converting from a
float to a double and losing precision. Squashes some -Wfloat-conversion
warnings.

cmd/smyrna/trackball.c

index c160023c8e9f8d55dde9a60e845c4dfb2c3e415f..a49ad5cce3b82bd445283b9b80d9906fccd61e3b 100644 (file)
@@ -195,8 +195,8 @@ void axis_to_quat(float a[3], float phi, float q[4])
 {
     vnormal(a);
     vcopy(a, q);
-    vscale(q, sin(phi / 2.0));
-    q[3] = cos(phi / 2.0);
+    vscale(q, sinf(phi / 2.0f));
+    q[3] = cosf(phi / 2.0f);
 }
 
 /*