Opened 8 years ago

Last modified 2 years ago

#190 new defect

FORMAT DOLLARSIGN fails to handle rounding negative arguments

Reported by: Evenson Not Org Owned by: ehuelsmann
Priority: critical Milestone: 1.6.0
Component: interpreter Version: 1.0
Keywords: ansi-conformance Cc:
Parent Tickets:

Description

Marshall Abrams reports:

It looks as if there's a bug in 1.0.0 with FORMAT's dollarsign directive's handling of negative numbers when it has to round up.  (Forgive me if this is a known issue--I didn't find it when I searched the bug list and mailing list archives--or if there's something I'm misunderstanding.)

The first group of examples use the F directive for comparison to show that the problem seems to be specific to dollarsign.  (I added blank lines between example groups for easy reading.)  

The second group of examples illustrates a problem using dollarsign with negative numbers.  The output is about 10x too large, and doesn't seem to be getting rounded properly.  I'm guessing that the out of bounds error is the result of the same issue.

The third group of examples shows that the problem doesn't seem to occur with positive numbers, although there's still an extra negative sign preprended.

Thank you-

Marshall Abrams


Armed Bear Common Lisp 1.0.0-svn-13663
Java 1.6.0_29 Apple Inc.
Java HotSpot(TM) 64-Bit Server VM
Low-level initialization completed in 0.7 seconds.
Startup completed in 2.211 seconds.
Type ":help" for a list of available commands.

CL-USER(1): (format t "~,vf" 3 -0.1768522)
-0.177
NIL
CL-USER(2): (format t "~,vf" 2 -0.1768522)
-0.18
NIL
CL-USER(3): (format t "~,vf" 1 -0.1768522)
-0.2
NIL
CL-USER(4): (format t "~,vf" 0 -0.1768522)
-0.
NIL

CL-USER(5): (format t "~$" -0.1768522)
--1.6
NIL
CL-USER(6): (format t "~v$" 3 -0.1768522)
--1.75
NIL
CL-USER(7): (format t "~v$" 2 -0.1768522)
--1.6
NIL
CL-USER(8): (format t "~v$" 1 -0.1768522)
#<THREAD "interpreter" {10FA1B2D}>: Debugger invoked on condition of type TYPE-ERROR
 Array index out of bounds: 2
Restarts:
 0: TOP-LEVEL Return to top level.
[1] CL-USER(9): 0
CL-USER(10): (format t "~v$" 0 -0.1768522)
--0.
NIL

CL-USER(11): (format t "~$" 0.1768522)
0.18
NIL
CL-USER(12): (format t "~v$" 3 0.1768522)
0.177
NIL
CL-USER(13): (format t "~v$" 2 0.1768522)
0.18
NIL
CL-USER(14): (format t "~v$" 1 0.1768522)
0.2
NIL
CL-USER(15): (format t "~v$" 0 0.1768522)
0.
NIL

Subtickets

Change History (11)

comment:1 Changed 7 years ago by Evenson Not Org

Milestone: 1.0.11.1.0

comment:2 Changed 7 years ago by Evenson Not Org

Keywords: ansi-conformance added
Priority: minormajor

comment:3 Changed 7 years ago by Evenson Not Org

Milestone: 1.1.01.1.1

comment:4 Changed 7 years ago by Evenson Not Org

Milestone: 1.1.11.2.0

comment:5 Changed 6 years ago by Evenson Not Org

Priority: majorcritical

comment:6 Changed 6 years ago by Evenson Not Org

Milestone: 1.2.01.3.0

comment:7 Changed 5 years ago by Evenson Not Org

Milestone: 1.3.02.0

Ticket retargeted after milestone closed

comment:8 Changed 5 years ago by Evenson Not Org

Milestone: 2.02.0.0

Milestone renamed

comment:9 Changed 5 years ago by Evenson Not Org

Milestone: 2.0.01.4.0

comment:10 Changed 3 years ago by Evenson Not Org

Milestone: 1.4.01.5.0

Ticket retargeted after milestone closed

comment:11 Changed 2 years ago by Evenson Not Org

Milestone: 1.5.01.6.0

Ticket retargeted after milestone closed

Note: See TracTickets for help on using tickets.