[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#48678: [PATCH] lex floats with trailing dot and exponent correctly
From: |
Mattias Engdegård |
Subject: |
bug#48678: [PATCH] lex floats with trailing dot and exponent correctly |
Date: |
Wed, 26 May 2021 18:56:43 +0200 |
Motivation: I poured lots of numeric data into Emacs for a computation, but the
result weren't as expected at all. Yet my code was correct, and so was the data.
After hours of debugging, it turned out that Emacs reads a number like 1.e6 as
the integer 1, not the float 1000000.0. The exponent is silently ignored!
Now Emacs has always treated numbers like 123. as integers rather than floats,
but
(1) it's documented,
(2) it's what Common Lisp does, and
(3) it actually doesn't affect the numeric value most of the time.
(Common Lisp probably got this from Maclisp, the rationale being that a
trailing dot can be used to write integers in base 10 even when the current
input radix is set to something else, something that Emacs Lisp doesn't need.)
Obviously this doesn't apply to 1.e6 which any sane person agrees is the float
1.0e+6 (including Common Lisp).
The attached patch fixes this bug.
0001-Fix-lexing-of-numbers-with-trailing-decimal-point-an.patch
Description: Binary data
- bug#48678: [PATCH] lex floats with trailing dot and exponent correctly,
Mattias Engdegård <=
- bug#48678: [PATCH] lex floats with trailing dot and exponent correctly, Eli Zaretskii, 2021/05/26
- bug#48678: [PATCH] lex floats with trailing dot and exponent correctly, Lars Ingebrigtsen, 2021/05/26
- bug#48678: [PATCH] lex floats with trailing dot and exponent correctly, Andreas Schwab, 2021/05/27
- bug#48678: [PATCH] lex floats with trailing dot and exponent correctly, Lars Ingebrigtsen, 2021/05/27
- bug#48678: [PATCH] lex floats with trailing dot and exponent correctly, Mattias Engdegård, 2021/05/27
- bug#48678: [PATCH] lex floats with trailing dot and exponent correctly, Philipp Stephani, 2021/05/27
- bug#48678: [PATCH] lex floats with trailing dot and exponent correctly, Philipp Stephani, 2021/05/27
bug#48678: [PATCH] lex floats with trailing dot and exponent correctly, Mattias Engdegård, 2021/05/27