[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Floating-point constant folding in Emacs byte compiler

From: Pip Cet
Subject: Re: Floating-point constant folding in Emacs byte compiler
Date: Fri, 23 Mar 2018 20:52:52 +0000

Is this really specific to floating-point expressions, though?

(byte-compile (lambda (x) (* #x10000 #x10000 #x10000 #x10000)))
#[(x) "À\207" [0] 1]

(at least on this somewhat oudated version of Emacs). Note the 0 in
the constant vector, which hardcodes the <65-bit-ness of fixnums.

I imagine that on a 32-bit version of emacs, (byte-compile (lambda (x)
(* #x10000 #x10000))) similarly produces a constant-zero function,
which will produce the wrong result when fixnums are actually 62 bits

(This is tangential, but I think that it might make sense, at some
point in the future, to switch to JavaScript-like
everything-is-a-float-but-there's-just-one-NaN "numbers"; that would
be quite a bit of work already, since several functions do different
things for integer and float arguments (I feel they should be fixed
anyway), and it would be nice to be able to point to the current
byte-opt situation as evidence that if you're relying on unusual
number behavior, you're already doing something wrong)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]