From bd79b6c8a1693a87a8a46848652cd6fbaf2e5c56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Fri, 24 Nov 2017 17:13:48 +0100 Subject: [PATCH] [poincare] inf -> undef Change-Id: Ibf7ba53a462c1d57f0928f9edcfe4919587908ab --- poincare/src/complex.cpp | 6 +++--- poincare/test/complex.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/poincare/src/complex.cpp b/poincare/src/complex.cpp index 8ea42b682..cce5517fc 100644 --- a/poincare/src/complex.cpp +++ b/poincare/src/complex.cpp @@ -313,7 +313,7 @@ template int Complex::convertFloatToTextPrivate(T f, char * buffer, int numberOfSignificantDigits, Expression::FloatDisplayMode mode) { assert(mode != Expression::FloatDisplayMode::Default); assert(numberOfSignificantDigits > 0); - if (std::isinf(f)) { + /*if (std::isinf(f)) { int currentChar = 0; if (f < 0) { buffer[currentChar++] = '-'; @@ -323,9 +323,9 @@ int Complex::convertFloatToTextPrivate(T f, char * buffer, int numberOfSignif buffer[currentChar++] = 'f'; buffer[currentChar] = 0; return currentChar; - } + }*/ - if (std::isnan(f)) { + if (std::isinf(f) || std::isnan(f)) { int currentChar = 0; buffer[currentChar++] = 'u'; buffer[currentChar++] = 'n'; diff --git a/poincare/test/complex.cpp b/poincare/test/complex.cpp index a1c883c0b..1cfc82be3 100644 --- a/poincare/test/complex.cpp +++ b/poincare/test/complex.cpp @@ -95,7 +95,7 @@ QUIZ_CASE(poincare_complex_cartesian_to_text) { assert_cartesian_complex_prints_to(64078208.0, 119229408.0, "6.407821E7+1.192294E8*i", DecimalDisplay, Cartesian); assert_cartesian_complex_prints_to(64078208.0f, 119229408.0f, "1.353576E8*e^(1.07765*i)", DecimalDisplay, Polar); assert_cartesian_complex_prints_to(64078208.0f, 119229408.0f, "1.353576E8*e^(1.07765*i)", DecimalDisplay, Polar); - assert_cartesian_complex_prints_to(INFINITY, 119229408.0f, "inf", DecimalDisplay, Polar); + assert_cartesian_complex_prints_to(INFINITY, 119229408.0f, "undef", DecimalDisplay, Polar); assert_cartesian_complex_prints_to(0.0f, 0.0f, "0", DecimalDisplay, Polar); assert_cartesian_complex_prints_to(NAN, 0.0f, "undef", DecimalDisplay, Polar); assert_cartesian_complex_prints_to(0.0f, NAN, "undef", DecimalDisplay, Polar);