Procházet zdrojové kódy

math: fix an infinite loop in the real number print function.

legacy
Sam Hocevar sam před 13 roky
rodič
revize
a949a2cd08
1 změnil soubory, kde provedl 6 přidání a 0 odebrání
  1. +6
    -0
      src/real.cpp

+ 6
- 0
src/real.cpp Zobrazit soubor

@@ -1274,6 +1274,12 @@ void real::print(int ndigits) const
x = -x; x = -x;
} }


if (!x)
{
printf("0.0\n");
return;
}

/* Normalise x so that mantissa is in [1..9.999] */ /* Normalise x so that mantissa is in [1..9.999] */
/* FIXME: better use int64_t when the cast is implemented */ /* FIXME: better use int64_t when the cast is implemented */
int exponent = ceil(log10(x)); int exponent = ceil(log10(x));


||||||
x
 
000:0
Načítá se…
Zrušit
Uložit