mojoshader_common.c
changeset 1180 8abc040525ed
parent 1170 6e9659bf396f
--- a/mojoshader_common.c	Sat Jul 09 01:44:57 2016 -0400
+++ b/mojoshader_common.c	Thu Oct 12 16:35:50 2017 -0400
@@ -1,5 +1,6 @@
 #define __MOJOSHADER_INTERNAL__ 1
 #include "mojoshader_internal.h"
+#include <math.h>
 
 // Convenience functions for allocators...
 #if !MOJOSHADER_FORCE_ALLOCATOR
@@ -1037,7 +1038,25 @@
 
     int precision = 9;
 
-    if (arg)
+    if (isnan(arg))
+    {
+        if (left > 3)
+        {
+            snprintf(text, left, "NaN");
+            left -= 3;
+        } // if
+        text += 3;
+    } // if
+    else if (isinf(arg))
+    {
+        if (left > 3)
+        {
+            snprintf(text, left, "inf");
+            left -= 3;
+        } // if
+        text += 3;
+    } // else if
+    else if (arg)
     {
         /* This isn't especially accurate, but hey, it's easy. :) */
         unsigned long value;