mailing list of musl libc
 help / color / mirror / code / Atom feed
e8ef56876c67feb4dcc69d47dbbbbbe50b2215de blob 903 bytes (raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
 
#include "libm.h"

#ifdef LONG_DOUBLE_IS_BINARY64
long double modfl(long double x, long double *iptr)
{
	double d;
	long double r;

	r = modf(x, &d);
	*iptr = d;
	return r;
}
#elif defined(LONG_DOUBLE_IS_X87_EXTENDED) || defined(LONG_DOUBLE_IS_BINARY128)

static const long double toint = 1/LDBL_EPSILON;

long double modfl(long double x, long double *iptr)
{
	union ldshape u = {x};
	int e = (u.i.se & 0x7fff) - 0x3fff;
	int s = u.i.se >> 15;
	long double absx;
	long double y;

	/* no fractional part */
	if (e >= LDBL_MANT_DIG-1) {
		*iptr = x;
		if (isnan(x))
			return x;
		return s ? -0.0 : 0.0;
	}

	/* no integral part*/
	if (e < 0) {
		*iptr = s ? -0.0 : 0.0;
		return x;
	}

	/* raises spurious inexact */
	absx = s ? -x : x;
	y = absx + toint - toint - absx;
	if (y == 0) {
		*iptr = x;
		return s ? -0.0 : 0.0;
	}
	if (y > 0)
		y -= 1;
	if (s)
		y = -y;
	*iptr = x + y;
	return -y;
}
#endif
debug log:

solving e8ef568 ...
found e8ef568 in https://inbox.vuxu.org/musl/1457404695-17281-1-git-send-email-masanori.ogino@gmail.com/
found a47b192 in https://git.vuxu.org/mirror/musl/
preparing index
index prepared:
100644 a47b1924f75d1125b712e3ccf5b0f39af27fd8f2	src/math/modfl.c

applying [1/1] https://inbox.vuxu.org/musl/1457404695-17281-1-git-send-email-masanori.ogino@gmail.com/
diff --git a/src/math/modfl.c b/src/math/modfl.c
index a47b192..e8ef568 100644

Checking patch src/math/modfl.c...
Applied patch src/math/modfl.c cleanly.

index at:
100644 e8ef56876c67feb4dcc69d47dbbbbbe50b2215de	src/math/modfl.c

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).