1 /* BZ 12394, test by Bruno Haible. */
15 if (setlocale (LC_NUMERIC
, "de_DE.UTF-8") == NULL
)
18 sprintf (buf1
, "%'.2f", 999.996);
19 sprintf (buf2
, "%'.2f", 1000.004);
20 printf ("%d: \"%s\" vs \"%s\"\n", __LINE__
, buf1
, buf2
);
21 if (strcmp (buf1
, buf2
) != 0)
24 sprintf (buf1
, "%'.2f", 999999.996);
25 sprintf (buf2
, "%'.2f", 1000000.004);
26 printf ("%d: \"%s\" vs \"%s\"\n", __LINE__
, buf1
, buf2
);
27 if (strcmp (buf1
, buf2
) != 0)
30 sprintf (buf1
, "%'.2f", 999999999.996);
31 sprintf (buf2
, "%'.2f", 1000000000.004);
32 printf ("%d: \"%s\" vs \"%s\"\n", __LINE__
, buf1
, buf2
);
33 if (strcmp (buf1
, buf2
) != 0)
36 sprintf (buf1
, "%'.2f", 999999999999.996);
37 sprintf (buf2
, "%'.2f", 1000000000000.004);
38 printf ("%d: \"%s\" vs \"%s\"\n", __LINE__
, buf1
, buf2
);
39 if (strcmp (buf1
, buf2
) != 0)
42 sprintf (buf1
, "%'.2f", 999999999999999.996);
43 sprintf (buf2
, "%'.2f", 1000000000000000.004);
44 printf ("%d: \"%s\" vs \"%s\"\n", __LINE__
, buf1
, buf2
);
45 if (strcmp (buf1
, buf2
) != 0)
48 sprintf (buf1
, "%'.5g", 999.996);
49 sprintf (buf2
, "%'.5g", 1000.004);
50 printf ("%d: \"%s\" vs \"%s\"\n", __LINE__
, buf1
, buf2
);
51 if (strcmp (buf1
, buf2
) != 0)
54 sprintf (buf1
, "%'.4g", 9999.996);
55 sprintf (buf2
, "%'.4g", 10000.004);
56 printf ("%d: \"%s\" vs \"%s\"\n", __LINE__
, buf1
, buf2
);
57 if (strcmp (buf1
, buf2
) != 0)
60 sprintf (buf1
, "%'.5g", 99999.996);
61 sprintf (buf2
, "%'.5g", 100000.004);
62 printf ("%d: \"%s\" vs \"%s\"\n", __LINE__
, buf1
, buf2
);
63 if (strcmp (buf1
, buf2
) != 0)
66 sprintf (buf1
, "%'.6g", 999999.996);
67 sprintf (buf2
, "%'.6g", 1000000.004);
68 printf ("%d: \"%s\" vs \"%s\"\n", __LINE__
, buf1
, buf2
);
69 if (strcmp (buf1
, buf2
) != 0)
72 sprintf (buf1
, "%'.7g", 9999999.996);
73 sprintf (buf2
, "%'.7g", 10000000.004);
74 printf ("%d: \"%s\" vs \"%s\"\n", __LINE__
, buf1
, buf2
);
75 if (strcmp (buf1
, buf2
) != 0)
82 #define TEST_FUNCTION do_test ()
83 #include "../test-skeleton.c"