-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
better operator definitions for largest unsigned integer #180
Comments
Maybe we should more generally treat unsigned integers as slightly less arithmetic types than signed integers. They really have limited applicability, so it seems acceptable to limit their functionality somewhat. |
LLVM has +, -, and * that can detect overflow efficiently. |
Oh, that's pretty awesome. Should we throw an error on overflow then? |
We need to decide whether the promotion type should switch to Uint64 or stay as Int64, then add logic to give an error if the result would not be representable. Unfortunately I don't think this is the same as detecting overflow. If Comparisons also need a new approach. |
I feel like we should punt on this for v1.0, although of course this isn't marked as a v1.0 issue. |
Yeah, posting "wrong answers" like the ones I wrote always seems scary, but the fact is we always get the right answer as long as the Uint64s involved are |
Here's something a little strange: julia> -x julia> x = zeros(Uint8,5) julia> for i = 1:5; x[i] = i-1; end julia> -x Note that a scalar gets promoted to Uint64, while the vector of Uint8 does not. |
Actually the promotion happens both times, but it gets converted to |
OK, thanks. Just thought I'd bring it to your attention in case it was a --Tim |
Stdlib: Tar URL: https://github.com/JuliaIO/Tar.jl.git Stdlib branch: master Julia branch: master Old commit: 81888a3 New commit: 1114260 Julia version: 1.12.0-DEV Tar version: 1.10.0(Does not match) Bump invoked by: @StefanKarpinski Powered by: [BumpStdlibs.jl](https://github.com/JuliaLang/BumpStdlibs.jl) Diff: JuliaIO/Tar.jl@81888a3...1114260 ``` $ git log --oneline 81888a3..1114260 1114260 Accept other string types for all string arguments (fix #179) (#180) a2e39d6 Bump julia-actions/cache from 1 to 2 (#178) 152d12e Bump julia-actions/setup-julia from 1 to 2 (#177) 5012536 Fix Codecov (#176) 9b5460b Add `public` declarations using `eval` (#175) 4e9d73a Add docstring for Tar module (#173) 38a4bf4 Bump codecov/codecov-action from 3 to 4 (#172) 166deb3 [CI] Switch to `julia-actions/cache` (#171) d0085d8 Hardcode doc edit backlink (#164) 7e83ed7 [NFC] fix some wonky formatting (#168) 6269b5b Bump actions/checkout from 3 to 4 (#163) ``` Co-authored-by: Dilum Aluthge <dilum@aluthge.com>
Stdlib: Tar URL: https://github.com/JuliaIO/Tar.jl.git Stdlib branch: master Julia branch: master Old commit: 81888a3 New commit: 1114260 Julia version: 1.12.0-DEV Tar version: 1.10.0(Does not match) Bump invoked by: @StefanKarpinski Powered by: [BumpStdlibs.jl](https://github.com/JuliaLang/BumpStdlibs.jl) Diff: JuliaIO/Tar.jl@81888a3...1114260 ``` $ git log --oneline 81888a3..1114260 1114260 Accept other string types for all string arguments (fix JuliaLang#179) (JuliaLang#180) a2e39d6 Bump julia-actions/cache from 1 to 2 (JuliaLang#178) 152d12e Bump julia-actions/setup-julia from 1 to 2 (JuliaLang#177) 5012536 Fix Codecov (JuliaLang#176) 9b5460b Add `public` declarations using `eval` (JuliaLang#175) 4e9d73a Add docstring for Tar module (JuliaLang#173) 38a4bf4 Bump codecov/codecov-action from 3 to 4 (JuliaLang#172) 166deb3 [CI] Switch to `julia-actions/cache` (JuliaLang#171) d0085d8 Hardcode doc edit backlink (JuliaLang#164) 7e83ed7 [NFC] fix some wonky formatting (JuliaLang#168) 6269b5b Bump actions/checkout from 3 to 4 (JuliaLang#163) ``` Co-authored-by: Dilum Aluthge <dilum@aluthge.com>
Currently we get:
For these cases it would probably be better to give the right answer if representable and an error otherwise.
I believe the only problematic cases involve combining
Uint64
with signed integers.The text was updated successfully, but these errors were encountered: