Fixed wrong bounding/rounding
This commit is contained in:
parent
f9123412e5
commit
f4577bcddd
@ -131,5 +131,5 @@ int main() {
|
||||
auto duration = std::chrono::duration_cast<std::chrono::nanoseconds>(stop - start);
|
||||
|
||||
std::cout << "Mach for CI " << ci << ": " << aioMach << std::endl << std::endl;
|
||||
std::cout << "END All-In-One, " << duration.count() << std::endl ;
|
||||
std::cout << "END All-In-One, " << duration.count() << "ns" << std::endl ;
|
||||
}
|
||||
BIN
V4/demo/demo.exe
BIN
V4/demo/demo.exe
Binary file not shown.
BIN
V4/demo/demo.ilk
BIN
V4/demo/demo.ilk
Binary file not shown.
BIN
V4/demo/demo.obj
BIN
V4/demo/demo.obj
Binary file not shown.
BIN
V4/demo/demo.pdb
BIN
V4/demo/demo.pdb
Binary file not shown.
Binary file not shown.
10
V4/econSpd.h
10
V4/econSpd.h
@ -35,10 +35,10 @@ float roundTo(float value, char decimals) {
|
||||
}
|
||||
|
||||
/// @brief Bounding function for altitudes in accordance with data granularity
|
||||
/// @param altitude Altitude in FL
|
||||
/// @param altitude Altitude in ft
|
||||
/// @return Lower bound in FL, upper bound in FL, ratio between bounds that equates to flightLevel
|
||||
std::tuple<int, int, float> boundAltitude(float altitude) {
|
||||
int flightLevel = (int)(altitude / 1000) * 10;
|
||||
std::tuple<int, int, float> boundAltitude(int altitude) {
|
||||
int flightLevel = (int)round(altitude / 100.0);
|
||||
|
||||
float lower = flightLevel - ((flightLevel - MIN_FL) % FL_STP);
|
||||
float upper = (flightLevel - MIN_FL) % FL_STP != 0 ? lower + FL_STP : lower;
|
||||
@ -51,11 +51,11 @@ std::tuple<int, int, float> boundAltitude(float altitude) {
|
||||
/// @param weight Weight in kilogrammes
|
||||
/// @return Lower bound in t, upper bound in t, ratio between bounds that equates to weight
|
||||
std::tuple<int, int, float> boundWeight(int weight) {
|
||||
int wgt = (int)(weight / 1000);
|
||||
int wgt = (int)round(weight / 1000.0);
|
||||
|
||||
float lower = wgt - ((wgt - MIN_WGT) % WGT_STP);
|
||||
float upper = (wgt - MIN_WGT) % WGT_STP != 0 ? lower + WGT_STP : lower;
|
||||
float ratio = (wgt - lower) / WGT_STP;
|
||||
float ratio = ((weight / 1000.0) - lower) / WGT_STP;
|
||||
|
||||
return {(int)lower, (int)upper, ratio};
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user