Understanding machine epsilon and floating-point precision in C++
This hard question tests your grasp of how floating-point arithmetic actually works at the hardware level—knowledge that separates candidates who can reason rigorously about numerical stability from those who treat doubles as infinite-precision reals. Quant firms ask this because precision gaps cause real money losses in high-frequency systems.
The question forces you to think about the smallest representable gap in the floating-point number system: the distance between consecutive representable values near 1.0. To answer it, you need to know which standard C++ library construct exposes this machine-level constant, and understand why simple addition can silently lose information when the addend falls below this threshold.
- IEEE 754 double-precision format and the spacing of representable numbers
- The role of the mantissa and exponent in determining precision at different scales
- Rounding modes and why
x + 1.0 may equal 1.0 for sufficiently small x