fix flround on [-0.5, 0.0)

original commit: 9679b21d99477a077b226bc279a6d68ebbd7ce5b
This commit is contained in:
Matthew Flatt 2019-06-21 12:20:06 -06:00
parent 8479c4bebf
commit e11d9c846e
3 changed files with 12 additions and 3 deletions

View File

@ -2186,6 +2186,8 @@
(fl= (round 0.5000000000000001) 1.0)
(eqv? (round 0.0) 0.0)
(eqv? (round -0.0) -0.0)
(eqv? (round -0.5) -0.0)
(eqv? (round -0.6) -1.0)
)
(mat abs

View File

@ -654,6 +654,11 @@
(fl= (flround 2.5) 2.0)
(fl= (flround 0.5000000000000000) 0.0)
(fl= (flround 0.5000000000000001) 1.0)
(eqv? (flround 0.0) 0.0)
(eqv? (flround -0.0) -0.0)
(eqv? (flround 0.5) 0.0)
(eqv? (flround -0.5) -0.0)
(fl= (flround -0.5000000000000001) -1.0)
)
(mat flinteger?

View File

@ -630,9 +630,11 @@
(if (fl< x threshold+)
(fl- (fl+ x threshold+) threshold+)
x)
(if (fl> x threshold-)
(fl- (fl+ x threshold-) threshold-)
x))))
(if (fl>= x -0.5)
-0.0 ; keep negative
(if (fl> x threshold-)
(fl- (fl+ x threshold-) threshold-)
x)))))
;;; The generic comparison entries assume the fixnum case is inlined.