File: test_fabs.cl

package info (click to toggle)
pocl 6.0-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 25,320 kB
  • sloc: lisp: 149,513; ansic: 103,778; cpp: 54,947; python: 1,513; sh: 949; ruby: 255; pascal: 226; tcl: 180; makefile: 175; java: 72; xml: 49
file content (29 lines) | stat: -rw-r--r-- 646 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include "common.cl"

DEFINE_BODY_V (
    test_fabs, ({
      /* fabs */
      res.v = fabs (val.v);
      equal = true;
      for (int n = 0; n < vecsize; ++n)
        {
          S r, g;
          r.s = res.s[n];
          g.s = good.s[n];
          equal = equal && (ISNAN (val.s[n]) || r.sj == g.sj);
        }
      if (!equal)
        {
          for (int n = 0; n < vecsize; ++n)
            {
              printf ("FAIL: fabs type=%s val=%.17g res=%.17g good=%.17g\n",
                      typename, val.s[n], res.s[n], good.s[n]);
            }
          return;
        }
    }))

kernel void test_fabs()
{
  CALL_FUNC_V(test_fabs)
}