Skip to content

Relax some floating point comparisons#670

Merged
garth-wells merged 3 commits intomainfrom
garth/float-tol
May 9, 2023
Merged

Relax some floating point comparisons#670
garth-wells merged 3 commits intomainfrom
garth/float-tol

Conversation

@garth-wells
Copy link
Member

@garth-wells garth-wells commented May 5, 2023

Some checks were too tight for float32. Issues picked up in testing float support in DOLFINx.

Eventually more tested is required, but only float64 is supported via the Python interface at the moment. Test should be added once the Python interface is extended.

@garth-wells garth-wells requested a review from mscroggs May 5, 2023 08:22
@garth-wells garth-wells added the bug Something isn't working label May 5, 2023
@garth-wells garth-wells marked this pull request as ready for review May 9, 2023 06:18
{
F v = col == row ? 1.0 : 0.0;
if (std::abs(matM(row, col) - v) > 1.0e-12)
constexpr F eps = 100 * std::numeric_limits<F>::epsilon();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be 10.0 * and <float> to match the other line? Or are these intentionally different?

Copy link
Member Author

@garth-wells garth-wells May 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deliberate, but without good justification ;).

I made the previous 'looser' because it follows a LU factorisation. I thought this check could be stricter. Proper 'fix' would be to support float32 from Python and run the test suite, but we're not there yet.

@garth-wells garth-wells merged commit b082121 into main May 9, 2023
@garth-wells garth-wells deleted the garth/float-tol branch May 9, 2023 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants