Make setthetime() static per the prototype.
[dragonfly.git] / lib / msun / src / s_nextafterf.c
1 /* s_nextafterf.c -- float version of s_nextafter.c.
2  * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
3  *
4  * $FreeBSD: src/lib/msun/src/s_nextafterf.c,v 1.5 1999/08/28 00:06:54 peter Exp $
5  * $DragonFly: src/lib/msun/src/Attic/s_nextafterf.c,v 1.2 2003/06/17 04:26:53 dillon Exp $
6  */
7
8 /*
9  * ====================================================
10  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
11  *
12  * Developed at SunPro, a Sun Microsystems, Inc. business.
13  * Permission to use, copy, modify, and distribute this
14  * software is freely granted, provided that this notice
15  * is preserved.
16  * ====================================================
17  */
18
19 #include "math.h"
20 #include "math_private.h"
21
22 #ifdef __STDC__
23         float nextafterf(float x, float y)
24 #else
25         float nextafterf(x,y)
26         float x,y;
27 #endif
28 {
29         int32_t hx,hy,ix,iy;
30
31         GET_FLOAT_WORD(hx,x);
32         GET_FLOAT_WORD(hy,y);
33         ix = hx&0x7fffffff;             /* |x| */
34         iy = hy&0x7fffffff;             /* |y| */
35
36         if((ix>0x7f800000) ||   /* x is nan */
37            (iy>0x7f800000))     /* y is nan */
38            return x+y;
39         if(x==y) return x;              /* x=y, return x */
40         if(ix==0) {                             /* x == 0 */
41             SET_FLOAT_WORD(x,(hy&0x80000000)|1);/* return +-minsubnormal */
42             y = x*x;
43             if(y==x) return y; else return x;   /* raise underflow flag */
44         }
45         if(hx>=0) {                             /* x > 0 */
46             if(hx>hy) {                         /* x > y, x -= ulp */
47                 hx -= 1;
48             } else {                            /* x < y, x += ulp */
49                 hx += 1;
50             }
51         } else {                                /* x < 0 */
52             if(hy>=0||hx>hy){                   /* x < y, x -= ulp */
53                 hx -= 1;
54             } else {                            /* x > y, x += ulp */
55                 hx += 1;
56             }
57         }
58         hy = hx&0x7f800000;
59         if(hy>=0x7f800000) return x+x;  /* overflow  */
60         if(hy<0x00800000) {             /* underflow */
61             y = x*x;
62             if(y!=x) {          /* raise underflow flag */
63                 SET_FLOAT_WORD(y,hx);
64                 return y;
65             }
66         }
67         SET_FLOAT_WORD(x,hx);
68         return x;
69 }