[flang] Do not emit a bogus exponent (0.e-1)

Original-commit: flang-compiler/f18@3d0b13d7ed
Reviewed-on: https://github.com/flang-compiler/f18/pull/736
This commit is contained in:
peter klausler 2019-09-11 09:48:15 -07:00
parent 722ffc3e2d
commit f2917c777b
1 changed files with 6 additions and 2 deletions

View File

@ -487,9 +487,13 @@ std::ostream &Real<W, P, IM>::AsFortran(
if (DEREF(p) == '-' || *p == '+') {
o << *p++;
}
int expo{result.decimalExponent};
if (*p != '0') {
--expo;
}
o << *p << '.' << (p + 1);
if (result.decimalExponent != 1) {
o << 'e' << (result.decimalExponent - 1);
if (expo != 0) {
o << 'e' << expo;
}
o << '_' << kind;
if (parenthesize) {