If a program is built with software floating-point emulation, is it affected by hardware floating-point environment?
⚓ Rust 📅 2026-04-19 👤 surdeus 👁️ 3Hello everyone!
Some FPUs support changeable settings and status flags that affect (and are affected) by floating-point operations, known as floating-point environment. This includes rounding mode and floating-point exceptions, as well as "denormals-are-zero" and other settings supported by some hardware. Currently, behavior of Rust program running in non-default floating-point environment (such as non-default rounding mode, enabled "denormals-are-zero" mode or unmasking any floating-point exceptions) is undefined, and floating-point exception status flags may have meaningless value. I wonder, what about Rust programs compiled in software floating-point emulation mode (soft-float)? Can its behavior become undefined solely because of unexpected floating-point environment, and can it affect floating-point exceptions in an unexpected way (that may be important if, for example, hardware floating-point computations are done with inline assembly)?
1 post - 1 participant
🏷️ Rust_feed