ICU-5852 Improve ability to round denormalized IEEE754 numbers and improve debug output.
X-SVN-Rev: 22417
This commit is contained in:
parent
a439b9f7f6
commit
a0088597b1
@ -1,6 +1,6 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
* Copyright (C) 1997-2006, International Business Machines Corporation and *
|
||||
* Copyright (C) 1997-2007, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*
|
||||
@ -75,7 +75,8 @@ static const UChar gLastResortScientificPat[] = {
|
||||
|
||||
// If the maximum base 10 exponent were 4, then the largest number would
|
||||
// be 99,999 which has 5 digits.
|
||||
static const int32_t gMaxIntegerDigits = DBL_MAX_10_EXP + 1; // Should be ~40 ? --srl
|
||||
// On IEEE754 systems gMaxIntegerDigits is 308 + possible denormalized 15 digits + rounding digit
|
||||
static const int32_t gMaxIntegerDigits = DBL_MAX_10_EXP + DBL_DIG + 1;
|
||||
static const int32_t gMinIntegerDigits = 127;
|
||||
|
||||
static const UChar * const gLastResortNumberPatterns[] =
|
||||
|
@ -1,6 +1,6 @@
|
||||
/********************************************************************
|
||||
* COPYRIGHT:
|
||||
* Copyright (c) 1997-2006, International Business Machines Corporation and
|
||||
* Copyright (c) 1997-2007, International Business Machines Corporation and
|
||||
* others. All Rights Reserved.
|
||||
********************************************************************/
|
||||
|
||||
@ -114,7 +114,7 @@ operator+(const UnicodeString& left,
|
||||
// 53*log(2)/log(10) = 15.95
|
||||
// so there is no need to show more than 16 digits. [alan]
|
||||
|
||||
sprintf(buffer, "%.16g", num);
|
||||
sprintf(buffer, "%.17g", num);
|
||||
assert(danger == 'p');
|
||||
|
||||
return left + buffer;
|
||||
|
@ -1,6 +1,6 @@
|
||||
/***********************************************************************
|
||||
* COPYRIGHT:
|
||||
* Copyright (c) 1997-2006, International Business Machines Corporation
|
||||
* Copyright (c) 1997-2007, International Business Machines Corporation
|
||||
* and others. All Rights Reserved.
|
||||
***********************************************************************/
|
||||
|
||||
@ -199,7 +199,7 @@ NumberFormatRoundTripTest::test(NumberFormat *fmt)
|
||||
test(fmt, randomDouble(1e-78)); /*OS390 and OS400*/
|
||||
# endif
|
||||
#else
|
||||
test(fmt, randomDouble(1e-323));
|
||||
test(fmt, randomDouble(DBL_MIN)); /* Usually 2.2250738585072014e-308 */
|
||||
#endif /* OS390 and OS400*/
|
||||
#if !defined(OS390) && !defined(OS400)
|
||||
test(fmt, randomDouble(1e-100));
|
||||
@ -283,8 +283,8 @@ NumberFormatRoundTripTest::test(NumberFormat *fmt, const Formattable& value)
|
||||
|
||||
if (show) {
|
||||
errln(/*value.getString(temp) +*/ typeOf(value, temp) + " F> " +
|
||||
escape(s) + " P> " +
|
||||
/*n.getString(temp) +*/ typeOf(n, temp) + " F> " +
|
||||
escape(s) + " P> " + (n.getType() == Formattable::kDouble ? n.getDouble() : (double)n.getLong())
|
||||
/*n.getString(temp) */ + typeOf(n, temp) + " F> " +
|
||||
escape(s2));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user