Changeset 833 for cpp/PrintFloat
- Timestamp:
- 11/27/18 01:10:41 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/PrintFloat/PrintFloat.cpp
r823 r833 1 // One modification by macko in FormatScientific(): use 3 digits of exponent only if necessary (e+123), otherwise use two if necessary (e+45), otherwise use one (e+6) 1 // One modification by macko in FormatScientific(): use 3 digits of exponent only if necessary (e+123), otherwise use two if necessary (e+45), otherwise use one (e+6). 2 2 // This is consistent with java and javascript, and partially with python (which never uses one digit, only two or three). 3 // To always print 3 digits in exponent (zero-padding if necessary), uncomment: 4 // #define PRINTFLOAT_DRAGON4_ALWAYS_3_DIGIT_EXPONENT 3 5 4 6 … … 334 336 // modified by macko: use 3 digits of exponent only if necessary (e+123), otherwise use two if necessary (e+45), otherwise use one (e+6) 335 337 unsigned int bufferIndex = 2; 338 #ifndef PRINTFLOAT_DRAGON4_ALWAYS_3_DIGIT_EXPONENT 336 339 if (hundredsPlace != 0) //3 digits needed 340 #endif 337 341 exponentBuffer[bufferIndex++] = (tC8)('0' + hundredsPlace); 342 #ifndef PRINTFLOAT_DRAGON4_ALWAYS_3_DIGIT_EXPONENT 338 343 if (hundredsPlace != 0 || tensPlace != 0) //2 digits needed 344 #endif 339 345 exponentBuffer[bufferIndex++] = (tC8)('0' + tensPlace); 340 346 exponentBuffer[bufferIndex++] = (tC8)('0' + onesPlace);
Note: See TracChangeset
for help on using the changeset viewer.