
#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