Opened 6 years ago

Last modified 5 months ago

#190 new defect

FORMAT DOLLARSIGN fails to handle rounding negative arguments

Reported by: mevenson 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 (add)

Change History (11)

comment:1 Changed 6 years ago by mevenson

  • Milestone changed from 1.0.1 to 1.1.0

comment:2 Changed 5 years ago by mevenson

  • Keywords ansi-conformance added
  • Priority changed from minor to major

comment:3 Changed 5 years ago by mevenson

  • Milestone changed from 1.1.0 to 1.1.1

comment:4 Changed 5 years ago by mevenson

  • Milestone changed from 1.1.1 to 1.2.0

comment:5 Changed 5 years ago by https://www.google.com/accounts/o8/id?id=AItOawkYnNNEAO_K40Gp0xROhyjOPgjvIskQ48M

  • Priority changed from major to critical

comment:6 Changed 4 years ago by https://www.google.com/accounts/o8/id?id=AItOawkYnNNEAO_K40Gp0xROhyjOPgjvIskQ48M

  • Milestone changed from 1.2.0 to 1.3.0

comment:7 Changed 4 years ago by mevenson

  • Milestone changed from 1.3.0 to 2.0

Ticket retargeted after milestone closed

comment:8 Changed 4 years ago by mevenson

  • Milestone changed from 2.0 to 2.0.0

Milestone renamed

comment:9 Changed 4 years ago by mevenson

  • Milestone changed from 2.0.0 to 1.4.0

comment:10 Changed 14 months ago by mevenson

  • Milestone changed from 1.4.0 to 1.5.0

Ticket retargeted after milestone closed

comment:11 Changed 5 months ago by mevenson

  • Milestone changed from 1.5.0 to 1.6.0

Ticket retargeted after milestone closed

Note: See TracTickets for help on using tickets.