← Back to team overview

kicad-developers team mailing list archive

Re: [PATCH 2/2] Remove questionable useless casts

 

On 9/6/19 6:36 PM, Simon Richter wrote:
-                    const float posYfactor = (float)(windowsPos.y + y * 4.0f) / (float)m_windowSize.y;
+                    const float posYfactor = windowsPos.y + y * 4.0f / (float)m_windowSize.y;

These are mathematically different expressions. You need to restore the parenthesis around the numerator expression even if you remove the cast.

I would further argue that in many cases removing the cast is less clear than explicitly indicating how you want the expression interpreted, even if the expressions were the same.

-Reece


Follow ups

References