Avoid precision problems in TR tests.

This commit is contained in:
Vincent St-Amour 2014-04-24 10:48:07 -04:00
parent 842137fc29
commit d30546cb7d
2 changed files with 84 additions and 76 deletions

View File

@ -1,13 +1,13 @@
#;#;
#<<END
TR missed opt: expt.rkt 13:5 (expt -2.0 0.5) -- unexpected complex type
TR missed opt: expt.rkt 6:13 (expt (sin 0.25) 1.0) -- unexpected complex type
TR missed opt: expt.rkt 9:0 (expt -2.0 0.5) -- unexpected complex type
TR opt: expt.rkt 12:5 (expt 2.0 3.0) -- binary float
TR opt: expt.rkt 6:19 (sin 0.25) -- unary float
TR opt: expt.rkt 8:0 (expt 2.0 3.0) -- binary float
END
#<<END
8.0
8.659560562354934e-17+1.4142135623730951i
"8.00000"
"0.00000"
END
#lang typed/racket
@ -19,5 +19,9 @@ END
(define (crash)
(real-part (expt (sin 0.25) 1.0)))
(expt 2.0 3.0)
(expt -2.0 0.5) ; not a valid optimization, returns a complex
;; to avoid machine-specific precision issues
(: out : Number -> String)
(define (out v) (real->decimal-string (real-part v) 5))
(out (expt 2.0 3.0))
(out (expt -2.0 0.5)) ; not a valid optimization, returns a complex

View File

@ -1,41 +1,41 @@
#;#;
#<<END
TR opt: extflonums.rkt 10:0 (extfl> 1.0t0 1.0t0) -- binary extflonum
TR opt: extflonums.rkt 11:0 (extfl<= 1.0t0 1.0t0) -- binary extflonum
TR opt: extflonums.rkt 12:0 (extfl>= 1.0t0 1.0t0) -- binary extflonum
TR opt: extflonums.rkt 13:0 (extflmin 1.0t0 1.0t0) -- binary extflonum
TR opt: extflonums.rkt 14:0 (extflmax 1.0t0 1.0t0) -- binary extflonum
TR opt: extflonums.rkt 15:0 (extflexpt 1.0t0 1.0t0) -- binary extflonum
TR opt: extflonums.rkt 17:0 (extflabs 1.0t0) -- unary extflonum
TR opt: extflonums.rkt 18:0 (extflround 1.0t0) -- unary extflonum
TR opt: extflonums.rkt 19:0 (extflfloor 1.0t0) -- unary extflonum
TR opt: extflonums.rkt 20:0 (extflceiling 1.0t0) -- unary extflonum
TR opt: extflonums.rkt 21:0 (extfltruncate 1.0t0) -- unary extflonum
TR opt: extflonums.rkt 22:0 (extflsin 1.0t0) -- unary extflonum
TR opt: extflonums.rkt 23:0 (extflcos 1.0t0) -- unary extflonum
TR opt: extflonums.rkt 24:0 (extfltan 1.0t0) -- unary extflonum
TR opt: extflonums.rkt 25:0 (extflasin 1.0t0) -- unary extflonum
TR opt: extflonums.rkt 26:0 (extflacos 1.0t0) -- unary extflonum
TR opt: extflonums.rkt 27:0 (extflatan 1.0t0) -- unary extflonum
TR opt: extflonums.rkt 28:0 (extfllog 1.0t0) -- unary extflonum
TR opt: extflonums.rkt 29:0 (extflexp 1.0t0) -- unary extflonum
TR opt: extflonums.rkt 30:0 (extflsqrt 1.0t0) -- unary extflonum
TR opt: extflonums.rkt 32:0 (->extfl (bitwise-and 1 2)) -- fixnum to extflonum conversion
TR opt: extflonums.rkt 32:9 (bitwise-and 1 2) -- binary fixnum
TR opt: extflonums.rkt 33:0 (real->extfl (bitwise-and 1 2)) -- fixnum to extflonum conversion
TR opt: extflonums.rkt 33:13 (bitwise-and 1 2) -- binary fixnum
TR opt: extflonums.rkt 4:0 (extfl+ 1.0t0 1.0t0) -- binary extflonum
TR opt: extflonums.rkt 5:0 (extfl- 1.0t0 1.0t0) -- binary extflonum
TR opt: extflonums.rkt 6:0 (extfl* 1.0t0 1.0t0) -- binary extflonum
TR opt: extflonums.rkt 7:0 (extfl/ 1.0t0 1.0t0) -- binary extflonum
TR opt: extflonums.rkt 8:0 (extfl= 1.0t0 1.0t0) -- binary extflonum
TR opt: extflonums.rkt 9:0 (extfl< 1.0t0 1.0t0) -- binary extflonum
TR opt: extflonums.rkt 10:5 (extfl* 1.0t0 1.0t0) -- binary extflonum
TR opt: extflonums.rkt 11:5 (extfl/ 1.0t0 1.0t0) -- binary extflonum
TR opt: extflonums.rkt 12:0 (extfl= 1.0t0 1.0t0) -- binary extflonum
TR opt: extflonums.rkt 13:0 (extfl< 1.0t0 1.0t0) -- binary extflonum
TR opt: extflonums.rkt 14:0 (extfl> 1.0t0 1.0t0) -- binary extflonum
TR opt: extflonums.rkt 15:0 (extfl<= 1.0t0 1.0t0) -- binary extflonum
TR opt: extflonums.rkt 16:0 (extfl>= 1.0t0 1.0t0) -- binary extflonum
TR opt: extflonums.rkt 17:0 (extflmin 1.0t0 1.0t0) -- binary extflonum
TR opt: extflonums.rkt 18:0 (extflmax 1.0t0 1.0t0) -- binary extflonum
TR opt: extflonums.rkt 19:0 (extflexpt 1.0t0 1.0t0) -- binary extflonum
TR opt: extflonums.rkt 21:5 (extflabs 1.0t0) -- unary extflonum
TR opt: extflonums.rkt 22:5 (extflround 1.0t0) -- unary extflonum
TR opt: extflonums.rkt 23:5 (extflfloor 1.0t0) -- unary extflonum
TR opt: extflonums.rkt 24:5 (extflceiling 1.0t0) -- unary extflonum
TR opt: extflonums.rkt 25:5 (extfltruncate 1.0t0) -- unary extflonum
TR opt: extflonums.rkt 26:5 (extflsin 1.0t0) -- unary extflonum
TR opt: extflonums.rkt 27:5 (extflcos 1.0t0) -- unary extflonum
TR opt: extflonums.rkt 28:5 (extfltan 1.0t0) -- unary extflonum
TR opt: extflonums.rkt 29:5 (extflasin 1.0t0) -- unary extflonum
TR opt: extflonums.rkt 30:5 (extflacos 1.0t0) -- unary extflonum
TR opt: extflonums.rkt 31:5 (extflatan 1.0t0) -- unary extflonum
TR opt: extflonums.rkt 32:5 (extfllog 1.0t0) -- unary extflonum
TR opt: extflonums.rkt 33:5 (extflexp 1.0t0) -- unary extflonum
TR opt: extflonums.rkt 34:5 (extflsqrt 1.0t0) -- unary extflonum
TR opt: extflonums.rkt 36:14 (bitwise-and 1 2) -- binary fixnum
TR opt: extflonums.rkt 36:5 (->extfl (bitwise-and 1 2)) -- fixnum to extflonum conversion
TR opt: extflonums.rkt 37:18 (bitwise-and 1 2) -- binary fixnum
TR opt: extflonums.rkt 37:5 (real->extfl (bitwise-and 1 2)) -- fixnum to extflonum conversion
TR opt: extflonums.rkt 8:5 (extfl+ 1.0t0 1.0t0) -- binary extflonum
TR opt: extflonums.rkt 9:5 (extfl- 1.0t0 1.0t0) -- binary extflonum
END
#<<END
2.0t0
0.0t0
1.0t0
1.0t0
"2.00000"
"0.00000"
"1.00000"
"1.00000"
#t
#f
#f
@ -44,22 +44,22 @@ END
1.0t0
1.0t0
1.0t0
1.0t0
1.0t0
1.0t0
1.0t0
1.0t0
0.84147098480789650666t0
0.5403023058681397174t0
1.5574077246549022306t0
1.5707963267948966193t0
0.0t0
0.78539816339744830963t0
0.0t0
2.7182818284590452354t0
1.0t0
0.0t0
0.0t0
"1.00000"
"1.00000"
"1.00000"
"1.00000"
"1.00000"
"0.84147"
"0.54030"
"1.55741"
"1.57080"
"0.00000"
"0.78540"
"0.00000"
"2.71828"
"1.00000"
"0.00000"
"0.00000"
END
@ -68,10 +68,14 @@ END
(require racket/extflonum)
(extfl+ 1.0t0 1.0t0)
(extfl- 1.0t0 1.0t0)
(extfl* 1.0t0 1.0t0)
(extfl/ 1.0t0 1.0t0)
;; to avoid machine-specific precision issues
(: out : ExtFlonum -> String)
(define (out v) (real->decimal-string (extfl->inexact v) 5))
(out (extfl+ 1.0t0 1.0t0))
(out (extfl- 1.0t0 1.0t0))
(out (extfl* 1.0t0 1.0t0))
(out (extfl/ 1.0t0 1.0t0))
(extfl= 1.0t0 1.0t0)
(extfl< 1.0t0 1.0t0)
(extfl> 1.0t0 1.0t0)
@ -81,20 +85,20 @@ END
(extflmax 1.0t0 1.0t0)
(extflexpt 1.0t0 1.0t0)
(extflabs 1.0t0)
(extflround 1.0t0)
(extflfloor 1.0t0)
(extflceiling 1.0t0)
(extfltruncate 1.0t0)
(extflsin 1.0t0)
(extflcos 1.0t0)
(extfltan 1.0t0)
(extflasin 1.0t0)
(extflacos 1.0t0)
(extflatan 1.0t0)
(extfllog 1.0t0)
(extflexp 1.0t0)
(extflsqrt 1.0t0)
(out (extflabs 1.0t0))
(out (extflround 1.0t0))
(out (extflfloor 1.0t0))
(out (extflceiling 1.0t0))
(out (extfltruncate 1.0t0))
(out (extflsin 1.0t0))
(out (extflcos 1.0t0))
(out (extfltan 1.0t0))
(out (extflasin 1.0t0))
(out (extflacos 1.0t0))
(out (extflatan 1.0t0))
(out (extfllog 1.0t0))
(out (extflexp 1.0t0))
(out (extflsqrt 1.0t0))
(->extfl (bitwise-and 1 2))
(real->extfl (bitwise-and 1 2))
(out (->extfl (bitwise-and 1 2)))
(out (real->extfl (bitwise-and 1 2)))