3 Replies Latest reply on Jan 22, 2014 2:47 PM by gkaiseril

    JavaScript for Three Significant Figures Rounding

    natjnelson Level 1

      I found a JavaScript that I would like to use to round the significant figures on a field:

       

      function sigFigs(n, sig) {

          var mult = Math.pow(10,

              sig - Math.floor(Math.log(n) / Math.LN10) - 1);

          return Math.round(n * mult) / mult;

      }

       

      In Properties for the field, I added the JavaScript as a Custom Calculation Script,but it does not appear to work.

       

      Any advice you can give me on what I am doing wrong would be greatly appreciated.

       

      Thanks!

      Natalie