Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 Jun 2013 08:49:46 +0100
From:      Chris Rees <utisoft@gmail.com>
To:        David Schultz <das@freebsd.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r251404 - in head/lib/msun: . src
Message-ID:  <CADLo83-8Q-uSD3JxiiGG4ZEfrYuR5sGc4%2BMaFNr4Q00B=TWd-w@mail.gmail.com>
In-Reply-To: <201306050533.r555X2dQ047208@svn.freebsd.org>
References:  <201306050533.r555X2dQ047208@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 5 Jun 2013 06:33, "David Schultz" <das@freebsd.org> wrote:
>
> Author: das
> Date: Wed Jun  5 05:33:01 2013
> New Revision: 251404
> URL: http://svnweb.freebsd.org/changeset/base/251404
>
> Log:
>   Style fixes.
>
>   Submitted by: bde
>
> Modified:
>   head/lib/msun/Makefile
>   head/lib/msun/src/catrig.c
>   head/lib/msun/src/catrigf.c
>   head/lib/msun/src/e_log2.c
>
> Modified: head/lib/msun/Makefile
>
==============================================================================
> --- head/lib/msun/Makefile      Wed Jun  5 01:22:59 2013        (r251403)
> +++ head/lib/msun/Makefile      Wed Jun  5 05:33:01 2013        (r251404)
> @@ -21,6 +21,10 @@ ARCH_SUBDIR= ${MACHINE_CPUARCH}
>  .include "${ARCH_SUBDIR}/Makefile.inc"
>
>  .PATH: ${.CURDIR}/${ARCH_SUBDIR}
> +.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
> +.PATH: ${.CURDIR}/x86
> +CFLAGS+=       -I${.CURDIR}/x86
> +.endif

Since you're doing style fixes, it is worth noting that quoting strings in
Makefiles is nearly always incorrect, and only works in our make because of
an extension.

Chris

>  # long double format
>  .if ${LDBL_PREC} == 64
> @@ -35,10 +39,6 @@ CFLAGS+=     -I${.CURDIR}/ld128
>  .PATH: ${.CURDIR}/src
>  .PATH: ${.CURDIR}/man
>
> -.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
> -.PATH: ${.CURDIR}/x86
> -.endif
> -
>  LIB=   m
>  SHLIBDIR?= /lib
>  SHLIB_MAJOR= 5
> @@ -187,8 +187,9 @@ MLINKS+=j0.3 j1.3 j0.3 jn.3 j0.3 y0.3 j0
>  MLINKS+=j0.3 j0f.3 j0.3 j1f.3 j0.3 jnf.3 j0.3 y0f.3 j0.3 ynf.3
>  MLINKS+=lgamma.3 gamma.3 lgamma.3 gammaf.3 lgamma.3 lgammaf.3 \
>         lgamma.3 tgamma.3 lgamma.3 tgammaf.3
> -MLINKS+=log.3 log10.3 log.3 log10f.3 log.3 log10l.3 log.3 \
> -       log1p.3 log.3 log1pf.3 log.3 log1pl.3 log.3 logf.3 log.3 logl.3 \
> +MLINKS+=log.3 log10.3 log.3 log10f.3 log.3 log10l.3 \
> +       log.3 log1p.3 log.3 log1pf.3 log.3 log1pl.3 \
> +       log.3 logf.3 log.3 logl.3 \
>         log.3 log2.3 log.3 log2f.3 log.3 log2l.3
>  MLINKS+=lrint.3 llrint.3 lrint.3 llrintf.3 lrint.3 llrintl.3 \
>         lrint.3 lrintf.3 lrint.3 lrintl.3
>
> Modified: head/lib/msun/src/catrig.c
>
==============================================================================
> --- head/lib/msun/src/catrig.c  Wed Jun  5 01:22:59 2013        (r251403)
> +++ head/lib/msun/src/catrig.c  Wed Jun  5 05:33:01 2013        (r251404)
> @@ -151,13 +151,13 @@ f(double a, double b, double hypot_a_b)
>   */
>  static inline void
>  do_hard_work(double x, double y, double *rx, int *B_is_usable, double *B,
> -            double *sqrt_A2my2, double *new_y)
> +    double *sqrt_A2my2, double *new_y)
>  {
>         double R, S, A; /* A, B, R, and S are as in Hull et al. */
>         double Am1, Amy; /* A-1, A-y. */
>
> -       R = hypot(x, y + 1); /* |z+I| */
> -       S = hypot(x, y - 1); /* |z-I| */
> +       R = hypot(x, y + 1);            /* |z+I| */
> +       S = hypot(x, y - 1);            /* |z-I| */
>
>         /* A = (|z+I| + |z-I|) / 2 */
>         A = (R + S) / 2;
> @@ -174,7 +174,7 @@ do_hard_work(double x, double y, double
>                  * Am1 = fp + fm, where fp = f(x, 1+y), and fm = f(x,
1-y).
>                  * rx = log1p(Am1 + sqrt(Am1*(A+1)))
>                  */
> -               if (y == 1 && x < DBL_EPSILON*DBL_EPSILON / 128) {
> +               if (y == 1 && x < DBL_EPSILON * DBL_EPSILON / 128) {
>                         /*
>                          * fp is of order x^2, and fm = x/2.
>                          * A = 1 (inexactly).
> @@ -193,7 +193,7 @@ do_hard_work(double x, double y, double
>                          * A = 1 (inexactly).
>                          */
>                         *rx = x / sqrt((1 - y) * (1 + y));
> -               } else /* if (y > 1) */ {
> +               } else {                /* if (y > 1) */
>                         /*
>                          * A-1 = y-1 (inexactly).
>                          */
> @@ -251,9 +251,9 @@ do_hard_work(double x, double y, double
>                          * scaling should avoid any underflow problems.
>                          */
>                         *sqrt_A2my2 = x * (4 / DBL_EPSILON / DBL_EPSILON)
* y /
> -                               sqrt((y + 1) * (y - 1));
> +                           sqrt((y + 1) * (y - 1));
>                         *new_y = y * (4 / DBL_EPSILON / DBL_EPSILON);
> -               } else /* if (y < 1) */ {
> +               } else {                /* if (y < 1) */
>                         /*
>                          * fm = 1-y >= DBL_EPSILON, fp is of order x^2,
and
>                          * A = 1 (inexactly).
> @@ -298,7 +298,6 @@ casinh(double complex z)
>                  * C99 leaves it optional whether to raise invalid if one
of
>                  * the arguments is not NaN, so we opt not to raise it.
>                  */
> -               /* Bruce Evans tells me this is the way to do this: */
>                 return (cpack(x + 0.0L + (y + 0), x + 0.0L + (y + 0)));
>         }
>
> @@ -337,6 +336,7 @@ double complex
>  casin(double complex z)
>  {
>         double complex w = casinh(cpack(cimag(z), creal(z)));
> +
>         return (cpack(cimag(w), creal(w)));
>  }
>
> @@ -402,17 +402,17 @@ cacos(double complex z)
>         /* All remaining cases are inexact. */
>         raise_inexact();
>
> -       if (ax < SQRT_6_EPSILON / 4 && ay < SQRT_6_EPSILON/4)
> +       if (ax < SQRT_6_EPSILON / 4 && ay < SQRT_6_EPSILON / 4)
>                 return (cpack(pio2_hi - (x - pio2_lo), -y));
>
>         do_hard_work(ay, ax, &ry, &B_is_usable, &B, &sqrt_A2mx2, &new_x);
>         if (B_is_usable) {
> -               if (sx==0)
> +               if (sx == 0)
>                         rx = acos(B);
>                 else
>                         rx = acos(-B);
>         } else {
> -               if (sx==0)
> +               if (sx == 0)
>                         rx = atan2(sqrt_A2mx2, new_x);
>                 else
>                         rx = atan2(sqrt_A2mx2, -new_x);
> @@ -488,10 +488,6 @@ clog_for_large_values(double complex z)
>  }
>
>  /*
> -
*=============================================================================
> - */
> -
> -/*
>   *                             =================
>   *                             | catanh, catan |
>   *                             =================
> @@ -511,6 +507,7 @@ sum_squares(double x, double y)
>         /* Avoid underflow when y is small. */
>         if (y < SQRT_MIN)
>                 return (x * x);
> +
>         return (x * x + y * y);
>  }
>
> @@ -578,7 +575,7 @@ catanh(double complex z)
>
>         /* This helps handle many cases. */
>         if (y == 0 && ax <= 1)
> -               return (cpack(atanh(x), y));
> +               return (cpack(atanh(x), y));
>
>         /* To ensure the same accuracy as atan(), and to filter out z =
0. */
>         if (x == 0)
> @@ -589,10 +586,9 @@ catanh(double complex z)
>                 if (isinf(x))
>                         return (cpack(copysign(0, x), y + y));
>                 /* catanh(NaN + I*+-Inf) = sign(NaN)0 + I*+-PI/2 */
> -               if (isinf(y)) {
> +               if (isinf(y))
>                         return (cpack(copysign(0, x),
> -                                     copysign(pio2_hi + pio2_lo, y)));
> -               }
> +                           copysign(pio2_hi + pio2_lo, y)));
>                 /*
>                  * All other cases involving NaN return NaN + I*NaN.
>                  * C99 leaves it optional whether to raise invalid if one
of
> @@ -601,10 +597,9 @@ catanh(double complex z)
>                 return (cpack(x + 0.0L + (y + 0), x + 0.0L + (y + 0)));
>         }
>
> -       if (ax > RECIP_EPSILON || ay > RECIP_EPSILON) {
> +       if (ax > RECIP_EPSILON || ay > RECIP_EPSILON)
>                 return (cpack(real_part_reciprocal(x, y),
> -                             copysign(pio2_hi + pio2_lo, y)));
> -       }
> +                   copysign(pio2_hi + pio2_lo, y)));
>
>         if (ax < SQRT_3_EPSILON / 2 && ay < SQRT_3_EPSILON / 2) {
>                 /*
> @@ -617,7 +612,7 @@ catanh(double complex z)
>         }
>
>         if (ax == 1 && ay < DBL_EPSILON)
> -               rx = (log(ay) - m_ln2) / -2;
> +               rx = (m_ln2 - log(ay)) / 2;
>         else
>                 rx = log1p(4 * ax / sum_squares(ax - 1, ay)) / 4;
>
> @@ -639,5 +634,6 @@ double complex
>  catan(double complex z)
>  {
>         double complex w = catanh(cpack(cimag(z), creal(z)));
> +
>         return (cpack(cimag(w), creal(w)));
>  }
>
> Modified: head/lib/msun/src/catrigf.c
>
==============================================================================
> --- head/lib/msun/src/catrigf.c Wed Jun  5 01:22:59 2013        (r251403)
> +++ head/lib/msun/src/catrigf.c Wed Jun  5 05:33:01 2013        (r251404)
> @@ -31,7 +31,11 @@
>   * Mathematical Software, Volume 23 Issue 3, 1997, Pages 299-335,
>   * http://dl.acm.org/citation.cfm?id=275324.
>   *
> - * The code for catrig.c contains complete comments.
> + * See catrig.c for complete comments.
> + *
> + * XXX comments were removed automatically, and even short ones on the
right
> + * of statements were removed (all of them), contrary to normal style.
 Only
> + * a few comments on the right of declarations remain.
>   */
>
>  #include <sys/cdefs.h>
> @@ -82,7 +86,7 @@ f(float a, float b, float hypot_a_b)
>
>  static inline void
>  do_hard_work(float x, float y, float *rx, int *B_is_usable, float *B,
> -            float *sqrt_A2my2, float *new_y)
> +    float *sqrt_A2my2, float *new_y)
>  {
>         float R, S, A;
>         float Am1, Amy;
> @@ -101,7 +105,7 @@ do_hard_work(float x, float y, float *rx
>                         Am1 = f(x, 1 + y, R) + f(x, 1 - y, S);
>                         *rx = log1pf(Am1 + sqrtf(Am1 * (A + 1)));
>                 } else if (y < 1) {
> -                       *rx = x / sqrtf((1 - y)*(1 + y));
> +                       *rx = x / sqrtf((1 - y) * (1 + y));
>                 } else {
>                         *rx = log1pf((y - 1) + sqrtf((y - 1) * (y + 1)));
>                 }
> @@ -130,7 +134,7 @@ do_hard_work(float x, float y, float *rx
>                         *sqrt_A2my2 = sqrtf(Amy * (A + y));
>                 } else if (y > 1) {
>                         *sqrt_A2my2 = x * (4 / FLT_EPSILON / FLT_EPSILON)
* y /
> -                               sqrtf((y + 1) * (y - 1));
> +                           sqrtf((y + 1) * (y - 1));
>                         *new_y = y * (4 / FLT_EPSILON / FLT_EPSILON);
>                 } else {
>                         *sqrt_A2my2 = sqrtf((1 - y) * (1 + y));
> @@ -166,7 +170,7 @@ casinhf(float complex z)
>                 else
>                         w = clog_for_large_values(-z) + m_ln2;
>                 return (cpackf(copysignf(crealf(w), x),
> -                              copysignf(cimagf(w), y)));
> +                   copysignf(cimagf(w), y)));
>         }
>
>         if (x == 0 && y == 0)
> @@ -189,6 +193,7 @@ float complex
>  casinf(float complex z)
>  {
>         float complex w = casinhf(cpackf(cimagf(z), crealf(z)));
> +
>         return (cpackf(cimagf(w), crealf(w)));
>  }
>
> @@ -212,7 +217,8 @@ cacosf(float complex z)
>                         return (cpackf(y + y, -INFINITY));
>                 if (isinf(y))
>                         return (cpackf(x + x, -y));
> -               if (x == 0) return (cpackf(pio2_hi + pio2_lo, y + y));
> +               if (x == 0)
> +                       return (cpackf(pio2_hi + pio2_lo, y + y));
>                 return (cpackf(x + 0.0L + (y + 0), x + 0.0L + (y + 0)));
>         }
>
> @@ -235,17 +241,17 @@ cacosf(float complex z)
>
>         do_hard_work(ay, ax, &ry, &B_is_usable, &B, &sqrt_A2mx2, &new_x);
>         if (B_is_usable) {
> -               if (sx==0)
> +               if (sx == 0)
>                         rx = acosf(B);
>                 else
>                         rx = acosf(-B);
>         } else {
> -               if (sx==0)
> +               if (sx == 0)
>                         rx = atan2f(sqrt_A2mx2, new_x);
>                 else
>                         rx = atan2f(sqrt_A2mx2, -new_x);
>         }
> -       if (sy==0)
> +       if (sy == 0)
>                 ry = -ry;
>         return (cpackf(rx, ry));
>  }
> @@ -284,10 +290,9 @@ clog_for_large_values(float complex z)
>                 ay = t;
>         }
>
> -       if (ax > FLT_MAX / 2) {
> +       if (ax > FLT_MAX / 2)
>                 return (cpackf(logf(hypotf(x / m_e, y / m_e)) + 1,
> -                              atan2f(y, x)));
> -       }
> +                   atan2f(y, x)));
>
>         if (ax > QUARTER_SQRT_MAX || ay < SQRT_MIN)
>                 return (cpackf(logf(hypotf(x, y)), atan2f(y, x)));
> @@ -300,8 +305,9 @@ sum_squares(float x, float y)
>  {
>
>         if (y < SQRT_MIN)
> -               return (x*x);
> -       return (x*x + y*y);
> +               return (x * x);
> +
> +       return (x * x + y * y);
>  }
>
>  static inline float
> @@ -318,9 +324,9 @@ real_part_reciprocal(float x, float y)
>  #define        BIAS    (FLT_MAX_EXP - 1)
>  #define        CUTOFF  (FLT_MANT_DIG / 2 + 1)
>         if (ix - iy >= CUTOFF << 23 || isinf(x))
> -               return (1/x);
> +               return (1 / x);
>         if (iy - ix >= CUTOFF << 23)
> -               return (x/y/y);
> +               return (x / y / y);
>         if (ix <= (BIAS + FLT_MAX_EXP / 2 - CUTOFF) << 23)
>                 return (x / (x * x + y * y));
>         SET_FLOAT_WORD(scale, 0x7f800000 - ix);
> @@ -340,25 +346,23 @@ catanhf(float complex z)
>         ay = fabsf(y);
>
>         if (y == 0 && ax <= 1)
> -               return (cpackf(atanhf(x), y));
> +               return (cpackf(atanhf(x), y));
>
>         if (x == 0)
>                 return (cpackf(x, atanf(y)));
>
>         if (isnan(x) || isnan(y)) {
>                 if (isinf(x))
> -                       return (cpackf(copysignf(0, x), y+y));
> -               if (isinf(y)) {
> +                       return (cpackf(copysignf(0, x), y + y));
> +               if (isinf(y))
>                         return (cpackf(copysignf(0, x),
> -                                      copysignf(pio2_hi + pio2_lo, y)));
> -               }
> +                           copysignf(pio2_hi + pio2_lo, y)));
>                 return (cpackf(x + 0.0L + (y + 0), x + 0.0L + (y + 0)));
>         }
>
> -       if (ax > RECIP_EPSILON || ay > RECIP_EPSILON) {
> +       if (ax > RECIP_EPSILON || ay > RECIP_EPSILON)
>                 return (cpackf(real_part_reciprocal(x, y),
> -                              copysignf(pio2_hi + pio2_lo, y)));
> -       }
> +                   copysignf(pio2_hi + pio2_lo, y)));
>
>         if (ax < SQRT_3_EPSILON / 2 && ay < SQRT_3_EPSILON / 2) {
>                 raise_inexact();
> @@ -366,7 +370,7 @@ catanhf(float complex z)
>         }
>
>         if (ax == 1 && ay < FLT_EPSILON)
> -               rx = (logf(ay) - m_ln2) / -2;
> +               rx = (m_ln2 - logf(ay)) / 2;
>         else
>                 rx = log1pf(4 * ax / sum_squares(ax - 1, ay)) / 4;
>
> @@ -384,5 +388,6 @@ float complex
>  catanf(float complex z)
>  {
>         float complex w = catanhf(cpackf(cimagf(z), crealf(z)));
> +
>         return (cpackf(cimagf(w), crealf(w)));
>  }
>
> Modified: head/lib/msun/src/e_log2.c
>
==============================================================================
> --- head/lib/msun/src/e_log2.c  Wed Jun  5 01:22:59 2013        (r251403)
> +++ head/lib/msun/src/e_log2.c  Wed Jun  5 05:33:01 2013        (r251404)
> @@ -24,6 +24,8 @@ __FBSDID("$FreeBSD$");
>   * in not-quite-routine extra precision.
>   */
>
> +#include <float.h>
> +
>  #include "math.h"
>  #include "math_private.h"
>  #include "k_log.h"
> _______________________________________________
> svn-src-all@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/svn-src-all
> To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CADLo83-8Q-uSD3JxiiGG4ZEfrYuR5sGc4%2BMaFNr4Q00B=TWd-w>