question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Provide a way to disable the "Consider using a tolerance" warning when matching exact doubles

See original GitHub issue

Whenever 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:closed
  • Created 7 years ago
  • Comments:19 (14 by maintainers)

github_iconTop GitHub Comments

1reaction
helmboldcommented, Jul 5, 2016

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 maybe between?

1reaction
sksamuelcommented, Jul 5, 2016

I’ve pushed this out as version 1.3.2

a shouldBe exactly(b)

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found