derekovecs: handle nan, inf and NA
diff --git a/templates/index.html.ep b/templates/index.html.ep
index 409b158..dda695d 100644
--- a/templates/index.html.ep
+++ b/templates/index.html.ep
@@ -136,6 +136,22 @@
          return changeCharColor(str, heat, word);
        }
 
+       function toFixed(n, d) {
+         if(typeof n != "number") {
+           return n;
+         } else {
+           return n.toFixed(d);
+         }
+       }
+
+       function toExponential(n, d) {
+         if(typeof n != "number") {
+           return n;
+         } else {
+           return n.toExponential(d);
+         }
+       }
+
        % use Mojo::ByteStream 'b';
        var paraResults = <%= b(Mojo::JSON::to_json($lists)) %>;
        var urlprefix =  new URLSearchParams(window.location.search);
@@ -322,21 +338,21 @@
            "dom": '<"top">rt<"bottom"flp><"clear">',
            "columns": [
              //                      { "data": "pos", width: "7%", sClass: "dt-center mono compact", render: function ( data, type, row ) {return bitvec2window(data, row.heat, row.word) }},
-             { "data": "llr",  render: function ( data, type, row ) {return data.toFixed(0) }},
-             { "data": "pmi", render: function ( data, type, row ) {return data.toFixed(2) }},
-             { "data": "md", render: function ( data, type, row ) {return data.toFixed(2) }},
-             { "data": "lfmd", render: function ( data, type, row ) {return data.toFixed(2) }},
+             { "data": "llr",  render: function ( data, type, row ) {return toFixed(data, 0) }},
+             { "data": "pmi", render: function ( data, type, row ) {return toFixed(data, 2) }},
+             { "data": "md", render: function ( data, type, row ) {return toFixed(data, 2) }},
+             { "data": "lfmd", render: function ( data, type, row ) {return toFixed(data, 2) }},
              //             { "data": "fpmi", type: "scientific", render: function ( data, type, row ) {return data.toExponential(2) }  },
-             { "data": "npmi", render: function ( data, type, row ) {return data.toFixed(3) }},
-             { "data": "dice", render: function ( data, type, row ) {return data.toExponential(2) }},
-             { "data": "ld", render: function ( data, type, row ) {return data.toFixed(2) }},
-             { "data": "af", render: function ( data, type, row ) {return data.toFixed(2) }},
-             { "data": "delta", render: function ( data, type, row ) {return data.toFixed(2) }},
+             { "data": "npmi", render: function ( data, type, row ) {return toFixed(data, 3) }},
+             { "data": "dice", render: function ( data, type, row ) {return toExponential(data, 2) }},
+             { "data": "ld", render: function ( data, type, row ) {return toFixed(data, 2) }},
+             { "data": "af", render: function ( data, type, row ) {return toFixed(data, 2) }},
+             { "data": "delta", render: function ( data, type, row ) {return toFixed(data, 2) }},
              { "data": "afwin", width: "auto", sClass: "dt-center mono compact", render: function ( data, type, row ) {return bitmask2window(data, row.win) }},
-             { "data": "llfmd", render: function ( data, type, row ) {return data.toFixed(1) }},
-             { "data": "rlfmd", render: function ( data, type, row ) {return data.toFixed(1) }},
-             { "data": "lnpmi", render: function ( data, type, row ) {return data.toFixed(2) }},
-             { "data": "rnpmi", render: function ( data, type, row ) {return data.toFixed(2) }},
+             { "data": "llfmd", render: function ( data, type, row ) {return toFixed(data, 1) }},
+             { "data": "rlfmd", render: function ( data, type, row ) {return toFixed(data, 1) }},
+             { "data": "lnpmi", render: function ( data, type, row ) {return toFixed(data, 2) }},
+             { "data": "rnpmi", render: function ( data, type, row ) {return toFixed(data, 2) }},
              { "data": "f" },
              { "data": "word",  sClass: "collocator" }
            ],