rpuig2001 / CDM

CDM
GNU General Public License v3.0
22 stars 9 forks source link

Fix lnt-integer-float-division #131

Closed hpeter2 closed 1 year ago

hpeter2 commented 1 year ago

This fixes a big problem, when calculating times based on Capacity Availability Document values.

The method CDM::calculateTime(string timeString, double minsToAdd) expects value minsToAdd as double - an hour-rate given as minute separation, but it will always receive a rounded integer written as a double.

Example:

@@ -2250,7 +2250,7 @@ void CDM::OnGetTagItem()
double seperationCAD = 60 / myCad.rate;
double seperationCAD = 60 / 26;

Should: seperationCAD = 2.3077
Is:     seperationCAD = 2.0000

26 is the hour-rate of inbound-flights to London-Gatwick (EGKK). That should be one aircraft every 2.3 minutes. Instead, due to roundings in these calculations, the system calculates with the value of one aircraft every 2.0 minutes. Meaning 4 more, than actually possible (26 v 30).

See: Microsoft - lnt-integer-float-division

hpeter2 commented 1 year ago

Might fix #125. Not sure