Fixes round-off error in sqrt.

This commit is contained in:
Abdulaziz Ghuloum 2008-01-12 21:05:26 -05:00
parent d9cdcb8959
commit f7dcbe87c6
2 changed files with 8 additions and 2 deletions

View File

@ -1914,7 +1914,13 @@
(let ([v (sqrt (inexact x))])
;;; could the [dropped] residual ever affect the answer?
(cond
[(infinite? v) (inexact s)]
[(infinite? v)
(if (bignum? s)
(foreign-call "ikrt_bignum_to_flonum"
s
1 ;;; round up in case of a tie
($make-flonum))
(inexact s))]
[else v]))]))]
[(ratnum? x)
;;; FIXME: incorrect as per bug 180170

View File

@ -1 +1 @@
1339
1340