glsl: Use fabs() on floating point values.
authorMatt Turner <mattst88@gmail.com>
Tue, 26 Nov 2013 06:18:28 +0000 (22:18 -0800)
committerMatt Turner <mattst88@gmail.com>
Thu, 5 Dec 2013 04:05:43 +0000 (20:05 -0800)
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/glsl/ir_print_visitor.cpp

index f85e573c43e43e548f1d2cb8887110574a5d1c3c..6ad22fe33e8de32dece4d802917ea9273210e8a3 100644 (file)
@@ -416,9 +416,9 @@ void ir_print_visitor::visit(ir_constant *ir)
             if (ir->value.f[i] == 0.0f)
                /* 0.0 == -0.0, so print with %f to get the proper sign. */
                printf("%.1f", ir->value.f[i]);
-            else if (abs(ir->value.f[i]) < 0.000001f)
+            else if (fabs(ir->value.f[i]) < 0.000001f)
                printf("%a", ir->value.f[i]);
-            else if (abs(ir->value.f[i]) > 1000000.0f)
+            else if (fabs(ir->value.f[i]) > 1000000.0f)
                printf("%e", ir->value.f[i]);
             else
                printf("%f", ir->value.f[i]);