Improve overflow error message#214
Merged
kimikage merged 1 commit intoJuliaMath:masterfrom Aug 15, 2020
Merged
Conversation
This displays the fixed point type of the input in the message, not the rawtype.
This also avoids the stall with `checked_{add/sub}` on Windows.
kimikage
commented
Aug 15, 2020
| @test all(x -> saturating_neg(x) == clamp(fneg(x), F), xs) | ||
| @test all(x -> !(typemin(F) < fneg(x) < typemax(F)) || | ||
| @test all(x -> saturating_neg(x) === clamp(fneg(x), F), xs) | ||
| @test all(x -> !(typemin(F) <= fneg(x) <= typemax(F)) || |
Collaborator
Author
There was a problem hiding this comment.
I had excluded typemin and typemax with the intention of writing generic code for 100% testing. They have a risk of causing inconsistencies due to the rounding errors in floating point operations.
However, I decided against supporting non-8-bit types in 100% tests for multiplication. So we can safely include typemin and typemax for 8-bit types.
Codecov Report
@@ Coverage Diff @@
## master #214 +/- ##
==========================================
+ Coverage 88.24% 88.48% +0.23%
==========================================
Files 6 6
Lines 485 495 +10
==========================================
+ Hits 428 438 +10
Misses 57 57
Continue to review full report at Codecov.
|
kimikage
added a commit
to kimikage/FixedPointNumbers.jl
that referenced
this pull request
May 1, 2024
This displays the fixed point type of the input in the message, not the rawtype.
kimikage
added a commit
to kimikage/FixedPointNumbers.jl
that referenced
this pull request
May 1, 2024
This displays the fixed point type of the input in the message, not the rawtype.
kimikage
added a commit
to kimikage/FixedPointNumbers.jl
that referenced
this pull request
May 1, 2024
This displays the fixed point type of the input in the message, not the rawtype.
kimikage
added a commit
to kimikage/FixedPointNumbers.jl
that referenced
this pull request
May 1, 2024
This displays the fixed point type of the input in the message, not the rawtype.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This displays the fixed point type of the input in the message, not the rawtype. (cf. #190 (comment))
Of course, more information could be added to the error message, but I think the error message in the constructor is sufficient to supplement it.
This also avoids the stall with
checked_{add/sub}on Windows. (cf. #190 (comment)) TBH, this is the real purpose of this PR. 😅