Commit aa4cd70
Avoid silent overflow in
This change catches the overflow in
```julia
(Int8(1)//Int8(1)) / (Int8(100) + Int8(100)im)
```
instead of incorrectly returning
```julia
25//8 - 25//8*im
```
This PR removes some of the specific `/` methods that involve complex
rationals in `rational.jl`.
The default methods in `complex.jl` have better promotion rules and edge
case checking. This includes the checks added in #32050, fixing #23134
for rational numbers.
The previous dispatch to `//` ignored overflow errors (see #53435), but
would return the correct answer if the numerator was zero even if the
denominator would overflow.
---------
Co-authored-by: Neven Sajko <[email protected]>/(x::Rational, y::Complex{Int}) (#53453)1 parent 087a9e5 commit aa4cd70
2 files changed
+17
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
421 | 421 | | |
422 | 422 | | |
423 | 423 | | |
424 | | - | |
425 | | - | |
| 424 | + | |
| 425 | + | |
426 | 426 | | |
427 | 427 | | |
428 | 428 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
203 | 203 | | |
204 | 204 | | |
205 | 205 | | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
206 | 221 | | |
207 | 222 | | |
208 | 223 | | |
| |||
0 commit comments