mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-10-01 01:26:06 -04:00
Fix NaNs coming out of angle_approx_0deg27().
Used in FM demodulator, was causing downstream problems when using the floating point values directly.
This commit is contained in:
parent
5a532f34a7
commit
64966d4539
@ -69,8 +69,12 @@ static inline float angle_approx_4deg0(const complex32_t t) {
|
||||
}
|
||||
*/
|
||||
static inline float angle_approx_0deg27(const complex32_t t) {
|
||||
if( t.real() ) {
|
||||
const auto x = static_cast<float>(t.imag()) / static_cast<float>(t.real());
|
||||
return x / (1.0f + 0.28086f * x * x);
|
||||
} else {
|
||||
return (t.imag() < 0) ? -1.5707963268f : 1.5707963268f;
|
||||
}
|
||||
}
|
||||
|
||||
static inline float angle_precise(const complex32_t t) {
|
||||
|
Loading…
Reference in New Issue
Block a user