SIMD/Uses/Conversion: Difference between revisions

m
variable name fix
m (variable name fix)
 
Line 5: Line 5:
  i = (int) d;
  i = (int) d;


The resulting value for a is 0, as casting in C will truncate any positions after the decimal point -- no rounding will occur. The same is true for JavaScript. (In JavaScript, the bitwise operators such as | will trigger an integer conversion.)
The resulting value for i is 0, as casting in C will truncate any positions after the decimal point -- no rounding will occur. The same is true for JavaScript. (In JavaScript, the bitwise operators such as | will trigger an integer conversion.)


To get proper rounding, following approach is often employed:
To get proper rounding, following approach is often employed:
51

edits