Some articles suggest using the command fistpto quickly convert float-> integer. It depends on the current CPU rounding mode, so you will need to set it.
But can this rounding mode be changed during program execution by other programs? In the OS?
Even worse, is this a possible scenario (pseudo-code)?
set_rounding_mode(ROUND_TRUNCATE);
int x = round_with_fistp(0.6);
printf("%d\n", x);
source
share