Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ncos tests assume an inaccurate result #16

Open
pjaaskel opened this issue Feb 9, 2016 · 1 comment
Open

ncos tests assume an inaccurate result #16

pjaaskel opened this issue Feb 9, 2016 · 1 comment
Assignees

Comments

@pjaaskel
Copy link

pjaaskel commented Feb 9, 2016

It seems ncos (and other native fp instructions) are very vaguely specified regarding their accuracy. However, at least ncos tests assume something of the result rounding. When implementing ncos with libm cosf(), there's a failure:

...
Validating buffer dst with expected values dst.data(method: ulps=8192.5)
  [ 0]:      0.540302277 (0x3f0a5140) (exp.      0.540302277 (0x3f0a5140), ulps difference                         0 )
  [ 1]:                1 (0x3f800000) (exp.                1 (0x3f800000), ulps difference                         0 )
  [ 2]:                1 (0x3f800000) (exp.                1 (0x3f800000), ulps difference                         0 )
  [ 3]:      0.540302277 (0x3f0a5140) (exp.      0.540302277 (0x3f0a5140), ulps difference                         0 )
  [ 4]:                +qNAN(0) (0x7fc00000) (exp.                +qNAN(0) (0x7fc00000), ulps difference                         0 )
  [ 5]:  -4.37113883e-08 (0xb33bbd2e) (exp.                0 (0x00000000), ulps difference                3007036718*)
  [ 6]:      0.707106769 (0x3f3504f3) (exp.      0.707106769 (0x3f3504f3), ulps difference                         0 )
  Error: failed 1 / 7 comparisons, max ulps error 3007036718 at [ 5].
FAILED: prm/core/arithmetic/nativefp/ncos/ncos_f32_00000 0.11s

The tested input value for [5] is -1.57079637. Because the specs is so vague of the accuracy of these instructions, I do not immediately know how to fix these tests as there doesn't seem to be accompanying runtime API to queries for asking the Agent specific accuracy either.

@atamazov atamazov self-assigned this May 30, 2016
@atamazov
Copy link
Contributor

Runtime API query for this looks like overkill. Perhaps it is worth to change comparison mode from "ulps" (which can yield enormously big diff) to "relative", with quite relaxed precision requirement, so the test will perform very rude assessment of ncos/nsin. Another option is to exclude nsin/ncos from testing unless explicitly specified by command-line option (together with expected precision).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants