lgammal[_r] patch

Bruce Evans brde at optusnet.com.au
Sun Sep 14 21:58:26 UTC 2014


On Sat, 13 Sep 2014, Steve Kargl wrote:

> Following my .sig is a patch that contains the ld80 and ld128
> implementations of lgamma[_r]().  It also contains an update
> to lgammaf_r() and lgamma_r().  Specifically, it has

Looks good.  It passed all my tests so far.  I haven't tested ld128
or compared ld80 with more than d64.

You even matched the fdlibm style bugs almost perfectly :-).  Do you
know agree that copying a reasonable method is easiest?

> Index: ld80/e_lgammal_r.c
> ===================================================================
> --- ld80/e_lgammal_r.c	(revision 0)
> +++ ld80/e_lgammal_r.c	(working copy)
> @@ -0,0 +1,343 @@
> +/* @(#)e_lgamma_r.c 1.3 95/01/18 */
> +/*
> + * ====================================================
> + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
> + *
> + * Developed at SunSoft, a Sun Microsystems, Inc. business.
> + * Permission to use, copy, modify, and distribute this
> + * software is freely granted, provided that this notice
> + * is preserved.
> + * ====================================================
> + */
> +
> +#include <sys/cdefs.h>
> +__FBSDID("$FreeBSD");
> +/*
> + * See s_lgamma_r.c for complete comments.
> + *
> + * Converted to long double by Steven G. Kargl.
> + */
> +#include <float.h>
> +#ifdef __i386__
> +#include <ieeefp.h>
> +#endif

Missing blank line before the <float.h> include here and in most other
places.

> Index: src/math.h
> ===================================================================
> --- src/math.h	(revision 271479)
> +++ src/math.h	(working copy)
> @@ -496,8 +496,12 @@
> long double	tanl(long double);
> long double	tgammal(long double);
> long double	truncl(long double);
> +#endif /* __ISO_C_VISIBLE >= 1999 */
>
> -#endif /* __ISO_C_VISIBLE >= 1999 */
> +#if __BSD_VISIBLE
> +long double	lgammal_r(long double, int *);
> +#endif	/* __BSD_VISIBLE */

This comment has extra indentation and is not needed.  Only larger
sections or more complicated conditionals need a comment on #endif.
The rest of the file mostly follows this rule.  One large section
is missing a comment.

The BSD extras aren't very well sorted.  Neither are the float and
double sections.  It was only useful to keep the float and double
functions in separate sections in 1990 when they weren't standard.

> +
> __END_DECLS
>
> #endif /* !_MATH_H_ */

Bruce


More information about the freebsd-numerics mailing list