double float computation

5 views
Skip to first unread message

Qian Yun

unread,
Jul 20, 2026, 7:37:46 AM (2 days ago) Jul 20
to fricas-devel
1. in src/lisp/primitives.lisp, there's special case for
versions earlier than ccl-1.8 (released in 2012),
shall we still keep it or remove it? (Or ban it in configure.ac.)

It is a bug to use "EQL" instead of "=" in |eql_DF|
because it fails for 0.0d0 and -0.0d0.

Also it affect my next point.

2. the implementation for sqrt/log/expt uses
"checkComplex", which is not optimized, we can do better
by checking if the argument is positive.

I'd like to do the checking at lisp level but not
repeat it twice for pre ccl-1.8.

3. for |abs_DF|, why use "FLOAT-SIGN" instead of "ABS",
it felt strange to me.

- Qian

Waldek Hebisch

unread,
Jul 21, 2026, 9:47:30 PM (17 hours ago) Jul 21
to fricas...@googlegroups.com
On Mon, Jul 20, 2026 at 07:37:40PM +0800, Qian Yun wrote:
> 1. in src/lisp/primitives.lisp, there's special case for
> versions earlier than ccl-1.8 (released in 2012),
> shall we still keep it or remove it? (Or ban it in configure.ac.)

My policy is to avoid breakage when cost of compatibility is
reasonably low, as in this case.

> It is a bug to use "EQL" instead of "=" in |eql_DF|
> because it fails for 0.0d0 and -0.0d0.

Hmm, Hyper spec says about EQL:
: 2. If x and y are both numbers of the same type and the same value.

and about '='

: The value of = is true if all numbers are the same in value;
: otherwise it is false.

I read it that if numbers are of the same type, then both should
return the same result. But '=' may perform type convertions.
So in typed system EQL looks preferable.

But if for Lisp that implements EQL incorrectly (like CCL-1.8), using
'=' is reasonable.

> Also it affect my next point.
>
> 2. the implementation for sqrt/log/expt uses
> "checkComplex", which is not optimized, we can do better
> by checking if the argument is positive.

That did not show as a big thing when I tested speed, so
I did not look much at it. I guess that in old times
some Lisp functions due to roundoff produced complex
result even if argument was in the correct range.

Modern systems tend to be better in this aspect, so
probably we can relay on argument checks.

> I'd like to do the checking at lisp level but not
> repeat it twice for pre ccl-1.8.

Why at Lisp level? You can do this in Spad and efficiency
should be essentially the same.

> 3. for |abs_DF|, why use "FLOAT-SIGN" instead of "ABS",
> it felt strange to me.

Possibly cargo cult. But also 'FLOAT-SIGN' is specialized
while 'abs' is generic, which can make speed difference in
system with weak optimizer.

--
Waldek Hebisch
Reply all
Reply to author
Forward
0 new messages