Hello, I can't understand why does my program do such calculations:
#define PixelsPerMeter 40.0
// 40 pixels ~ 1 meter
#define Meters2Pixels(meters) (float)meters*PixelsPerMeter
#define Pixels2Meters(pixels) (float)pixels/PixelsPerMeter
// The speed of free falling
#define G Meters2Pixels(9.81)
// ...
float mHeight = 768;
float _windPower = Meters2Pixels(-5.0);
// ...
float x1 = ( mHeight / G ) * _windPower;
cout << "G: " << G << "; wind: " << _windPower << "\n";
cout << "Height: " << mHeight << "\n";
cout << "Calculating: " << mHeight / G * _windPower << "\n";
=>
G: 392.4; wind: -200
Height: 768
Calculating: -626300
I can't understand why... If I calculate this by hands, for example, I have to get: -391.4
What's wrong?