ide - 如何在 VB6 中声明 MAX_DOUBLE?

标签 ide vb6 constants max minimum

根据 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/

相关文章:

c++ - 类似于 Turbo C++ 的编辑器

visual-studio-2010 - DevExpress 代码缩进指南 11.2

c++ - 为什么修改IDL会导致C++项目崩溃,而VB项目不会?

c++ - 是否可以初始化 const Eigen 矩阵?

visual-studio - Visual Studio 中的哑完成

c++ - 替代 Eclipse 进行 C 和 C++ 开发?

version-control - 如何使VB6与Visual Source Safe 6.0集成?

c# - 使用来自 VB6 代码的 C# 程序集。一些问题

c++ - 字符串作为指针与数组

java - 泛型中类型参数中的常量