I never knew exactly what the float-to-int C cast is supposed to do.

float f = whatever();
int b = cast(int) f;


Does it truncate, floor or round ?

I've never heard anything else but truncate. Rounding can thus be done with cast(int)(f + 0.5f).

Reply via email to