prfdbl.c (868B)
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 double pi = 3.1415926; 13 double e = 2.71828; 14 double root2 = 1.414; 15 double zero = 0.0; 16 double nan = zero / zero; 17 18 PR_fprintf(PR_STDOUT, "pi is %f.\n", pi); 19 PR_fprintf(PR_STDOUT, "e is %f.\n", e); 20 PR_fprintf(PR_STDOUT, "The square root of 2 is %f.\n", root2); 21 PR_fprintf(PR_STDOUT, "NaN is %f.\n", nan); 22 23 PR_fprintf(PR_STDOUT, "pi is %301f.\n", pi); 24 PR_fprintf(PR_STDOUT, "e is %65416.123f.\n", e); 25 PR_fprintf(PR_STDOUT, "e is %0000000000000000000065416.123f.\n", e); 26 PR_fprintf(PR_STDOUT, "NaN is %1024.1f.\n", nan); 27 return 0; 28 }