1 /* s_nextafterf.c -- float version of s_nextafter.c.
2 * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
6 * ====================================================
7 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
9 * Developed at SunPro, a Sun Microsystems, Inc. business.
10 * Permission to use, copy, modify, and distribute this
11 * software is freely granted, provided that this notice
13 * ====================================================
16 #if defined(LIBM_SCCS) && !defined(lint)
17 static char rcsid
[] = "$NetBSD: s_nextafterf.c,v 1.4 1995/05/10 20:48:01 jtc Exp $";
21 #include <math_private.h>
25 float __nextafterf(float x
, float y
)
27 float __nextafterf(x
,y
)
35 ix
= hx
&0x7fffffff; /* |x| */
36 iy
= hy
&0x7fffffff; /* |y| */
38 if((ix
>0x7f800000) || /* x is nan */
39 (iy
>0x7f800000)) /* y is nan */
41 if(x
==y
) return y
; /* x=y, return y */
42 if(ix
==0) { /* x == 0 */
44 SET_FLOAT_WORD(x
,(hy
&0x80000000)|1);/* return +-minsubnormal */
45 u
= math_opt_barrier (x
);
47 math_force_eval (u
); /* raise underflow flag */
50 if(hx
>=0) { /* x > 0 */
51 if(hx
>hy
) { /* x > y, x -= ulp */
53 } else { /* x < y, x += ulp */
57 if(hy
>=0||hx
>hy
){ /* x < y, x -= ulp */
59 } else { /* x > y, x += ulp */
65 x
= x
+x
; /* overflow */
66 if (FLT_EVAL_METHOD
!= 0)
68 return x
; /* overflow */
71 float u
= x
*x
; /* underflow */
72 math_force_eval (u
); /* raise underflow flag */
77 weak_alias (__nextafterf
, nextafterf
)