I'm trying to evaluate the following expression in C++. I'm using Visual Studio (current release) if that makes any difference.
#define _USE_MATH_DEFINES
#include <math.h>
#include <iostream>
std::cout << (1.686 * 1000 / (4 / 3) / M_PI / (pow(0.015, 3)) / 3340);
Now when I execute the program the output is:
47608.8
Whereas if I use WolframAlpha the expression is evaluated to:
I've also tried breaking down each portion of the expression to check if things like the "pow()" function is working correctly or if M_PI is accurate but everything seems to be consistent up until I evaluate everything at once.
Am I missing something, why am I getting an incorrect answer?
I've been looking at this code for quite a while now and I can't seem to figure out what's going on. I'm thinking it might be some sort of precision error?