I have a double and I want to round down to values 0.00000/0.00005 using C89/ANSI C. So:
1.10984 becomes 1.10980
1.10985 becomes 1.10985
1.10986 becomes 1.10985
1.10988 becomes 1.10985
1.10989 becomes 1.10985
1.10990 becomes 1.10990
1.10991 becomes 1.10990
I have tried:
roundedDouble = doubleToRound - (doubleToRound % 0.00005);
But % operator only works with integers.
Solution shall work also with the following rounding down cases:
0.000000 / 0.000025 / 0.000050 / 0.000075
and
0.00001 / 0.00002 / 0.00003 / 0.00004 / ... / 0.00008 / 0.00009