public inbox for ecos-patches@sourceware.org
 help / color / mirror / Atom feed
From: bugzilla-daemon@bugs.ecos.sourceware.org
To: ecos-patches@ecos.sourceware.org
Subject: [Bug 1001539] Single precision floating point math library
Date: Thu, 22 Mar 2012 13:42:00 -0000	[thread overview]
Message-ID: <20120322134223.9ECDB2F78005@mail.ecoscentric.com> (raw)
In-Reply-To: <bug-1001539-104@http.bugs.ecos.sourceware.org/>

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

--- Comment #19 from Sergei Gavrikov <sergei.gavrikov@gmail.com> 2012-03-22 13:42:17 GMT ---
(In reply to comment #18)
> (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:

IMO, it can depend on libm compatibility, look at libm compat. wrappers
(w_*.c), e.g.  at w_asin{,f}.c. Though, I think in our case it should be
a result of call __ieee754_asin{,f}().  And if libm compat mode is not
IEEE?  I'm looking at misc/standard.c (__kernel_standard)...

> 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.

Thank you for the example.

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

Further I would refer to http://sourceware.org/newlib/libm.html and thus
to http://sourceware.org/newlib/libm.html#asin However, they also talk
about NaN, errno (EDOM), etc.

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

Do you trust your checkErrorAcceptableFloat() implementation? As I could
see asin*(10.0) should return N-a-N if libm compat is IEEE. IMHO, we have
to compare return values for d-implementations with f-ones and then test
(compare) behaviors of its checkers. I will try to investigate tonight.

Sergei

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

  parent reply	other threads:[~2012-03-22 13:42 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-20 19:23 [Bug 1001539] New: " bugzilla-daemon
2012-03-20 19:24 ` [Bug 1001539] " bugzilla-daemon
2012-03-20 19:26 ` bugzilla-daemon
2012-03-20 19:39 ` bugzilla-daemon
2012-03-20 19:39 ` bugzilla-daemon
2012-03-20 19:40 ` bugzilla-daemon
2012-03-20 19:41 ` bugzilla-daemon
2012-03-20 19:43 ` bugzilla-daemon
2012-03-20 19:47 ` bugzilla-daemon
2012-03-21 13:44 ` bugzilla-daemon
2012-03-21 15:56 ` bugzilla-daemon
2012-03-21 18:36 ` bugzilla-daemon
2012-03-21 19:52 ` bugzilla-daemon
2012-03-22 10:24 ` bugzilla-daemon
2012-03-22 10:25 ` bugzilla-daemon
2012-03-22 10:26 ` bugzilla-daemon
2012-03-22 10:27 ` bugzilla-daemon
2012-03-22 10:28 ` bugzilla-daemon
2012-03-22 11:01 ` bugzilla-daemon
2012-03-22 13:42 ` bugzilla-daemon [this message]
2012-03-22 18:05 ` bugzilla-daemon
2012-03-22 23:53 ` bugzilla-daemon
2012-08-08 11:48 ` bugzilla-daemon
2013-05-15 20:00 ` bugzilla-daemon
2013-05-16  9:59 ` bugzilla-daemon
2013-06-07  9:17 ` bugzilla-daemon
2013-06-07 12:47 ` bugzilla-daemon
2013-06-07 20:20 ` bugzilla-daemon
2013-06-08 12:24 ` bugzilla-daemon
2013-06-08 15:37 ` bugzilla-daemon
2013-06-08 19:04 ` bugzilla-daemon
2013-06-08 19:08 ` bugzilla-daemon
2013-06-08 19:39 ` bugzilla-daemon
2013-06-09  9:39 ` bugzilla-daemon
2013-06-09  9:42 ` bugzilla-daemon
2013-06-09 18:23 ` bugzilla-daemon
2013-06-28 15:42 ` bugzilla-daemon
2013-06-28 15:44 ` bugzilla-daemon
2013-06-28 15:46 ` bugzilla-daemon
2013-06-28 15:51 ` bugzilla-daemon
2013-06-28 15:52 ` bugzilla-daemon
2013-06-28 15:53 ` bugzilla-daemon
2013-06-28 15:55 ` bugzilla-daemon
2013-06-28 15:56 ` bugzilla-daemon
2013-06-28 15:57 ` bugzilla-daemon
2013-06-28 15:58 ` bugzilla-daemon
2013-06-28 17:26 ` bugzilla-daemon
2013-08-09 15:44 ` bugzilla-daemon
2013-08-25 15:41 ` bugzilla-daemon
2013-09-24 18:08 ` bugzilla-daemon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120322134223.9ECDB2F78005@mail.ecoscentric.com \
    --to=bugzilla-daemon@bugs.ecos.sourceware.org \
    --cc=ecos-patches@ecos.sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).