[GHC] #15509: `showEFloat` inconsistency introduced in base-4.12
#15509: `showEFloat` inconsistency introduced in base-4.12 -------------------------------------+------------------------------------- Reporter: hvr | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- While base-4.11 had a `showEFloat` that behaved like {{{#!hs showEFloat (Just n) | n <= 0 == showEFloat (Just 1) }}} For non-positive values, base-4.12 introduced an unfortunate inconsistency: {{{#!hs showEFloat (Just n) | n < 0 == showEFloat (Just 1) -- NB: *not* equivalent to showEFloat (Just 0) }}} e.g. now we have {{{#!hs showEFloat (Just 2) 1.0 "" == "1.00e0" showEFloat (Just 1) 1.0 "" == "1.0e0" showEFloat (Just 0) 1.0 "" == "1e0" showEFloat (Just (-1)) 1.0 "" == "1.0e0" showEFloat (Just (-2)) 1.0 "" == "1.0e0" }}} iow, negative `n`s in the precision argument are now treated differently from `(Just 0)` which is a source of subtle bugs for API consumers which assume `showEFloat` to have "continuous total" semantics for the precision argument. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15509> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#15509: `showEFloat` inconsistency introduced in base-4.12 -------------------------------------+------------------------------------- Reporter: hvr | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 8.6.1-beta1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by hvr): * version: => 8.6.1-beta1 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15509#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#15509: `showEFloat` inconsistency introduced in base-4.12 -------------------------------------+------------------------------------- Reporter: hvr | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 8.6.1-beta1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Description changed by hvr: Old description:
While base-4.11 had a `showEFloat` that behaved like
{{{#!hs showEFloat (Just n) | n <= 0 == showEFloat (Just 1) }}}
For non-positive values, base-4.12 introduced an unfortunate inconsistency:
{{{#!hs showEFloat (Just n) | n < 0 == showEFloat (Just 1) -- NB: *not* equivalent to showEFloat (Just 0) }}}
e.g. now we have
{{{#!hs showEFloat (Just 2) 1.0 "" == "1.00e0" showEFloat (Just 1) 1.0 "" == "1.0e0" showEFloat (Just 0) 1.0 "" == "1e0" showEFloat (Just (-1)) 1.0 "" == "1.0e0" showEFloat (Just (-2)) 1.0 "" == "1.0e0" }}}
iow, negative `n`s in the precision argument are now treated differently from `(Just 0)` which is a source of subtle bugs for API consumers which assume `showEFloat` to have "continuous total" semantics for the precision argument.
New description: While base-4.11 had a `showEFloat` that behaved like {{{#!hs showEFloat (Just n) | n <= 0 == showEFloat (Just 1) }}} For non-positive values, base-4.12 introduced an unfortunate inconsistency: {{{#!hs showEFloat (Just n) | n < 0 == showEFloat (Just 1) -- NB: *not* equivalent to showEFloat (Just 0) }}} e.g. now we have {{{#!hs showEFloat (Just 2) 1.0 "" == "1.00e0" showEFloat (Just 1) 1.0 "" == "1.0e0" showEFloat (Just 0) 1.0 "" == "1e0" showEFloat (Just (-1)) 1.0 "" == "1.0e0" showEFloat (Just (-2)) 1.0 "" == "1.0e0" }}} iow, negative `n`s in the precision argument are now treated differently from `(Just 0)` which is a source of subtle bugs for API consumers which assume `showEFloat` to have "continuous total" (or rather, saturated subtraction) semantics for the precision argument. -- -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15509#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#15509: `showEFloat` inconsistency introduced in base-4.12 -------------------------------------+------------------------------------- Reporter: hvr | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 8.6.1-beta1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by bgamari): This was likely introduced by the fix to #15115. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15509#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#15509: `showEFloat` inconsistency introduced in base-4.12 -------------------------------------+------------------------------------- Reporter: hvr | Owner: (none) Type: bug | Status: patch Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 8.6.1-beta1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D5083 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: new => patch * differential: => Phab:D5083 Comment: See Phab:D5083. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15509#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#15509: `showEFloat` inconsistency introduced in base-4.12 -------------------------------------+------------------------------------- Reporter: hvr | Owner: (none) Type: bug | Status: patch Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 8.6.1-beta1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D5083 Wiki Page: | -------------------------------------+------------------------------------- Comment (by Ben Gamari <ben@…>): In [changeset:"e71e341f87c055ecc01f85ddd8d7a2094dfa8e9a/ghc" e71e341f/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="e71e341f87c055ecc01f85ddd8d7a2094dfa8e9a" base: showEFloat: Handle negative precisions the same of zero precision Test Plan: Validate Reviewers: hvr, alpmestan Reviewed By: alpmestan Subscribers: rwbarton, carter GHC Trac Issues: #15509 Differential Revision: https://phabricator.haskell.org/D5083 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15509#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#15509: `showEFloat` inconsistency introduced in base-4.12 -------------------------------------+------------------------------------- Reporter: hvr | Owner: (none) Type: bug | Status: merge Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 8.6.1-beta1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D5083 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: patch => merge -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15509#comment:6> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#15509: `showEFloat` inconsistency introduced in base-4.12 -------------------------------------+------------------------------------- Reporter: hvr | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 8.6.1-beta1 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D5083 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: merge => closed * resolution: => fixed Comment: Merged with 2116932ef55fe2f11e04f9a9e593bc73a2e96680. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15509#comment:7> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC