C # math. Round () Achieves Chinese rounding
Math. Round () in C # does not use the "Rounding" method. In fact, in VB, VBScript, C #, J #, T-SQL in the round function are using banker's rounding (Banker algorithm), namely:Four Homes, six in five
Some Math object methods can implement some mathematical calculations in our textbooks. The following are commonly used methods:
1. Math. min () and Math. max () return the minimum and maximum values of the parameters respectively.
Example:
Alert
1. Math. min () and Math. max () return the minimum and maximum values of the parameters respectively. Example:Alert (Math. min (1, 2, 3) // output "1"Alert (Math. max (1, 2, 3) // output "3"2. Math. abs () returns the absolute value of the
1. Math. Min () and math. Max () return the minimum and maximum values of the parameters respectively.
Example:
Alert (math. Min (1, 2, 3) // output "1"
Alert (math. Max (1, 2, 3) // output "3"
2. Math. Abs () returns the absolute value of the
This article is the official HTML5 training course for h5edu institutions, mainly introduces: JavaScript intensive tutorial--javascript Math (Arithmetic) object The function of the Math object is: Perform common arithmetic tasks. Round () How to use
As for antipattern, you may know that its only function is to avoid reverse pattern during actual development. The main introduction in Baidu encyclopedia is as follows:
Recognized anti-pattern in software development
Anti-pattern in project
Math Object
The Math object is a built-in object that you have learned in high school math class. It knows all the formulas that solve the most complex mathematical problems, and if you give it the numbers to deal with, you can calculate the result.
PHP Math function Summary (classic worth collecting), PHP is worth collecting
This paper summarizes and analyzes the mathematical operation function of PHP. Share to everyone for your reference, as follows:
First, the common function
When processing some data, we hope to use the "Rounding" method, but C # uses the "four homes, six homes, five into two" method, as shown in the following example, the result is obtained using "four homes, six homes, and five into two:
double
When processing some data, we hope to use the "Rounding" method, but C # uses the "four homes, six homes, five into two" method, as shown in the following example, the result is obtained using "four homes, six homes, and five into two:
Code
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.