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:
parent
19324814e2
commit
5f1eea4d08
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user