推荐文章

c#去除字符串中的空格,回车,换行符,制表符

c#去除字符串中的空格,回车,换行符,制表符

c#去除字符串中的空格,回车,换行符,制表符
C#监控程序启动和关闭

C#监控程序启动和关闭

C#监控程序启动和关闭using System;using System.Collections.Generic;using System.Text;using System.Diagnostics;using System.Threading;namespace ProcessListener{ class Program { static void Main(stri
C#操作USB口的摄像头

C#操作USB口的摄像头

private const uint BM_CLICK = 0xF5; 鼠标点击的消息,对于各种消息的数值,查API手册,也可用VS2010自带的SPY++ [DllImpt("user32.dll", EntryPoint = "SendMessage", SetLastErr = true, Set = Set.Auto)]private static extern int SendMe
C# FTP操作

C# FTP操作

C# FTP操作
C#文件监控对象FileSystemWatcher

C#文件监控对象FileSystemWatcher

使用C#文件监控对象FileSystemWatcher对文件夹下的删除、修改、新增

C#取整函数Math.Round、Math.Ceiling和Math.Floor

日期:2018-07-12 点击:2615 来源:PB2.CN

1.Math.Round:四舍六入五取偶
 
Math.Round(0.0) //0
Math.Round(0.1) //0
Math.Round(0.2) //0
Math.Round(0.3) //0
Math.Round(0.4) //0
Math.Round(0.5) //0
Math.Round(0.6) //1
Math.Round(0.7) //1
Math.Round(0.8) //1
Math.Round(0.9) //1
说明:对于1.5,因要返回偶数,所以结果为2。
 
2.Math.Ceiling:只要有小数都加1
 
Math.Ceiling(0.0) //0
Math.Ceiling(0.1) //1
Math.Ceiling(0.2) //1
Math.Ceiling(0.3) //1
Math.Ceiling(0.4) //1
Math.Ceiling(0.5) //1
Math.Ceiling(0.6) //1
Math.Ceiling(0.7) //1
Math.Ceiling(0.8) //1
Math.Ceiling(0.9) //1
说明:例如在分页算法中计算分页数很有用。

3.Math.Floor:总是舍去小数
 
Math.Floor(0.0) //0
Math.Floor(0.1) //0
Math.Floor(0.2) //0
Math.Floor(0.3) //0
Math.Floor(0.4) //0
Math.Floor(0.5) //0
Math.Floor(0.6) //0
Math.Floor(0.7) //0
Math.Floor(0.8) //0
Math.Floor(0.9) //0


这篇文档对您是否有帮助?

c#去除字符串中的空格,回车,换行符,制表符

c#去除字符串中的空格,回车,换行符,制表符

c#去除字符串中的空格,回车,换行符,制表符
C#监控程序启动和关闭

C#监控程序启动和关闭

C#监控程序启动和关闭using System;using System.Collections.Generic;using System.Text;using System.Diagnostics;using System.Threading;namespace ProcessListener{ class Program { static void Main(stri
C#操作USB口的摄像头

C#操作USB口的摄像头

private const uint BM_CLICK = 0xF5; 鼠标点击的消息,对于各种消息的数值,查API手册,也可用VS2010自带的SPY++ [DllImpt("user32.dll", EntryPoint = "SendMessage", SetLastErr = true, Set = Set.Auto)]private static extern int SendMe
C# FTP操作

C# FTP操作

C# FTP操作
C#文件监控对象FileSystemWatcher

C#文件监控对象FileSystemWatcher

使用C#文件监控对象FileSystemWatcher对文件夹下的删除、修改、新增