1 /* Measure strtod implementation.
2 Copyright (C) 2013-2017 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
20 #define TEST_NAME "strtod"
24 #include "bench-timing.h"
26 #undef INNER_LOOP_ITERS
27 #define INNER_LOOP_ITERS 65536
29 static const char *inputs
[] =
36 "0x0.00001p1040" "1e-307",
80 "0x100000000000008p0",
81 "0x100000000000008.p0",
82 "0x100000000000008.00p0",
83 "0x10000000000000800p0",
84 "0x10000000000000801p0",
91 const size_t iters
= INNER_LOOP_ITERS
;
92 timing_t res
__attribute__ ((unused
));
96 for (size_t i
= 0; inputs
[i
] != NULL
; ++i
)
99 timing_t start
, stop
, cur
;
101 printf ("Input %-24s:", inputs
[i
]);
103 for (size_t j
= 0; j
< iters
; ++j
)
104 strtod (inputs
[i
], &ep
);
107 TIMING_DIFF (cur
, start
, stop
);
108 TIMING_PRINT_MEAN ((double) cur
, (double) iters
);
115 #define TEST_FUNCTION do_bench ()
117 /* On slower platforms this test needs more than the default 2 seconds. */
120 #include "../test-skeleton.c"