RFR: Use isnan instead of isnanf
Mikael Vidstedt
mikael.vidstedt at oracle.com
Thu Apr 13 05:07:02 UTC 2017
Cheers,
Mikael
> On Apr 12, 2017, at 9:36 PM, David Holmes <david.holmes at oracle.com> wrote:
>
>> On 12/04/2017 7:52 PM, Magnus Ihse Bursie wrote:
>>> On 2017-04-12 02:30, David Holmes wrote:
>>> Hi Mikael,
>>>
>>>> On 12/04/2017 9:04 AM, Mikael Vidstedt wrote:
>>>>
>>>> isnanf is not available in musl. posix says that isnan handles both
>>>> float and double arguments (typically through a macro checking the
>>>> size of the operand and delegation to the corresponding/actual isnan
>>>> primitive).
>>>>
>>>> This change makes the two JDK wrapper macros call isnan instead of
>>>> isnanf. I’ve tried to verify that the toolchains I have access to
>>>> does the Right(tm) thing for float, but additional
>>>> verification/testing is probably warranted before this is “productized”.
>>>>
>>>> hotspot:
>>>> http://cr.openjdk.java.net/~mikael/webrevs/portola/isnan/webrev.00/hotspot/webrev/
>>>> jdk:
>>>> http://cr.openjdk.java.net/~mikael/webrevs/portola/isnan/webrev.00/jdk/webrev/
>>>
>>> Are we building with C99 support enabled?
>> No, we are not. In fact, on Solaris, we build with c99 explicitly off.
>
> So can someone explain to me how we are able to use these math functions/macros that seem to be guarded with:
>
> #ifdef __USE_ISOC99
>
> ??
Well, I guess the answer could well be that before my change we didn't try to, and with my change we may well be using the wrong isnan for floats. Specifically, on platforms other than musl it may well be using the isnan function taking a double argument, implicitly converting the float argument to a double..?
I filed https://bugs.openjdk.java.net/browse/JDK-8178689 to follow up on and verify the correctness of that fix.
Cheers,
Mikael
>
> David
> -----
>
>> We probably *should* move to C99 in JDK 10, but that is (perhaps?)
>> another story.
>>
>> /Magnus
>>>
>>> The feature test macros are shown as:
>>>
>>> isnan():
>>> _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE || _ISOC99_SOURCE ||
>>> _POSIX_C_SOURCE >= 200112L;
>>> or cc -std=c99
>>>
>>> isnanf(), isnanl():
>>> _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE >= 600
>>>
>>> On linux we don't seem to do anything to explicitly enable access to
>>> either of these ??
>>>
>>> Thanks,
>>> David
>>>
>>>> Cheers,
>>>> Mikael
>>>>
>>
More information about the portola-dev
mailing list