1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-04-07 19:26:46 +00:00

Avoid potential division by zero

This commit is contained in:
Carles Fernandez 2025-01-27 16:53:37 +01:00
parent 19324814e2
commit 5f1eea4d08
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D

View File

@ -37,6 +37,7 @@
#include <array>
#include <cmath> // for floor, fmod, rint, ceil
#include <iostream>
#include <limits>
#include <map>
#if USE_GLOG_AND_GFLAGS
@ -529,7 +530,10 @@ float pcps_acquisition::max_to_input_power_statistic(uint32_t& indext, int32_t&
{
doppler = static_cast<int32_t>(d_doppler_center_step_two + (static_cast<float>(index_doppler) - static_cast<float>(floor(d_num_doppler_bins_step2 / 2.0))) * d_acq_parameters.doppler_step2);
}
if (d_input_power < std::numeric_limits<float>::epsilon())
{
return 0.0;
}
return grid_maximum / d_input_power;
}