![epsilon epsilon]()
几乎,不要滥用epsilon。您的输入值似乎是小数点后的到小数点后的4位数,所以取1e-4而不是epsilon。你需要将epsilon作为参数添加到isEqual,作为模板 参数通过一些旁路,或者在函数参数中,或硬编码 epsilon其他方式。 Bernd Strieder Almost, just don''t abuse epsilon. Your input values seem to be roundedto 4 digits after decimal point, so take 1e-4 instead of epsilon. Youwill have to add epsilon as parameter to isEqual, either as templateargument via some bypass, or in the function argument, or hardcodeepsilon some other way. Bernd Strieder 这篇关于理智检查 - 浮点比较的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-14 01:41