ASP/VBScript - Int() 与 CInt() [英] ASP/VBScript - Int() vs CInt()

查看:12
本文介绍了ASP/VBScript - Int() 与 CInt()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Int()CInt()在ASP/VBScript中有什么区别?

What is the difference in ASP/VBScript between Int() and CInt()?

推荐答案

  • Int()
  • Int 函数返回指定数字的整数部分.

    The Int function returns the integer part of a specified number.

    • CInt()
    • CInt 函数将表达式转换为整数类型.

      The CInt function converts an expression to type Integer.

      最好的答案来自 MSDN

      CInt 与 Fix 和 Int 函数不同,后者截断而不是舍入数字的小数部分.当小数部分正好是 0.5 时,CInt 函数总是将其四舍五入到最接近的偶数.例如,0.5 轮到 0,1.5 轮到 2.

      CInt differs from the Fix and Int functions, which truncate, rather than round, the fractional part of a number. When the fractional part is exactly 0.5, the CInt function always rounds it to the nearest even number. For example, 0.5 rounds to 0, and 1.5 rounds to 2.

      这篇关于ASP/VBScript - Int() 与 CInt()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆