Actual fix for not suppressing divide-by-0 errors.
This commit is contained in:
parent
623a29eff4
commit
db79beaf12
|
@ -132,6 +132,21 @@
|
|||
#,(mark-as-real res-imag)) ; this case implies real
|
||||
(values (/ #,first-non-float #,second-non-float)
|
||||
0.0)]]
|
||||
[second-non-float
|
||||
;; may be dividing by exact 0, be conservative to preserve error
|
||||
;; (res-real can't be non-float, since we've hit a float, so we either
|
||||
;; error or coerce)
|
||||
#`[(#,res-real #,(if both-real?
|
||||
(mark-as-real res-imag)
|
||||
res-imag))
|
||||
;; TODO could optimize computation of `res-div` when one or the other is real
|
||||
(let-values ([(res-div)
|
||||
(/ (make-rectangular #,a
|
||||
#,(if first-arg-real? #'0 b))
|
||||
(make-rectangular #,second-non-float
|
||||
#,(if second-arg-real? #'0 d)))])
|
||||
(values (real-part res-div)
|
||||
(imag-part res-div)))]]
|
||||
[both-real?
|
||||
#`[(#,res-real #,(mark-as-real res-imag))
|
||||
(values (unsafe-fl/ #,a #,c)
|
||||
|
|
6
typed-racket-test/fail/div-0-complex2.rkt
Normal file
6
typed-racket-test/fail/div-0-complex2.rkt
Normal file
|
@ -0,0 +1,6 @@
|
|||
#;
|
||||
(exn-pred "division by zero")
|
||||
#lang typed/racket
|
||||
|
||||
;; float-complex opts should not make div-by-0 errors go away
|
||||
(* (/ 1.0+1.0i (ann 0 Integer) (ann 0 Integer)) -4.880003479031522e-08)
|
Loading…
Reference in New Issue
Block a user