深入浅出ASP.NET程序设计-源代码
书籍语言: 简体中文
书籍类型: 程序设计
授权方式: 免费软件
书籍大小: 627 KB
源代码在线查看: ch12-03-01.aspx
Ch12-03-01.aspx System.Math数学类的数值运算
System.Math数学类的数值运算
Dim ValueA As Double
' 返回最大值和最小值
Response.Write("返回最大值Max(29, 64):" & Math.Max(29, 64) & "")
Response.Write("返回最小值Min(29, 64):" & Math.Min(29, 64) & "")
' 返回绝对值
ValueA = -36.5
Response.Write("返回绝对值Abs(" & ValueA & "):" & Math.Abs(ValueA) & "")
' 返回大于参数的最小值
ValueA = 3.1415926
Response.Write("返回大于Ceiling(" & ValueA & ")参数的最小值:" & Math.Ceiling(ValueA) & "")
ValueA = -3.1415926
Response.Write("返回大于Ceiling(" & ValueA & ")参数的最小值:" & Math.Ceiling(ValueA) & "")
' 返回小于参数的最大值
ValueA = 3.1415926
Response.Write("返回小于Floor(" & ValueA & ")参数的最大值:" & Math.Floor(ValueA) & "")
ValueA = -3.1415926
Response.Write("返回小于Floor(" & ValueA & ")参数的最大值:" & Math.Floor(ValueA) & "")
' 返回四舍五入的运算结果
Response.Write("返回Round(3.4)四舍五入的运算结果:" & Math.Round(3.4) & "")
Response.Write("返回Round(3.5)四舍五入的运算结果:" & Math.Round(3.5) & "")
Response.Write("返回Round(3.6)四舍五入的运算结果:" & Math.Round(3.6) & "")
Response.Write("返回Round(6.44, 1)四舍五入的运算结果:" & Math.Round(6.44, 1) & "")
Response.Write("返回Round(6.45, 1)四舍五入的运算结果:" & Math.Round(6.55, 1) & "")
Response.Write("返回Round(6.46, 1)四舍五入的运算结果:" & Math.Round(6.46, 1) & "")
%>