From 75d8ee7cf07ee546e5f9fdbfad904060840fa607 Mon Sep 17 00:00:00 2001 From: Tajmeet Singh Date: Tue, 23 Jun 2020 19:43:56 +0100 Subject: [PATCH] fix: Readability issues --- math/complex_numbers.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/math/complex_numbers.cpp b/math/complex_numbers.cpp index 30edf4964..8b24c6d3c 100644 --- a/math/complex_numbers.cpp +++ b/math/complex_numbers.cpp @@ -37,9 +37,16 @@ class Complex { * to use initialiser which initialises real and imaginary values using the * first two parameters (optional). */ - explicit Complex(double x = 0.f, double y = 0.f, bool is_polar = false) - : re(is_polar ? x * std::cos(y) : x), - im(is_polar ? x * std::sin(y) : y) {} + explicit Complex(double x = 0.f, double y = 0.f, bool is_polar = false) { + if (!is_polar) { + re = x; + im = y; + return; + } + + re = x * std::cos(y); + im = x * std::sin(y); + } /** * Copy Constructor