2 * Copyright (C) 2008-2020 Free Software Foundation, Inc.
3 * Written by Eric Blake
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
10 * This program 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
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <https://www.gnu.org/licenses/>. */
22 #include "signature.h"
23 SIGNATURE_CHECK (strtold
, long double, (char const *, char **));
30 #include "isnanl-nolibm.h"
31 #include "minus-zero.h"
34 /* Avoid requiring -lm just for fabsl. */
35 #define FABSL(d) ((d) < 0.0L ? -(d) : (d))
41 /* Subject sequence empty or invalid. */
43 const char input
[] = "";
47 result
= strtold (input
, &ptr
);
48 ASSERT (result
== 0.0L);
49 ASSERT (!signbit (result
));
50 ASSERT (ptr
== input
);
51 ASSERT (errno
== 0 || errno
== EINVAL
);
54 const char input
[] = " ";
58 result
= strtold (input
, &ptr
);
59 ASSERT (result
== 0.0L);
60 ASSERT (!signbit (result
));
61 ASSERT (ptr
== input
);
62 ASSERT (errno
== 0 || errno
== EINVAL
);
65 const char input
[] = " +";
69 result
= strtold (input
, &ptr
);
70 ASSERT (result
== 0.0L);
71 ASSERT (!signbit (result
));
72 ASSERT (ptr
== input
);
73 ASSERT (errno
== 0 || errno
== EINVAL
);
76 const char input
[] = " .";
80 result
= strtold (input
, &ptr
);
81 ASSERT (result
== 0.0L);
82 ASSERT (!signbit (result
));
83 ASSERT (ptr
== input
);
84 ASSERT (errno
== 0 || errno
== EINVAL
);
87 const char input
[] = " .e0";
91 result
= strtold (input
, &ptr
);
92 ASSERT (result
== 0.0L);
93 ASSERT (!signbit (result
));
94 ASSERT (ptr
== input
); /* IRIX 6.5 */
95 ASSERT (errno
== 0 || errno
== EINVAL
);
98 const char input
[] = " +.e-0";
102 result
= strtold (input
, &ptr
);
103 ASSERT (result
== 0.0L);
104 ASSERT (!signbit (result
));
105 ASSERT (ptr
== input
); /* IRIX 6.5 */
106 ASSERT (errno
== 0 || errno
== EINVAL
);
109 const char input
[] = " in";
113 result
= strtold (input
, &ptr
);
114 ASSERT (result
== 0.0L);
115 ASSERT (!signbit (result
));
116 ASSERT (ptr
== input
);
117 ASSERT (errno
== 0 || errno
== EINVAL
);
120 const char input
[] = " na";
124 result
= strtold (input
, &ptr
);
125 ASSERT (result
== 0.0L);
126 ASSERT (!signbit (result
));
127 ASSERT (ptr
== input
);
128 ASSERT (errno
== 0 || errno
== EINVAL
);
131 /* Simple floating point values. */
133 const char input
[] = "1";
137 result
= strtold (input
, &ptr
);
138 ASSERT (result
== 1.0L);
139 ASSERT (ptr
== input
+ 1);
143 const char input
[] = "1.";
147 result
= strtold (input
, &ptr
);
148 ASSERT (result
== 1.0L);
149 ASSERT (ptr
== input
+ 2);
153 const char input
[] = ".5";
157 result
= strtold (input
, &ptr
);
158 ASSERT (result
== 0.5L);
159 ASSERT (ptr
== input
+ 2);
163 const char input
[] = " 1";
167 result
= strtold (input
, &ptr
);
168 ASSERT (result
== 1.0L);
169 ASSERT (ptr
== input
+ 2);
173 const char input
[] = "+1";
177 result
= strtold (input
, &ptr
);
178 ASSERT (result
== 1.0L);
179 ASSERT (ptr
== input
+ 2);
183 const char input
[] = "-1";
187 result
= strtold (input
, &ptr
);
188 ASSERT (result
== -1.0L);
189 ASSERT (ptr
== input
+ 2);
193 const char input
[] = "1e0";
197 result
= strtold (input
, &ptr
);
198 ASSERT (result
== 1.0L);
199 ASSERT (ptr
== input
+ 3);
203 const char input
[] = "1e+0";
207 result
= strtold (input
, &ptr
);
208 ASSERT (result
== 1.0L);
209 ASSERT (ptr
== input
+ 4);
213 const char input
[] = "1e-0";
217 result
= strtold (input
, &ptr
);
218 ASSERT (result
== 1.0L);
219 ASSERT (ptr
== input
+ 4);
223 const char input
[] = "1e1";
227 result
= strtold (input
, &ptr
);
228 ASSERT (result
== 10.0L);
229 ASSERT (ptr
== input
+ 3);
233 const char input
[] = "5e-1";
237 result
= strtold (input
, &ptr
);
238 ASSERT (result
== 0.5L);
239 ASSERT (ptr
== input
+ 4);
245 const char input
[] = "0";
249 result
= strtold (input
, &ptr
);
250 ASSERT (result
== 0.0L);
251 ASSERT (!signbit (result
));
252 ASSERT (ptr
== input
+ 1);
256 const char input
[] = ".0";
260 result
= strtold (input
, &ptr
);
261 ASSERT (result
== 0.0L);
262 ASSERT (!signbit (result
));
263 ASSERT (ptr
== input
+ 2);
267 const char input
[] = "0e0";
271 result
= strtold (input
, &ptr
);
272 ASSERT (result
== 0.0L);
273 ASSERT (!signbit (result
));
274 ASSERT (ptr
== input
+ 3);
278 const char input
[] = "0e+9999999";
282 result
= strtold (input
, &ptr
);
283 ASSERT (result
== 0.0L);
284 ASSERT (!signbit (result
));
285 ASSERT (ptr
== input
+ 10);
289 const char input
[] = "0e-9999999";
293 result
= strtold (input
, &ptr
);
294 ASSERT (result
== 0.0L);
295 ASSERT (!signbit (result
));
296 ASSERT (ptr
== input
+ 10);
300 const char input
[] = "-0";
304 result
= strtold (input
, &ptr
);
305 ASSERT (result
== 0.0L);
306 ASSERT (!!signbit (result
) == !!signbit (minus_zerol
)); /* IRIX 6.5 */
307 ASSERT (ptr
== input
+ 2);
313 const char input
[] = "1f";
317 result
= strtold (input
, &ptr
);
318 ASSERT (result
== 1.0L);
319 ASSERT (ptr
== input
+ 1);
323 const char input
[] = "1.f";
327 result
= strtold (input
, &ptr
);
328 ASSERT (result
== 1.0L);
329 ASSERT (ptr
== input
+ 2);
333 const char input
[] = "1e";
337 result
= strtold (input
, &ptr
);
338 ASSERT (result
== 1.0L);
339 ASSERT (ptr
== input
+ 1);
343 const char input
[] = "1e+";
347 result
= strtold (input
, &ptr
);
348 ASSERT (result
== 1.0L);
349 ASSERT (ptr
== input
+ 1);
353 const char input
[] = "1e-";
357 result
= strtold (input
, &ptr
);
358 ASSERT (result
== 1.0L);
359 ASSERT (ptr
== input
+ 1);
363 const char input
[] = "1E 2";
367 result
= strtold (input
, &ptr
);
368 ASSERT (result
== 1.0L); /* HP-UX 11.31/ia64, IRIX 6.5 */
369 ASSERT (ptr
== input
+ 1); /* HP-UX 11.31/ia64, IRIX 6.5 */
373 const char input
[] = "0x";
377 result
= strtold (input
, &ptr
);
378 ASSERT (result
== 0.0L);
379 ASSERT (!signbit (result
));
380 ASSERT (ptr
== input
+ 1); /* glibc-2.3.2, Mac OS X 10.5, Haiku */
384 const char input
[] = "00x1";
388 result
= strtold (input
, &ptr
);
389 ASSERT (result
== 0.0L);
390 ASSERT (!signbit (result
));
391 ASSERT (ptr
== input
+ 2);
395 const char input
[] = "-0x";
399 result
= strtold (input
, &ptr
);
400 ASSERT (result
== 0.0L);
401 ASSERT (!!signbit (result
) == !!signbit (minus_zerol
)); /* Mac OS X 10.5, IRIX 6.5 */
402 ASSERT (ptr
== input
+ 2); /* glibc-2.3.2, Mac OS X 10.5, Haiku */
406 const char input
[] = "0xg";
410 result
= strtold (input
, &ptr
);
411 ASSERT (result
== 0.0L);
412 ASSERT (!signbit (result
));
413 ASSERT (ptr
== input
+ 1); /* glibc-2.3.2, Mac OS X 10.5, Haiku */
417 const char input
[] = "0xp";
421 result
= strtold (input
, &ptr
);
422 ASSERT (result
== 0.0L);
423 ASSERT (!signbit (result
));
424 ASSERT (ptr
== input
+ 1); /* glibc-2.3.2, Mac OS X 10.5, Haiku */
428 const char input
[] = "0XP";
432 result
= strtold (input
, &ptr
);
433 ASSERT (result
== 0.0L);
434 ASSERT (!signbit (result
));
435 ASSERT (ptr
== input
+ 1); /* glibc-2.3.2, Mac OS X 10.5, Haiku */
439 const char input
[] = "0x.";
443 result
= strtold (input
, &ptr
);
444 ASSERT (result
== 0.0L);
445 ASSERT (!signbit (result
));
446 ASSERT (ptr
== input
+ 1); /* glibc-2.3.2, Mac OS X 10.5, Haiku */
450 const char input
[] = "0xp+";
454 result
= strtold (input
, &ptr
);
455 ASSERT (result
== 0.0L);
456 ASSERT (!signbit (result
));
457 ASSERT (ptr
== input
+ 1); /* glibc-2.3.2, Mac OS X 10.5, Haiku */
461 const char input
[] = "0xp+1";
465 result
= strtold (input
, &ptr
);
466 ASSERT (result
== 0.0L);
467 ASSERT (!signbit (result
));
468 ASSERT (ptr
== input
+ 1); /* glibc-2.3.2, Mac OS X 10.5, Haiku */
472 const char input
[] = "0x.p+1";
476 result
= strtold (input
, &ptr
);
477 ASSERT (result
== 0.0L);
478 ASSERT (!signbit (result
));
479 ASSERT (ptr
== input
+ 1); /* glibc-2.3.2, Mac OS X 10.5, Haiku */
483 const char input
[] = "1p+1";
487 result
= strtold (input
, &ptr
);
488 ASSERT (result
== 1.0L);
489 ASSERT (ptr
== input
+ 1);
493 const char input
[] = "1P+1";
497 result
= strtold (input
, &ptr
);
498 ASSERT (result
== 1.0L);
499 ASSERT (ptr
== input
+ 1);
503 /* Overflow/underflow. */
505 const char input
[] = "1E1000000";
509 result
= strtold (input
, &ptr
);
510 ASSERT (result
== HUGE_VALL
);
511 ASSERT (ptr
== input
+ 9);
512 ASSERT (errno
== ERANGE
);
515 const char input
[] = "-1E1000000";
519 result
= strtold (input
, &ptr
);
520 ASSERT (result
== -HUGE_VALL
);
521 ASSERT (ptr
== input
+ 10);
522 ASSERT (errno
== ERANGE
);
525 const char input
[] = "1E-100000";
529 result
= strtold (input
, &ptr
);
530 ASSERT (0.0L <= result
&& result
<= LDBL_MIN
);
531 ASSERT (!signbit (result
));
532 ASSERT (ptr
== input
+ 9);
533 ASSERT (errno
== ERANGE
);
536 const char input
[] = "-1E-100000";
540 result
= strtold (input
, &ptr
);
541 ASSERT (-LDBL_MIN
<= result
&& result
<= 0.0L);
543 /* FIXME - this is glibc bug 5995; POSIX allows returning positive
544 0 on negative underflow, even though quality of implementation
545 demands preserving the sign. Disable this test until fixed
546 glibc is more prevalent. */
547 ASSERT (!!signbit (result
) == !!signbit (minus_zerol
)); /* glibc-2.3.2, Haiku */
549 ASSERT (ptr
== input
+ 10);
550 ASSERT (errno
== ERANGE
);
553 const char input
[] = "1E 1000000";
557 result
= strtold (input
, &ptr
);
558 ASSERT (result
== 1.0L); /* HP-UX 11.31/ia64, IRIX 6.5 */
559 ASSERT (ptr
== input
+ 1); /* HP-UX 11.31/ia64, IRIX 6.5 */
560 ASSERT (errno
== 0); /* HP-UX 11.31/ia64, IRIX 6.5 */
563 const char input
[] = "0x1P 1000000";
567 result
= strtold (input
, &ptr
);
568 ASSERT (result
== 1.0L); /* HP-UX 11.31/ia64, IRIX 6.5, mingw */
569 ASSERT (ptr
== input
+ 3); /* HP-UX 11.31/ia64, IRIX 6.5, mingw */
575 const char input
[] = "iNf";
579 result
= strtold (input
, &ptr
);
580 ASSERT (result
== HUGE_VALL
); /* IRIX 6.5 */
581 ASSERT (ptr
== input
+ 3); /* IRIX 6.5 */
582 ASSERT (errno
== 0); /* HP-UX 11.31/ia64 */
585 const char input
[] = "-InF";
589 result
= strtold (input
, &ptr
);
590 ASSERT (result
== -HUGE_VALL
); /* IRIX 6.5 */
591 ASSERT (ptr
== input
+ 4); /* IRIX 6.5 */
592 ASSERT (errno
== 0); /* HP-UX 11.31/ia64 */
595 const char input
[] = "infinite";
599 result
= strtold (input
, &ptr
);
600 ASSERT (result
== HUGE_VALL
); /* IRIX 6.5 */
601 ASSERT (ptr
== input
+ 3); /* IRIX 6.5 */
602 ASSERT (errno
== 0); /* HP-UX 11.31/ia64 */
605 const char input
[] = "infinitY";
609 result
= strtold (input
, &ptr
);
610 ASSERT (result
== HUGE_VALL
); /* IRIX 6.5 */
611 ASSERT (ptr
== input
+ 8); /* IRIX 6.5 */
612 ASSERT (errno
== 0); /* HP-UX 11.31/ia64 */
615 const char input
[] = "infinitY.";
619 result
= strtold (input
, &ptr
);
620 ASSERT (result
== HUGE_VALL
); /* IRIX 6.5 */
621 ASSERT (ptr
== input
+ 8); /* IRIX 6.5 */
622 ASSERT (errno
== 0); /* HP-UX 11.31/ia64 */
625 /* NaN. Some processors set the sign bit of the default NaN, so all
626 we check is that using a sign changes the result. */
628 const char input
[] = "-nan";
634 result1
= strtold (input
, &ptr1
);
635 result2
= strtold (input
+ 1, &ptr2
);
636 #if 1 /* All known CPUs support NaNs. */
637 ASSERT (isnanl (result1
)); /* IRIX 6.5 */
638 ASSERT (isnanl (result2
)); /* IRIX 6.5 */
640 /* Sign bits of NaN is a portability sticking point, not worth
642 ASSERT (!!signbit (result1
) != !!signbit (result2
));
644 ASSERT (ptr1
== input
+ 4); /* IRIX 6.5 */
645 ASSERT (ptr2
== input
+ 4); /* IRIX 6.5 */
646 ASSERT (errno
== 0); /* HP-UX 11.31/ia64 */
648 ASSERT (result1
== 0.0L);
649 ASSERT (result2
== 0.0L);
650 ASSERT (!signbit (result1
));
651 ASSERT (!signbit (result2
));
652 ASSERT (ptr1
== input
);
653 ASSERT (ptr2
== input
+ 1);
654 ASSERT (errno
== 0 || errno
== EINVAL
);
658 const char input
[] = "+nan(";
664 result1
= strtold (input
, &ptr1
);
665 result2
= strtold (input
+ 1, &ptr2
);
666 #if 1 /* All known CPUs support NaNs. */
667 ASSERT (isnanl (result1
)); /* IRIX 6.5 */
668 ASSERT (isnanl (result2
)); /* IRIX 6.5 */
669 ASSERT (!!signbit (result1
) == !!signbit (result2
));
670 ASSERT (ptr1
== input
+ 4); /* Mac OS X 10.5, IRIX 6.5 */
671 ASSERT (ptr2
== input
+ 4); /* Mac OS X 10.5, IRIX 6.5 */
672 ASSERT (errno
== 0); /* HP-UX 11.31/ia64 */
674 ASSERT (result1
== 0.0L);
675 ASSERT (result2
== 0.0L);
676 ASSERT (!signbit (result1
));
677 ASSERT (!signbit (result2
));
678 ASSERT (ptr1
== input
);
679 ASSERT (ptr2
== input
+ 1);
680 ASSERT (errno
== 0 || errno
== EINVAL
);
684 const char input
[] = "-nan()";
690 result1
= strtold (input
, &ptr1
);
691 result2
= strtold (input
+ 1, &ptr2
);
692 #if 1 /* All known CPUs support NaNs. */
693 ASSERT (isnanl (result1
)); /* IRIX 6.5 */
694 ASSERT (isnanl (result2
)); /* IRIX 6.5 */
696 /* Sign bits of NaN is a portability sticking point, not worth
698 ASSERT (!!signbit (result1
) != !!signbit (result2
)); /* glibc-2.3.2, musl libc, OpenBSD 6.0, IRIX 6.5, mingw, Haiku */
700 ASSERT (ptr1
== input
+ 6); /* glibc-2.3.2, IRIX 6.5, mingw, Haiku */
701 ASSERT (ptr2
== input
+ 6); /* glibc-2.3.2, IRIX 6.5, mingw, Haiku */
702 ASSERT (errno
== 0); /* HP-UX 11.31/ia64, Haiku */
704 ASSERT (result1
== 0.0L);
705 ASSERT (result2
== 0.0L);
706 ASSERT (!signbit (result1
));
707 ASSERT (!signbit (result2
));
708 ASSERT (ptr1
== input
);
709 ASSERT (ptr2
== input
+ 1);
710 ASSERT (errno
== 0 || errno
== EINVAL
);
714 const char input
[] = " nan().";
718 result
= strtold (input
, &ptr
);
719 #if 1 /* All known CPUs support NaNs. */
720 ASSERT (isnanl (result
)); /* IRIX 6.5 */
721 ASSERT (ptr
== input
+ 6); /* glibc-2.3.2, IRIX 6.5, mingw, Haiku */
722 ASSERT (errno
== 0); /* HP-UX 11.31/ia64, Haiku */
724 ASSERT (result
== 0.0L);
725 ASSERT (!signbit (result
));
726 ASSERT (ptr
== input
);
727 ASSERT (errno
== 0 || errno
== EINVAL
);
731 /* The behavior of nan(0) is implementation-defined, but all
732 implementations we know of which handle optional
733 n-char-sequences handle nan(0) the same as nan(). */
734 const char input
[] = "-nan(0).";
740 result1
= strtold (input
, &ptr1
);
741 result2
= strtold (input
+ 1, &ptr2
);
742 #if 1 /* All known CPUs support NaNs. */
743 ASSERT (isnanl (result1
)); /* IRIX 6.5 */
744 ASSERT (isnanl (result2
)); /* IRIX 6.5 */
746 /* Sign bits of NaN is a portability sticking point, not worth
748 ASSERT (!!signbit (result1
) != !!signbit (result2
));
750 ASSERT (ptr1
== input
+ 7); /* glibc-2.3.2, IRIX 6.5, mingw, Haiku */
751 ASSERT (ptr2
== input
+ 7); /* glibc-2.3.2, IRIX 6.5, mingw, Haiku */
752 ASSERT (errno
== 0); /* HP-UX 11.31/ia64 */
754 ASSERT (result1
== 0.0L);
755 ASSERT (result2
== 0.0L);
756 ASSERT (!signbit (result1
));
757 ASSERT (!signbit (result2
));
758 ASSERT (ptr1
== input
);
759 ASSERT (ptr2
== input
+ 1);
760 ASSERT (errno
== 0 || errno
== EINVAL
);
766 const char input
[] = "0xa";
770 result
= strtold (input
, &ptr
);
771 ASSERT (result
== 10.0L); /* IRIX 6.5, mingw */
772 ASSERT (ptr
== input
+ 3); /* IRIX 6.5, mingw */
776 const char input
[] = "0XA";
780 result
= strtold (input
, &ptr
);
781 ASSERT (result
== 10.0L); /* IRIX 6.5, mingw */
782 ASSERT (ptr
== input
+ 3); /* IRIX 6.5, mingw */
786 const char input
[] = "0x1p";
790 result
= strtold (input
, &ptr
);
791 ASSERT (result
== 1.0L); /* IRIX 6.5, mingw */
792 ASSERT (ptr
== input
+ 3); /* IRIX 6.5, mingw */
796 const char input
[] = "0x1p+";
800 result
= strtold (input
, &ptr
);
801 ASSERT (result
== 1.0L); /* IRIX 6.5, mingw */
802 ASSERT (ptr
== input
+ 3); /* IRIX 6.5, mingw */
806 const char input
[] = "0x1P+";
810 result
= strtold (input
, &ptr
);
811 ASSERT (result
== 1.0L); /* IRIX 6.5, mingw */
812 ASSERT (ptr
== input
+ 3); /* IRIX 6.5, mingw */
816 const char input
[] = "0x1p+1";
820 result
= strtold (input
, &ptr
);
821 ASSERT (result
== 2.0L); /* IRIX 6.5, mingw */
822 ASSERT (ptr
== input
+ 6); /* IRIX 6.5, mingw */
826 const char input
[] = "0X1P+1";
830 result
= strtold (input
, &ptr
);
831 ASSERT (result
== 2.0L); /* IRIX 6.5, mingw */
832 ASSERT (ptr
== input
+ 6); /* IRIX 6.5, mingw */
836 const char input
[] = "0x1p+1a";
840 result
= strtold (input
, &ptr
);
841 ASSERT (result
== 2.0L); /* IRIX 6.5, mingw */
842 ASSERT (ptr
== input
+ 6); /* IRIX 6.5, mingw */
846 const char input
[] = "0x1p 2";
850 result
= strtold (input
, &ptr
);
851 ASSERT (result
== 1.0L); /* HP-UX 11.31/ia64, IRIX 6.5, mingw */
852 ASSERT (ptr
== input
+ 3); /* HP-UX 11.31/ia64, IRIX 6.5, mingw */
859 char *input
= malloc (m
+ 1);
864 memset (input
, '\t', m
- 1);
868 result
= strtold (input
, &ptr
);
869 ASSERT (result
== 1.0L);
870 ASSERT (ptr
== input
+ m
);
877 char *input
= malloc (m
+ 1);
882 memset (input
, '0', m
- 1);
886 result
= strtold (input
, &ptr
);
887 ASSERT (result
== 1.0L);
888 ASSERT (ptr
== input
+ m
);
894 /* Newlib has an artificial limit of 20000 for the exponent. TODO -
895 gnulib should fix this. */
898 char *input
= malloc (m
+ 1);
904 memset (input
+ 1, '0', m
- 10);
916 result
= strtold (input
, &ptr
);
917 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 */
918 ASSERT (ptr
== input
+ m
);
919 ASSERT (errno
== 0); /* Mac OS X 10.5, FreeBSD 11.0, NetBSD 7.1, OpenBSD 6.0, Minix 3.3, IRIX 6.5, mingw */
925 char *input
= malloc (m
+ 1);
931 memset (input
+ 1, '0', m
- 9);
942 result
= strtold (input
, &ptr
);
943 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 */
944 ASSERT (ptr
== input
+ m
);
945 ASSERT (errno
== 0); /* Mac OS X 10.5, FreeBSD 11.0, NetBSD 7.1, OpenBSD 6.0, Minix 3.3, IRIX 6.5, mingw */
952 char *input
= malloc (m
+ 1);
961 memset (input
+ 4, '0', m
- 3);
964 result
= strtold (input
, &ptr
);
965 ASSERT (result
== 0.0L);
966 ASSERT (!!signbit (result
) == !!signbit (minus_zerol
)); /* IRIX 6.5 */
967 ASSERT (ptr
== input
+ m
);
974 /* TODO - is it worth some tests of rounding for typical IEEE corner
975 cases, such as .5 ULP rounding up to the smallest denormal and
976 not causing underflow, or LDBL_MIN - .5 ULP not causing an