unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Pip Cet <pipcet@gmail.com>
To: Andrea Corallo <akrl@sdf.org>
Cc: emacs-devel@gnu.org
Subject: Re: feature/native-comp 5bc0855 2/2: Don't treat '=' as simple equality emitting constraints (bug#46812)
Date: Tue, 2 Mar 2021 17:14:39 +0000	[thread overview]
Message-ID: <CAOqdjBd5+=NOhPO5ke_WS51jzoXzVTYd3=X0eNXxJh53GeKbCw@mail.gmail.com> (raw)
In-Reply-To: <xjfo8g1aar6.fsf@sdf.org>

On Tue, Mar 2, 2021 at 2:30 PM Andrea Corallo <akrl@sdf.org> wrote:
> Pip Cet <pipcet@gmail.com> writes:
> > On Tue, Mar 2, 2021 at 1:47 PM Andrea Corallo <akrl@sdf.org> wrote:
> >> > It's not working either, as far as I can tell: (lambda (x) (and
> >> > (floatp x) (= x 0) x)) always returns nil when compiled.
> >>
> >> Right, I think a better approach is to relax the inputs before
> >> intersecting them so intersection is not cutting off already constrained
> >> inputs.
> >
> > That should work.
> >
> >> 8c7228e8cd for now follows this conservative approach and adds
> >> some testing for the case.
> >
> > Indeed, and it breaks trying to compile (lambda (x) (unless (= x
> > 1.0e+INF) (error "")) x). (And please don't forget NaNs, they're
> > numbers too! Except they're not.)
>
> Is there a better way to guard against these cases than catching the
> error around truncate?

I don't think so, but wrapping it into (float-rational-p) or something
would be nice. Even catching the error, by the way, isn't going to
handle the -0.0 / 0.0 special case properly.

(That is because there is no nice way to handle it, because 0.0 and
-0.0 are the same number and always will be.)

Don't forget this one either (currently miscompiled to have subr-type
((t) nil)):

(lambda (x)
  (unless (= x 0.0) (error ""))
  (unless (eql x -0.0) (error ""))
  x)

There are also some aesthetic issues with how you handle integers too
large to be accurately represented as floats and such, but I'm
focussing on correctness right now.

Pip



  reply	other threads:[~2021-03-02 17:14 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210228230215.15472.12941@vcs0.savannah.gnu.org>
     [not found] ` <20210228230217.1971E20E1B@vcs0.savannah.gnu.org>
2021-03-02  5:20   ` feature/native-comp 5bc0855 2/2: Don't treat '=' as simple equality emitting constraints (bug#46812) Pip Cet
2021-03-02 13:47     ` Andrea Corallo via Emacs development discussions.
2021-03-02 14:16       ` Pip Cet
2021-03-02 14:30         ` Andrea Corallo via Emacs development discussions.
2021-03-02 17:14           ` Pip Cet [this message]
2021-03-04  7:36             ` Pip Cet
2021-03-04  7:58               ` Andrea Corallo via Emacs development discussions.
2021-03-06 22:18                 ` Andrea Corallo via Emacs development discussions.
2021-03-07  7:03                   ` Pip Cet
2021-03-07  7:07                     ` Andrea Corallo via Emacs development discussions.
2021-03-07  7:13                       ` Pip Cet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAOqdjBd5+=NOhPO5ke_WS51jzoXzVTYd3=X0eNXxJh53GeKbCw@mail.gmail.com' \
    --to=pipcet@gmail.com \
    --cc=akrl@sdf.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).