forked from OSchip/llvm-project
Remove unneeded RoundDefault enumerator, and fix spelling in comments
This commit is contained in:
parent
7c5630fe99
commit
49bbb8b60e
|
@ -44,12 +44,11 @@ struct ConversionToDecimalResult {
|
|||
};
|
||||
|
||||
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
|
||||
|
|
|
@ -66,12 +66,12 @@ private:
|
|||
|
||||
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 @@ private:
|
|||
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
|
||||
|
|
|
@ -143,7 +143,6 @@ BigRadixFloatingPointNumber<PREC, LOG10RADIX>::ConvertToDecimal(char *buffer,
|
|||
bool incr{false};
|
||||
switch (rounding_) {
|
||||
case RoundNearest:
|
||||
case RoundDefault:
|
||||
incr = *end > '5' ||
|
||||
(*end == '5' && (p > end + 1 || ((end[-1] - '0') & 1) != 0));
|
||||
break;
|
||||
|
|
|
@ -150,7 +150,6 @@ void BigRadixFloatingPointNumber<PREC,
|
|||
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 @@ ConversionToBinaryResult<PREC> IntermediateFloat<PREC>::ToBinary(
|
|||
bool incr{false};
|
||||
switch (rounding) {
|
||||
case RoundNearest:
|
||||
case RoundDefault:
|
||||
incr = guard > oneHalf || (guard == oneHalf && (fraction & 1));
|
||||
break;
|
||||
case RoundUp:
|
||||
|
|
|
@ -140,14 +140,14 @@ template <> struct HostTypeHelper<Type<TypeCategory::Integer, 16>> {
|
|||
// It should be defined when gcc/clang have a better support for it.
|
||||
|
||||
template <> struct HostTypeHelper<Type<TypeCategory::Real, 4>> {
|
||||
// IEE 754 64bits
|
||||
// IEEE 754 64bits
|
||||
using Type = std::conditional_t<sizeof(float) == 4 &&
|
||||
std::numeric_limits<float>::is_iec559,
|
||||
float, UnsupportedType>;
|
||||
};
|
||||
|
||||
template <> struct HostTypeHelper<Type<TypeCategory::Real, 8>> {
|
||||
// IEE 754 64bits
|
||||
// IEEE 754 64bits
|
||||
using Type = std::conditional_t<sizeof(double) == 8 &&
|
||||
std::numeric_limits<double>::is_iec559,
|
||||
double, UnsupportedType>;
|
||||
|
@ -162,7 +162,7 @@ template <> struct HostTypeHelper<Type<TypeCategory::Real, 10>> {
|
|||
};
|
||||
|
||||
template <> struct HostTypeHelper<Type<TypeCategory::Real, 16>> {
|
||||
// IEE 754 128bits
|
||||
// IEEE 754 128bits
|
||||
using Type = std::conditional_t<sizeof(long double) == 16 &&
|
||||
std::numeric_limits<long double>::digits == 113 &&
|
||||
std::numeric_limits<long double>::max_exponent == 16384,
|
||||
|
|
Loading…
Reference in New Issue