This is the mail archive of the ecos-bugs@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug 1001539] Single precision floating point math library


Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001539

--- Comment #18 from Ilija Kocho <ilijak@siva.com.mk> 2012-03-22 11:01:07 GMT ---
(In reply to comment #12)
> (In comment #9 I wrote)
> 
> > All f-tests fail on eCos synthetic target
> 
> My fault (that was wrong grep GDB output)! I'm sorry. Only below fails:
> 
>   FAIL:<sqrtf() failed tests> Line: 92, File: tests/vectors/sqrtf.c
>   FAIL:<log10f() failed tests> Line: 92, File: tests/vectors/log10f.c
>   FAIL:<frexpf() failed tests> Line: 92, File: tests/vectors/frexpf.c
>   FAIL:<acosf() failed tests> Line: 92, File: tests/vectors/acosf.c
>   FAIL:<asinf() failed tests> Line: 92, File: tests/vectors/asinf.c
>   FAIL:<logf() failed tests> Line: 92, File: tests/vectors/logf.c
> 
> So, I got the same results for eCos sythetic target as for ARM7 target.
> 
> Sergei

Tests expect NaN for out-of-domain arguments, but functions return something
else. For instance asinf(10) returns 0. Here is a little example:

int main(void)
{
    volatile float fla, flb, flc;
    volatile double dla, dlb, dlc;

    printf("Enter floats: ");
    scanf("%f %f", &fla, &flb);
    printf("Enter doubles: ");
    scanf ("%lf %lf", &dla, &dlb);

    flc = fla + flb;
    dlc = dla + dlb;
    printf("float:  %f + %f = %f\n", fla, flb, flc);
    printf("double: %f + %f = %f\n", dla, dlb, dlc);

    flc = fla / flb;
    dlc = dla / dlb;
    printf("float:   %f / %f = %f\n", fla, flb, flc);
    printf("double: %f / %f = %f\n", dla, dlb, dlc);

    flc = asinf(fla);
    dlc = asin(dla);
    printf("float:   asinf(%f) = %f\n", fla, flc);
    printf("double: asin(%f)  = %f\n", dla, dlc);

    return 0;
}

And some printouts:

Enter floats: 0 0
Enter doubles: 0 0
float:  0.000000 + 0.000000 = 0.000000
double: 0.000000 + 0.000000 = 0.000000
float:   0.000000 / 0.000000 = nan
double: 0.000000 / 0.000000 = nan
float:   asinf(0.000000) = 0.000000
double: asin(0.000000)  = 0.000000

Enter floats: 10 10
Enter doubles: 10 10
float:  10.000000 + 10.000000 = 20.000000
double: 10.000000 + 10.000000 = 20.000000
float:   10.000000 / 10.000000 = 1.000000
double: 10.000000 / 10.000000 = 1.000000
float:   asinf(10.000000) = 0.000000
double: asin(10.000000)  = 0.000000

As we can the same behavior is for double. I haven't check but I could imagine
that double's tests either don't contain these cases or expect 0.

I wander if this is some compatibility issue?! FYI Linux man pages say they
should return NaN.

Then next question: what to fix, functions or tests?

Ilija

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]