[Bug 211965] [patch] fmodl not properly aliased on architectures where LDBL_PREC == 53 (arm, mips, powerpc)

Bruce Evans brde at optusnet.com.au
Wed Aug 31 03:57:37 UTC 2016


On Tue, 30 Aug 2016 a bug that doesn't want replies at freebsd.org wrote:

> https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=211965
>
> Kyle Evans <bsdports at kyle-evans.net> changed:
>
>           What    |Removed                     |Added
> ----------------------------------------------------------------------------
> Attachment #173822|0                           |1
>        is obsolete|                            |
>
> --- Comment #1 from Kyle Evans <bsdports at kyle-evans.net> ---
> Created attachment 174233
>  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=174233&action=edit
> svn(1) diff of lib/msun/src, standardizing conditionals and properly aliasing
> fmodl

I sent a patch with approved style in response to PR 199422.

> As mentioned by Warner Losh [1], LDBL_MANT_DIG == 53 could be written as
> LDBL_MANT_DIG == DBL_MANT_DIG to better convey the intention of this block.

This is a worse way.  It should be backed out if committed.

The double precision version of fmod() has about 50 magic numbers
related to 53.  The one in this conditional must be written as 53 to
match.  Try writing the others as much more complicated expressions
depending on DBL_MANT_DIG and other parameters to see how much easier
it is to use magic numbers.  Don't forget to change all the int32_t
types to int<(DBL_MANT_DIG + LOG(MUMBLE(RANGE))) / 2>_t and all the
packing expressions to pack the parametrised types.

> I've amended this to do that, as well as to give the same treatment to the
> other instances where the same meaning is intended. Also, I've standardized all
> of these to a form without parentheses enclosing the statement.

The other instances mostly have correct style.

Bruce


More information about the freebsd-bugs mailing list