Raymond Toy pushed to branch issue-175-simplify-float-compare-vops at cmucl / cmucl

Commits:

1 changed file:

Changes:

  • tests/nan.lisp
    ... ... @@ -32,7 +32,9 @@
    32 32
         (frob single-float <)
    
    33 33
         (frob single-float >)
    
    34 34
         (frob double-float <)
    
    35
    -    (frob double-float >)))
    
    35
    +    (frob double-float >)
    
    36
    +    (frob single-float =)
    
    37
    +    (frob double-float =)))
    
    36 38
     
    
    37 39
     (define-test nan-single.<
    
    38 40
         (:tag :nan)
    
    ... ... @@ -158,3 +160,50 @@
    158 160
         (assert-false (dtst->3 1d0 *double-float-nan* 3d0))
    
    159 161
         (assert-false (dtst->3 *double-float-nan* *double-float-nan* 3d0))))
    
    160 162
       
    
    163
    +(define-test nan-single.=
    
    164
    +    (:tag :nan)
    
    165
    +  ;; Basic tests with regular numbers.
    
    166
    +  (assert-true (stst-= 1f0 1f0))
    
    167
    +  (assert-false (stst-= 2f0 1f0))
    
    168
    +  (assert-false (stst-= 0f0 1f0))
    
    169
    +  ;; Tests with NaN, where = should fail.
    
    170
    +  (ext:with-float-traps-masked (:invalid)
    
    171
    +    (assert-false (stst-= *single-float-nan* 1f0))
    
    172
    +    (assert-false (stst-= 1f0 *single-float-nan*))
    
    173
    +    (assert-false (stst-= *single-float-nan* *single-float-nan*))))
    
    174
    +
    
    175
    +(define-test nan-double.=
    
    176
    +    (:tag :nan)
    
    177
    +  ;; Basic tests with regular numbers.
    
    178
    +  (assert-true (stst-= 1d0 1d0))
    
    179
    +  (assert-false (stst-= 2d0 1d0))
    
    180
    +  (assert-false (stst-= 0d0 1d0))
    
    181
    +  ;; Tests with NaN, where = should fail.
    
    182
    +  (ext:with-float-traps-masked (:invalid)
    
    183
    +    (assert-false (stst-= *double-float-nan* 1d0))
    
    184
    +    (assert-false (stst-= 1d0 *double-float-nan*))
    
    185
    +    (assert-false (stst-= *double-float-nan* *double-float-nan*))))
    
    186
    +  
    
    187
    +(define-test nan-single.=3
    
    188
    +    (:tag :nan)
    
    189
    +  ;; Basic tests with regular numbers.
    
    190
    +  (assert-true (stst-=3 1f0 1f0 1f0))
    
    191
    +  (assert-false (stst-=3 1f0 1f0 0f0))
    
    192
    +  (assert-false (stst-=3 0f0 1f0 1f0))
    
    193
    +  ;; Tests with NaN, where = should fail.
    
    194
    +  (ext:with-float-traps-masked (:invalid)
    
    195
    +    (assert-false (stst-=3 *single-float-nan* 1f0 1f0))
    
    196
    +    (assert-false (stst-=3 1f0 *single-float-nan* 1f0))
    
    197
    +    (assert-false (stst-=3 1f0 1f0 *single-float-nan*))))
    
    198
    +
    
    199
    +(define-test nan-double.=3
    
    200
    +    (:tag :nan)
    
    201
    +  ;; Basic tests with regular numbers.
    
    202
    +  (assert-true (dtst-=3 1d0 1d0 1d0))
    
    203
    +  (assert-false (dtst-=3 1d0 1d0 0d0))
    
    204
    +  (assert-false (dtst-=3 0d0 1d0 1d0))
    
    205
    +  ;; Tests with NaN, where = should fail.
    
    206
    +  (ext:with-float-traps-masked (:invalid)
    
    207
    +    (assert-false (dtst-=3 *double-float-nan* 1d0 1d0))
    
    208
    +    (assert-false (dtst-=3 1d0 *double-float-nan* 1d0))
    
    209
    +    (assert-false (dtst-=3 1d0 1d0 *double-float-nan*))))