[poincare] inf -> undef

Change-Id: Ibf7ba53a462c1d57f0928f9edcfe4919587908ab
This commit is contained in:
Émilie Feral
2017-11-24 17:13:48 +01:00
parent 89485104b8
commit bd79b6c8a1
2 changed files with 4 additions and 4 deletions

View File

@@ -313,7 +313,7 @@ template <class T>
int Complex<T>::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<T>::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';

View File

@@ -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);