Skip to content

Commit

Permalink
Format floating routines.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ondřej Bílka committed Oct 17, 2013
1 parent e5c2c2d commit c5d5d57
Show file tree
Hide file tree
Showing 59 changed files with 2,830 additions and 2,175 deletions.
61 changes: 61 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,64 @@
2013-10-17 Ondřej Bílka <neleai@seznam.cz>

* sysdeps/ieee754/dbl-64/dbl2mpn.c: Fix formatting.
* sysdeps/ieee754/dbl-64/dla.h: Likewise.
* sysdeps/ieee754/dbl-64/dosincos.c: Likewise.
* sysdeps/ieee754/dbl-64/e_acosh.c: Likewise.
* sysdeps/ieee754/dbl-64/e_atan2.c: Likewise.
* sysdeps/ieee754/dbl-64/e_cosh.c: Likewise.
* sysdeps/ieee754/dbl-64/e_exp2.c: Likewise.
* sysdeps/ieee754/dbl-64/e_fmod.c: Likewise.
* sysdeps/ieee754/dbl-64/e_gamma_r.c: Likewise.
* sysdeps/ieee754/dbl-64/e_hypot.c: Likewise.
* sysdeps/ieee754/dbl-64/e_ilogb.c: Likewise.
* sysdeps/ieee754/dbl-64/e_j0.c: Likewise.
* sysdeps/ieee754/dbl-64/e_j1.c: Likewise.
* sysdeps/ieee754/dbl-64/e_jn.c: Likewise.
* sysdeps/ieee754/dbl-64/e_log10.c: Likewise.
* sysdeps/ieee754/dbl-64/e_log2.c: Likewise.
* sysdeps/ieee754/dbl-64/e_log.c: Likewise.
* sysdeps/ieee754/dbl-64/e_remainder.c: Likewise.
* sysdeps/ieee754/dbl-64/e_rem_pio2.c: Likewise.
* sysdeps/ieee754/dbl-64/e_sinh.c: Likewise.
* sysdeps/ieee754/dbl-64/e_sqrt.c: Likewise.
* sysdeps/ieee754/dbl-64/halfulp.c: Likewise.
* sysdeps/ieee754/dbl-64/k_rem_pio2.c: Likewise.
* sysdeps/ieee754/dbl-64/MathLib.h: Likewise.
* sysdeps/ieee754/dbl-64/mpa-arch.h: Likewise.
* sysdeps/ieee754/dbl-64/mpa.c: Likewise.
* sysdeps/ieee754/dbl-64/mpatan.c: Likewise.
* sysdeps/ieee754/dbl-64/mpn2dbl.c: Likewise.
* sysdeps/ieee754/dbl-64/mptan.c: Likewise.
* sysdeps/ieee754/dbl-64/mydefs.h: Likewise.
* sysdeps/ieee754/dbl-64/s_asinh.c: Likewise.
* sysdeps/ieee754/dbl-64/s_atan.c: Likewise.
* sysdeps/ieee754/dbl-64/s_cbrt.c: Likewise.
* sysdeps/ieee754/dbl-64/s_ceil.c: Likewise.
* sysdeps/ieee754/dbl-64/s_copysign.c: Likewise.
* sysdeps/ieee754/dbl-64/s_erf.c: Likewise.
* sysdeps/ieee754/dbl-64/s_expm1.c: Likewise.
* sysdeps/ieee754/dbl-64/s_fabs.c: Likewise.
* sysdeps/ieee754/dbl-64/s_finite.c: Likewise.
* sysdeps/ieee754/dbl-64/s_floor.c: Likewise.
* sysdeps/ieee754/dbl-64/s_frexp.c: Likewise.
* sysdeps/ieee754/dbl-64/s_isinf.c: Likewise.
* sysdeps/ieee754/dbl-64/s_isinf_ns.c: Likewise.
* sysdeps/ieee754/dbl-64/s_isnan.c: Likewise.
* sysdeps/ieee754/dbl-64/s_llround.c: Likewise.
* sysdeps/ieee754/dbl-64/s_log1p.c: Likewise.
* sysdeps/ieee754/dbl-64/s_logb.c: Likewise.
* sysdeps/ieee754/dbl-64/s_lrint.c: Likewise.
* sysdeps/ieee754/dbl-64/s_modf.c: Likewise.
* sysdeps/ieee754/dbl-64/s_nearbyint.c: Likewise.
* sysdeps/ieee754/dbl-64/s_remquo.c: Likewise.
* sysdeps/ieee754/dbl-64/s_rint.c: Likewise.
* sysdeps/ieee754/dbl-64/s_scalbln.c: Likewise.
* sysdeps/ieee754/dbl-64/s_scalbn.c: Likewise.
* sysdeps/ieee754/dbl-64/s_sin.c: Likewise.
* sysdeps/ieee754/dbl-64/s_sincos.c: Likewise.
* sysdeps/ieee754/dbl-64/s_tan.c: Likewise.
* sysdeps/ieee754/dbl-64/s_tanh.c: Likewise.

2013-10-17 Joseph Myers <joseph@codesourcery.com>

[BZ #16041]
Expand Down
30 changes: 14 additions & 16 deletions sysdeps/ieee754/dbl-64/MathLib.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,70 +33,68 @@
/* It returns the original status of these modes. */
/* See further explanations of usage in DPChange.h */
/********************************************************************/
unsigned short Init_Lib(void);
unsigned short Init_Lib (void);

/********************************************************************/
/* Function that changes the precision and rounding modes to the */
/* specified by the argument received. See further explanations in */
/* DPChange.h */
/********************************************************************/
void Exit_Lib(unsigned short);
void Exit_Lib (unsigned short);


/* The asin() function calculates the arc sine of its argument. */
/* The function returns the arc sine in radians */
/* (between -PI/2 and PI/2). */
/* If the argument is greater than 1 or less than -1 it returns */
/* a NaN. */
double uasin(double );
double uasin (double);


/* The acos() function calculates the arc cosine of its argument. */
/* The function returns the arc cosine in radians */
/* (between -PI/2 and PI/2). */
/* If the argument is greater than 1 or less than -1 it returns */
/* a NaN. */
double uacos(double );
double uacos (double);

/* The atan() function calculates the arctanget of its argument. */
/* The function returns the arc tangent in radians */
/* (between -PI/2 and PI/2). */
double uatan(double );
double uatan (double);


/* The uatan2() function calculates the arc tangent of the two arguments x */
/* and y (x is the right argument and y is the left one).The signs of both */
/* arguments are used to determine the quadrant of the result. */
/* The function returns the result in radians, which is between -PI and PI */
double uatan2(double ,double );
double uatan2 (double, double);

/* Compute log(x). The base of log is e (natural logarithm) */
double ulog(double );
double ulog (double);

/* Compute e raised to the power of argument x. */
double uexp(double );
double uexp (double);

/* Compute sin(x). The argument x is assumed to be given in radians.*/
double usin(double );
double usin (double);

/* Compute cos(x). The argument x is assumed to be given in radians.*/
double ucos(double );
double ucos (double);

/* Compute tan(x). The argument x is assumed to be given in radians.*/
double utan(double );
double utan (double);

/* Compute the square root of non-negative argument x. */
/* If x is negative the returned value is NaN. */
double usqrt(double );
double usqrt (double);

/* Compute x raised to the power of y, where x is the left argument */
/* and y is the right argument. The function returns a NaN if x<0. */
/* If x equals zero it returns -inf */
double upow(double , double );
double upow (double, double);

/* Computing x mod y, where x is the left argument and y is the */
/* right one. */
double uremainder(double , double );


double uremainder (double, double);
#endif
8 changes: 4 additions & 4 deletions sysdeps/ieee754/dbl-64/dbl2mpn.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ __mpn_extract_double (mp_ptr res_ptr, mp_size_t size,
#if BITS_PER_MP_LIMB == 32
res_ptr[0] = u.ieee.mantissa1; /* Low-order 32 bits of fraction. */
res_ptr[1] = u.ieee.mantissa0; /* High-order 20 bits. */
#define N 2
# define N 2
#elif BITS_PER_MP_LIMB == 64
/* Hopefully the compiler will combine the two bitfield extracts
and this composition into just the original quadword extract. */
res_ptr[0] = ((mp_limb_t) u.ieee.mantissa0 << 32) | u.ieee.mantissa1;
#define N 1
# define N 1
#else
#error "mp_limb size " BITS_PER_MP_LIMB "not accounted for"
# error "mp_limb size " BITS_PER_MP_LIMB "not accounted for"
#endif
/* The format does not fill the last limb. There are some zeros. */
#define NUM_LEADING_ZEROS (BITS_PER_MP_LIMB \
Expand All @@ -73,7 +73,7 @@ __mpn_extract_double (mp_ptr res_ptr, mp_size_t size,
#if N == 2
res_ptr[N - 1] = res_ptr[1] << cnt
| (N - 1)
* (res_ptr[0] >> (BITS_PER_MP_LIMB - cnt));
* (res_ptr[0] >> (BITS_PER_MP_LIMB - cnt));
res_ptr[0] <<= cnt;
#else
res_ptr[N - 1] <<= cnt;
Expand Down
86 changes: 43 additions & 43 deletions sysdeps/ieee754/dbl-64/dla.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@
/* storage variables of type double. */

#ifdef DLA_FMS
# define EMULV(x,y,z,zz,p,hx,tx,hy,ty) \
z=x*y; zz=DLA_FMS(x,y,z);
# define EMULV(x, y, z, zz, p, hx, tx, hy, ty) \
z = x * y; zz = DLA_FMS (x, y, z);
#else
# define EMULV(x,y,z,zz,p,hx,tx,hy,ty) \
p=CN*(x); hx=((x)-p)+p; tx=(x)-hx; \
p=CN*(y); hy=((y)-p)+p; ty=(y)-hy; \
z=(x)*(y); zz=(((hx*hy-z)+hx*ty)+tx*hy)+tx*ty;
# define EMULV(x, y, z, zz, p, hx, tx, hy, ty) \
p = CN * (x); hx = ((x) - p) + p; tx = (x) - hx; \
p = CN * (y); hy = ((y) - p) + p; ty = (y) - hy; \
z = (x) * (y); zz = (((hx * hy - z) + hx * ty) + tx * hy) + tx * ty;
#endif


Expand All @@ -93,11 +93,11 @@
/* are assumed to be double-length numbers. r,s are temporary */
/* storage variables of type double. */

#define ADD2(x,xx,y,yy,z,zz,r,s) \
r=(x)+(y); s=(ABS(x)>ABS(y)) ? \
(((((x)-r)+(y))+(yy))+(xx)) : \
(((((y)-r)+(x))+(xx))+(yy)); \
z=r+s; zz=(r-z)+s;
#define ADD2(x, xx, y, yy, z, zz, r, s) \
r = (x) + (y); s = (ABS (x) > ABS (y)) ? \
(((((x) - r) + (y)) + (yy)) + (xx)) : \
(((((y) - r) + (x)) + (xx)) + (yy)); \
z = r + s; zz = (r - z) + s;


/* Double-length subtraction, Dekker. The macro produces a double-length */
Expand All @@ -106,11 +106,11 @@
/* are assumed to be double-length numbers. r,s are temporary */
/* storage variables of type double. */

#define SUB2(x,xx,y,yy,z,zz,r,s) \
r=(x)-(y); s=(ABS(x)>ABS(y)) ? \
(((((x)-r)-(y))-(yy))+(xx)) : \
((((x)-((y)+r))+(xx))-(yy)); \
z=r+s; zz=(r-z)+s;
#define SUB2(x, xx, y, yy, z, zz, r, s) \
r = (x) - (y); s = (ABS (x) > ABS (y)) ? \
(((((x) - r) - (y)) - (yy)) + (xx)) : \
((((x) - ((y) + r)) + (xx)) - (yy)); \
z = r + s; zz = (r - z) + s;


/* Double-length multiplication, Dekker. The macro produces a double-length */
Expand All @@ -119,9 +119,9 @@
/* are assumed to be double-length numbers. p,hx,tx,hy,ty,q,c,cc are */
/* temporary storage variables of type double. */

#define MUL2(x,xx,y,yy,z,zz,p,hx,tx,hy,ty,q,c,cc) \
MUL12(x,y,c,cc,p,hx,tx,hy,ty,q) \
cc=((x)*(yy)+(xx)*(y))+cc; z=c+cc; zz=(c-z)+cc;
#define MUL2(x, xx, y, yy, z, zz, p, hx, tx, hy, ty, q, c, cc) \
MUL12 (x, y, c, cc, p, hx, tx, hy, ty, q) \
cc = ((x) * (yy) + (xx) * (y)) + cc; z = c + cc; zz = (c - z) + cc;


/* Double-length division, Dekker. The macro produces a double-length */
Expand All @@ -142,18 +142,18 @@
/* are assumed to be double-length numbers. r,rr,s,ss,u,uu,w */
/* are temporary storage variables of type double. */

#define ADD2A(x,xx,y,yy,z,zz,r,rr,s,ss,u,uu,w) \
r=(x)+(y); \
if (ABS(x)>ABS(y)) { rr=((x)-r)+(y); s=(rr+(yy))+(xx); } \
else { rr=((y)-r)+(x); s=(rr+(xx))+(yy); } \
if (rr!=0.0) { \
z=r+s; zz=(r-z)+s; } \
else { \
ss=(ABS(xx)>ABS(yy)) ? (((xx)-s)+(yy)) : (((yy)-s)+(xx)); \
u=r+s; \
uu=(ABS(r)>ABS(s)) ? ((r-u)+s) : ((s-u)+r) ; \
w=uu+ss; z=u+w; \
zz=(ABS(u)>ABS(w)) ? ((u-z)+w) : ((w-z)+u) ; }
#define ADD2A(x, xx, y, yy, z, zz, r, rr, s, ss, u, uu, w) \
r = (x) + (y); \
if (ABS (x) > ABS (y)) { rr = ((x) - r) + (y); s = (rr + (yy)) + (xx); } \
else { rr = ((y) - r) + (x); s = (rr + (xx)) + (yy); } \
if (rr != 0.0) { \
z = r + s; zz = (r - z) + s; } \
else { \
ss = (ABS (xx) > ABS (yy)) ? (((xx) - s) + (yy)) : (((yy) - s) + (xx));\
u = r + s; \
uu = (ABS (r) > ABS (s)) ? ((r - u) + s) : ((s - u) + r); \
w = uu + ss; z = u + w; \
zz = (ABS (u) > ABS (w)) ? ((u - z) + w) : ((w - z) + u); }


/* Double-length subtraction, slower but more accurate than SUB2. */
Expand All @@ -163,15 +163,15 @@
/* are assumed to be double-length numbers. r,rr,s,ss,u,uu,w */
/* are temporary storage variables of type double. */

#define SUB2A(x,xx,y,yy,z,zz,r,rr,s,ss,u,uu,w) \
r=(x)-(y); \
if (ABS(x)>ABS(y)) { rr=((x)-r)-(y); s=(rr-(yy))+(xx); } \
else { rr=(x)-((y)+r); s=(rr+(xx))-(yy); } \
if (rr!=0.0) { \
z=r+s; zz=(r-z)+s; } \
else { \
ss=(ABS(xx)>ABS(yy)) ? (((xx)-s)-(yy)) : ((xx)-((yy)+s)); \
u=r+s; \
uu=(ABS(r)>ABS(s)) ? ((r-u)+s) : ((s-u)+r) ; \
w=uu+ss; z=u+w; \
zz=(ABS(u)>ABS(w)) ? ((u-z)+w) : ((w-z)+u) ; }
#define SUB2A(x, xx, y, yy, z, zz, r, rr, s, ss, u, uu, w) \
r = (x) - (y); \
if (ABS (x) > ABS (y)) { rr = ((x) - r) - (y); s = (rr - (yy)) + (xx); } \
else { rr = (x) - ((y) + r); s = (rr + (xx)) - (yy); } \
if (rr != 0.0) { \
z = r + s; zz = (r - z) + s; } \
else { \
ss = (ABS (xx) > ABS (yy)) ? (((xx) - s) - (yy)) : ((xx) - ((yy) + s)); \
u = r + s; \
uu = (ABS (r) > ABS (s)) ? ((r - u) + s) : ((s - u) + r); \
w = uu + ss; z = u + w; \
zz = (ABS (u) > ABS (w)) ? ((u - z) + w) : ((w - z) + u); }
Loading

0 comments on commit c5d5d57

Please sign in to comment.