When printf "%g" with trailing 0 number, decial point be printed.
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?
Trac metadata
| Trac field | Value |
|---|---|
| Version | 8.0.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | libraries/base |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |