1 /* Test of strtold() and c_strtold() in the "C" locale.
2 Copyright (C) 2008-2024 Free Software Foundation, Inc.
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17 /* Written by Eric Blake. */
20 test_function (long double (*my_strtold
) (const char *, char **))
22 /* Subject sequence empty or invalid. */
24 const char input
[] = "";
28 result
= my_strtold (input
, &ptr
);
29 ASSERT (result
== 0.0L);
30 ASSERT (!signbit (result
));
31 ASSERT (ptr
== input
);
32 ASSERT (errno
== 0 || errno
== EINVAL
);
35 const char input
[] = " ";
39 result
= my_strtold (input
, &ptr
);
40 ASSERT (result
== 0.0L);
41 ASSERT (!signbit (result
));
42 ASSERT (ptr
== input
);
43 ASSERT (errno
== 0 || errno
== EINVAL
);
46 const char input
[] = " +";
50 result
= my_strtold (input
, &ptr
);
51 ASSERT (result
== 0.0L);
52 ASSERT (!signbit (result
));
53 ASSERT (ptr
== input
);
54 ASSERT (errno
== 0 || errno
== EINVAL
);
57 const char input
[] = " .";
61 result
= my_strtold (input
, &ptr
);
62 ASSERT (result
== 0.0L);
63 ASSERT (!signbit (result
));
64 ASSERT (ptr
== input
);
65 ASSERT (errno
== 0 || errno
== EINVAL
);
68 const char input
[] = " .e0";
72 result
= my_strtold (input
, &ptr
);
73 ASSERT (result
== 0.0L);
74 ASSERT (!signbit (result
));
75 ASSERT (ptr
== input
); /* IRIX 6.5 */
76 ASSERT (errno
== 0 || errno
== EINVAL
);
79 const char input
[] = " +.e-0";
83 result
= my_strtold (input
, &ptr
);
84 ASSERT (result
== 0.0L);
85 ASSERT (!signbit (result
));
86 ASSERT (ptr
== input
); /* IRIX 6.5 */
87 ASSERT (errno
== 0 || errno
== EINVAL
);
90 const char input
[] = " in";
94 result
= my_strtold (input
, &ptr
);
95 ASSERT (result
== 0.0L);
96 ASSERT (!signbit (result
));
97 ASSERT (ptr
== input
);
98 ASSERT (errno
== 0 || errno
== EINVAL
);
101 const char input
[] = " na";
105 result
= my_strtold (input
, &ptr
);
106 ASSERT (result
== 0.0L);
107 ASSERT (!signbit (result
));
108 ASSERT (ptr
== input
);
109 ASSERT (errno
== 0 || errno
== EINVAL
);
112 /* Simple floating point values. */
114 const char input
[] = "1";
118 result
= my_strtold (input
, &ptr
);
119 ASSERT (result
== 1.0L);
120 ASSERT (ptr
== input
+ 1);
124 const char input
[] = "1.";
128 result
= my_strtold (input
, &ptr
);
129 ASSERT (result
== 1.0L);
130 ASSERT (ptr
== input
+ 2);
134 const char input
[] = ".5";
138 result
= my_strtold (input
, &ptr
);
139 ASSERT (result
== 0.5L);
140 ASSERT (ptr
== input
+ 2);
144 const char input
[] = " 1";
148 result
= my_strtold (input
, &ptr
);
149 ASSERT (result
== 1.0L);
150 ASSERT (ptr
== input
+ 2);
154 const char input
[] = "+1";
158 result
= my_strtold (input
, &ptr
);
159 ASSERT (result
== 1.0L);
160 ASSERT (ptr
== input
+ 2);
164 const char input
[] = "-1";
168 result
= my_strtold (input
, &ptr
);
169 ASSERT (result
== -1.0L);
170 ASSERT (ptr
== input
+ 2);
174 const char input
[] = "1e0";
178 result
= my_strtold (input
, &ptr
);
179 ASSERT (result
== 1.0L);
180 ASSERT (ptr
== input
+ 3);
184 const char input
[] = "1e+0";
188 result
= my_strtold (input
, &ptr
);
189 ASSERT (result
== 1.0L);
190 ASSERT (ptr
== input
+ 4);
194 const char input
[] = "1e-0";
198 result
= my_strtold (input
, &ptr
);
199 ASSERT (result
== 1.0L);
200 ASSERT (ptr
== input
+ 4);
204 const char input
[] = "1e1";
208 result
= my_strtold (input
, &ptr
);
209 ASSERT (result
== 10.0L);
210 ASSERT (ptr
== input
+ 3);
214 const char input
[] = "5e-1";
218 result
= my_strtold (input
, &ptr
);
219 ASSERT (result
== 0.5L);
220 ASSERT (ptr
== input
+ 4);
226 const char input
[] = "0";
230 result
= my_strtold (input
, &ptr
);
231 ASSERT (result
== 0.0L);
232 ASSERT (!signbit (result
));
233 ASSERT (ptr
== input
+ 1);
237 const char input
[] = ".0";
241 result
= my_strtold (input
, &ptr
);
242 ASSERT (result
== 0.0L);
243 ASSERT (!signbit (result
));
244 ASSERT (ptr
== input
+ 2);
248 const char input
[] = "0e0";
252 result
= my_strtold (input
, &ptr
);
253 ASSERT (result
== 0.0L);
254 ASSERT (!signbit (result
));
255 ASSERT (ptr
== input
+ 3);
259 const char input
[] = "0e+9999999";
263 result
= my_strtold (input
, &ptr
);
264 ASSERT (result
== 0.0L);
265 ASSERT (!signbit (result
));
266 ASSERT (ptr
== input
+ 10);
270 const char input
[] = "0e-9999999";
274 result
= my_strtold (input
, &ptr
);
275 ASSERT (result
== 0.0L);
276 ASSERT (!signbit (result
));
277 ASSERT (ptr
== input
+ 10);
281 const char input
[] = "-0";
285 result
= my_strtold (input
, &ptr
);
286 ASSERT (result
== 0.0L);
287 ASSERT (!!signbit (result
) == !!signbit (minus_zerol
)); /* IRIX 6.5 */
288 ASSERT (ptr
== input
+ 2);
294 const char input
[] = "1f";
298 result
= my_strtold (input
, &ptr
);
299 ASSERT (result
== 1.0L);
300 ASSERT (ptr
== input
+ 1);
304 const char input
[] = "1.f";
308 result
= my_strtold (input
, &ptr
);
309 ASSERT (result
== 1.0L);
310 ASSERT (ptr
== input
+ 2);
314 const char input
[] = "1e";
318 result
= my_strtold (input
, &ptr
);
319 ASSERT (result
== 1.0L);
320 ASSERT (ptr
== input
+ 1);
324 const char input
[] = "1e+";
328 result
= my_strtold (input
, &ptr
);
329 ASSERT (result
== 1.0L);
330 ASSERT (ptr
== input
+ 1);
334 const char input
[] = "1e-";
338 result
= my_strtold (input
, &ptr
);
339 ASSERT (result
== 1.0L);
340 ASSERT (ptr
== input
+ 1);
344 const char input
[] = "1E 2";
348 result
= my_strtold (input
, &ptr
);
349 ASSERT (result
== 1.0L); /* HP-UX 11.31/ia64, IRIX 6.5 */
350 ASSERT (ptr
== input
+ 1); /* HP-UX 11.31/ia64, IRIX 6.5 */
354 const char input
[] = "0x";
358 result
= my_strtold (input
, &ptr
);
359 ASSERT (result
== 0.0L);
360 ASSERT (!signbit (result
));
361 ASSERT (ptr
== input
+ 1); /* glibc-2.3.2, Mac OS X 10.5, Haiku */
365 const char input
[] = "00x1";
369 result
= my_strtold (input
, &ptr
);
370 ASSERT (result
== 0.0L);
371 ASSERT (!signbit (result
));
372 ASSERT (ptr
== input
+ 2);
376 const char input
[] = "-0x";
380 result
= my_strtold (input
, &ptr
);
381 ASSERT (result
== 0.0L);
382 ASSERT (!!signbit (result
) == !!signbit (minus_zerol
)); /* Mac OS X 10.5, IRIX 6.5 */
383 ASSERT (ptr
== input
+ 2); /* glibc-2.3.2, Mac OS X 10.5, Haiku */
387 const char input
[] = "0xg";
391 result
= my_strtold (input
, &ptr
);
392 ASSERT (result
== 0.0L);
393 ASSERT (!signbit (result
));
394 ASSERT (ptr
== input
+ 1); /* glibc-2.3.2, Mac OS X 10.5, Haiku */
398 const char input
[] = "0xp";
402 result
= my_strtold (input
, &ptr
);
403 ASSERT (result
== 0.0L);
404 ASSERT (!signbit (result
));
405 ASSERT (ptr
== input
+ 1); /* glibc-2.3.2, Mac OS X 10.5, Haiku */
409 const char input
[] = "0XP";
413 result
= my_strtold (input
, &ptr
);
414 ASSERT (result
== 0.0L);
415 ASSERT (!signbit (result
));
416 ASSERT (ptr
== input
+ 1); /* glibc-2.3.2, Mac OS X 10.5, Haiku */
420 const char input
[] = "0x.";
424 result
= my_strtold (input
, &ptr
);
425 ASSERT (result
== 0.0L);
426 ASSERT (!signbit (result
));
427 ASSERT (ptr
== input
+ 1); /* glibc-2.3.2, Mac OS X 10.5, Haiku */
431 const char input
[] = "0xp+";
435 result
= my_strtold (input
, &ptr
);
436 ASSERT (result
== 0.0L);
437 ASSERT (!signbit (result
));
438 ASSERT (ptr
== input
+ 1); /* glibc-2.3.2, Mac OS X 10.5, Haiku */
442 const char input
[] = "0xp+1";
446 result
= my_strtold (input
, &ptr
);
447 ASSERT (result
== 0.0L);
448 ASSERT (!signbit (result
));
449 ASSERT (ptr
== input
+ 1); /* glibc-2.3.2, Mac OS X 10.5, Haiku */
453 const char input
[] = "0x.p+1";
457 result
= my_strtold (input
, &ptr
);
458 ASSERT (result
== 0.0L);
459 ASSERT (!signbit (result
));
460 ASSERT (ptr
== input
+ 1); /* glibc-2.3.2, Mac OS X 10.5, Haiku */
464 const char input
[] = "1p+1";
468 result
= my_strtold (input
, &ptr
);
469 ASSERT (result
== 1.0L);
470 ASSERT (ptr
== input
+ 1);
474 const char input
[] = "1P+1";
478 result
= my_strtold (input
, &ptr
);
479 ASSERT (result
== 1.0L);
480 ASSERT (ptr
== input
+ 1);
486 const char input
[] = "1e6000";
490 result
= my_strtold (input
, &ptr
);
491 ASSERT (result
== HUGE_VALL
);
492 ASSERT (ptr
== input
+ 6);
493 ASSERT (errno
== ERANGE
);
496 const char input
[] = "1E1000000";
500 result
= my_strtold (input
, &ptr
);
501 ASSERT (result
== HUGE_VALL
);
502 ASSERT (ptr
== input
+ 9);
503 ASSERT (errno
== ERANGE
);
506 const char input
[] = "-1E1000000";
510 result
= my_strtold (input
, &ptr
);
511 ASSERT (result
== -HUGE_VALL
);
512 ASSERT (ptr
== input
+ 10);
513 ASSERT (errno
== ERANGE
);
516 /* Gradual underflow, resulting in a denormalized number. */
518 #if LDBL_MAX_EXP > 10000
519 const char input
[] = "1e-4950";
521 const char input
[] = "1e-320";
526 result
= my_strtold (input
, &ptr
);
527 ASSERT (0.0L < result
&& result
<= LDBL_MIN
);
528 ASSERT (ptr
== input
+ strlen (input
));
529 #if !defined _MSC_VER
530 ASSERT (errno
== ERANGE
);
534 #if LDBL_MAX_EXP > 10000
535 const char input
[] = "-1e-4950";
537 const char input
[] = "-1e-320";
542 result
= my_strtold (input
, &ptr
);
543 ASSERT (-LDBL_MIN
<= result
&& result
< 0.0L);
544 ASSERT (ptr
== input
+ strlen (input
));
545 #if !defined _MSC_VER
546 ASSERT (errno
== ERANGE
);
550 /* Flush-to-zero underflow. */
552 const char input
[] = "1E-100000";
556 result
= my_strtold (input
, &ptr
);
558 ASSERT (result
== 0.0L);
559 #else /* This is all that ISO C guarantees. */
560 ASSERT (0.0L <= result
&& result
<= LDBL_MIN
);
562 ASSERT (!signbit (result
));
563 ASSERT (ptr
== input
+ 9);
564 ASSERT (errno
== ERANGE
);
567 const char input
[] = "-1E-100000";
571 result
= my_strtold (input
, &ptr
);
573 ASSERT (result
== 0.0L);
574 #else /* This is all that ISO C guarantees. */
575 ASSERT (-LDBL_MIN
<= result
&& result
<= 0.0L);
577 /* Negative underflow. Expect a negative sign, although POSIX allows +0.0L.
578 See also <https://sourceware.org/bugzilla/show_bug.cgi?id=5995>. */
579 ASSERT (!!signbit (result
) == !!signbit (minus_zerol
)); /* glibc-2.3.2, Haiku */
580 ASSERT (ptr
== input
+ 10);
581 ASSERT (errno
== ERANGE
);
584 /* Space before the exponent. */
586 const char input
[] = "1E 1000000";
590 result
= my_strtold (input
, &ptr
);
591 ASSERT (result
== 1.0L); /* HP-UX 11.31/ia64, IRIX 6.5 */
592 ASSERT (ptr
== input
+ 1); /* HP-UX 11.31/ia64, IRIX 6.5 */
593 ASSERT (errno
== 0); /* HP-UX 11.31/ia64, IRIX 6.5 */
596 const char input
[] = "0x1P 1000000";
600 result
= my_strtold (input
, &ptr
);
601 ASSERT (result
== 1.0L); /* HP-UX 11.31/ia64, IRIX 6.5, mingw */
602 ASSERT (ptr
== input
+ 3); /* HP-UX 11.31/ia64, IRIX 6.5, mingw */
608 const char input
[] = "iNf";
612 result
= my_strtold (input
, &ptr
);
613 ASSERT (result
== HUGE_VALL
); /* IRIX 6.5 */
614 ASSERT (ptr
== input
+ 3); /* IRIX 6.5 */
615 ASSERT (errno
== 0); /* HP-UX 11.31/ia64 */
618 const char input
[] = "-InF";
622 result
= my_strtold (input
, &ptr
);
623 ASSERT (result
== -HUGE_VALL
); /* IRIX 6.5 */
624 ASSERT (ptr
== input
+ 4); /* IRIX 6.5 */
625 ASSERT (errno
== 0); /* HP-UX 11.31/ia64 */
628 const char input
[] = "infinite";
632 result
= my_strtold (input
, &ptr
);
633 ASSERT (result
== HUGE_VALL
); /* IRIX 6.5 */
634 ASSERT (ptr
== input
+ 3); /* IRIX 6.5 */
635 ASSERT (errno
== 0); /* HP-UX 11.31/ia64 */
638 const char input
[] = "infinitY";
642 result
= my_strtold (input
, &ptr
);
643 ASSERT (result
== HUGE_VALL
); /* IRIX 6.5 */
644 ASSERT (ptr
== input
+ 8); /* IRIX 6.5 */
645 ASSERT (errno
== 0); /* HP-UX 11.31/ia64 */
648 const char input
[] = "infinitY.";
652 result
= my_strtold (input
, &ptr
);
653 ASSERT (result
== HUGE_VALL
); /* IRIX 6.5 */
654 ASSERT (ptr
== input
+ 8); /* IRIX 6.5 */
655 ASSERT (errno
== 0); /* HP-UX 11.31/ia64 */
658 /* NaN. Some processors set the sign bit of the default NaN, so all
659 we check is that using a sign changes the result. */
661 const char input
[] = "-nan";
667 result1
= my_strtold (input
, &ptr1
);
668 result2
= my_strtold (input
+ 1, &ptr2
);
669 #if 1 /* All known CPUs support NaNs. */
670 ASSERT (isnanl (result1
)); /* IRIX 6.5 */
671 ASSERT (isnanl (result2
)); /* IRIX 6.5 */
673 /* Sign bits of NaN is a portability sticking point, not worth
675 ASSERT (!!signbit (result1
) != !!signbit (result2
));
677 ASSERT (ptr1
== input
+ 4); /* IRIX 6.5 */
678 ASSERT (ptr2
== input
+ 4); /* IRIX 6.5 */
679 ASSERT (errno
== 0); /* HP-UX 11.31/ia64 */
681 ASSERT (result1
== 0.0L);
682 ASSERT (result2
== 0.0L);
683 ASSERT (!signbit (result1
));
684 ASSERT (!signbit (result2
));
685 ASSERT (ptr1
== input
);
686 ASSERT (ptr2
== input
+ 1);
687 ASSERT (errno
== 0 || errno
== EINVAL
);
691 const char input
[] = "+nan(";
697 result1
= my_strtold (input
, &ptr1
);
698 result2
= my_strtold (input
+ 1, &ptr2
);
699 #if 1 /* All known CPUs support NaNs. */
700 ASSERT (isnanl (result1
)); /* IRIX 6.5 */
701 ASSERT (isnanl (result2
)); /* IRIX 6.5 */
702 ASSERT (!!signbit (result1
) == !!signbit (result2
));
703 ASSERT (ptr1
== input
+ 4); /* Mac OS X 10.5, IRIX 6.5 */
704 ASSERT (ptr2
== input
+ 4); /* Mac OS X 10.5, IRIX 6.5 */
705 ASSERT (errno
== 0); /* HP-UX 11.31/ia64 */
707 ASSERT (result1
== 0.0L);
708 ASSERT (result2
== 0.0L);
709 ASSERT (!signbit (result1
));
710 ASSERT (!signbit (result2
));
711 ASSERT (ptr1
== input
);
712 ASSERT (ptr2
== input
+ 1);
713 ASSERT (errno
== 0 || errno
== EINVAL
);
717 const char input
[] = "-nan()";
723 result1
= my_strtold (input
, &ptr1
);
724 result2
= my_strtold (input
+ 1, &ptr2
);
725 #if 1 /* All known CPUs support NaNs. */
726 ASSERT (isnanl (result1
)); /* IRIX 6.5 */
727 ASSERT (isnanl (result2
)); /* IRIX 6.5 */
729 /* Sign bits of NaN is a portability sticking point, not worth
731 ASSERT (!!signbit (result1
) != !!signbit (result2
)); /* glibc-2.3.2, musl libc, OpenBSD 6.0, IRIX 6.5, mingw, Haiku */
733 ASSERT (ptr1
== input
+ 6); /* glibc-2.3.2, IRIX 6.5, mingw, Haiku */
734 ASSERT (ptr2
== input
+ 6); /* glibc-2.3.2, IRIX 6.5, mingw, Haiku */
735 ASSERT (errno
== 0); /* HP-UX 11.31/ia64, Haiku */
737 ASSERT (result1
== 0.0L);
738 ASSERT (result2
== 0.0L);
739 ASSERT (!signbit (result1
));
740 ASSERT (!signbit (result2
));
741 ASSERT (ptr1
== input
);
742 ASSERT (ptr2
== input
+ 1);
743 ASSERT (errno
== 0 || errno
== EINVAL
);
747 const char input
[] = " nan().";
751 result
= my_strtold (input
, &ptr
);
752 #if 1 /* All known CPUs support NaNs. */
753 ASSERT (isnanl (result
)); /* IRIX 6.5 */
754 ASSERT (ptr
== input
+ 6); /* glibc-2.3.2, IRIX 6.5, mingw, Haiku */
755 ASSERT (errno
== 0); /* HP-UX 11.31/ia64, Haiku */
757 ASSERT (result
== 0.0L);
758 ASSERT (!signbit (result
));
759 ASSERT (ptr
== input
);
760 ASSERT (errno
== 0 || errno
== EINVAL
);
764 /* The behavior of nan(0) is implementation-defined, but all
765 implementations we know of which handle optional
766 n-char-sequences handle nan(0) the same as nan(). */
767 const char input
[] = "-nan(0).";
773 result1
= my_strtold (input
, &ptr1
);
774 result2
= my_strtold (input
+ 1, &ptr2
);
775 #if 1 /* All known CPUs support NaNs. */
776 ASSERT (isnanl (result1
)); /* IRIX 6.5 */
777 ASSERT (isnanl (result2
)); /* IRIX 6.5 */
779 /* Sign bits of NaN is a portability sticking point, not worth
781 ASSERT (!!signbit (result1
) != !!signbit (result2
));
783 ASSERT (ptr1
== input
+ 7); /* glibc-2.3.2, IRIX 6.5, mingw, Haiku */
784 ASSERT (ptr2
== input
+ 7); /* glibc-2.3.2, IRIX 6.5, mingw, Haiku */
785 ASSERT (errno
== 0); /* HP-UX 11.31/ia64 */
787 ASSERT (result1
== 0.0L);
788 ASSERT (result2
== 0.0L);
789 ASSERT (!signbit (result1
));
790 ASSERT (!signbit (result2
));
791 ASSERT (ptr1
== input
);
792 ASSERT (ptr2
== input
+ 1);
793 ASSERT (errno
== 0 || errno
== EINVAL
);
799 const char input
[] = "0xa";
803 result
= my_strtold (input
, &ptr
);
804 ASSERT (result
== 10.0L); /* IRIX 6.5, mingw */
805 ASSERT (ptr
== input
+ 3); /* IRIX 6.5, mingw */
809 const char input
[] = "0XA";
813 result
= my_strtold (input
, &ptr
);
814 ASSERT (result
== 10.0L); /* IRIX 6.5, mingw */
815 ASSERT (ptr
== input
+ 3); /* IRIX 6.5, mingw */
819 const char input
[] = "0x1p";
823 result
= my_strtold (input
, &ptr
);
824 ASSERT (result
== 1.0L); /* IRIX 6.5, mingw */
825 ASSERT (ptr
== input
+ 3); /* IRIX 6.5, mingw */
829 const char input
[] = "0x1p+";
833 result
= my_strtold (input
, &ptr
);
834 ASSERT (result
== 1.0L); /* IRIX 6.5, mingw */
835 ASSERT (ptr
== input
+ 3); /* IRIX 6.5, mingw */
839 const char input
[] = "0x1P+";
843 result
= my_strtold (input
, &ptr
);
844 ASSERT (result
== 1.0L); /* IRIX 6.5, mingw */
845 ASSERT (ptr
== input
+ 3); /* IRIX 6.5, mingw */
849 const char input
[] = "0x1p+1";
853 result
= my_strtold (input
, &ptr
);
854 ASSERT (result
== 2.0L); /* IRIX 6.5, mingw */
855 ASSERT (ptr
== input
+ 6); /* IRIX 6.5, mingw */
859 const char input
[] = "0X1P+1";
863 result
= my_strtold (input
, &ptr
);
864 ASSERT (result
== 2.0L); /* IRIX 6.5, mingw */
865 ASSERT (ptr
== input
+ 6); /* IRIX 6.5, mingw */
869 const char input
[] = "0x1p+1a";
873 result
= my_strtold (input
, &ptr
);
874 ASSERT (result
== 2.0L); /* IRIX 6.5, mingw */
875 ASSERT (ptr
== input
+ 6); /* IRIX 6.5, mingw */
879 const char input
[] = "0x1p 2";
883 result
= my_strtold (input
, &ptr
);
884 ASSERT (result
== 1.0L); /* HP-UX 11.31/ia64, IRIX 6.5, mingw */
885 ASSERT (ptr
== input
+ 3); /* HP-UX 11.31/ia64, IRIX 6.5, mingw */
892 char *input
= malloc (m
+ 1);
897 memset (input
, '\t', m
- 1);
901 result
= my_strtold (input
, &ptr
);
902 ASSERT (result
== 1.0L);
903 ASSERT (ptr
== input
+ m
);
910 char *input
= malloc (m
+ 1);
915 memset (input
, '0', m
- 1);
919 result
= my_strtold (input
, &ptr
);
920 ASSERT (result
== 1.0L);
921 ASSERT (ptr
== input
+ m
);
927 /* Newlib has an artificial limit of 20000 for the exponent. TODO -
928 gnulib should fix this. */
931 char *input
= malloc (m
+ 1);
937 memset (input
+ 1, '0', m
- 10);
949 result
= my_strtold (input
, &ptr
);
950 ASSERT (result
== 1.0L); /* Mac OS X 10.5, FreeBSD 11.0, NetBSD 7.1, OpenBSD 6.0, Minix 3.3, IRIX 6.5, mingw */
951 ASSERT (ptr
== input
+ m
);
952 ASSERT (errno
== 0); /* Mac OS X 10.5, FreeBSD 11.0, NetBSD 7.1, OpenBSD 6.0, Minix 3.3, IRIX 6.5, mingw */
958 char *input
= malloc (m
+ 1);
964 memset (input
+ 1, '0', m
- 9);
975 result
= my_strtold (input
, &ptr
);
976 ASSERT (result
== 1.0L); /* Mac OS X 10.5, FreeBSD 11.0, NetBSD 7.1, OpenBSD 6.0, Minix 3.3, IRIX 6.5, mingw */
977 ASSERT (ptr
== input
+ m
);
978 ASSERT (errno
== 0); /* Mac OS X 10.5, FreeBSD 11.0, NetBSD 7.1, OpenBSD 6.0, Minix 3.3, IRIX 6.5, mingw */
985 char *input
= malloc (m
+ 1);
994 memset (input
+ 4, '0', m
- 3);
997 result
= my_strtold (input
, &ptr
);
998 ASSERT (result
== 0.0L);
999 ASSERT (!!signbit (result
) == !!signbit (minus_zerol
)); /* IRIX 6.5 */
1000 ASSERT (ptr
== input
+ m
);
1001 ASSERT (errno
== 0);
1007 /* TODO - is it worth some tests of rounding for typical IEEE corner
1008 cases, such as .5 ULP rounding up to the smallest denormal and
1009 not causing underflow, or LDBL_MIN - .5 ULP not causing an