> On Aug 12, 2017, at 14:45, Ngie Cooper (yaneurabeya) <yaneurab...@gmail.com> 
> wrote:
> 
>> 
>> On Aug 12, 2017, at 10:55, Ryan Libby <rli...@freebsd.org> wrote:
> 
> …
> 
>> A few possible quick fixes:
>> 
>> - Change the {arm64,riscv,sparc64}/include/float.h LDBL_MAX_EXP
>>  definitions from (+16384) to 16384.
>> 
>> - Change HALF_LDBL_MAX from
>> #define HALF_LDBL_MAX __CONCAT(__CONCAT(0x0.8p, LDBL_MAX_EXP), L)
>>  to
>> #if LDBL_MAX_EXP != 0x4000
>> #error "Unsupported long double format"
>> #endif
>> #define HALF_LDBL_MAX 0x0.8p16384L
>> 
>> - Change the HALF_LDBL_MAX constant to a variable constructed with
>>  LD80C(), I think with
>> LD80C(0x8000000000000000, 16383, 5.9486574767861588254e+4931L)
>>  but this also requires #error for LDBL_MAX_EXP != 0x4000, so not
>>  really any better than the above.
>> 
>> I think I will back the patch out for now and go back to review.
> 
> The issue is an inconsistency with how LDBL_MAX_EXP is defined in the MD 
> headers:

        * is an -> is due to an

> $ grep -r LDBL_MAX_EXP sys/sparc64/
> sys/sparc64/include/float.h:#define LDBL_MAX_EXP        (+16384)
> $ grep -r LDBL_MAX_EXP sys/x86/
> sys/x86/include/float.h:#define LDBL_MAX_EXP    16384

        Here are the full gamut of definitions for LDBL_MAX_EXP. It seems that 
sparc64 isn’t the only architecture using this pattern:

$ grep -r DBL_MAX_EXP sys/*/include
sys/arm/include/float.h:#define DBL_MAX_EXP     1024
sys/arm/include/float.h:#define LDBL_MAX_EXP    DBL_MAX_EXP
sys/arm64/include/float.h:#define       DBL_MAX_EXP     1024
sys/arm64/include/float.h:#define       LDBL_MAX_EXP    (+16384)
sys/mips/include/float.h:#define        DBL_MAX_EXP     1024
sys/mips/include/float.h:#define        LDBL_MAX_EXP    DBL_MAX_EXP
sys/powerpc/include/float.h:#define DBL_MAX_EXP 1024
sys/powerpc/include/float.h:#define LDBL_MAX_EXP        DBL_MAX_EXP
sys/riscv/include/float.h:#define       DBL_MAX_EXP     1024
sys/riscv/include/float.h:#define       LDBL_MAX_EXP    (+16384)
sys/sparc64/include/float.h:#define DBL_MAX_EXP 1024
sys/sparc64/include/float.h:#define LDBL_MAX_EXP        (+16384)
sys/x86/include/float.h:#define DBL_MAX_EXP     1024
sys/x86/include/float.h:#define LDBL_MAX_EXP    16384

        It might also be an inconsistency with how clang vs gcc [4.2.1] handles 
__CONCAT, and what -std= flags are passed to ${CC} in the Makefile, since the 
implementation is predicated by whether or not it’s C++ or __STDC__ is defined. 
There might be an update that we can grab from NetBSD (since the macro 
originated there).
        I don’t understand [right now] why the (+foo) form is used *shrugs*.
Cheers,
-Ngie

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

Reply via email to