Tilde-E in absence of format arguments not always same as PRIN1
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SBCL |
New
|
Undecided
|
Unassigned |
Bug Description
SBCL version 2.3.3.
`uname -a` reports:
Linux freekbox 4.4.0-148-generic #174~14.04.1-Ubuntu SMP Thu May 9 08:18:11 UTC 2019 i686 i686 i686 GNU/Linux
`*features*`:
```
(:QUICKLISP :ASDF3.3 :ASDF3.2 :ASDF3.1 :ASDF3 :ASDF2 :ASDF :OS-UNIX
:NON-BASE-
:IEEE-
:SB-PACKAGE-LOCKS :SB-THREAD :SB-UNICODE :SBCL :UNIX)
```
CLHS 22.3.3.2 (http://
I've found some examples where `~e` produces a different results as shown here.
```
(defun foo (x)
(let ((*print-readably* t))
(let*
((a (prin1-to-string x))
(b (format nil "~e" x))
(c (read-from-string b)))
(print (list x a b (- c x))))))
(dotimes (i 20) (foo (* pi (expt 2 (- i 10)))))
```
Here is the output. `(* pi 4)` is the example of smallest magnitude which I found.
```
(0.003067961575
(0.006135923151
(0.012271846303
(0.024543692606
(0.049087385212
(0.098174770424
(0.196349540849
(0.392699081698
(0.7853981633974483 #A((18) BASE-CHAR . "0.785398163397
(1.5707963267948966 #A((18) BASE-CHAR . "1.570796326794
(3.141592653589793 #A((17) BASE-CHAR . "3.141592653589
(6.283185307179586 #A((17) BASE-CHAR . "6.283185307179
(12.566370614359172 #A((18) BASE-CHAR . "12.56637061435
(25.132741228718345 #A((18) BASE-CHAR . "25.13274122871
(50.26548245743669 #A((17) BASE-CHAR . "50.26548245743
(100.53096491487338 #A((18) BASE-CHAR . "100.5309649148
(201.06192982974676 #A((18) BASE-CHAR . "201.0619298297
(402.1238596594935 #A((17) BASE-CHAR . "402.1238596594
(804.247719318987 #A((16) BASE-CHAR . "804.247719318987") #A((20) BASE-CHAR . "8.042477193189
(1608.495438637974 #A((17) BASE-CHAR . "1608.495438637
NIL
```
Incidentally `~f` doesn't have the same behavior -- I didn't find any examples in which `~f` output in the absence of format arguments produces a results different from PRIN1.