[GHC] #15115: `Numeric.showEFloat` does not honor precision with 0 digits
#15115: `Numeric.showEFloat` does not honor precision with 0 digits -------------------------------------+------------------------------------- Reporter: guibou | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.6.1 Component: | Version: 8.4.2 libraries/base | 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: -------------------------------------+------------------------------------- Hello, `Numeric.showEFloat` should display a number of digit after the dot depending on the `Maybe Int` argument. It works for values > 0: {{{#!haskell Prelude Numeric> Numeric.showEFloat (Just 5) pi "" "3.14159e0" Prelude Numeric> Numeric.showEFloat (Just 1) pi "" "3.1e0" }}} But for `0` it shows the same result as with `1`: {{{#!haskell Prelude Numeric> Numeric.showEFloat (Just 0) pi "" "3.1e0" }}} I was expecting `3e0` or `3e0`. As a matter of comparison, here is the behavior with `Numeric.showFFloat`: {{{#!haskell Prelude Numeric> Numeric.showFFloat (Just 5) pi "" "3.14159" Prelude Numeric> Numeric.showFFloat (Just 1) pi "" "3.1" Prelude Numeric> Numeric.showFFloat (Just 0) pi "" "3" }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15115> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#15115: `Numeric.showEFloat` does not honor precision with 0 digits -------------------------------------+------------------------------------- Reporter: guibou | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.6.1 Component: libraries/base | Version: 8.4.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | libraries/base/tests/Numeric/num008 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D4665 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * testcase: => libraries/base/tests/Numeric/num008 * differential: => Phab:D4665 Comment: Indeed this looks like a bug. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15115#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#15115: `Numeric.showEFloat` does not honor precision with 0 digits -------------------------------------+------------------------------------- Reporter: guibou | Owner: (none) Type: bug | Status: patch Priority: normal | Milestone: 8.6.1 Component: libraries/base | Version: 8.4.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | libraries/base/tests/Numeric/num008 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D4665 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: new => patch -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15115#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#15115: `Numeric.showEFloat` does not honor precision with 0 digits -------------------------------------+------------------------------------- Reporter: guibou | Owner: (none) Type: bug | Status: patch Priority: normal | Milestone: 8.6.1 Component: libraries/base | Version: 8.4.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | libraries/base/tests/Numeric/num008 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D4665 Wiki Page: | -------------------------------------+------------------------------------- Comment (by Ben Gamari <ben@…>): In [changeset:"9039f847a568ac69436d449b9fe090ecd03b9e06/ghc" 9039f847/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="9039f847a568ac69436d449b9fe090ecd03b9e06" base: Fix handling of showEFloat (Just 0) Previously `showEFloat (Just 0) pi ""` would produce `3.0e0`. Of course, this blatantly disrespects the user's request to print with zero digits of precision. Fix this. This is tested by base's `num008` testcase. Test Plan: Validate Reviewers: hvr Subscribers: rwbarton, thomie, carter GHC Trac Issues: #15115 Differential Revision: https://phabricator.haskell.org/D4665 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15115#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#15115: `Numeric.showEFloat` does not honor precision with 0 digits -------------------------------------+------------------------------------- Reporter: guibou | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: 8.6.1 Component: libraries/base | Version: 8.4.2 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | libraries/base/tests/Numeric/num008 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D4665 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: patch => closed * resolution: => fixed -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15115#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC