[Beignet] [PATCH] fix builtin function "isnormal"

Homer Hsing homer.xing at intel.com
Thu Nov 7 21:27:30 PST 2013


fix a corner case of very small input

Signed-off-by: Homer Hsing <homer.xing at intel.com>
---
 backend/src/ocl_stdlib.tmpl.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/backend/src/ocl_stdlib.tmpl.h b/backend/src/ocl_stdlib.tmpl.h
index ec9ed60..fc4ea3c 100644
--- a/backend/src/ocl_stdlib.tmpl.h
+++ b/backend/src/ocl_stdlib.tmpl.h
@@ -256,7 +256,7 @@ INLINE_OVERLOADABLE int isnormal(float x) {
   union { uint u; float f; } u;
   u.f = x;
   u.u &= 0x7FFFFFFF;
-  return (u.u < 0x7F800000) && (u.u >= 1);
+  return (u.u < 0x7F800000) && (u.u >= 0x800000);
 }
 INLINE_OVERLOADABLE int isordered(float x, float y) { return isequal(x, x) && isequal(y, y); }
 INLINE_OVERLOADABLE int isunordered(float x, float y) { return isnan(x) || isnan(y); }
-- 
1.8.3.2



More information about the Beignet mailing list