nsprpub/pr/tests/prfdbl.c

branch
TOR_BUG_9701
changeset 13
44a2da4a2ab2
equal deleted inserted replaced
-1:000000000000 0:27bd22d16074
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5 /*
6 * This is a simple test of the PR_fprintf() function for doubles.
7 */
8
9 #include "prprf.h"
10
11 int main()
12 {
13 double pi = 3.1415926;
14 double e = 2.71828;
15 double root2 = 1.414;
16 double zero = 0.0;
17 double nan = zero / zero;
18
19 PR_fprintf(PR_STDOUT, "pi is %f.\n", pi);
20 PR_fprintf(PR_STDOUT, "e is %f.\n", e);
21 PR_fprintf(PR_STDOUT, "The square root of 2 is %f.\n", root2);
22 PR_fprintf(PR_STDOUT, "NaN is %f.\n", nan);
23
24 PR_fprintf(PR_STDOUT, "pi is %301f.\n", pi);
25 PR_fprintf(PR_STDOUT, "e is %65416.123f.\n", e);
26 PR_fprintf(PR_STDOUT, "e is %0000000000000000000065416.123f.\n", e);
27 PR_fprintf(PR_STDOUT, "NaN is %1024.1f.\n", nan);
28 return 0;
29 }

mercurial