[GHC] #16226: printf g format specifier doesn't match the C standard behaviour
GHC
ghc-devs at haskell.org
Thu Jan 24 04:20:57 UTC 2019
#16226: printf g format specifier doesn't match the C standard behaviour
-------------------------------------+-------------------------------------
Reporter: Fuuzetsu | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Core | Version: 8.6.3
Libraries |
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:
-------------------------------------+-------------------------------------
{{{
[nix-shell:/tmp]$ clang printg.c && ./a.out && cat printg.c
3122.55
#include <stdio.h>
int main(void) {
printf("%.16g\n", 3122.55);
}
[nix-shell:/tmp]$ runhaskell printg.hs && cat printg.hs
3122.5500000000000000
import Text.Printf (printf)
main = printf "%.16g\n" (3122.55 :: Double)
}}}
Some more info here https://stackoverflow.com/questions/54162152/what-
precisely-does-the-g-printf-specifier-mean
Notably I'd expect GHC to give me the same answer as the shown C program.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/16226>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list