diff --git a/flang/include/flang/Decimal/decimal.h b/flang/include/flang/Decimal/decimal.h --- a/flang/include/flang/Decimal/decimal.h +++ b/flang/include/flang/Decimal/decimal.h @@ -44,12 +44,11 @@ }; enum FortranRounding { - RoundNearest, /* RN */ + RoundNearest, /* RN and RP */ RoundUp, /* RU */ RoundDown, /* RD */ RoundToZero, /* RZ - no rounding */ RoundCompatible, /* RC: like RN, but ties go away from 0 */ - RoundDefault, /* RP: maps to one of the above */ }; /* The "minimize" flag causes the fewest number of output digits diff --git a/flang/lib/Decimal/big-radix-floating-point.h b/flang/lib/Decimal/big-radix-floating-point.h --- a/flang/lib/Decimal/big-radix-floating-point.h +++ b/flang/lib/Decimal/big-radix-floating-point.h @@ -66,12 +66,12 @@ public: explicit BigRadixFloatingPointNumber( - enum FortranRounding rounding = RoundDefault) + enum FortranRounding rounding = RoundNearest) : rounding_{rounding} {} // Converts a binary floating point value. explicit BigRadixFloatingPointNumber( - Real, enum FortranRounding = RoundDefault); + Real, enum FortranRounding = RoundNearest); BigRadixFloatingPointNumber &SetToZero() { isNegative_ = false; @@ -355,7 +355,7 @@ int digitLimit_{maxDigits}; // precision clamp int exponent_{0}; // signed power of ten bool isNegative_{false}; - enum FortranRounding rounding_ { RoundDefault }; + enum FortranRounding rounding_ { RoundNearest }; }; } // namespace Fortran::decimal #endif diff --git a/flang/lib/Decimal/binary-to-decimal.cpp b/flang/lib/Decimal/binary-to-decimal.cpp --- a/flang/lib/Decimal/binary-to-decimal.cpp +++ b/flang/lib/Decimal/binary-to-decimal.cpp @@ -143,7 +143,6 @@ bool incr{false}; switch (rounding_) { case RoundNearest: - case RoundDefault: incr = *end > '5' || (*end == '5' && (p > end + 1 || ((end[-1] - '0') & 1) != 0)); break; diff --git a/flang/lib/Decimal/decimal-to-binary.cpp b/flang/lib/Decimal/decimal-to-binary.cpp --- a/flang/lib/Decimal/decimal-to-binary.cpp +++ b/flang/lib/Decimal/decimal-to-binary.cpp @@ -150,7 +150,6 @@ bool incr{false}; switch (rounding_) { case RoundNearest: - case RoundDefault: incr = LSD > radix / 2 || (LSD == radix / 2 && digit_[0] % 2 != 0); break; case RoundUp: @@ -260,7 +259,6 @@ bool incr{false}; switch (rounding) { case RoundNearest: - case RoundDefault: incr = guard > oneHalf || (guard == oneHalf && (fraction & 1)); break; case RoundUp: diff --git a/flang/lib/Evaluate/host.h b/flang/lib/Evaluate/host.h --- a/flang/lib/Evaluate/host.h +++ b/flang/lib/Evaluate/host.h @@ -140,14 +140,14 @@ // It should be defined when gcc/clang have a better support for it. template <> struct HostTypeHelper> { - // IEE 754 64bits + // IEEE 754 64bits using Type = std::conditional_t::is_iec559, float, UnsupportedType>; }; template <> struct HostTypeHelper> { - // IEE 754 64bits + // IEEE 754 64bits using Type = std::conditional_t::is_iec559, double, UnsupportedType>; @@ -162,7 +162,7 @@ }; template <> struct HostTypeHelper> { - // IEE 754 128bits + // IEEE 754 128bits using Type = std::conditional_t::digits == 113 && std::numeric_limits::max_exponent == 16384,