1 /* @(#)k_standard.c 5.1 93/09/24 */
3 * ====================================================
4 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
6 * Developed at SunPro, a Sun Microsystems, Inc. business.
7 * Permission to use, copy, modify, and distribute this
8 * software is freely granted, provided that this notice
10 * ====================================================
13 #if defined(LIBM_SCCS) && !defined(lint)
14 static char rcsid
[] = "$NetBSD: k_standard.c,v 1.6 1995/05/10 20:46:35 jtc Exp $";
18 #include <math_private.h>
25 #include <stdio.h> /* fputs(), stderr */
26 #define WRITE2(u,v) fputs(u, stderr)
27 #else /* !defined(_USE_WRITE) */
28 #include <unistd.h> /* write */
29 #define WRITE2(u,v) write(2, u, v)
31 #endif /* !defined(_USE_WRITE) */
33 /* XXX gcc versions until now don't delay the 0.0/0.0 division until
34 runtime but produce NaN at compile time. This is wrong since the
35 exceptions are not set correctly. */
37 static const double zero
= 0.0; /* used as const */
39 static double zero
= 0.0; /* used as const */
43 * Standard conformance (non-IEEE) on exception cases.
58 * 14-- lgamma(finite) overflow
59 * 15-- lgamma(-integer)
65 * 21-- pow(x,y) overflow
66 * 22-- pow(x,y) underflow
67 * 23-- pow(0,negative)
68 * 24-- pow(neg,non-integral)
69 * 25-- sinh(finite) overflow
77 * 33-- scalb underflow
78 * 34-- j0(|x|>X_TLOSS)
80 * 36-- j1(|x|>X_TLOSS)
82 * 38-- jn(|x|>X_TLOSS, n)
83 * 39-- yn(x>X_TLOSS, n)
84 * 40-- tgamma(finite) overflow
85 * 41-- tgamma(-integer)
91 * 47-- exp10 underflow
99 __kernel_standard(double x
, double y
, int type
)
101 struct exception exc
;
102 #ifndef HUGE_VAL /* this is the only routine that uses HUGE_VAL */
106 SET_HIGH_WORD(inf
,0x7ff00000); /* set inf to infinite */
110 (void) fflush(stdout
);
120 exc
.name
= type
< 100 ? "acos" : (type
< 200
121 ? "acosf" : "acosl");;
122 if (_LIB_VERSION
== _SVID_
)
126 if (_LIB_VERSION
== _POSIX_
)
128 else if (!matherr(&exc
)) {
129 if(_LIB_VERSION
== _SVID_
) {
130 (void) WRITE2("acos: DOMAIN error\n", 19);
140 exc
.name
= type
< 100 ? "asin" : (type
< 200
141 ? "asinf" : "asinl");
142 if (_LIB_VERSION
== _SVID_
)
146 if(_LIB_VERSION
== _POSIX_
)
148 else if (!matherr(&exc
)) {
149 if(_LIB_VERSION
== _SVID_
) {
150 (void) WRITE2("asin: DOMAIN error\n", 19);
162 exc
.name
= type
< 100 ? "atan2" : (type
< 200
163 ? "atan2f" : "atan2l");
164 assert (_LIB_VERSION
== _SVID_
);
166 if(_LIB_VERSION
== _POSIX_
)
168 else if (!matherr(&exc
)) {
169 if(_LIB_VERSION
== _SVID_
) {
170 (void) WRITE2("atan2: DOMAIN error\n", 20);
178 /* hypot(finite,finite) overflow */
180 exc
.name
= type
< 100 ? "hypot" : (type
< 200
181 ? "hypotf" : "hypotl");
182 if (_LIB_VERSION
== _SVID_
)
185 exc
.retval
= HUGE_VAL
;
186 if (_LIB_VERSION
== _POSIX_
)
187 __set_errno (ERANGE
);
188 else if (!matherr(&exc
)) {
189 __set_errno (ERANGE
);
195 /* cosh(finite) overflow */
197 exc
.name
= type
< 100 ? "cosh" : (type
< 200
198 ? "coshf" : "coshl");
199 if (_LIB_VERSION
== _SVID_
)
202 exc
.retval
= HUGE_VAL
;
203 if (_LIB_VERSION
== _POSIX_
)
204 __set_errno (ERANGE
);
205 else if (!matherr(&exc
)) {
206 __set_errno (ERANGE
);
212 /* exp(finite) overflow */
214 exc
.name
= type
< 100 ? "exp" : (type
< 200
216 if (_LIB_VERSION
== _SVID_
)
219 exc
.retval
= HUGE_VAL
;
220 if (_LIB_VERSION
== _POSIX_
)
221 __set_errno (ERANGE
);
222 else if (!matherr(&exc
)) {
223 __set_errno (ERANGE
);
229 /* exp(finite) underflow */
230 exc
.type
= UNDERFLOW
;
231 exc
.name
= type
< 100 ? "exp" : (type
< 200
234 if (_LIB_VERSION
== _POSIX_
)
235 __set_errno (ERANGE
);
236 else if (!matherr(&exc
)) {
237 __set_errno (ERANGE
);
244 exc
.type
= DOMAIN
; /* should be SING for IEEE */
245 exc
.name
= type
< 100 ? "y0" : (type
< 200 ? "y0f" : "y0l");
246 if (_LIB_VERSION
== _SVID_
)
249 exc
.retval
= -HUGE_VAL
;
250 if (_LIB_VERSION
== _POSIX_
)
251 __set_errno (ERANGE
);
252 else if (!matherr(&exc
)) {
253 if (_LIB_VERSION
== _SVID_
) {
254 (void) WRITE2("y0: DOMAIN error\n", 17);
264 exc
.name
= type
< 100 ? "y0" : (type
< 200 ? "y0f" : "y0l");
265 if (_LIB_VERSION
== _SVID_
)
269 if (_LIB_VERSION
== _POSIX_
)
271 else if (!matherr(&exc
)) {
272 if (_LIB_VERSION
== _SVID_
) {
273 (void) WRITE2("y0: DOMAIN error\n", 17);
282 exc
.type
= DOMAIN
; /* should be SING for IEEE */
283 exc
.name
= type
< 100 ? "y1" : (type
< 200 ? "y1f" : "y1l");
284 if (_LIB_VERSION
== _SVID_
)
287 exc
.retval
= -HUGE_VAL
;
288 if (_LIB_VERSION
== _POSIX_
)
289 __set_errno (ERANGE
);
290 else if (!matherr(&exc
)) {
291 if (_LIB_VERSION
== _SVID_
) {
292 (void) WRITE2("y1: DOMAIN error\n", 17);
302 exc
.name
= type
< 100 ? "y1" : (type
< 200 ? "y1f" : "y1l");
303 if (_LIB_VERSION
== _SVID_
)
307 if (_LIB_VERSION
== _POSIX_
)
309 else if (!matherr(&exc
)) {
310 if (_LIB_VERSION
== _SVID_
) {
311 (void) WRITE2("y1: DOMAIN error\n", 17);
320 exc
.type
= DOMAIN
; /* should be SING for IEEE */
321 exc
.name
= type
< 100 ? "yn" : (type
< 200 ? "ynf" : "ynl");
322 if (_LIB_VERSION
== _SVID_
)
325 exc
.retval
= ((x
< 0 && ((int) x
& 1) != 0)
328 if (_LIB_VERSION
== _POSIX_
)
329 __set_errno (ERANGE
);
330 else if (!matherr(&exc
)) {
331 if (_LIB_VERSION
== _SVID_
) {
332 (void) WRITE2("yn: DOMAIN error\n", 17);
342 exc
.name
= type
< 100 ? "yn" : (type
< 200 ? "ynf" : "ynl");
343 if (_LIB_VERSION
== _SVID_
)
347 if (_LIB_VERSION
== _POSIX_
)
349 else if (!matherr(&exc
)) {
350 if (_LIB_VERSION
== _SVID_
) {
351 (void) WRITE2("yn: DOMAIN error\n", 17);
359 /* lgamma(finite) overflow */
361 exc
.name
= type
< 100 ? "lgamma" : (type
< 200
362 ? "lgammaf" : "lgammal");
363 if (_LIB_VERSION
== _SVID_
)
366 exc
.retval
= HUGE_VAL
;
367 if (_LIB_VERSION
== _POSIX_
)
368 __set_errno (ERANGE
);
369 else if (!matherr(&exc
)) {
370 __set_errno (ERANGE
);
376 /* lgamma(-integer) or lgamma(0) */
378 exc
.name
= type
< 100 ? "lgamma" : (type
< 200
379 ? "lgammaf" : "lgammal");
380 if (_LIB_VERSION
== _SVID_
)
383 exc
.retval
= HUGE_VAL
;
384 if (_LIB_VERSION
== _POSIX_
)
385 __set_errno (ERANGE
);
386 else if (!matherr(&exc
)) {
387 if (_LIB_VERSION
== _SVID_
) {
388 (void) WRITE2("lgamma: SING error\n", 19);
398 exc
.name
= type
< 100 ? "log" : (type
< 200 ? "logf" : "logl");
399 if (_LIB_VERSION
== _SVID_
)
402 exc
.retval
= -HUGE_VAL
;
403 if (_LIB_VERSION
== _POSIX_
)
404 __set_errno (ERANGE
);
405 else if (!matherr(&exc
)) {
406 if (_LIB_VERSION
== _SVID_
) {
407 (void) WRITE2("log: SING error\n", 16);
417 exc
.name
= type
< 100 ? "log" : (type
< 200 ? "logf" : "logl");
418 if (_LIB_VERSION
== _SVID_
)
422 if (_LIB_VERSION
== _POSIX_
)
424 else if (!matherr(&exc
)) {
425 if (_LIB_VERSION
== _SVID_
) {
426 (void) WRITE2("log: DOMAIN error\n", 18);
436 exc
.name
= type
< 100 ? "log10" : (type
< 200
437 ? "log10f" : "log10l");
438 if (_LIB_VERSION
== _SVID_
)
441 exc
.retval
= -HUGE_VAL
;
442 if (_LIB_VERSION
== _POSIX_
)
443 __set_errno (ERANGE
);
444 else if (!matherr(&exc
)) {
445 if (_LIB_VERSION
== _SVID_
) {
446 (void) WRITE2("log10: SING error\n", 18);
456 exc
.name
= type
< 100 ? "log10" : (type
< 200
457 ? "log10f" : "log10l");
458 if (_LIB_VERSION
== _SVID_
)
462 if (_LIB_VERSION
== _POSIX_
)
464 else if (!matherr(&exc
)) {
465 if (_LIB_VERSION
== _SVID_
) {
466 (void) WRITE2("log10: DOMAIN error\n", 20);
475 /* error only if _LIB_VERSION == _SVID_ */
477 exc
.name
= type
< 100 ? "pow" : (type
< 200 ? "powf" : "powl");
479 if (_LIB_VERSION
!= _SVID_
) exc
.retval
= 1.0;
480 else if (!matherr(&exc
)) {
481 (void) WRITE2("pow(0,0): DOMAIN error\n", 23);
488 /* pow(x,y) overflow */
490 exc
.name
= type
< 100 ? "pow" : (type
< 200 ? "powf" : "powl");
491 if (_LIB_VERSION
== _SVID_
) {
494 if(x
<zero
&&__rint(y
)!=y
) exc
.retval
= -HUGE
;
496 exc
.retval
= HUGE_VAL
;
498 if(x
<zero
&&__rint(y
)!=y
) exc
.retval
= -HUGE_VAL
;
500 if (_LIB_VERSION
== _POSIX_
)
501 __set_errno (ERANGE
);
502 else if (!matherr(&exc
)) {
503 __set_errno (ERANGE
);
509 /* pow(x,y) underflow */
510 exc
.type
= UNDERFLOW
;
511 exc
.name
= type
< 100 ? "pow" : (type
< 200 ? "powf" : "powl");
514 if (x
< zero
&& __rint (y
) != y
)
516 if (_LIB_VERSION
== _POSIX_
)
517 __set_errno (ERANGE
);
518 else if (!matherr(&exc
)) {
519 __set_errno (ERANGE
);
527 exc
.name
= type
< 100 ? "pow" : (type
< 200 ? "powf" : "powl");
528 if (_LIB_VERSION
== _SVID_
)
531 exc
.retval
= -HUGE_VAL
;
532 if (_LIB_VERSION
== _POSIX_
)
533 __set_errno (ERANGE
);
534 else if (!matherr(&exc
)) {
535 if (_LIB_VERSION
== _SVID_
) {
536 (void) WRITE2("pow(0,neg): DOMAIN error\n", 25);
546 exc
.name
= type
< 100 ? "pow" : (type
< 200 ? "powf" : "powl");
547 if (_LIB_VERSION
== _SVID_
)
550 exc
.retval
= HUGE_VAL
;
551 if (_LIB_VERSION
== _POSIX_
)
552 __set_errno (ERANGE
);
553 else if (!matherr(&exc
)) {
554 if (_LIB_VERSION
== _SVID_
) {
555 (void) WRITE2("pow(0,neg): DOMAIN error\n", 25);
563 /* neg**non-integral */
565 exc
.name
= type
< 100 ? "pow" : (type
< 200 ? "powf" : "powl");
566 if (_LIB_VERSION
== _SVID_
)
569 exc
.retval
= zero
/zero
; /* X/Open allow NaN */
570 if (_LIB_VERSION
== _POSIX_
)
572 else if (!matherr(&exc
)) {
573 if (_LIB_VERSION
== _SVID_
) {
574 (void) WRITE2("neg**non-integral: DOMAIN error\n", 32);
582 /* sinh(finite) overflow */
584 exc
.name
= type
< 100 ? "sinh" : (type
< 200
585 ? "sinhf" : "sinhl");
586 if (_LIB_VERSION
== _SVID_
)
587 exc
.retval
= ( (x
>zero
) ? HUGE
: -HUGE
);
589 exc
.retval
= ( (x
>zero
) ? HUGE_VAL
: -HUGE_VAL
);
590 if (_LIB_VERSION
== _POSIX_
)
591 __set_errno (ERANGE
);
592 else if (!matherr(&exc
)) {
593 __set_errno (ERANGE
);
601 exc
.name
= type
< 100 ? "sqrt" : (type
< 200
602 ? "sqrtf" : "sqrtl");
603 if (_LIB_VERSION
== _SVID_
)
606 exc
.retval
= zero
/zero
;
607 if (_LIB_VERSION
== _POSIX_
)
609 else if (!matherr(&exc
)) {
610 if (_LIB_VERSION
== _SVID_
) {
611 (void) WRITE2("sqrt: DOMAIN error\n", 19);
621 exc
.name
= type
< 100 ? "fmod" : (type
< 200
622 ? "fmodf" : "fmodl");
623 if (_LIB_VERSION
== _SVID_
)
626 exc
.retval
= zero
/zero
;
627 if (_LIB_VERSION
== _POSIX_
)
629 else if (!matherr(&exc
)) {
630 if (_LIB_VERSION
== _SVID_
) {
631 (void) WRITE2("fmod: DOMAIN error\n", 20);
641 exc
.name
= type
< 100 ? "remainder" : (type
< 200
644 exc
.retval
= zero
/zero
;
645 if (_LIB_VERSION
== _POSIX_
)
647 else if (!matherr(&exc
)) {
648 if (_LIB_VERSION
== _SVID_
) {
649 (void) WRITE2("remainder: DOMAIN error\n", 24);
659 exc
.name
= type
< 100 ? "acosh" : (type
< 200
660 ? "acoshf" : "acoshl");
661 exc
.retval
= zero
/zero
;
662 if (_LIB_VERSION
== _POSIX_
)
664 else if (!matherr(&exc
)) {
665 if (_LIB_VERSION
== _SVID_
) {
666 (void) WRITE2("acosh: DOMAIN error\n", 20);
676 exc
.name
= type
< 100 ? "atanh" : (type
< 200
677 ? "atanhf" : "atanhl");
678 exc
.retval
= zero
/zero
;
679 if (_LIB_VERSION
== _POSIX_
)
681 else if (!matherr(&exc
)) {
682 if (_LIB_VERSION
== _SVID_
) {
683 (void) WRITE2("atanh: DOMAIN error\n", 20);
693 exc
.name
= type
< 100 ? "atanh" : (type
< 200
694 ? "atanhf" : "atanhl");
695 exc
.retval
= x
/zero
; /* sign(x)*inf */
696 if (_LIB_VERSION
== _POSIX_
)
697 __set_errno (ERANGE
);
698 else if (!matherr(&exc
)) {
699 if (_LIB_VERSION
== _SVID_
) {
700 (void) WRITE2("atanh: SING error\n", 18);
708 /* scalb overflow; SVID also returns +-HUGE_VAL */
710 exc
.name
= type
< 100 ? "scalb" : (type
< 200
711 ? "scalbf" : "scalbl");
712 exc
.retval
= x
> zero
? HUGE_VAL
: -HUGE_VAL
;
713 if (_LIB_VERSION
== _POSIX_
)
714 __set_errno (ERANGE
);
715 else if (!matherr(&exc
)) {
716 __set_errno (ERANGE
);
722 /* scalb underflow */
723 exc
.type
= UNDERFLOW
;
724 exc
.name
= type
< 100 ? "scalb" : (type
< 200
725 ? "scalbf" : "scalbl");
726 exc
.retval
= __copysign(zero
,x
);
727 if (_LIB_VERSION
== _POSIX_
)
728 __set_errno (ERANGE
);
729 else if (!matherr(&exc
)) {
730 __set_errno (ERANGE
);
736 /* j0(|x|>X_TLOSS) */
738 exc
.name
= type
< 100 ? "j0" : (type
< 200 ? "j0f" : "j0l");
740 if (_LIB_VERSION
== _POSIX_
)
741 __set_errno (ERANGE
);
742 else if (!matherr(&exc
)) {
743 if (_LIB_VERSION
== _SVID_
) {
744 (void) WRITE2(exc
.name
, 2);
745 (void) WRITE2(": TLOSS error\n", 14);
747 __set_errno (ERANGE
);
755 exc
.name
= type
< 100 ? "y0" : (type
< 200 ? "y0f" : "y0l");
757 if (_LIB_VERSION
== _POSIX_
)
758 __set_errno (ERANGE
);
759 else if (!matherr(&exc
)) {
760 if (_LIB_VERSION
== _SVID_
) {
761 (void) WRITE2(exc
.name
, 2);
762 (void) WRITE2(": TLOSS error\n", 14);
764 __set_errno (ERANGE
);
770 /* j1(|x|>X_TLOSS) */
772 exc
.name
= type
< 100 ? "j1" : (type
< 200 ? "j1f" : "j1l");
774 if (_LIB_VERSION
== _POSIX_
)
775 __set_errno (ERANGE
);
776 else if (!matherr(&exc
)) {
777 if (_LIB_VERSION
== _SVID_
) {
778 (void) WRITE2(exc
.name
, 2);
779 (void) WRITE2(": TLOSS error\n", 14);
781 __set_errno (ERANGE
);
789 exc
.name
= type
< 100 ? "y1" : (type
< 200 ? "y1f" : "y1l");
791 if (_LIB_VERSION
== _POSIX_
)
792 __set_errno (ERANGE
);
793 else if (!matherr(&exc
)) {
794 if (_LIB_VERSION
== _SVID_
) {
795 (void) WRITE2(exc
.name
, 2);
796 (void) WRITE2(": TLOSS error\n", 14);
798 __set_errno (ERANGE
);
804 /* jn(|x|>X_TLOSS) */
806 exc
.name
= type
< 100 ? "jn" : (type
< 200 ? "jnf" : "jnl");
808 if (_LIB_VERSION
== _POSIX_
)
809 __set_errno (ERANGE
);
810 else if (!matherr(&exc
)) {
811 if (_LIB_VERSION
== _SVID_
) {
812 (void) WRITE2(exc
.name
, 2);
813 (void) WRITE2(": TLOSS error\n", 14);
815 __set_errno (ERANGE
);
823 exc
.name
= type
< 100 ? "yn" : (type
< 200 ? "ynf" : "ynl");
825 if (_LIB_VERSION
== _POSIX_
)
826 __set_errno (ERANGE
);
827 else if (!matherr(&exc
)) {
828 if (_LIB_VERSION
== _SVID_
) {
829 (void) WRITE2(exc
.name
, 2);
830 (void) WRITE2(": TLOSS error\n", 14);
832 __set_errno (ERANGE
);
838 /* tgamma(finite) overflow */
840 exc
.name
= type
< 100 ? "tgamma" : (type
< 200
841 ? "tgammaf" : "tgammal");
842 exc
.retval
= __copysign (HUGE_VAL
, x
);
843 if (_LIB_VERSION
== _POSIX_
)
844 __set_errno (ERANGE
);
845 else if (!matherr(&exc
)) {
846 __set_errno (ERANGE
);
852 /* tgamma(-integer) */
854 exc
.name
= type
< 100 ? "tgamma" : (type
< 200
855 ? "tgammaf" : "tgammal");
857 if (_LIB_VERSION
== _POSIX_
)
859 else if (!matherr(&exc
)) {
860 if (_LIB_VERSION
== _SVID_
) {
861 (void) WRITE2("tgamma: SING error\n", 18);
862 exc
.retval
= HUGE_VAL
;
871 /* error only if _LIB_VERSION == _SVID_ & _XOPEN_ */
873 exc
.name
= type
< 100 ? "pow" : (type
< 200 ? "powf" : "powl");
875 if (_LIB_VERSION
== _IEEE_
||
876 _LIB_VERSION
== _POSIX_
) exc
.retval
= 1.0;
877 else if (!matherr(&exc
)) {
885 /* exp(finite) overflow */
887 exc
.name
= type
< 100 ? "exp2" : (type
< 200
888 ? "exp2f" : "exp2l");
889 if (_LIB_VERSION
== _SVID_
)
892 exc
.retval
= HUGE_VAL
;
893 if (_LIB_VERSION
== _POSIX_
)
894 __set_errno (ERANGE
);
895 else if (!matherr(&exc
)) {
896 __set_errno (ERANGE
);
902 /* exp(finite) underflow */
903 exc
.type
= UNDERFLOW
;
904 exc
.name
= type
< 100 ? "exp2" : (type
< 200
905 ? "exp2f" : "exp2l");
907 if (_LIB_VERSION
== _POSIX_
)
908 __set_errno (ERANGE
);
909 else if (!matherr(&exc
)) {
910 __set_errno (ERANGE
);
917 /* exp(finite) overflow */
919 exc
.name
= type
< 100 ? "exp10" : (type
< 200
920 ? "exp10f" : "exp10l");
921 if (_LIB_VERSION
== _SVID_
)
924 exc
.retval
= HUGE_VAL
;
925 if (_LIB_VERSION
== _POSIX_
)
926 __set_errno (ERANGE
);
927 else if (!matherr(&exc
)) {
928 __set_errno (ERANGE
);
934 /* exp(finite) underflow */
935 exc
.type
= UNDERFLOW
;
936 exc
.name
= type
< 100 ? "exp10" : (type
< 200
937 ? "exp10f" : "exp10l");
939 if (_LIB_VERSION
== _POSIX_
)
940 __set_errno (ERANGE
);
941 else if (!matherr(&exc
)) {
942 __set_errno (ERANGE
);
950 exc
.name
= type
< 100 ? "log2" : (type
< 200
951 ? "log2f" : "log2l");
952 if (_LIB_VERSION
== _SVID_
)
955 exc
.retval
= -HUGE_VAL
;
956 if (_LIB_VERSION
== _POSIX_
)
957 __set_errno (ERANGE
);
958 else if (!matherr(&exc
)) {
967 exc
.name
= type
< 100 ? "log2" : (type
< 200
968 ? "log2f" : "log2l");
969 if (_LIB_VERSION
== _SVID_
)
973 if (_LIB_VERSION
== _POSIX_
)
975 else if (!matherr(&exc
)) {
984 exc
.name
= type
< 100 ? "tgamma" : (type
< 200
985 ? "tgammaf" : "tgammal");
986 exc
.retval
= __copysign (HUGE_VAL
, x
);
987 if (_LIB_VERSION
== _POSIX_
)
988 __set_errno (ERANGE
);
989 else if (!matherr(&exc
)) {
990 if (_LIB_VERSION
== _SVID_
)
991 (void) WRITE2("tgamma: SING error\n", 18);
992 __set_errno (ERANGE
);
996 /* #### Last used is 50/150/250 ### */
1003 __kernel_standard_f(float x
, float y
, int type
)
1005 return __kernel_standard(x
, y
, type
);
1008 #ifndef __NO_LONG_DOUBLE_MATH
1010 __kernel_standard_l (long double x
, long double y
, int type
)
1013 struct exception exc
;
1017 long double ax
= fabsl (x
);
1019 dx
= __copysignl (DBL_MAX
, x
);
1020 else if (ax
> 0 && ax
< DBL_MIN
)
1021 dx
= __copysignl (DBL_MIN
, x
);
1029 long double ay
= fabsl (y
);
1031 dy
= __copysignl (DBL_MAX
, y
);
1032 else if (ay
> 0 && ay
< DBL_MIN
)
1033 dy
= __copysignl (DBL_MIN
, y
);
1043 /* powl (x, y) overflow. */
1046 exc
.type
= OVERFLOW
;
1048 if (_LIB_VERSION
== _SVID_
)
1052 if (x
< zero
&& __rintl (y
) != y
)
1057 exc
.retval
= HUGE_VAL
;
1059 if (x
< zero
&& __rintl (y
) != y
)
1060 exc
.retval
= -HUGE_VAL
;
1062 if (_LIB_VERSION
== _POSIX_
)
1063 __set_errno (ERANGE
);
1064 else if (!matherr (&exc
))
1065 __set_errno (ERANGE
);
1069 /* powl (x, y) underflow. */
1072 exc
.type
= UNDERFLOW
;
1076 if (x
< zero
&& __rintl (y
) != y
)
1078 if (_LIB_VERSION
== _POSIX_
)
1079 __set_errno (ERANGE
);
1080 else if (!matherr (&exc
))
1081 __set_errno (ERANGE
);
1085 return __kernel_standard (dx
, dy
, type
);