Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add checked_mul for type suffix #210

Merged
merged 1 commit into from
Aug 15, 2020

Conversation

kimikage
Copy link
Collaborator

This prevents MethodError due to lexical replacement of implicit * by macros. (cf. #190 (comment))

julia> using CheckedArithmetic

julia> @checked 1N0f8
1.0N0f8

julia> julia> @checked 1N0f8 * 0.5N0f8 # binary op. `mul`s will be gradually supported.
ERROR: MethodError: no method matching checked_mul(::Normed{UInt8,8}, ::Normed{UInt8,8})

The constructors still check the input range by default.

@codecov
Copy link

codecov bot commented Aug 13, 2020

Codecov Report

Merging #210 into master will increase coverage by 0.07%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #210      +/-   ##
==========================================
+ Coverage   88.24%   88.31%   +0.07%     
==========================================
  Files           6        6              
  Lines         485      488       +3     
==========================================
+ Hits          428      431       +3     
  Misses         57       57              
Impacted Files Coverage Δ
src/FixedPointNumbers.jl 84.52% <100.00%> (+0.28%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b7e2ae1...2a60c95. Read the comment docs.

This prevents MethodError due to lexical replacement of implicit `*` by macros.
The constructors still check the input range by default.
@kimikage kimikage merged commit 5dcaf97 into JuliaMath:master Aug 15, 2020
@kimikage kimikage deleted the checked_suffix_mul branch August 15, 2020 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant