cl: fix bug in piglit_cl_probe_floating

Submitted by Zoltan Gilian on Aug. 15, 2015, 1:37 p.m.

Details

Message ID 1439645887-18378-1-git-send-email-zoltan.gilian@gmail.com
State New
Headers show

Not browsing as part of any series.

Commit Message

Zoltan Gilian Aug. 15, 2015, 1:37 p.m.
The uint ulp value is compared to the float diff instead of
reinterpreting the ulp as float.
---
 Note: I'm new to contributing to piglit, and I don't have commit access.
 tests/util/piglit-util-cl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/tests/util/piglit-util-cl.c b/tests/util/piglit-util-cl.c
index 47e0c7a..b49665a 100644
--- a/tests/util/piglit-util-cl.c
+++ b/tests/util/piglit-util-cl.c
@@ -80,7 +80,7 @@  piglit_cl_probe_floating(float value, float expect,  uint32_t ulp)
 
 	diff = fabsf(value - expect);
 
-	if(diff > ulp || isnan(value)) {
+	if(diff > t.f || isnan(value)) {
 		printf("Expecting %f (0x%x) with tolerance %f (%u ulps), but got %f (0x%x)\n",
 		       e.f, e.u, t.f, t.u, v.f, v.u);
 		return false;

Comments

Hmm, I'm not sure this is totally correct.  We actually ran into this back
in June, and I believe the conclusion is that we should actually be using
nextafterf/nextafter for calculating the tolerances for a given ulp.

See the email thread that started with my first patch here:
http://lists.freedesktop.org/archives/piglit/2015-June/016238.html

--Aaron

On Sat, Aug 15, 2015 at 8:37 AM, Zoltan Gilian <zoltan.gilian@gmail.com>
wrote:

> The uint ulp value is compared to the float diff instead of
> reinterpreting the ulp as float.
> ---
>  Note: I'm new to contributing to piglit, and I don't have commit access.
>  tests/util/piglit-util-cl.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tests/util/piglit-util-cl.c b/tests/util/piglit-util-cl.c
> index 47e0c7a..b49665a 100644
> --- a/tests/util/piglit-util-cl.c
> +++ b/tests/util/piglit-util-cl.c
> @@ -80,7 +80,7 @@ piglit_cl_probe_floating(float value, float expect,
> uint32_t ulp)
>
>         diff = fabsf(value - expect);
>
> -       if(diff > ulp || isnan(value)) {
> +       if(diff > t.f || isnan(value)) {
>                 printf("Expecting %f (0x%x) with tolerance %f (%u ulps),
> but got %f (0x%x)\n",
>                        e.f, e.u, t.f, t.u, v.f, v.u);
>                 return false;
> --
> 2.4.6
>
> _______________________________________________
> Piglit mailing list
> Piglit@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
>