Function to Fetch the number with two decimal points without rounding the number.





     /**
         * @description function to fetch the number with two decimal point with out   rounding the number
         * @param {number} number - input number for setting the two decimal point
         * @param {number} fixed - number up to decimal place we want to set the number.
         * @return number
         */
        function toFixed(num, fixed) {
            try {

                var re = new RegExp('^-?\\d+(?:\.\\d{0,' + (fixed || -1) + '})?');
                return num.toString().match(re)[0];
            } catch (e) {
                log.debug("error @ precesion function", e);
                return false;
            }
        }

Leave a comment

Your email address will not be published. Required fields are marked *