precision issues with floating-point | WordPress.org

[ad_1]

Hello @ramanandmehta

Thank you very much for using our plugin. It is not a plugin issue or error but the Javascript engine implementation on browsers. Please look at the screenshot below. I evaluated the operation directly in the browser console:

The plugin includes the PREC operation to fix the accuracy issue on the browser.

PREC(X, Y) rounds the number X with Y decimals, and you should use it as the outermost operation in the equation.

You can edit your equation as follows:

PREC(0.0166666667 * 60, 2, true)

It must be read as follows: Rounds the result of the mathematical operation 0.0166666667 * 60 with two decimal places, and the last parameter tells the plugin not to include the decimal places (.00) if the mathematical operation returns an integer number.

Best regards.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer