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 copile 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_
)
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_
)
268 exc
.retval
= -HUGE_VAL
;
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_
)
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_
)
306 exc
.retval
= -HUGE_VAL
;
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
= -HUGE_VAL
;
326 if (_LIB_VERSION
== _POSIX_
)
328 else if (!matherr(&exc
)) {
329 if (_LIB_VERSION
== _SVID_
) {
330 (void) WRITE2("yn: DOMAIN error\n", 17);
340 exc
.name
= type
< 100 ? "yn" : (type
< 200 ? "ynf" : "ynl");
341 if (_LIB_VERSION
== _SVID_
)
344 exc
.retval
= -HUGE_VAL
;
345 if (_LIB_VERSION
== _POSIX_
)
347 else if (!matherr(&exc
)) {
348 if (_LIB_VERSION
== _SVID_
) {
349 (void) WRITE2("yn: DOMAIN error\n", 17);
357 /* lgamma(finite) overflow */
359 exc
.name
= type
< 100 ? "lgamma" : (type
< 200
360 ? "lgammaf" : "lgammal");
361 if (_LIB_VERSION
== _SVID_
)
364 exc
.retval
= HUGE_VAL
;
365 if (_LIB_VERSION
== _POSIX_
)
366 __set_errno (ERANGE
);
367 else if (!matherr(&exc
)) {
368 __set_errno (ERANGE
);
374 /* lgamma(-integer) or lgamma(0) */
376 exc
.name
= type
< 100 ? "lgamma" : (type
< 200
377 ? "lgammaf" : "lgammal");
378 if (_LIB_VERSION
== _SVID_
)
381 exc
.retval
= HUGE_VAL
;
382 if (_LIB_VERSION
== _POSIX_
)
383 __set_errno (ERANGE
);
384 else if (!matherr(&exc
)) {
385 if (_LIB_VERSION
== _SVID_
) {
386 (void) WRITE2("lgamma: SING error\n", 19);
396 exc
.name
= type
< 100 ? "log" : (type
< 200 ? "logf" : "logl");
397 if (_LIB_VERSION
== _SVID_
)
400 exc
.retval
= -HUGE_VAL
;
401 if (_LIB_VERSION
== _POSIX_
)
402 __set_errno (ERANGE
);
403 else if (!matherr(&exc
)) {
404 if (_LIB_VERSION
== _SVID_
) {
405 (void) WRITE2("log: SING error\n", 16);
415 exc
.name
= type
< 100 ? "log" : (type
< 200 ? "logf" : "logl");
416 if (_LIB_VERSION
== _SVID_
)
420 if (_LIB_VERSION
== _POSIX_
)
422 else if (!matherr(&exc
)) {
423 if (_LIB_VERSION
== _SVID_
) {
424 (void) WRITE2("log: DOMAIN error\n", 18);
434 exc
.name
= type
< 100 ? "log10" : (type
< 200
435 ? "log10f" : "log10l");
436 if (_LIB_VERSION
== _SVID_
)
439 exc
.retval
= -HUGE_VAL
;
440 if (_LIB_VERSION
== _POSIX_
)
441 __set_errno (ERANGE
);
442 else if (!matherr(&exc
)) {
443 if (_LIB_VERSION
== _SVID_
) {
444 (void) WRITE2("log10: SING error\n", 18);
454 exc
.name
= type
< 100 ? "log10" : (type
< 200
455 ? "log10f" : "log10l");
456 if (_LIB_VERSION
== _SVID_
)
460 if (_LIB_VERSION
== _POSIX_
)
462 else if (!matherr(&exc
)) {
463 if (_LIB_VERSION
== _SVID_
) {
464 (void) WRITE2("log10: DOMAIN error\n", 20);
473 /* error only if _LIB_VERSION == _SVID_ */
475 exc
.name
= type
< 100 ? "pow" : (type
< 200 ? "powf" : "powl");
477 if (_LIB_VERSION
!= _SVID_
) exc
.retval
= 1.0;
478 else if (!matherr(&exc
)) {
479 (void) WRITE2("pow(0,0): DOMAIN error\n", 23);
486 /* pow(x,y) overflow */
488 exc
.name
= type
< 100 ? "pow" : (type
< 200 ? "powf" : "powl");
489 if (_LIB_VERSION
== _SVID_
) {
492 if(x
<zero
&&__rint(y
)!=y
) exc
.retval
= -HUGE
;
494 exc
.retval
= HUGE_VAL
;
496 if(x
<zero
&&__rint(y
)!=y
) exc
.retval
= -HUGE_VAL
;
498 if (_LIB_VERSION
== _POSIX_
)
499 __set_errno (ERANGE
);
500 else if (!matherr(&exc
)) {
501 __set_errno (ERANGE
);
507 /* pow(x,y) underflow */
508 exc
.type
= UNDERFLOW
;
509 exc
.name
= type
< 100 ? "pow" : (type
< 200 ? "powf" : "powl");
512 if (x
< zero
&& __rint (y
) != y
)
514 if (_LIB_VERSION
== _POSIX_
)
515 __set_errno (ERANGE
);
516 else if (!matherr(&exc
)) {
517 __set_errno (ERANGE
);
525 exc
.name
= type
< 100 ? "pow" : (type
< 200 ? "powf" : "powl");
526 if (_LIB_VERSION
== _SVID_
)
529 exc
.retval
= -HUGE_VAL
;
530 if (_LIB_VERSION
== _POSIX_
)
531 __set_errno (ERANGE
);
532 else if (!matherr(&exc
)) {
533 if (_LIB_VERSION
== _SVID_
) {
534 (void) WRITE2("pow(0,neg): DOMAIN error\n", 25);
544 exc
.name
= type
< 100 ? "pow" : (type
< 200 ? "powf" : "powl");
545 if (_LIB_VERSION
== _SVID_
)
548 exc
.retval
= HUGE_VAL
;
549 if (_LIB_VERSION
== _POSIX_
)
550 __set_errno (ERANGE
);
551 else if (!matherr(&exc
)) {
552 if (_LIB_VERSION
== _SVID_
) {
553 (void) WRITE2("pow(0,neg): DOMAIN error\n", 25);
561 /* neg**non-integral */
563 exc
.name
= type
< 100 ? "pow" : (type
< 200 ? "powf" : "powl");
564 if (_LIB_VERSION
== _SVID_
)
567 exc
.retval
= zero
/zero
; /* X/Open allow NaN */
568 if (_LIB_VERSION
== _POSIX_
)
570 else if (!matherr(&exc
)) {
571 if (_LIB_VERSION
== _SVID_
) {
572 (void) WRITE2("neg**non-integral: DOMAIN error\n", 32);
580 /* sinh(finite) overflow */
582 exc
.name
= type
< 100 ? "sinh" : (type
< 200
583 ? "sinhf" : "sinhl");
584 if (_LIB_VERSION
== _SVID_
)
585 exc
.retval
= ( (x
>zero
) ? HUGE
: -HUGE
);
587 exc
.retval
= ( (x
>zero
) ? HUGE_VAL
: -HUGE_VAL
);
588 if (_LIB_VERSION
== _POSIX_
)
589 __set_errno (ERANGE
);
590 else if (!matherr(&exc
)) {
591 __set_errno (ERANGE
);
599 exc
.name
= type
< 100 ? "sqrt" : (type
< 200
600 ? "sqrtf" : "sqrtl");
601 if (_LIB_VERSION
== _SVID_
)
604 exc
.retval
= zero
/zero
;
605 if (_LIB_VERSION
== _POSIX_
)
607 else if (!matherr(&exc
)) {
608 if (_LIB_VERSION
== _SVID_
) {
609 (void) WRITE2("sqrt: DOMAIN error\n", 19);
619 exc
.name
= type
< 100 ? "fmod" : (type
< 200
620 ? "fmodf" : "fmodl");
621 if (_LIB_VERSION
== _SVID_
)
624 exc
.retval
= zero
/zero
;
625 if (_LIB_VERSION
== _POSIX_
)
627 else if (!matherr(&exc
)) {
628 if (_LIB_VERSION
== _SVID_
) {
629 (void) WRITE2("fmod: DOMAIN error\n", 20);
639 exc
.name
= type
< 100 ? "remainder" : (type
< 200
642 exc
.retval
= zero
/zero
;
643 if (_LIB_VERSION
== _POSIX_
)
645 else if (!matherr(&exc
)) {
646 if (_LIB_VERSION
== _SVID_
) {
647 (void) WRITE2("remainder: DOMAIN error\n", 24);
657 exc
.name
= type
< 100 ? "acosh" : (type
< 200
658 ? "acoshf" : "acoshl");
659 exc
.retval
= zero
/zero
;
660 if (_LIB_VERSION
== _POSIX_
)
662 else if (!matherr(&exc
)) {
663 if (_LIB_VERSION
== _SVID_
) {
664 (void) WRITE2("acosh: DOMAIN error\n", 20);
674 exc
.name
= type
< 100 ? "atanh" : (type
< 200
675 ? "atanhf" : "atanhl");
676 exc
.retval
= zero
/zero
;
677 if (_LIB_VERSION
== _POSIX_
)
679 else if (!matherr(&exc
)) {
680 if (_LIB_VERSION
== _SVID_
) {
681 (void) WRITE2("atanh: DOMAIN error\n", 20);
691 exc
.name
= type
< 100 ? "atanh" : (type
< 200
692 ? "atanhf" : "atanhl");
693 exc
.retval
= x
/zero
; /* sign(x)*inf */
694 if (_LIB_VERSION
== _POSIX_
)
695 __set_errno (ERANGE
);
696 else if (!matherr(&exc
)) {
697 if (_LIB_VERSION
== _SVID_
) {
698 (void) WRITE2("atanh: SING error\n", 18);
706 /* scalb overflow; SVID also returns +-HUGE_VAL */
708 exc
.name
= type
< 100 ? "scalb" : (type
< 200
709 ? "scalbf" : "scalbl");
710 exc
.retval
= x
> zero
? HUGE_VAL
: -HUGE_VAL
;
711 if (_LIB_VERSION
== _POSIX_
)
712 __set_errno (ERANGE
);
713 else if (!matherr(&exc
)) {
714 __set_errno (ERANGE
);
720 /* scalb underflow */
721 exc
.type
= UNDERFLOW
;
722 exc
.name
= type
< 100 ? "scalb" : (type
< 200
723 ? "scalbf" : "scalbl");
724 exc
.retval
= __copysign(zero
,x
);
725 if (_LIB_VERSION
== _POSIX_
)
726 __set_errno (ERANGE
);
727 else if (!matherr(&exc
)) {
728 __set_errno (ERANGE
);
734 /* j0(|x|>X_TLOSS) */
736 exc
.name
= type
< 100 ? "j0" : (type
< 200 ? "j0f" : "j0l");
738 if (_LIB_VERSION
== _POSIX_
)
739 __set_errno (ERANGE
);
740 else if (!matherr(&exc
)) {
741 if (_LIB_VERSION
== _SVID_
) {
742 (void) WRITE2(exc
.name
, 2);
743 (void) WRITE2(": TLOSS error\n", 14);
745 __set_errno (ERANGE
);
753 exc
.name
= type
< 100 ? "y0" : (type
< 200 ? "y0f" : "y0l");
755 if (_LIB_VERSION
== _POSIX_
)
756 __set_errno (ERANGE
);
757 else if (!matherr(&exc
)) {
758 if (_LIB_VERSION
== _SVID_
) {
759 (void) WRITE2(exc
.name
, 2);
760 (void) WRITE2(": TLOSS error\n", 14);
762 __set_errno (ERANGE
);
768 /* j1(|x|>X_TLOSS) */
770 exc
.name
= type
< 100 ? "j1" : (type
< 200 ? "j1f" : "j1l");
772 if (_LIB_VERSION
== _POSIX_
)
773 __set_errno (ERANGE
);
774 else if (!matherr(&exc
)) {
775 if (_LIB_VERSION
== _SVID_
) {
776 (void) WRITE2(exc
.name
, 2);
777 (void) WRITE2(": TLOSS error\n", 14);
779 __set_errno (ERANGE
);
787 exc
.name
= type
< 100 ? "y1" : (type
< 200 ? "y1f" : "y1l");
789 if (_LIB_VERSION
== _POSIX_
)
790 __set_errno (ERANGE
);
791 else if (!matherr(&exc
)) {
792 if (_LIB_VERSION
== _SVID_
) {
793 (void) WRITE2(exc
.name
, 2);
794 (void) WRITE2(": TLOSS error\n", 14);
796 __set_errno (ERANGE
);
802 /* jn(|x|>X_TLOSS) */
804 exc
.name
= type
< 100 ? "jn" : (type
< 200 ? "jnf" : "jnl");
806 if (_LIB_VERSION
== _POSIX_
)
807 __set_errno (ERANGE
);
808 else if (!matherr(&exc
)) {
809 if (_LIB_VERSION
== _SVID_
) {
810 (void) WRITE2(exc
.name
, 2);
811 (void) WRITE2(": TLOSS error\n", 14);
813 __set_errno (ERANGE
);
821 exc
.name
= type
< 100 ? "yn" : (type
< 200 ? "ynf" : "ynl");
823 if (_LIB_VERSION
== _POSIX_
)
824 __set_errno (ERANGE
);
825 else if (!matherr(&exc
)) {
826 if (_LIB_VERSION
== _SVID_
) {
827 (void) WRITE2(exc
.name
, 2);
828 (void) WRITE2(": TLOSS error\n", 14);
830 __set_errno (ERANGE
);
836 /* tgamma(finite) overflow */
838 exc
.name
= type
< 100 ? "tgamma" : (type
< 200
839 ? "tgammaf" : "tgammal");
840 exc
.retval
= HUGE_VAL
;
841 if (_LIB_VERSION
== _POSIX_
)
842 __set_errno (ERANGE
);
843 else if (!matherr(&exc
)) {
844 __set_errno (ERANGE
);
850 /* tgamma(-integer) */
852 exc
.name
= type
< 100 ? "tgamma" : (type
< 200
853 ? "tgammaf" : "tgammal");
855 if (_LIB_VERSION
== _POSIX_
)
857 else if (!matherr(&exc
)) {
858 if (_LIB_VERSION
== _SVID_
) {
859 (void) WRITE2("tgamma: SING error\n", 18);
860 exc
.retval
= HUGE_VAL
;
869 /* error only if _LIB_VERSION == _SVID_ & _XOPEN_ */
871 exc
.name
= type
< 100 ? "pow" : (type
< 200 ? "powf" : "powl");
873 if (_LIB_VERSION
== _IEEE_
||
874 _LIB_VERSION
== _POSIX_
) exc
.retval
= 1.0;
875 else if (!matherr(&exc
)) {
883 /* exp(finite) overflow */
885 exc
.name
= type
< 100 ? "exp2" : (type
< 200
886 ? "exp2f" : "exp2l");
887 if (_LIB_VERSION
== _SVID_
)
890 exc
.retval
= HUGE_VAL
;
891 if (_LIB_VERSION
== _POSIX_
)
892 __set_errno (ERANGE
);
893 else if (!matherr(&exc
)) {
894 __set_errno (ERANGE
);
900 /* exp(finite) underflow */
901 exc
.type
= UNDERFLOW
;
902 exc
.name
= type
< 100 ? "exp2" : (type
< 200
903 ? "exp2f" : "exp2l");
905 if (_LIB_VERSION
== _POSIX_
)
906 __set_errno (ERANGE
);
907 else if (!matherr(&exc
)) {
908 __set_errno (ERANGE
);
915 /* exp(finite) overflow */
917 exc
.name
= type
< 100 ? "exp10" : (type
< 200
918 ? "exp10f" : "exp10l");
919 if (_LIB_VERSION
== _SVID_
)
922 exc
.retval
= HUGE_VAL
;
923 if (_LIB_VERSION
== _POSIX_
)
924 __set_errno (ERANGE
);
925 else if (!matherr(&exc
)) {
926 __set_errno (ERANGE
);
932 /* exp(finite) underflow */
933 exc
.type
= UNDERFLOW
;
934 exc
.name
= type
< 100 ? "exp10" : (type
< 200
935 ? "exp10f" : "exp10l");
937 if (_LIB_VERSION
== _POSIX_
)
938 __set_errno (ERANGE
);
939 else if (!matherr(&exc
)) {
940 __set_errno (ERANGE
);
948 exc
.name
= type
< 100 ? "log2" : (type
< 200
949 ? "log2f" : "log2l");
950 if (_LIB_VERSION
== _SVID_
)
953 exc
.retval
= -HUGE_VAL
;
954 if (_LIB_VERSION
== _POSIX_
)
955 __set_errno (ERANGE
);
956 else if (!matherr(&exc
)) {
965 exc
.name
= type
< 100 ? "log2" : (type
< 200
966 ? "log2f" : "log2l");
967 if (_LIB_VERSION
== _SVID_
)
971 if (_LIB_VERSION
== _POSIX_
)
973 else if (!matherr(&exc
)) {
982 exc
.name
= type
< 100 ? "tgamma" : (type
< 200
983 ? "tgammaf" : "tgammal");
984 exc
.retval
= __copysign (HUGE_VAL
, x
);
985 if (_LIB_VERSION
== _POSIX_
)
986 __set_errno (ERANGE
);
987 else if (!matherr(&exc
)) {
988 if (_LIB_VERSION
== _SVID_
)
989 (void) WRITE2("tgamma: SING error\n", 18);
990 __set_errno (ERANGE
);
994 /* #### Last used is 50/150/250 ### */
1001 __kernel_standard_f(float x
, float y
, int type
)
1003 return __kernel_standard(x
, y
, type
);
1006 #ifndef __NO_LONG_DOUBLE_MATH
1008 __kernel_standard_l (long double x
, long double y
, int type
)
1011 struct exception exc
;
1015 long double ax
= fabsl (x
);
1017 dx
= __copysignl (DBL_MAX
, x
);
1018 else if (ax
> 0 && ax
< DBL_MIN
)
1019 dx
= __copysignl (DBL_MIN
, x
);
1027 long double ay
= fabsl (y
);
1029 dy
= __copysignl (DBL_MAX
, y
);
1030 else if (ay
> 0 && ay
< DBL_MIN
)
1031 dy
= __copysignl (DBL_MIN
, y
);
1041 /* powl (x, y) overflow. */
1044 exc
.type
= OVERFLOW
;
1046 if (_LIB_VERSION
== _SVID_
)
1050 if (x
< zero
&& __rintl (y
) != y
)
1055 exc
.retval
= HUGE_VAL
;
1057 if (x
< zero
&& __rintl (y
) != y
)
1058 exc
.retval
= -HUGE_VAL
;
1060 if (_LIB_VERSION
== _POSIX_
)
1061 __set_errno (ERANGE
);
1062 else if (!matherr (&exc
))
1063 __set_errno (ERANGE
);
1067 /* powl (x, y) underflow. */
1070 exc
.type
= UNDERFLOW
;
1074 if (x
< zero
&& __rintl (y
) != y
)
1076 if (_LIB_VERSION
== _POSIX_
)
1077 __set_errno (ERANGE
);
1078 else if (!matherr (&exc
))
1079 __set_errno (ERANGE
);
1083 return __kernel_standard (dx
, dy
, type
);