4 ms·
>Could you give some examples where the same value needs to be used in integer and floating-point math? When you want to draw a pong game in a finite matrix re
by huachimingo 5y ago
>Could you give some examples where the same value needs to be used in integer and floating-point math?
When you want to draw a pong game in a finite matrix representation, like a screen in ncurses, you cannot have something like screen[2.1][3.5], so you have to truncate (or round, depending what you want to do) the same float coordinates to write that matrix.
Of course, you could avoid these using fixed point but even there you need a type conversion.