From 4b0ef4bf38f84af33000cd70a01d6df8b14afee9 Mon Sep 17 00:00:00 2001 From: Matt Turner Date: Mon, 25 Nov 2013 22:18:28 -0800 Subject: [PATCH] glsl: Use fabs() on floating point values. Reviewed-by: Kenneth Graunke --- src/glsl/ir_print_visitor.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/glsl/ir_print_visitor.cpp b/src/glsl/ir_print_visitor.cpp index f85e573c43e..6ad22fe33e8 100644 --- a/src/glsl/ir_print_visitor.cpp +++ b/src/glsl/ir_print_visitor.cpp @@ -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]); -- 2.30.2