Ticket #880 (new defect)

Opened 3 years ago

~F format directive incorrectly uses exponential form when "w" and "d" are omitted.

Reported by: aidenn0 Owned by:
Priority: normal Milestone:
Component: ANSI CL Compliance Version: 1.7
Keywords: Cc:

Description

From Section 22.3.3.1

If both w and d are omitted, then the effect is to print the value using ordinary free-format output; prin1 uses this format for any number whose magnitude is either zero or between 10-3 (inclusive) and 107 (exclusive).

free-format is defined in this section to be the same format used by prin1 for the range 10-3 through 107. This is covered in section 22.1.3.1.3:

If the magnitude of the float is either zero or between 10-3 (inclusive) and 107 (exclusive), it is printed as the integer part of the number, then a decimal point, followed by the fractional part of the number; there is always at least one digit on each side of the decimal point. If the sign of the number (as determined by float-sign) is negative, then a minus sign is printed before the number. If the format of the number does not match that specified by *read-default-float-format*, then the exponent marker for that format and the digit 0 are also printed. For example, the base of the natural logarithms as a short float might be printed as 2.71828S0.

22.3.3.1 does go on to say that if the width would be greater than 100, exponential notation may be used. However, it follows from the specification that (for example)

(format t "~F" 1e7)

should print:

10000000.0

Not:

1.0E+7

Note: See TracTickets for help on using tickets.