Re: pi seems not to be a constant

Pierpaolo Bernardi <[email protected]>
Newsgroups gmane.lisp.clisp.general
Message-ID <CANY8u7G5OmA3-XD-xjwJTLd1KX5V3qf1+0R7BhWcfyDW9vuGKg@mail.gmail.com>
On Mon, Oct 19, 2015 at 8:46 PM, Don Cohen
<[email protected]> wrote:
>
>  > Yes, now it is a sound proposal. But, if implemented in plain Clisp it
>  > would make variable precision floats a PITA to use, in addition to
>
> I don't see how it makes variable precision any worse than before.

A typical use case for adjustable precision floats is the following:

(setf (ext:long-float-digits) some-appropriate-number-of-bits)
(large-body-of-standard-portable-cl-code-using-long-floats)

If long-float-digits is changed and the "constants" are not adjusted
then STANDARD PORTABLE CL code will break.

>  > invalidating all previously written Clisp programs using variable
>  > precision floats.
>
> Actually, only those using variable precision float CONSTANTS,

All of them will be broken until someone audits them and proves that
they are not.

>  > One solution could be for the ansi mode to transform all these
>  > variables in constant variables, and remove the EXT:LONG-FLOAT-DIGITS
>  > function from the image.
>
> I don't see that removing EXT:LONG-FLOAT-DIGITS is really necessary.
> It's an extension, and if you don't use it then everything seems to
> conform.

And if you use it then everything breaks.  So removing it will avoid troubles.

>  > Still, I don't get the need to do this work, supposing someone is
>  > willing to do it (It seems I haven't got all the emails in this thread
>  > and I may have missed some clarifying explanation of this point)
>
> I don't claim it's necessary, only an improvement.  A small one, but
> also, I think, requiring a small amount of work.

Maybe a simpler solution could be to replace CL:CONSTANTP with
something similar to

(setf (symbol-function 'cl::system-constantp) (symbol-function 'cl:constantp)

(defun cl:constantp (x)
  (case s
     ((CL:PI CL:MOST-POSITIVE-LONG-FLOAT ...) t)
     (otherwise (cl::system-constantp x))))

when compliance wrt this issue is desired.

Would this break something?

------------------------------------------------------------------------------
_______________________________________________
clisp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/clisp-list
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.