| @@ -2,42 +2,43 @@ | | | @@ -2,42 +2,43 @@ |
2 | /* | | 2 | /* |
3 | * ==================================================== | | 3 | * ==================================================== |
4 | * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. | | 4 | * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. |
5 | * | | 5 | * |
6 | * Developed at SunPro, a Sun Microsystems, Inc. business. | | 6 | * Developed at SunPro, a Sun Microsystems, Inc. business. |
7 | * Permission to use, copy, modify, and distribute this | | 7 | * Permission to use, copy, modify, and distribute this |
8 | * software is freely granted, provided that this notice | | 8 | * software is freely granted, provided that this notice |
9 | * is preserved. | | 9 | * is preserved. |
10 | * ==================================================== | | 10 | * ==================================================== |
11 | */ | | 11 | */ |
12 | | | 12 | |
13 | #include <sys/cdefs.h> | | 13 | #include <sys/cdefs.h> |
14 | #if defined(LIBM_SCCS) && !defined(lint) | | 14 | #if defined(LIBM_SCCS) && !defined(lint) |
15 | __RCSID("$NetBSD: s_nextafter.c,v 1.16 2017/08/16 11:22:52 he Exp $"); | | 15 | __RCSID("$NetBSD: s_nextafter.c,v 1.17 2024/05/05 22:10:06 riastradh Exp $"); |
16 | #endif | | 16 | #endif |
17 | | | 17 | |
18 | /* IEEE functions | | 18 | /* IEEE functions |
19 | * nextafter(x,y) | | 19 | * nextafter(x,y) |
20 | * return the next machine floating-point number of x in the | | 20 | * return the next machine floating-point number of x in the |
21 | * direction toward y. | | 21 | * direction toward y. |
22 | * Special cases: | | 22 | * Special cases: |
23 | */ | | 23 | */ |
24 | | | 24 | |
25 | #include "math.h" | | 25 | #include "math.h" |
26 | #include "math_private.h" | | 26 | #include "math_private.h" |
27 | | | 27 | |
28 | #ifndef __HAVE_LONG_DOUBLE | | 28 | #ifndef __HAVE_LONG_DOUBLE |
29 | __strong_alias(nextafterl, nextafter) | | 29 | __strong_alias(nextafterl, nextafter) |
30 | __strong_alias(nexttoward, nextafter) | | 30 | __strong_alias(nexttoward, nextafter) |
| | | 31 | __strong_alias(nexttowardl, nextafter) |
31 | #endif | | 32 | #endif |
32 | | | 33 | |
33 | double | | 34 | double |
34 | nextafter(double x, double y) | | 35 | nextafter(double x, double y) |
35 | { | | 36 | { |
36 | int32_t hx,hy,ix,iy; | | 37 | int32_t hx,hy,ix,iy; |
37 | u_int32_t lx,ly; | | 38 | u_int32_t lx,ly; |
38 | | | 39 | |
39 | EXTRACT_WORDS(hx,lx,x); | | 40 | EXTRACT_WORDS(hx,lx,x); |
40 | EXTRACT_WORDS(hy,ly,y); | | 41 | EXTRACT_WORDS(hy,ly,y); |
41 | ix = hx&0x7fffffff; /* |x| */ | | 42 | ix = hx&0x7fffffff; /* |x| */ |
42 | iy = hy&0x7fffffff; /* |y| */ | | 43 | iy = hy&0x7fffffff; /* |y| */ |
43 | | | 44 | |