Bizarre floating-point behavior with vs. without extra variables, why?
问题 When I run the following code in VC++ 2013 (32-bit, no optimizations): #include <cmath> #include <iostream> #include <limits> double mulpow10(double const value, int const pow10) { static double const table[] = { 1E+000, 1E+001, 1E+002, 1E+003, 1E+004, 1E+005, 1E+006, 1E+007, 1E+008, 1E+009, 1E+010, 1E+011, 1E+012, 1E+013, 1E+014, 1E+015, 1E+016, 1E+017, 1E+018, 1E+019, }; return pow10 < 0 ? value / table[-pow10] : value * table[+pow10]; } int main(void) { double d = 9710908999.008999; int j