gpt4 book ai didi

ide - 如何在 VB6 中声明 MAX_DOUBLE?

转载 作者:行者123 更新时间:2023-12-04 14:28:03 25 4
gpt4 key购买 nike

根据 VB6 的 MSDN 帮助

Floating-point values can be expressed as mmmEeee or mmmDeee, in which mmm is the mantissa and eee is the exponent (a power of 10). The highest positive value of a Single data type is 3.402823E+38, or 3.4 times 10 to the 38th power; the highest positive value of a Double data type is 1.79769313486232D+308, or about 1.8 times 10 to the 308th power. Using D to separate the mantissa and exponent in a numeric literal causes the value to be treated as a Double data type. Likewise, using E in the same fashion treats the value as a Single data type.



现在在 VB6 IDE 中我试图输入这个
const MAX_DOUBLE as Double = 1.79769313486232D+308

但是,一旦我离开那条线,IDE 就会抛出错误 6(溢出)

An overflow results when you try to make an assignment that exceeds the limitations of the target of the assignment. ...



那么如何定义 MAX_DOUBLE(和 MIN_DOUBLE)?

最佳答案

编辑:
解决了!

Const test As Double = 1.79769313486231E+308 + 5.88768018655736E+293

仔细检查它到二进制级别,应该尽可能高。您可以继续添加 1 等值,但它会产生一个等于而不是大于的数字。
输出是这样的:
01111111|11101111|11111111|11111111|11111111|11111111|11111111|11111111
这确实是 DoubleMax

老的:
您可以使用 Positive infinity .

关于ide - 如何在 VB6 中声明 MAX_DOUBLE?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/929069/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com