• VBA:Double类型与Decimal类型


    Sub DataType()
        For i = 0 To 100
            t1 = t1 + 0.1
            t2 = t2 + CDec(0.1)
            Debug.Print "Double=" & t1 & "    Decimal=" & t2
        Next
    End Sub
    结果:
    
    
    
    Double=.1    Decimal=.1
    Double=.2    Decimal=.2
    Double=.3    Decimal=.3
    Double=.4    Decimal=.4
    Double=.5    Decimal=.5
    Double=.6    Decimal=.6
    Double=.7    Decimal=.7
    Double=.8    Decimal=.8
    Double=.9    Decimal=.9
    Double=1    Decimal=1
    Double=1.1    Decimal=1.1
    Double=1.2    Decimal=1.2
    Double=1.3    Decimal=1.3
    Double=1.4    Decimal=1.4
    Double=1.5    Decimal=1.5
    Double=1.6    Decimal=1.6
    Double=1.7    Decimal=1.7
    Double=1.8    Decimal=1.8
    Double=1.9    Decimal=1.9
    Double=2    Decimal=2
    Double=2.1    Decimal=2.1
    Double=2.2    Decimal=2.2
    Double=2.3    Decimal=2.3
    Double=2.4    Decimal=2.4
    Double=2.5    Decimal=2.5
    Double=2.6    Decimal=2.6
    Double=2.7    Decimal=2.7
    Double=2.8    Decimal=2.8
    Double=2.9    Decimal=2.9
    Double=3    Decimal=3
    Double=3.1    Decimal=3.1
    Double=3.2    Decimal=3.2
    Double=3.3    Decimal=3.3
    Double=3.4    Decimal=3.4
    Double=3.5    Decimal=3.5
    Double=3.6    Decimal=3.6
    Double=3.7    Decimal=3.7
    Double=3.8    Decimal=3.8
    Double=3.9    Decimal=3.9
    Double=4    Decimal=4
    Double=4.1    Decimal=4.1
    Double=4.2    Decimal=4.2
    Double=4.3    Decimal=4.3
    Double=4.4    Decimal=4.4
    Double=4.5    Decimal=4.5
    Double=4.6    Decimal=4.6
    Double=4.7    Decimal=4.7
    Double=4.8    Decimal=4.8
    Double=4.9    Decimal=4.9
    Double=5    Decimal=5
    Double=5.1    Decimal=5.1
    Double=5.2    Decimal=5.2
    Double=5.3    Decimal=5.3
    Double=5.4    Decimal=5.4
    Double=5.5    Decimal=5.5
    Double=5.6    Decimal=5.6
    Double=5.7    Decimal=5.7
    Double=5.8    Decimal=5.8
    Double=5.9    Decimal=5.9
    Double=5.99999999999999    Decimal=6
    Double=6.09999999999999    Decimal=6.1
    Double=6.19999999999999    Decimal=6.2
    Double=6.29999999999999    Decimal=6.3
    Double=6.39999999999999    Decimal=6.4
    Double=6.49999999999999    Decimal=6.5
    Double=6.59999999999999    Decimal=6.6
    Double=6.69999999999999    Decimal=6.7
    Double=6.79999999999999    Decimal=6.8
    Double=6.89999999999999    Decimal=6.9
    Double=6.99999999999999    Decimal=7
    Double=7.09999999999999    Decimal=7.1
    Double=7.19999999999999    Decimal=7.2
    Double=7.29999999999999    Decimal=7.3
    Double=7.39999999999999    Decimal=7.4
    Double=7.49999999999999    Decimal=7.5
    Double=7.59999999999999    Decimal=7.6
    Double=7.69999999999999    Decimal=7.7
    Double=7.79999999999999    Decimal=7.8
    Double=7.89999999999999    Decimal=7.9
    Double=7.99999999999999    Decimal=8
    Double=8.09999999999999    Decimal=8.1
    Double=8.19999999999999    Decimal=8.2
    Double=8.29999999999999    Decimal=8.3
    Double=8.39999999999999    Decimal=8.4
    Double=8.49999999999999    Decimal=8.5
    Double=8.59999999999999    Decimal=8.6
    Double=8.69999999999999    Decimal=8.7
    Double=8.79999999999998    Decimal=8.8
    Double=8.89999999999998    Decimal=8.9
    Double=8.99999999999998    Decimal=9
    Double=9.09999999999998    Decimal=9.1
    Double=9.19999999999998    Decimal=9.2
    Double=9.29999999999998    Decimal=9.3
    Double=9.39999999999998    Decimal=9.4
    Double=9.49999999999998    Decimal=9.5
    Double=9.59999999999998    Decimal=9.6
    Double=9.69999999999998    Decimal=9.7
    Double=9.79999999999998    Decimal=9.8
    Double=9.89999999999998    Decimal=9.9
    Double=9.99999999999998    Decimal=10
    Double=10.1    Decimal=10.1
  • 相关阅读:
    Lombok介绍、使用方法和总结
    JSONObject.fromObject
    idea多级目录不展开的问题
    SpringBoot | 查看默认版本配置
    常见的版本号及Springcloud的版本
    Spring Boot,Spring Security实现OAuth2 + JWT认证
    OAuth2实现原理
    什么是OAuth2
    springboot 实时监控 spring-boot-starter-actuator 包
    解决springboot 新版本 2.1.6 spring-boot-starter-actuator 访问报404
  • 原文地址:https://www.cnblogs.com/zhaoshujie/p/9594704.html
Copyright © 2020-2023  润新知