From 75fd364ccf966e5c574757d6c67adfc33aafe418 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 29 Oct 2019 12:42:46 +0000 Subject: Combine TCL_DD_SHORTEN_FLAG and TCL_DD_SHORTEST to be the same flag (which it is .... actually) --- generic/tclInt.h | 8 ++------ generic/tclStrToD.c | 10 +++++----- generic/tclTest.c | 2 +- generic/tclUtil.c | 4 ++-- 4 files changed, 10 insertions(+), 14 deletions(-) diff --git a/generic/tclInt.h b/generic/tclInt.h index a4e6f55..6c92204 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -2875,18 +2875,14 @@ struct Tcl_LoadHandle_ { /* Flags for conversion of doubles to digit strings */ -#define TCL_DD_SHORTEST 0x4 - /* Use the shortest possible string */ #define TCL_DD_E_FORMAT 0x2 /* Use a fixed-length string of digits, * suitable for E format*/ #define TCL_DD_F_FORMAT 0x3 /* Use a fixed number of digits after the * decimal point, suitable for F format */ - -#define TCL_DD_SHORTEN_FLAG 0x4 - /* Allow return of a shorter digit string - * if it converts losslessly */ +#define TCL_DD_SHORTEST 0x4 + /* Use the shortest possible string */ #define TCL_DD_NO_QUICK 0x8 /* Debug flag: forbid quick FP conversion */ diff --git a/generic/tclStrToD.c b/generic/tclStrToD.c index 402735f..8828c15 100644 --- a/generic/tclStrToD.c +++ b/generic/tclStrToD.c @@ -2724,7 +2724,7 @@ QuickConversion( int k, /* floor(log10(d)), approximately. */ int k_check, /* 0 if k is exact, 1 if it may be too high */ int flags, /* Flags passed to dtoa: - * TCL_DD_SHORTEN_FLAG */ + * TCL_DD_SHORTEST */ int len, /* Length of the return value. */ int ilim, /* Number of digits to store. */ int ilim1, /* Number of digits to store if we misguessed @@ -2795,7 +2795,7 @@ QuickConversion( * Format the digit string. */ - if (flags & TCL_DD_SHORTEN_FLAG) { + if (flags & TCL_DD_SHORTEST) { end = ShorteningQuickFormat(d, k, ilim, eps.d, retval, decpt); } else { end = StrictQuickFormat(d, k, ilim, eps.d, retval, decpt); @@ -4008,7 +4008,7 @@ StrictBignumConversion( * choosing the one that is closest to the given number (and * resolving ties with 'round to even'). It is allowed to return * fewer than 'ndigits' if the number converts exactly; if the - * TCL_DD_E_FORMAT|TCL_DD_SHORTEN_FLAG is supplied instead, it + * TCL_DD_E_FORMAT|TCL_DD_SHORTEST is supplied instead, it * also returns fewer digits if the shorter string will still * reconvert without loss to the given input number. In any case, * strings of trailing zeroes are suppressed. @@ -4019,7 +4019,7 @@ StrictBignumConversion( * string if the number is sufficiently small. Again, it is * permissible for TCL_DD_F_FORMAT to return fewer digits for a * number that converts exactly, and changing the argument to - * TCL_DD_F_FORMAT|TCL_DD_SHORTEN_FLAG will allow the routine + * TCL_DD_F_FORMAT|TCL_DD_SHORTEST will allow the routine * also to return fewer digits if the shorter string will still * reconvert without loss to the given input number. Strings of * trailing zeroes are suppressed. @@ -4156,7 +4156,7 @@ TclDoubleDigits( * denominator. */ - if (flags & TCL_DD_SHORTEN_FLAG) { + if (flags & TCL_DD_SHORTEST) { int m2minus = b2; int m2plus; int m5 = b5; diff --git a/generic/tclTest.c b/generic/tclTest.c index 61c88ba..73ce5d9 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -1803,7 +1803,7 @@ TestdoubledigitsObjCmd(void *unused, Tcl_SetObjResult(interp, Tcl_NewStringObj("bad flag", -1)); return TCL_ERROR; } - type |= TCL_DD_SHORTEN_FLAG; + type |= TCL_DD_SHORTEST; } str = TclDoubleDigits(d, ndigits, type, &decpt, &signum, &endPtr); strObj = Tcl_NewStringObj(str, endPtr-str); diff --git a/generic/tclUtil.c b/generic/tclUtil.c index 0e4bb18..5c51216 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -3345,13 +3345,13 @@ Tcl_PrintDouble( * the first (the recommended zero value for tcl_precision avoids the * problem entirely). * - * Uncomment TCL_DD_SHORTEN_FLAG in the next call to prefer the method + * Uncomment TCL_DD_SHORTEST in the next call to prefer the method * that allows floating point values to be shortened if it can be done * without loss of precision. */ digits = TclDoubleDigits(value, *precisionPtr, - TCL_DD_E_FORMAT /* | TCL_DD_SHORTEN_FLAG */, + TCL_DD_E_FORMAT /* | TCL_DD_SHORTEST */, &exponent, &signum, &end); } if (signum) { -- cgit v0.12