Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 12 Aug 2017 14:53:48 -0700
From:      "Ngie Cooper (yaneurabeya)" <yaneurabeya@gmail.com>
To:        Ryan Libby <rlibby@FreeBSD.org>
Cc:        Ian Lepore <ian@freebsd.org>, src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org, svn-src-head@freebsd.org, Bruce Evans <brde@optusnet.com.au>
Subject:   Re: svn commit: r322418 - head/lib/msun/src
Message-ID:  <A6C8FE24-3458-474D-B05D-FEABFFF7F6EB@gmail.com>
In-Reply-To: <5672BE7A-0640-4C8B-9B41-44AD83D7B59E@gmail.com>
References:  <201708112241.v7BMfP5X028262@repo.freebsd.org> <1502555191.47886.30.camel@freebsd.org> <CAHgpiFx=pDQA-dHNQJwqDQ%2B2iXJDkvVNsdmyBZG2EL%2BVJQCU4g@mail.gmail.com> <CAHgpiFwAAs8=pcpuwVCx-hNdPp3OXFESVdZ6=9fJ8kPwZiqVCg@mail.gmail.com> <5672BE7A-0640-4C8B-9B41-44AD83D7B59E@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--Apple-Mail=_BDF55496-57E5-4C13-8DF1-81D59F02CDC5
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=utf-8


> On Aug 12, 2017, at 14:45, Ngie Cooper (yaneurabeya) =
<yaneurabeya@gmail.com> wrote:
>=20
>>=20
>> On Aug 12, 2017, at 10:55, Ryan Libby <rlibby@FreeBSD.org> wrote:
>=20
> =E2=80=A6
>=20
>> A few possible quick fixes:
>>=20
>> - Change the {arm64,riscv,sparc64}/include/float.h LDBL_MAX_EXP
>>  definitions from (+16384) to 16384.
>>=20
>> - Change HALF_LDBL_MAX from
>> #define HALF_LDBL_MAX __CONCAT(__CONCAT(0x0.8p, LDBL_MAX_EXP), L)
>>  to
>> #if LDBL_MAX_EXP !=3D 0x4000
>> #error "Unsupported long double format"
>> #endif
>> #define HALF_LDBL_MAX 0x0.8p16384L
>>=20
>> - 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 !=3D 0x4000, so not
>>  really any better than the above.
>>=20
>> I think I will back the patch out for now and go back to review.
>=20
> 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=E2=80=99t 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=3D flags are passed to ${CC} in the =
Makefile, since the implementation is predicated by whether or not =
it=E2=80=99s C++ or __STDC__ is defined. There might be an update that =
we can grab from NetBSD (since the macro originated there).
	I don=E2=80=99t understand [right now] why the (+foo) form is =
used *shrugs*.
Cheers,
-Ngie

--Apple-Mail=_BDF55496-57E5-4C13-8DF1-81D59F02CDC5
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename=signature.asc
Content-Type: application/pgp-signature;
	name=signature.asc
Content-Description: Message signed with OpenPGP using GPGMail

-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - https://gpgtools.org

iQIcBAEBCgAGBQJZj3jsAAoJEPWDqSZpMIYVuNIP/A2L0Q2+TY9QRBVFTFofoDJF
PGjMe3E87pDLGuCePk0W3IBo6raGJ1tQw8WhYJast4H/z38J5VImuF0er//ZzUTf
E76rB44simjn9tsM38lTNGFmBWKgvbrXJxTVFyEEE3tGL7rWW3sG0tf44HW3Z3tk
cR/+8lO6RkFV3RodrPS1VhNFgV6WvzAgyyO4oYcx176HBdY/qlzXeFbww2swfgnZ
rLTmmUQD4wLgfSSxkBCoKdru/YOGpCNeqQg1Dy7WDVBsMs2m7UL3RO0olgtdE0kr
DDc2FCuUcDM2DpQBvG9PoRm3maK/OfVUgK16cc4np7mAg2cn4kERuSJMmE7PJFdS
FOKcfBi+ACZJXFWkEGfEoUeW8QDjiBUC8sLfmuPQgjgYhyn9zsYhMj2bI6/W9L28
wzECELQl+F5yFxKg1QGRod/5BwqjLITTJSXMWGpuSE2tNMWiRxTpB/tjCofkbqES
WhizL2QiZVdKZJLnUJAHW5IS4rAYdE4fZ3Y4rBwp3+TvZcDm+Y9z0XTIc6giUQfB
kQkAxKRyz9wsW4Mw5wnb+RPiCSFpc4ptAD5OIQBY9UAJr9i7iT65IsBXZzDwobPj
aygOzSs8hgQKQvJ5i+cUm80gcrKNIJRzR6LAMwhokrN+eFuTuPgp+JqIeUIKlFRa
qrr+NeAAd4dM93ur8m4u
=43lZ
-----END PGP SIGNATURE-----

--Apple-Mail=_BDF55496-57E5-4C13-8DF1-81D59F02CDC5--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?A6C8FE24-3458-474D-B05D-FEABFFF7F6EB>