Opened 10 years ago

Closed 9 years ago

Last modified 9 years ago

#2036 closed bug (fixed)

Show for Double and Float doesn't use parenthesis for negative zero.

Reported by: clanehin Owned by: igloo
Priority: normal Milestone: 6.8.3
Component: libraries/haskell98 Version: 6.6.1
Keywords: Cc: Malcolm.Wallace@…
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


For any other negative number, show would use parenthesis. This is visually disconcerting, and prevents the expression from being pasted back into ghci.

Prelude> Just (-0/1)
Just -0.0

Change History (8)

comment:1 Changed 10 years ago by igloo

Cc: Malcolm.Wallace@… added
difficulty: Unknown
Milestone: 6.10 branch

Thanks for the report. According to the Show instance for Double should be

instance  Show Double  where
    showsPrec p         = showFloat

i.e. it ignores p, so even Just (-3 :: Double) shouldn't have parens as far as I can see. I think this is just a bug in the Haskell report, though; CCing Malcolm.

Either way, we should certainly be consistent in the negative zero case!

comment:2 Changed 10 years ago by igloo

Milestone: 6.10 branch6.8.3

Actually, I think we ought to do this for 6.8.3.

comment:3 Changed 10 years ago by igloo

Malcolm agrees that this looks like a language defn bug, so we should just fix the -0 case.

comment:4 Changed 9 years ago by igloo

Owner: set to igloo

comment:5 Changed 9 years ago by igloo

Fixed in HEAD and 6.8 branch:

Sun Apr 27 14:32:30 BST 2008  Ian Lynagh <>
  * Just (-0/1) is now printed as Just (-0.0), not Just -0.0; trac #2036

comment:6 Changed 9 years ago by igloo

Resolution: fixed
Status: newclosed

comment:7 Changed 9 years ago by simonmar

Architecture: MultipleUnknown/Multiple

comment:8 Changed 9 years ago by simonmar

Operating System: MultipleUnknown/Multiple
Note: See TracTickets for help on using tickets.