]> git.mxchange.org Git - flightgear.git/commitdiff
Temporary hack to avoid NaN problems when _mp is negative (?). Discovered by Csaba
authorfredb <fredb>
Thu, 1 Jan 2009 10:18:13 +0000 (10:18 +0000)
committerTim Moore <timoore@redhat.com>
Sat, 3 Jan 2009 23:24:20 +0000 (00:24 +0100)
src/FDM/YASim/PistonEngine.cpp

index 11b04fe7a491ec0c086500c65868678f9d695edc..b032342d486b4f82572f27cd6e9aa2622e712004 100644 (file)
@@ -169,7 +169,7 @@ void PistonEngine::calc(float pressure, float temp, float speed)
     // pressure change can be assumed to be adiabatic.  Calculate a
     // temperature change, and use that to get the density.
     // Note: need to model intercoolers here...
-    float T = temp * Math::pow(_mp/pressure, 2.0/7.0);
+    float T = temp * Math::pow((_mp*_mp)/(pressure*pressure), 1.0/7.0);
     float rho = _mp / (287.1f * T);
 
     // The actual fuel flow is determined only by engine RPM and the