Changeset 10626

Show
Ignore:
Timestamp:
02/02/05 17:58:47 (4 years ago)
Author:
rtoy
Message:

Fix some floating point printing bugs. Based on the version in sbcl.

(format nil "~G" 1d23) prints "100000000000000000000000. " instead
of "099999999999999990000000. ".

Location:
trunk/src/code
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/code/format.lisp

    r10597 r10606  
    20752075                          (*outside-args* args)) 
    20762076                     (catch 'up-and-out 
    2077                        (do-guts arg arg) 
    2078                        args)) 
     2077                       (do-guts arg arg)) 
     2078                     args) 
    20792079                   (do-guts orig-args args))) 
    20802080             (do-loop (orig-args args) 
  • trunk/src/code/print.lisp

    r10581 r10623  
    283283           (pprint-logical-block (stream nil :prefix "#<" :suffix ">") 
    284284             (print-description))) 
     285          ((and *print-level* (>= *current-level* *print-level*)) 
     286           (write-char #\# stream)) 
    285287          (t 
    286288           (write-string "#<" stream) 
     
    10011003|# 
    10021004  
     1005 
     1006(defun array-readably-printable-p (array) 
     1007  (and (eq (array-element-type array) t) 
     1008       (let ((zero (position 0 (array-dimensions array))) 
     1009             (number (position 0 (array-dimensions array) 
     1010                               :test (complement #'eql) 
     1011                               :from-end t))) 
     1012         (or (null zero) (null number) (> zero number))))) 
     1013 
     1014 
    10031015;;;; Recursive objects. 
    10041016 
     
    10401052             (1 (write-char #\1 stream))))) 
    10411053        ((and *print-readably* 
    1042               (not (eq (array-element-type vector) 't))) 
     1054              (not (array-readably-printable-p vector))) 
    10431055         (output-array vector stream)) 
    10441056        (t