与简单的算术失败的合同 [英] Failing contract with simple arithmatic
问题描述
静态检查是否有理由抛出以下合同的警告:
Is there some reason why the static check throws warnings for the following contract: 嗨Alan, 问题在于双打。静态检查器具有有限的推理能力和双打(它基本上跟踪简单的间隔),在你的例子中这还不够。 the problem is with doubles. The static checker has a limited reasoning capability with doubles (it essentially tracks simple intervals), and in your example this is not enough. 我们正在努力增加对浮点表达式的支持。 We are working to increase the support of floating point expressions. 谢谢 f 这篇关于与简单的算术失败的合同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
Contract.Ensures(Contract.Result<double>() >= minimumValue);
Contract.Ensures(Contract.Result<double>() <= maximumValue);
return minimumValue + (0.5 * (maximumValue - minimumValue);
谢谢
推荐答案