[Info-vax] gnulib test-fmal-ieee failure help needed.
John E. Malmberg
wb8tyw at qsl.net_work
Sun Jul 23 20:20:45 EDT 2017
On 7/23/2017 6:54 PM, John E. Malmberg wrote:
> On 7/23/2017 6:38 PM, Craig A. Berry wrote:
>> On 7/23/17 4:51 PM, John E. Malmberg wrote:
>>> On 7/22/2017 11:01 PM, John E. Malmberg wrote:
>>>> On 7/22/2017 10:52 PM, John E. Malmberg wrote:
>>>>> On 7/22/2017 10:09 PM, Craig A. Berry wrote:
>>>>>> On 7/22/17 8:54 PM, John E. Malmberg wrote:
>>>>>>> The gnulib test-fmal-ieee is failing for the gnulib provided fmal
>>>>>>> routine.
>>>>>>>
>>>>>>> Actually a lot of the IEEE tests are failing.
>>>>>>>
>>>>>>> My compiler command line on OpenVMS 8.4 is:
>>>>>>>
>>>>>>> CC/STANDARD=(RELAXED)/ACCEPT=(NOVAXC,RESTR,C99)-
>>>>>>> /LIST/SHOW=(EXPAN,INCLU)/NAMES=(AS_IS,SHORT)-
>>>>>>> /MAIN=POSIX_EXIT-
>>>>>>> /FLOAT=IEEE/IEEE_MODE=DENORM_RESULTS-
>>>>>>> /NESTED=NONE-
>>>>>>> /PREFIX=EXCEPT=(STRTOIMAX,STRTOUMAX,ISWBLANK,ISBLANK)-
>>>>>>> /WARN=(DISABLE=QUESTCOMPARE)-
>>>>>>> /DEBUG/NOOPTIMIZE/DEB=ALL/NOOPT-
>>>>>>> /DEF=-(HAVE_CONFIG_H,EXEEXT="",EXEEXT="",NO_XMALLOC,EXEEXT="",-
>>>>>>> GNULIB_STRICT_CHECKING=1,_POSIX_EXIT,_USE_STD_STAT,-
>>>>>>> _ _USE_STD_IOSTREAM)-
>>>>>>> /INC=(./,../)/OBJECT=SYS$DISK:[]fmal.o SYS$DISK:[]fmal.c
>>>>>>>
>>>>>>> The floating variables involved are declared double.
>>>>>>>
>>>>>>> The input to the failed call is:
>>>>>>>
>>>>>>> fmal(Infinity, 2.0L, -Infinity) and the result is expected to
>>>>>>> be NaN.
>>>>>>>
>>>>>>> Is there some other compile settings that I should be using to be
>>>>>>> more compatible with GNULIB's expectations for IEEE math?
>>>>>>
>>>>>> fmal is for long doubles, so passing doubles to it is unlikely to
>>>>>> work.
>>>>>> For example, you probably want LDBL_INFINITY instead of Infinity.
>>>>>> Possibly related is that none of the IEEE test macros (isnan, isinf,
>>>>>> etc.) in math.h on VMS works for floats or long doubles -- they only
>>>>>> work for doubles. Which is a bug. We have some workarounds in Perl
>>>>>> for
>>>>>> some of it.
>>>>>
>>>>> Your right, the gnulib fmal code is long doubles, not doubles.
>>>>>
>>>>> VMS has a number of the declarations that should be in math.h in fp.h.
>>>>>
>>>>> In this case INFINITY is defined as decc$gt_gbl_infinity by fp.h
>>>>> and is reported as Infinity in the VMS debugger.
>>>>
>>>> The test-fmal1 fails in the same way as test-fmal-ieee.
>>>>
>>>> The test-malm2 fails when fma returns what the debugger says is
>>>> Infinity and the test was expecting "-Infinity".
>>>>
>>>> DBG> eval result
>>>> Infinity
>>>> DBG> eval -result
>>>> -Infinity
>>>
>>> Latest failure:
>>>
>>> ASSERT (ILOGB (L_(0.0)) == FP_ILOGB0)
>>> ILOG_B is ilogb()
>>> FP_ILOGB0 is - 2147483647
>>> L_(0.0) is 0.0L
>>
>> So it's passing a long double to a function that expects a double. That
>> doesn't seem likely to work. It should be calling ilogbl not ilogb if
>> the argument is a long double. See:
>>
>> <http://pubs.opengroup.org/onlinepubs/9699919799/functions/ilogb.html>
>
> I can not seem to copy things right.
>
> The ILOGB in the last test was
>
> I2 1 42156 ASSERT (ILOGB (L_(0.0)) == FP_ILOGB0);
> E do { if ( ! ( ilogbl ( 0.0L ) == ( - 2147483647 ) ) )
> { rpl_fprintf ( ( decc$ga_stderr ) ,
> "%s:%d: assertion '%s' failed\n" ,
>
> "GNULIB_ROOT:[gnulib.gltests]test-ilogb.h;1" ,
> 60 , "ILOGB (L_(0.0)) ==
> FP_ILOGB0" ) ; rpl_fflush ( ( decc$ga_stderr )
> ) ; abort ( ) ; } } while ( 0 )
>
> The gnulib code should be correct with regards to doubles, long doubles,
> etc as the code works on many other platforms. If I post a mis-match
> between doubles and long doubles etc, it is likely a transcription
> error. I realize that makes it harder to diagnose what is going wrong.
>
> So the problem is likely one of:
>
> 1. Wrong CC command qualifiers.
> 2. Bug in math.h/fp.h
> 3. Bug in VMS CRTL
> 4. Bug in VMS C compiler.
>
>>>> These results are showing up while am running the failed tests in
>>>> debug to get more information. So as soon as I exit one failed
>>>> test, the script moves on to the next. I am not sure how many more
>>>> tests are going to run in this pass.
>>>
>>> And to clarify, this is on HPE OpenVMS 8.4 on Itanium.
The test-log-ieee seems to be more clear on the failure.
x = 0.6;
y = log (x);
ASSERT (y >= -0.5108256238 && y <= -0.5108256237);
Debugger reports y = -0.510825623765991 so assert passes.
Failed assert:
minus_zerod = 0.0 in the debugger.
I2 2 41962 DOUBLE z = LOG (MINUS_ZERO);
E double
E log
E minus_zerod
I2 2 41963 ASSERT (z == - HUGEVAL);
E z == - decc$gt_dbl_infinity
Debugger reports z is NaN
I am seeing a pattern where NaN is seen where infinity is expected in
some of the failed asserts.
Regards,
-John
wb8tyw at qsl.net_work
More information about the Info-vax
mailing list