On Sunday, 6 April 2014 at 09:23:21 UTC, anonymous wrote:
Conversion to int drops the fractional part, so you don't really
need floor. But if you think it makes the intent clearer, feel
free to leave it in.

Well, conversion to int "drops" the fractional part, rounding *towards* 0, whereas floor floor will reduce to the lower integral.

It can make a difference for negatives:

auto x = -3.5;
floor(x); // => -4
cast(int)x; // => -3

Reply via email to