Opened 6 years ago

Closed 6 years ago

Last modified 6 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: Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description

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 6 years ago by igloo

  • Cc Malcolm.Wallace@… added
  • Difficulty set to Unknown
  • Milestone set to 6.10 branch

Thanks for the report.
According to http://haskell.org/onlinereport/standard-prelude.html 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 6 years ago by igloo

  • Milestone changed from 6.10 branch to 6.8.3

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

comment:3 Changed 6 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 6 years ago by igloo

  • Owner set to igloo

comment:5 Changed 6 years ago by igloo

Fixed in HEAD and 6.8 branch:

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

comment:6 Changed 6 years ago by igloo

  • Resolution set to fixed
  • Status changed from new to closed

comment:7 Changed 6 years ago by simonmar

  • Architecture changed from Multiple to Unknown/Multiple

comment:8 Changed 6 years ago by simonmar

  • Operating System changed from Multiple to Unknown/Multiple
Note: See TracTickets for help on using tickets.