c - Is there a difference between these two implemenations? -


is there difference on how compiler generate code following two. secondly, produce same return values.

  static inline float fix2float(int64_t f)   {     return (float)f / ((int64_t)1 << 60);    } 

and this

  static inline float fix2float(int64_t f)   {     return (float)(f / ((int64_t)1 << 60));    } 

these 2 functions different: second 1 performs integer division, while first 1 floating-point.

in particular, return value of second version going integer in range [-8, 7].

update: of course true if first correct the typo unwind caught.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -