From b9e8093f5a3f330ef6ec475f557cd034863460da Mon Sep 17 00:00:00 2001 From: Mikhail Svechnikov <m.svechnikov@fz-juelich.de> Date: Thu, 11 Jul 2024 15:02:59 +0200 Subject: [PATCH] use std::hypot --- Base/Math/FourierTransform.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Base/Math/FourierTransform.cpp b/Base/Math/FourierTransform.cpp index b5d460c5e88..4d37d602e83 100644 --- a/Base/Math/FourierTransform.cpp +++ b/Base/Math/FourierTransform.cpp @@ -306,9 +306,7 @@ void FourierTransform::fft2amp(complex2d_t& source, double2d_t& result) for (int i = 0; i < ws.h; i++) { int k = (i == 0) ? 0 : ws.h - i; for (int j = 0; j < ws.w_fftw; j++) { - double re = source[i][j].real(); - double im = source[i][j].imag(); - result[i][j] = sqrt(re * re + im * im); + result[i][j] = std::hypot(source[i][j].real(), source[i][j].imag()); if (j != 0) result[k][ws.w_real - j] = result[i][j]; } -- GitLab