Calculate the percentage of two numbers in js, retain the percentage of the two digits after the decimal point, js decimal point

Source: Internet
Author: User

Calculate the percentage of two numbers in js, retain the percentage of the two digits after the decimal point, js decimal point
Function Percentage (number1, number2 ){
Return (Math. round (num/total * 10000)/100.00 + "%"); // percentage of the two digits after the decimal point

}
Two decimal digits, two decimal places, percentage

To retain two decimal places, you can first multiply 100 by an integer, and then divide the last result by 100.

Oracle: Percentage. Keep the last two digits of the decimal point. If the decimal point is not 01, or ######, write an SQL statement.

I will solve this problem, kiddie. You sent the field and the table name. I promise that. 01 will not happen. That's right. How did you calculate your percentage.
I use the decode method and then intercept the judgment method. If the first method is. 01, we add 0 in the front and connect the logic to. 01.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.