<div dir="ltr">On 22 August 2013 16:08, Matt Turner <span dir="ltr"><<a href="mailto:mattst88@gmail.com" target="_blank">mattst88@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">

---<br>
 src/glsl/ir_print_visitor.cpp | 12 +++++++++++-<br>
 1 file changed, 11 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/src/glsl/ir_print_visitor.cpp b/src/glsl/ir_print_visitor.cpp<br>
index 541231a..b518310 100644<br>
--- a/src/glsl/ir_print_visitor.cpp<br>
+++ b/src/glsl/ir_print_visitor.cpp<br>
@@ -406,7 +406,17 @@ void ir_print_visitor::visit(ir_constant *ir)<br>
         switch (ir->type->base_type) {<br>
         case GLSL_TYPE_UINT:  printf("%u", ir->value.u[i]); break;<br>
         case GLSL_TYPE_INT:   printf("%d", ir->value.i[i]); break;<br>
-        case GLSL_TYPE_FLOAT: printf("%f", ir->value.f[i]); break;<br>
+        case GLSL_TYPE_FLOAT:<br>
+            if (ir->value.f[i] == 0.0f)<br>
+               /* 0.0 == -0.0, so print with %f to get the proper sign. */<br>
+               printf("%.1f", ir->value.f[i]);<br>
+            else if (abs(ir->value.f[i]) < 0.000001f)<br>
+               printf("%a", ir->value.f[i]);<br>
+            else if (abs(ir->value.f[i]) > 1000000.0f)<br>
+               printf("%e", ir->value.f[i]);<br>
+            else<br>
+               printf("%f", ir->value.f[i]);<br>
+            break;<br>
         case GLSL_TYPE_BOOL:  printf("%d", ir->value.b[i]); break;<br>
         default: assert(0);<br>
         }<br></blockquote><div><br></div><div>Unfortunately, this patch breaks "make check", because src/glsl/tests/optimization-test does a strict character-by-character diff between the expected and actual output of optimization passes (I'm not thrilled that the optimization tests do this, but off hand I can't think of a better way that wouldn't be a pain to implement).<br>

<br></div><div>I believe you can fix it by replacing "(0.000000)" with "(0.0)" in all the *.expected files in src/glsl/tests/lower_jumps/.<br></div><br></div><div class="gmail_quote">With the "make check" issue fixed, this patch is:<br>

<br></div><div class="gmail_quote">Reviewed-by: Paul Berry <<a href="mailto:strereotype441@gmail.com" target="_blank">strereotype441@gmail.com</a>><br></div></div></div>