1 // commit 89740868c9f1c84b8ee528468d12df1fa72cd392 2014-04-07
2 // %g should not print trailing zeros
7 static void t(const char *fmt
, double d
, const char *want
)
11 int r
= snprintf(buf
, sizeof buf
, fmt
, d
);
12 if (r
!= n
|| memcmp(buf
, want
, n
+1) != 0)
13 t_error("snprintf(\"%s\",%f) want %s got %s\n", fmt
, d
, want
, buf
);
18 t("%.50g", 100000000000000.5, "100000000000000.5");
19 t("%.50g", 987654321098765.0, "987654321098765");