Fix optimization of unary float subtraction.
Closes PR13339. original commit: 9f9092b762cb4394e04901694301a1d0750f95d7
This commit is contained in:
parent
eb40161575
commit
1501c1db01
28
collects/tests/typed-racket/succeed/pr13339.rkt
Normal file
28
collects/tests/typed-racket/succeed/pr13339.rkt
Normal file
|
@ -0,0 +1,28 @@
|
|||
#lang typed/racket
|
||||
|
||||
(require racket/flonum
|
||||
typed/rackunit)
|
||||
|
||||
(: neg (Real -> Real))
|
||||
(define (neg x) (- x))
|
||||
|
||||
(: flneg (Flonum -> Flonum))
|
||||
(define (flneg x) (fl* -1.0 x))
|
||||
|
||||
(check-eqv? (neg +inf.0) -inf.0)
|
||||
(check-eqv? (neg -inf.0) +inf.0)
|
||||
(check-eqv? (neg +nan.0) +nan.0)
|
||||
(check-eqv? (neg -0.0) +0.0)
|
||||
(check-eqv? (neg +0.0) -0.0)
|
||||
|
||||
(check-eqv? (flneg +inf.0) (neg +inf.0))
|
||||
(check-eqv? (flneg -inf.0) (neg -inf.0))
|
||||
(check-eqv? (flneg +nan.0) (neg +nan.0))
|
||||
(check-eqv? (flneg -0.0) (neg -0.0))
|
||||
(check-eqv? (flneg +0.0) (neg +0.0))
|
||||
|
||||
(check-eqv? (- +inf.0) (neg +inf.0))
|
||||
(check-eqv? (- -inf.0) (neg -inf.0))
|
||||
(check-eqv? (- +nan.0) (neg +nan.0))
|
||||
(check-eqv? (- -0.0) (neg -0.0))
|
||||
(check-eqv? (- +0.0) (neg +0.0))
|
|
@ -180,7 +180,7 @@
|
|||
#:with opt
|
||||
(begin (log-optimization "unary float" float-opt-msg this-syntax)
|
||||
(add-disappeared-use #'op)
|
||||
#'(unsafe-fl- 0.0 f.opt)))
|
||||
#'(unsafe-fl* -1.0 f.opt)))
|
||||
(pattern (#%plain-app (~and op (~literal /)) f:float-expr)
|
||||
#:with opt
|
||||
(begin (log-optimization "unary float" float-opt-msg this-syntax)
|
||||
|
|
Loading…
Reference in New Issue
Block a user