3 ms·
Compilers are very cautious about floating point optimization because many real number identities do not hold in FP, so they won't do much unless instructed to
by lifthrasiir 4y ago
Compilers are very cautious about floating point optimization because many real number identities do not hold in FP, so they won't do much unless instructed to do so. Even if they do a constant propagation they will generally calculate in binary, in decimal. (Exception: decimal literals in some languages like Go are untyped and can be exactly calculated before getting rounded at once.)