3 ms·
Can anyone who knows C better than me explain what the difference is between constexpr double mu = 3.986004418 * pow(10.0, 14.0); which is used in the the
by dark-star 4y ago
Can anyone who knows C better than me explain what the difference is between
constexpr double mu = 3.986004418 * pow(10.0, 14.0);
which is used in the the explanatory blog post and presumably the code, and
constexpr double mu = 3.986004418e14;
which is how I would have written it?
- jraph 4y agoI would probably have used the first because it would not have occurred to me I could use the second. FWIW the following prints 1, so it's probably a matter of taste: int main() { printf("%d\n", 3.986004418e14 == 3.986004418 * pow(10.0, 14.0)); } I prefer the second one for sure.