This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Minor cleanups in s_sin.c
- From: OndÅej BÃlka <neleai at seznam dot cz>
- To: Siddhesh Poyarekar <siddhesh at redhat dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Mon, 16 Dec 2013 11:38:56 +0100
- Subject: Re: [PATCH] Minor cleanups in s_sin.c
- Authentication-results: sourceware.org; auth=none
- References: <20131216095134 dot GB18419 at spoyarek dot pnq dot redhat dot com>
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;