源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

VBS教程:函数-Int、Fix 函数

  • 时间:2022-10-21 05:07 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:VBS教程:函数-Int、Fix 函数

Int、Fix 函数

返回数字的整数部分。 [code][b]Int([/b]number[b])[/b][/code] [code][b]Fix([/b]number[b])[/b][/code] [b]number[/b] 参数可以是任意有效的数值表达式。如果 [b]number[/b] 参数包含 Null,则返回 [b]Null[/b]。 [h3]说明[/h3][b]Int[/b] 和 [b]Fix[/b] 函数都删除 [b]number[/b] 参数的小数部分并返回以整数表示的结果。 [b]Int[/b] 和 [b]Fix[/b] 函数的区别在于如果 [b]number[/b] 参数为负数时,[b]Int[/b] 函数返回小于或等于 [b]number[/b] 的第一个负整数,而 [b]Fix[/b] 函数返回大于或等于 [b]number[/b] 参数的第一个负整数。例如,[b]Int[/b] 将 -8.4 转换为 -9,而 [b]Fix[/b] 函数将 -8.4 转换为 -8。 Fix(number) 等同于:
[code]Sgn([b]number[/b]) * [b]Int([/b]Abs([b]number[/b])[b])[/b][/code]
下面的示例说明 [b]Int[/b] 和 [b]Fix[/b] 函数如何返回数字的整数部分:
[code]MyNumber = [b]Int([/b]99.8[b])[/b]    ' [/code]返回[code] 99[/code]。[code]MyNumber = [b]Fix([/b]99.2[b])[/b]    ' [/code]返回[code] 99[/code]。[code]MyNumber = [b]Int([/b]-99.8[b])[/b]   ' [/code]返回[code] -100[/code]。[code]MyNumber = [b]Fix([/b]-99.8[b])[/b]   ' [/code]返回[code]-99[/code]。[code]MyNumber = [b]Int([/b]-99.2[b])[/b]   ' [/code]返回[code] -100[/code]。[code]MyNumber = [b]Fix([/b]-99.2[b])[/b]   ' [/code]返回[code] -99[/code]。
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部