How to round down a double to the nearest smaller int in C?

c, double, integer, rounding

Solution

int i = (int)floor(25.342);

Problem

I've got a `double`: ``` double d = 25.342; ``` How can I convert it to `25`? If it were `-12.46` I'd like to get `-13`.

Original source