|
|
|
|
|
by 01HNNWZ0MV43FF
811 days ago
|
|
Makes sense for dollars, but for anything like graphics or physics I'd consider a power of two like 1,024 as the fixed-point factor instead. My intuition tells me that "x * 1000 / 1000 == x" might not be true for all numbers if you're using floats. |
|
if (x == 0) ...
instead of something like
if (abs(x) < eps) ...
where eps is a suitably defined small number.