Opened 10 years ago

Closed 4 years ago

Last modified 3 years ago

#563 closed defect (fixed)

possible bug in format tilde e

Reported by: boyer Owned by: rme
Priority: normal Milestone:
Component: ANSI CL Compliance Version: trunk
Keywords: format tilde e Cc:

Description

When I do (setq x 0) (loop (setq x (+ x .00001)) (format t "~%~8,2e" x)) I pretty soon see lines of varying width such as

1.169E-2 1.7E-2

and I wonder if that can be right. From the ANSI:

The full form is ~w,d,e,k,overflowchar,padchar, exponentcharE. ... Exactly w characters will be output.

Change History (6)

comment:1 Changed 9 years ago by rme

  • Owner changed from gb to rme

comment:2 Changed 9 years ago by rme

An offender:

(format t "~8,2e"  0.010009956)

comment:3 Changed 9 years ago by rme

(defun bug-563 ()
  (let* ((x 0.00001)
	 (lastx x)
	 (str nil))
    (loop
      (setq lastx x)
      (incf x 0.00001)
      (setq str (format nil "~8,2e" x))
      (if (/= (length str) 8)
	(error "~s (previous ~s) formatted as ~s" x lastx str)))))

;; > Error: 0.010009956 (previous 0.009999956) formatted as " 1.001E-2"

comment:4 Changed 8 years ago by rme

  • Milestone set to Clozure CL 1.8
  • Priority changed from trivial to normal

comment:5 Changed 4 years ago by rme

  • Resolution set to fixed
  • Status changed from new to closed

Fixed in r16639.

comment:6 Changed 3 years ago by rme

  • Milestone Clozure CL 1.9 deleted

Milestone Clozure CL 1.9 deleted

Note: See TracTickets for help on using tickets.