1 /* This file is distributed under the University of Illinois Open Source
2 * License. See LICENSE.TXT for details.
6 #include "../int_math.h"
8 #define makeFinite(x) { \
9 (x).s.hi = crt_copysign(crt_isinf((x).s.hi) ? 1.0 : 0.0, (x).s.hi); \
13 #define zeroNaN(x) { \
14 if (crt_isnan((x).s.hi)) { \
15 (x).s.hi = crt_copysign(0.0, (x).s.hi); \
20 long double __gcc_qadd(long double, long double);
21 long double __gcc_qsub(long double, long double);
22 long double __gcc_qmul(long double, long double);
25 __multc3(long double a
, long double b
, long double c
, long double d
)
27 long double ac
= __gcc_qmul(a
,c
);
28 long double bd
= __gcc_qmul(b
,d
);
29 long double ad
= __gcc_qmul(a
,d
);
30 long double bc
= __gcc_qmul(b
,c
);
32 DD real
= { .ld
= __gcc_qsub(ac
,bd
) };
33 DD imag
= { .ld
= __gcc_qadd(ad
,bc
) };
35 if (crt_isnan(real
.s
.hi
) && crt_isnan(imag
.s
.hi
))
44 if (crt_isinf(aDD
.s
.hi
) || crt_isinf(bDD
.s
.hi
))
53 if (crt_isinf(cDD
.s
.hi
) || crt_isinf(dDD
.s
.hi
))
64 DD acDD
= { .ld
= ac
};
65 DD bdDD
= { .ld
= bd
};
66 DD adDD
= { .ld
= ad
};
67 DD bcDD
= { .ld
= bc
};
69 if (crt_isinf(acDD
.s
.hi
) || crt_isinf(bdDD
.s
.hi
) ||
70 crt_isinf(adDD
.s
.hi
) || crt_isinf(bcDD
.s
.hi
))
82 real
.s
.hi
= CRT_INFINITY
* (aDD
.s
.hi
*cDD
.s
.hi
- bDD
.s
.hi
*dDD
.s
.hi
);
84 imag
.s
.hi
= CRT_INFINITY
* (aDD
.s
.hi
*dDD
.s
.hi
+ bDD
.s
.hi
*cDD
.s
.hi
);
89 long double _Complex z
;