Opened 20 years ago
Closed 18 years ago
#1 closed defect (fixed)
prin1 and ~E produce different outputs.
| Reported by: | anonymous | Owned by: | Raymond Toy | 
|---|---|---|---|
| Priority: | minor | Milestone: | |
| Component: | Core | Version: | 19c | 
| Keywords: | printing | Cc: | 
Description (last modified by )
(let ((x (random 1d-3)))
  (values (prin1-to-string x)
          (format nil "~E" x)))
will produce different significant digits. I think the problem is in ~E which calls lisp::scale-exponent to scale the number between 0.1 and 1. I think we could just call flonum-to-digits which will give us the digits and the exponent. We can massage that into the desired digits and exponent as in scale-exponent, but we won't have the round-off problem.
Maybe.
Change History (4)
comment:1 Changed 20 years ago by
| Owner: | changed from somebody to Raymond Toy | 
|---|---|
| Status: | new → assigned | 
comment:2 Changed 20 years ago by
| Version: | → 19c | 
|---|
comment:3 Changed 19 years ago by
| Description: | modified (diff) | 
|---|
comment:4 Changed 18 years ago by
| Resolution: | → fixed | 
|---|---|
| Status: | assigned → closed | 
Note: See
        TracTickets for help on using
        tickets.
    
One particular example is
The right answer is
which is what
prin1returns.This should now be fixed in CVS.