1 /* Measure strtod implementation.
2 Copyright (C) 2013-2024 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 <https://www.gnu.org/licenses/>. */
20 #define TEST_NAME "strtod"
24 #include "bench-timing.h"
26 #undef INNER_LOOP_ITERS
27 #define INNER_LOOP_ITERS 131072
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
;
93 for (size_t i
= 0; inputs
[i
] != NULL
; ++i
)
96 timing_t start
, stop
, cur
;
98 printf ("Input %-24s:", inputs
[i
]);
100 for (size_t j
= 0; j
< iters
; ++j
)
101 strtod (inputs
[i
], &ep
);
104 TIMING_DIFF (cur
, start
, stop
);
105 TIMING_PRINT_MEAN ((double) cur
, (double) iters
);
112 #define TEST_FUNCTION do_bench ()
114 #include "../test-skeleton.c"