The simple floating-point number types in Java float and double are not capable of operation. It's not just Java, it's also a problem in many other programming languages.What will we see if we compile and run the following program?public class Test {
In dealing with some of the data, we want to be able to use the "rounding" method, but C # uses the "four six into 50% pairs" method, such as the following example, is the "four six into 50% pairs" results obtained:Double D1 = Math.Round (1.25, 1);//
PHP takes integer functions commonly used in four ways:
1. Direct rounding, discarding decimals, preserving integers: intval ();2 Rounding and Rounding: round ();3. Rounding up, there are decimals on the addition of 1:ceil ();4. Rounding Down:
PHP takes integer functions commonly used four methods, the following collection of four functions, often used to take the whole function, a small sum today! Actually very simple, is just a few functions ~ ~ mainly: Ceil,floor,round,intval
PHP
Reprint Source: HTTP://BLOG.CSDN.NET/YF210YF
Matlab takes the whole function: fix, floor, ceil, round. The rounding function is useful in programming. First, take the whole function 1. To 0 rounding (truncated rounding)
fix-to 0 rounding (Round
PHP takes integer functions commonly used in four ways:1. Direct rounding, discarding decimals, preserving integers: intval ();2 Rounding and Rounding: round ();3. Rounding up, there are decimals on the addition of 1:ceil ();4. Rounding Down: Floor (
PHP takes integer functions commonly used four methods, the following collection of four functions, often used to take the whole function, a small sum today! Actually very simple, is just a few functions ~ ~ mainly:Ceil, Floor,round,intvalPHP Four
This article mainly introduces the PHP division operations rounded rounding, up rounding, down rounding, the use of fractional interception, has a certain reference value, now share to everyone, there is a need for friends can refer to
PHP takes
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.