-
Notifications
You must be signed in to change notification settings - Fork 33
Add checked, wrapping and saturating arithmetic for div/cld/fld #226
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
Conversation
The default arithmetic for `div` is still checked arithmetic. This changes the error type for overflow from `DivideError` to `OverflowError`. This also adds the support for `cld` and 3-arg `div`.
Codecov Report
@@ Coverage Diff @@
## master #226 +/- ##
==========================================
+ Coverage 95.19% 95.42% +0.22%
==========================================
Files 6 6
Lines 645 677 +32
==========================================
+ Hits 614 646 +32
Misses 31 31
Continue to review full report at Codecov.
|
BenchmarkSee #222 (comment) for detail of variables. for op in (div, fld)
@btime $op.($z_q0f7 , $w_q0f7 );
@btime $op.($z_q0f15, $w_q0f15);
@btime $op.($z_q3f4 , $w_q3f4 );
@btime $op.($z_q3f12, $w_q3f12);
@btime $op.($z_n0f8 , $w_n0f8 );
@btime $op.($z_n0f16, $w_n0f16);
@btime $op.($z_n4f4 , $w_n4f4 );
@btime $op.($z_n4f12, $w_n4f12);
end @btime wrapping_div.($x_q0f7 , $y_q0f7 );
@btime wrapping_fld.($x_q0f7 , $y_q0f7 );
@btime wrapping_cld.($x_q0f7 , $y_q0f7 );
@btime wrapping_div.($x_q0f15, $y_q0f15);
@btime wrapping_div.($x_q3f4 , $y_q3f4 );
@btime wrapping_div.($x_q3f12, $y_q3f12);
@btime wrapping_div.($x_n0f8 , $y_n0f8 );
@btime wrapping_fld.($x_n0f8 , $y_n0f8 );
@btime wrapping_cld.($x_n0f8 , $y_n0f8 );
@btime wrapping_div.($x_n0f16, $y_n0f16);
@btime wrapping_div.($x_n4f4 , $y_n4f4 );
@btime wrapping_div.($x_n4f12, $y_n4f12);
@btime saturating_div.($x_q0f7 , $y_q0f7 );
@btime saturating_fld.($x_q0f7 , $y_q0f7 );
@btime saturating_cld.($x_q0f7 , $y_q0f7 );
@btime saturating_div.($x_q0f15, $y_q0f15);
@btime saturating_div.($x_q3f4 , $y_q3f4 );
@btime saturating_div.($x_q3f12, $y_q3f12);
@btime saturating_div.($x_n0f8 , $y_n0f8 );
@btime saturating_fld.($x_n0f8 , $y_n0f8 );
@btime saturating_cld.($x_n0f8 , $y_n0f8 );
@btime saturating_div.($x_n0f16, $y_n0f16);
@btime saturating_div.($x_n4f4 , $y_n4f4 );
@btime saturating_div.($x_n4f12, $y_n4f12);
|
Fixed |
before | after | Normed |
before | after | |
---|---|---|---|---|---|---|
(z_q0f7 , w_q0f7 ) |
2.019 ms | 1.541 ms | (z_n0f8 , w_n0f8 ) |
1.793 ms | 1.321 ms | |
(z_q0f15, w_q0f15) |
3.085 ms | 2.173 ms | (z_n0f16, w_n0f16) |
2.427 ms | 1.932 ms | |
(z_q3f4 , w_q3f4 ) |
2.019 ms | 1.544 ms | (z_n4f4 , w_n4f4 ) |
1.791 ms | 1.291 ms | |
(z_q3f12, w_q3f12) |
3.320 ms | 2.428 ms | (z_n4f12, w_n4f12) |
2.423 ms | 2.228 ms |
fld
(checked_fld
)
Fixed |
before | after | Normed |
before | after | |
---|---|---|---|---|---|---|
(z_q0f7 , w_q0f7 ) |
3.363 ms | 1.540 ms | (z_n0f8 , w_n0f8 ) |
1.793 ms | 1.327 ms | |
(z_q0f15, w_q0f15) |
3.989 ms | 2.194 ms | (z_n0f16, w_n0f16) |
2.431 ms | 1.967 ms | |
(z_q3f4 , w_q3f4 ) |
3.356 ms | 1.544 ms | (z_n4f4 , w_n4f4 ) |
1.795 ms | 1.312 ms | |
(z_q3f12, w_q3f12) |
4.030 ms | 2.227 ms | (z_n4f12, w_n4f12) |
2.434 ms | 2.164 ms |
wrapping_*
Fixed |
Normed |
||||
---|---|---|---|---|---|
wrapping_div. |
(x_q0f7 , y_q0f7 ) |
496.4 μs | (x_n0f8 , y_n0f8 ) |
323.1 μs | |
wrapping_fld. |
(x_q0f7 , y_q0f7 ) |
496.1 μs | (x_n0f8 , y_n0f8 ) |
309.3 μs | |
wrapping_cld. |
(x_q0f7 , y_q0f7 ) |
496.6 μs | (x_n0f8 , y_n0f8 ) |
309.0 μs | |
wrapping_div. |
(x_q0f15, y_q0f15) |
1.054 ms | (x_n0f16, y_n0f16) |
909.5 μs | |
wrapping_div. |
(x_q3f4 , y_q3f4 ) |
496.4 μs | (x_n4f4 , y_n4f4 ) |
309.9 μs | |
wrapping_div. |
(x_q3f12, y_q3f12) |
1.105 ms | (x_n4f12, y_n4f12) |
869.3 μs |
saturating_*
Fixed |
Normed |
||||
---|---|---|---|---|---|
saturating_div. |
(x_q0f7 , y_q0f7 ) |
319.8 μs | (x_n0f8 , y_n0f8 ) |
489.3 μs | |
saturating_fld. |
(x_q0f7 , y_q0f7 ) |
319.7 μs | (x_n0f8 , y_n0f8 ) |
485.4 μs | |
saturating_cld. |
(x_q0f7 , y_q0f7 ) |
320.2 μs | (x_n0f8 , y_n0f8 ) |
485.7 μs | |
saturating_div. |
(x_q0f15, y_q0f15) |
936.1 μs | (x_n0f16, y_n0f16) |
1.014 ms | |
saturating_div. |
(x_q3f4 , y_q3f4 ) |
319.8 μs | (x_n4f4 , y_n4f4 ) |
485.5 μs | |
saturating_div. |
(x_q3f12, y_q3f12) |
973.9 μs | (x_n4f12, y_n4f12) |
967.2 μs |
I'm going to move on to the implementation of Probably most people are not interested in the division as I'm not interested in it.:joy: |
…or div/cld/fld (JuliaMath#226)" The wrapping and saturating `div`/`cld`/`fld` are not backported. The default arithmetic for `div` is still checked arithmetic. This changes the error type for overflow from `DivideError` to `OverflowError`. This also adds the support for `cld` and 3-arg `div`.
…or div/cld/fld (JuliaMath#226)" The wrapping and saturating `div`/`cld`/`fld` are not backported. The default arithmetic for `div` is still checked arithmetic. This changes the error type for overflow from `DivideError` to `OverflowError`. This also adds the support for `cld` and 3-arg `div`.
The default arithmetic for
div
is still checked arithmetic.This changes the error type for overflow from
DivideError
toOverflowError
.This also adds the support for
cld
and 3-argdiv
.