简体   繁体   English

MiniZinc中的最小和最大浮点值

[英]Minimum and Maximum float value in MiniZinc

From the MiniZinc specification : 根据MiniZinc 规范

Floats represent real numbers. 浮点数代表实数。 Float representations are implementation-defined. 浮点表示法是实现定义的。 This means that the representable range and precision of floats is implementation-defined. 这意味着浮点数的可表示范围和精度是实现定义的。 However, an implementation should abort at run-time on exceptional float operations (eg, those that produce NaN, if using IEEE754 floats). 但是,实现应在运行时中止特殊的浮点操作(例如,如果使用IEEE754浮点,则产生NaN的操作)中止。

What does it means that Float representations are implementation-defined ? Float表示是实现定义的 ,这意味着什么? Does it depends on the solver which will be used? 是否取决于要使用的求解器?

And how the Float representation is handled by the mzn2fzn tool? 以及mzn2fzn工具如何处理Float表示形式? Which are its bound? 它的界限是什么?

MiniZinc tries to adhere to the IEEE standard. MiniZinc尝试遵守IEEE标准。 The compiler itself (the minizinc driver or its older brother mzn2fzn ) adheres to this standard, as far as my knowledge goes. 就我所知,编译器本身( minizinc驱动程序或其较老的兄弟mzn2fzn )遵守此标准。 Internally the compiler uses a 64 bit precision for its floating point values. 在内部,编译器对其浮点值使用64位精度。 If there are any problems where the compiler does not adhere to these standards, I would encourage you to report them. 如果存在任何编译器不遵守这些标准的问题,我建议您报告这些问题。

The standards for the solvers are a different matter. 求解器的标准是另一回事。 MiniZinc only enforces minimal control over the solvers. MiniZinc仅对求解器实施最小的控制。 If you want to ensure they employ the correct standards you will have to verify with the manufacturer of the solver. 如果要确保他们采用正确的标准,则必须与求解器的制造商进行验证。 This is why the specification says it is implementation-defined , as the solver might use 32-bits, like Gecode, 64-bit, as most solvers do, or a fully different technique like an interval library. 这就是为什么规范说它是实现定义的原因 ,因为求解程序可能像大多数求解程序那样使用32位(例如Gecode),64位,或者使用完全不同的技术(例如间隔库)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM