You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In some code I'm writing I have to compare two creals. The code I'm using is the following:
(defun =r (a b precision)
(let ((a (approx-r a precision))
(b (approx-r b precision)))
(unless (= a b) (break))
(= a b)))
For some values, I end up in the debugger (with the break) but what is strange to me is that the backtrace (in sbcl BTW) shows me the following values for a and b:
Ok, it seems to come from the fact that creal-print itself sets the creal precision to a much higher value then the one I have get with both approx-r calls.
For instance, the following works:
(defun =r (a b precision)
(approx-r a (+ precision 9))
(approx-r b (+ precision 9))
(let ((a (approx-r a precision))
(b (approx-r b precision)))
(unless (= a b) (break))
(= a b)))
Maybe it should be something that is handled in get-approx directly… don't know?
Hi,
In some code I'm writing I have to compare two creals. The code I'm using is the following:
For some values, I end up in the debugger (with the
break
) but what is strange to me is that the backtrace (in sbcl BTW) shows me the following values fora
andb
:So the printed representation of creals
a
andb
seems to be the same up to the 19th decimal but their(approx-r x 17)
are different.I don't really understand creals internal representation so I don't know how to proceed from here.
The text was updated successfully, but these errors were encountered: