1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/nsprpub/pr/tests/prfdbl.c Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,29 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +/* 1.9 + * This is a simple test of the PR_fprintf() function for doubles. 1.10 + */ 1.11 + 1.12 +#include "prprf.h" 1.13 + 1.14 +int main() 1.15 +{ 1.16 + double pi = 3.1415926; 1.17 + double e = 2.71828; 1.18 + double root2 = 1.414; 1.19 + double zero = 0.0; 1.20 + double nan = zero / zero; 1.21 + 1.22 + PR_fprintf(PR_STDOUT, "pi is %f.\n", pi); 1.23 + PR_fprintf(PR_STDOUT, "e is %f.\n", e); 1.24 + PR_fprintf(PR_STDOUT, "The square root of 2 is %f.\n", root2); 1.25 + PR_fprintf(PR_STDOUT, "NaN is %f.\n", nan); 1.26 + 1.27 + PR_fprintf(PR_STDOUT, "pi is %301f.\n", pi); 1.28 + PR_fprintf(PR_STDOUT, "e is %65416.123f.\n", e); 1.29 + PR_fprintf(PR_STDOUT, "e is %0000000000000000000065416.123f.\n", e); 1.30 + PR_fprintf(PR_STDOUT, "NaN is %1024.1f.\n", nan); 1.31 + return 0; 1.32 +}