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: [PATCH] Minor cleanups in s_sin.c


On Mon, Dec 16, 2013 at 03:21:34PM +0530, Siddhesh Poyarekar wrote:
> Hi,
> 
> I've done some minor code cleanups (and some refactoring, which I'll
> post soon) in s_sin.c.
> 
>      - Remove redundant mynumber union definitions
>      - Clean up a clumsy ternary operator
>      - Rename TAYLOR_SINCOS to TAYLOR_SIN since we're only expanding the
>        sin Taylor series in it.
> 
> Tested on x86_64 to verify that there are no regressions.  OK to
> commit?
>
looks ok,

> -  cor =
> -    (cor >
> -     0) ? 1.0005 * cor + ABS (orig) * 3.1e-30 : 1.0005 * cor -
> -    ABS (orig) * 3.1e-30;
> +  if (cor > 0)
> +    cor = 1.0005 * cor + ABS (orig) * 3.1e-30;
> +  else
> +    cor = 1.0005 * cor - ABS (orig) * 3.1e-30;
> +
If sgn function is present you could simplify this to

cor =  1.0005 * cor + SGN (cor) * ABS (orig) * 3.1e-30;


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