[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] trivial patch to fix fenv test compilation under Linux

From: Greg Chicares
Subject: Re: [lmi] trivial patch to fix fenv test compilation under Linux
Date: Wed, 24 Mar 2010 11:39:39 +0000
User-agent: Thunderbird (Windows/20090812)

On 2010-03-23 23:20Z, Vadim Zeitlin wrote:
>  Could you please apply the following trivial patch?

Yes, soon.

> AFAICS it can't break anything (yes, I had said this before... but this
> time I'm really sure about it (even more so than the previous ones)) and it

I tested it with all three compilers I have.

> allows the calls to rint() to compile under Linux. It's a bit of a mystery
> to me why does it compile with MinGW without it as rint() is declared in
> math.h there as well and the test currently only includes float.h which
> does not include math.h but in any case, including math.h shouldn't hurt
> there neither.

Probably <math.h> gets pulled in by one of the other MinGW headers,
perhaps <climits>.

>  With this patch (and a couple of changes in Makefile.am which I'm going to
> commit myself to svn if you don't object)

I don't object to your committing autotools files.

> all tests compile under Linux
> again now. Unfortunately they still don't pass, even this one fails with
>       **** test failed:   '-3' == '-2'
>       [file fenv_lmi_test.cpp, line 211]
>       **** test failed:   '1' == '2'
>       [file fenv_lmi_test.cpp, line 213]
> (note that the line numbers are offset by the above patch compared to the
> svn version) but I ran out of time to investigate it today.

Here's the applicable part of the code:

    fenv_rounding   (fe_downward);
    BOOST_TEST_EQUAL(fe_downward  , fenv_rounding());
    BOOST_TEST_EQUAL(-3, rint(-2.5));
    BOOST_TEST_EQUAL(-2, rint(-1.5));
    BOOST_TEST_EQUAL( 1, rint( 1.5));
    BOOST_TEST_EQUAL( 2, rint( 2.5));

and it's interesting that two of the tests pass but two fail.
The failures seem to be here:
    BOOST_TEST_EQUAL(-3, rint(-2.5)); // '-2' observed
    BOOST_TEST_EQUAL( 1, rint( 1.5)); //  '2' observed
and that pattern seems to suggest a round-to-nearest mode,
so I'd suspect a problem in fenv_rounding() because it doesn't
seem possible that glibc implements rint() incorrectly for
such obvious testcases...unless they're not trying to be
compatible with C99?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]