fast floor
Joseph Rushton Wakeling
joseph.wakeling at webdrake.net
Thu Oct 10 16:09:42 PDT 2013
On 11/10/13 00:27, Spacen Jasset wrote:
> I am after a fast floor function; In fact a fast truncation and conversion to
> integer. I see that std.math takes a real, and that std.c.math takes a double.
>
> Is there a quicker function, and what might cast(int)1.5f do?
What's wrong with
to!int(floor(x));
... which you could also write as
x.floor.to!int;
Have you tried it? Is it empirically to slow for your purposes, or are you just
assuming it won't work?
More information about the Digitalmars-d-learn
mailing list