Provide a way to disable the "Consider using a tolerance" warning when matching exact doubles
See original GitHub issueWhenever you compare two values like this: d shouldBe 0.0
you get this warning:
[WARN] When comparing doubles consider using tolerance, eg: a shouldBe b plusOrMinus c
I have a project with a lot of testcases that do indeed need exact double matches with no tolerance, and this output spamming the console for every double comparison is kind of annoying. I would appreciate if there was a way to disable that output - a possible way that goes in line with the testing syntax might be to use a syntax like this: d shouldBe exactly(0.0)
Issue Analytics
- State:
- Created 7 years ago
- Comments:19 (14 by maintainers)
Top Results From Across the Web
Comparing double values in C# - Stack Overflow
The problem with comparing a double with another value is that doubles are approximate values, not exact values. So when you set x...
Read more >all.equal: Test if Two Objects are (Nearly) Equal - Rdrr.io
S3 method for class 'numeric' all.equal(target, current, tolerance = sqrt(.Machine$double.eps), scale = NULL, countEQ = FALSE, formatFUN = function(err, ...
Read more >Data Cleaning Challenge: Deduplication - Kaggle
Today we're going to learn how to find and remove duplicate records. (Removing duplicates is called "deduplication".) Here's a quick overview of what...
Read more >Frequently Asked Questions - DifferentialEquations.jl - SciML
The simplest trick is to change the solver tolerance. Reduce abstol (and maybe reltol ) a bit. That can help reduce the error...
Read more >Bug Patterns - Error Prone
Consider using AutoAnnotation instead of implementing Annotation by hand. ... The number of arguments provided to lenient format methods should match the ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’d vote against
exactly
since it is generally not useful and perhaps misleading. And there is ==. Maybe we can have something like ScalaTest has. Or maybebetween
?I’ve pushed this out as version 1.3.2
a shouldBe exactly(b)