2 * This file has no copyright assigned and is placed in the Public Domain.
3 * This file is part of the mingw-w64 runtime package.
4 * No warranty is given; refer to the file DISCLAIMER.PD within this package.
8 Contributed by Danny Smith <dannysmith@users.sourceforge.net>
9 No copyright claimed, absolutely no warranties.
17 nextafterl (long double x
, long double y
)
22 /* packed attribute is unnecessary on x86/x64 for these three variables */
23 unsigned long long mantissa
;
29 /* The normal bit is explicit for long doubles, unlike
31 static const unsigned long long normal_bit
= 0x8000000000000000ull
;
33 if (isnan (y
) || isnan (x
))
37 /* nextafter (0.0, -O.0) should return -0.0. */
43 u
.parts
.mantissa
= 1ull;
44 return y
> 0.0L ? u
.ld
: -u
.ld
;
47 if (((x
> 0.0L) ^ (y
> x
)) == 0)
50 if ((u
.parts
.mantissa
& ~normal_bit
) == 0ull)
55 if ((u
.parts
.mantissa
& ~normal_bit
) == 0ull)
60 /* If we have updated the expn of a normal number,
61 or moved from denormal to normal, [re]set the normal bit. */
62 if (u
.parts
.expn
& 0x7fff)
63 u
.parts
.mantissa
|= normal_bit
;
68 /* nexttowardl is the same function with a different name. */
70 nexttowardl (long double, long double) __attribute__ ((alias("nextafterl")));