1. Math.floor &math.ceiling (floor--; ceiling--) Math.floor: Returns the maximum integer value that is less than or equal to the specified decimal. Math.floor (3.21);//3Math.floor (5.952);//5Math.floor (0.64);//0Math.floor (-0.64);//-1Math.floor (-5.2);//-6Math.floor (-5.8);//-6math.ceiling: Returns the smallest integer value greater than or equal to the specified decimal. Math.ceiling (3.21);//4Math.ceiling (5.952);//6Math.ceiling (0.64);//1Math.ceiling (-0.64);//0Math.ceiling (-5.2);//-5Math.ceiling (-5.8);//-5Note: The return type is double or decimal. 2. Math.truncate Rounding/truncation Effect: Calculates the integer portion of the specified decimal. Example: Math.truncate (3.21);//3Math.truncate (5.952);//5Math.truncate (0.64);//0Math.truncate (-0.64);//0Math.truncate (-5.2);//-5Math.truncate (-5.8);//-5Note: The return type is double or decimal. 3. Math.Round Rounding Effect: Math.Round takes the same rounding method as Convert.ToInt32 (Double), and is used bankers'rounding rules (four homes six into 50% pairs)Example: Math.Round (3.21);//3Math.Round (5.5);//6Math.Round (4.5);//4Math.Round (-0.64);//-1Math.Round (-5.5);//-6Math.Round (-4.5);//-4decimal Trade-offs: Math.Round (Double, Int32), where Int32 specifies the number of decimal places for the return value. Example: Math.Round (3.44,1);//Returns 3.4.Math.Round (3.45,1);//Returns 3.4.Math.Round (3.46,1);//Returns 3.5.Math.Round (4.34,1);//Returns 4.3Math.Round (4.35,1);//Returns 4.4Math.Round (4.36,1);//Returns 4.4pasted from//msdn.microsoft.com/zh-cn/library/zy06z30k.aspx>extension: The function by default is according to bankers'The rounding rule (quad six into 50% pairs) is rounded. To allow for more flexible rounding, the function adds the system.midpointrounding parameter. Midpointrounding.awayfromzero: In positive cases, this is the most common rounding. In the case of negative numbers,-4.5--5。 (Negative case,-4.5 Rounding is-4 or-5, everyone has different opinions). Midpointrounding.toeven: Is the default four six into 50% pairs.
Transfer from http://blog.sina.com.cn/s/blog_6d5a77ce0100xpcb.html
The trade-offs of decimals