This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCHv3 1/8] Prepare to convert _Complex cosine functions


On Wed, 17 Aug 2016, Paul E. Murphy wrote:

> Likewise, in a few files I have removed superfluous
> parenthesis as part of the formatting cleanups.

In at least some cases they aren't superfluous; they are needed for 
correct indentation.  See where the GNU Coding Standards say:

  Insert extra parentheses so that Emacs will indent the code properly.
  For example, the following indentation looks nice if you do it by hand,

  @example
  v = rup->ru_utime.tv_sec*1000 + rup->ru_utime.tv_usec/1000
      + rup->ru_stime.tv_sec*1000 + rup->ru_stime.tv_usec/1000;
  @end example

  @noindent
  but Emacs would alter it.  Adding a set of parentheses produces
  something that looks equally nice, and which Emacs will preserve:

  @example
  v = (rup->ru_utime.tv_sec*1000 + rup->ru_utime.tv_usec/1000
       + rup->ru_stime.tv_sec*1000 + rup->ru_stime.tv_usec/1000);
  @end example

In patch 2, in cacosh, a similar issue arises; you have:

> +	    __imag__ res = M_COPYSIGN (signbit (__real__ x) ? M_MLIT (M_PI)
> +							    : 0,

which is not the indentation you'd get automatically - but there the 
parentheses are already present, so you just need to align both the '?' 
and the ':' just after the '('.  Then in ccosh you have exactly the issue 
of removing parentheses that are actually required for indentation:

> -	  __real__ retval = __copysign (HUGE_VAL, cosix);
> -	  __imag__ retval = (__copysign (HUGE_VAL, sinix)
> -			     * __copysign (1.0, __real__ x));
> +	  __real__ retval = M_COPYSIGN (M_HUGE_VAL, cosix);
> +	  __imag__ retval = M_COPYSIGN (M_HUGE_VAL, sinix)
> +			    * M_COPYSIGN (1, __real__ x);

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]