Mesa (master): mesa: Return -FLT_MAX instead of 0 for LG2(0).

Brian Paul brianp at kemper.freedesktop.org
Thu Oct 1 19:37:20 UTC 2009


Module: Mesa
Branch: master
Commit: 18883cdf2334511005973155fc517eb678dc0043
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=18883cdf2334511005973155fc517eb678dc0043

Author: Vinson Lee <vlee at vmware.com>
Date:   Thu Oct  1 13:33:20 2009 -0600

mesa: Return -FLT_MAX instead of 0 for LG2(0).

lim x->0 log(x) = -inf so -FLT_MAX is a better approximation than 0
for LG2(0).

---

 src/mesa/shader/prog_execute.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/mesa/shader/prog_execute.c b/src/mesa/shader/prog_execute.c
index 69b81e7..192d39a 100644
--- a/src/mesa/shader/prog_execute.c
+++ b/src/mesa/shader/prog_execute.c
@@ -939,7 +939,7 @@ _mesa_execute_program(GLcontext * ctx,
 	    /* The fast LOG2 macro doesn't meet the precision requirements.
 	     */
             if (a[0] == 0.0F) {
-               val = 0.0F;
+               val = -FLT_MAX;
             }
             else {
                val = log(a[0]) * 1.442695F;




More information about the mesa-commit mailing list