comparison libquadmath/math/nextafterq.c @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents 561a7518be6b
children 1830386684a0
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
1 /* s_nextafterl.c -- long double version of s_nextafter.c. 1 /* nextafterq.c -- __float128 version of s_nextafter.c.
2 * Conversion to IEEE quad long double by Jakub Jelinek, jj@ultra.linux.cz. 2 * Conversion to IEEE quad long double by Jakub Jelinek, jj@ultra.linux.cz.
3 */ 3 */
4 4
5 /* 5 /*
6 * ==================================================== 6 * ====================================================
11 * software is freely granted, provided that this notice 11 * software is freely granted, provided that this notice
12 * is preserved. 12 * is preserved.
13 * ==================================================== 13 * ====================================================
14 */ 14 */
15 15
16 #include <errno.h>
16 #include "quadmath-imp.h" 17 #include "quadmath-imp.h"
17 18
18 __float128 19 __float128
19 nextafterq (__float128 x, __float128 y) 20 nextafterq (__float128 x, __float128 y)
20 { 21 {
52 lx++; 53 lx++;
53 if(lx==0) hx++; 54 if(lx==0) hx++;
54 } 55 }
55 } 56 }
56 hy = hx&0x7fff000000000000LL; 57 hy = hx&0x7fff000000000000LL;
57 if(hy==0x7fff000000000000LL) return x+x;/* overflow */ 58 if(hy==0x7fff000000000000LL) {
59 __float128 u = x + x; /* overflow */
60 math_force_eval (u);
61 errno = ERANGE;
62 }
58 if(hy==0) { 63 if(hy==0) {
59 /* here we should raise an underflow flag */ 64 __float128 u = x*x; /* underflow */
65 math_force_eval (u); /* raise underflow flag */
66 errno = ERANGE;
60 } 67 }
61 SET_FLT128_WORDS64(x,hx,lx); 68 SET_FLT128_WORDS64(x,hx,lx);
62 return x; 69 return x;
63 } 70 }