1 /* Single precision version of nexttoward.c.
2 Conversion to IEEE single float by Jakub Jelinek, jj@ultra.linux.cz. */
4 * ====================================================
5 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
7 * Developed at SunPro, a Sun Microsystems, Inc. business.
8 * Permission to use, copy, modify, and distribute this
9 * software is freely granted, provided that this notice
11 * ====================================================
16 * return the next machine floating-point number of x in the
18 * This is for machines which use the same binary type for double and
25 #include <math_private.h>
28 float __nexttowardf(float x
, long double y
)
34 EXTRACT_WORDS(hy
,ly
,y
);
35 ix
= hx
&0x7fffffff; /* |x| */
36 iy
= hy
&0x7fffffff; /* |y| */
38 if((ix
>0x7f800000) || /* x is nan */
39 ((iy
>=0x7ff00000)&&((iy
-0x7ff00000)|ly
)!=0)) /* y is nan */
41 if((long double) x
==y
) return y
; /* x=y, return y */
42 if(ix
==0) { /* x == 0 */
44 SET_FLOAT_WORD(x
,(uint32_t)(hy
&0x80000000)|1);/* return +-minsub*/
45 u
= math_opt_barrier (x
);
47 math_force_eval (u
); /* raise underflow flag */
50 if(hx
>=0) { /* x > 0 */
51 if(x
> y
) /* x -= ulp */
53 else /* x < y, x += ulp */
56 if(x
< y
) /* x -= ulp */
58 else /* x > y, x += ulp */
63 float u
= x
+x
; /* overflow */
68 float u
= x
*x
; /* underflow */
69 math_force_eval (u
); /* raise underflow flag */
75 weak_alias (__nexttowardf
, nexttowardf
)