[GHC] #13682: When printf "%g" with trailing 0 number, decial point be printed.

GHC ghc-devs at haskell.org
Wed May 10 17:10:59 UTC 2017


#13682: When printf "%g" with trailing 0 number, decial point be printed.
----------------------------------------+---------------------------------
           Reporter:  nakaji_dayo       |             Owner:  (none)
               Type:  bug               |            Status:  new
           Priority:  normal            |         Milestone:
          Component:  libraries/base    |           Version:  8.0.1
           Keywords:  printf            |  Operating System:  MacOS X
       Architecture:  Unknown/Multiple  |   Type of failure:  None/Unknown
          Test Case:                    |        Blocked By:
           Blocking:                    |   Related Tickets:
Differential Rev(s):                    |         Wiki Page:
----------------------------------------+---------------------------------
 C lang's printf function doesn't print decimal point if only trailing 0s.
 But GHC does.

 {{{
 Prelude Text.Printf> :m + Text.Printf
 Prelude Text.Printf> printf "%g\n" 2.0
 2.0
 }}}


 {{{
 #include <stdio.h>

 int main() {
   printf("%g\n", 2.0);
   return 0;
 }
 // output: 2
 }}}


 Is this bug?
 Should printf be compatible with C?

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13682>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list