diff options
| author | Paul Eggert | 2011-04-19 23:24:51 -0700 |
|---|---|---|
| committer | Paul Eggert | 2011-04-19 23:24:51 -0700 |
| commit | 8b9587d73b579fb2fdd0eaaa1ed5fd608653e522 (patch) | |
| tree | 2f0c598b1d7bfe1e08fdf7b36fce973d7cbd657e /src/lisp.h | |
| parent | 602ea69dc7a93969742958ee6af3feae23cd1e02 (diff) | |
| download | emacs-8b9587d73b579fb2fdd0eaaa1ed5fd608653e522.tar.gz emacs-8b9587d73b579fb2fdd0eaaa1ed5fd608653e522.zip | |
Make the Lisp reader and string-to-float more consistent.
* data.c (atof): Remove decl; no longer used or needed.
(Fstring_to_number): Use new string_to_float function, to be
consistent with how the Lisp reader treats infinities and NaNs.
Do not assume that floating-point numbers represent EMACS_INT
without losing information; this is not true on most 64-bit hosts.
Avoid double-rounding errors, by insisting on integers when
parsing non-base-10 numbers, as the documentation specifies.
Report integer overflow instead of silently converting to
integers.
* lisp.h (string_to_float): New decl, replacing ...
(isfloat_string): Remove.
* lread.c (read1): Do not accept +. and -. as integers; this
appears to have been a coding error. Similarly, do not accept
strings like +-1e0 as floating point numbers. Do not report
overflow for some integer overflows and not others; instead,
report them all. Break out the floating-point parsing into a new
function string_to_float, so that Fstring_to_number parses
floating point numbers consistently with the Lisp reader.
(string_to_float): New function, replacing isfloat_string.
This function checks for valid syntax and produces the resulting
Lisp float number too.
Diffstat (limited to 'src/lisp.h')
| -rw-r--r-- | src/lisp.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/lisp.h b/src/lisp.h index 581835dd32b..6080007c780 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -2782,7 +2782,7 @@ extern Lisp_Object oblookup (Lisp_Object, const char *, EMACS_INT, EMACS_INT); | |||
| 2782 | } while (0) | 2782 | } while (0) |
| 2783 | extern int openp (Lisp_Object, Lisp_Object, Lisp_Object, | 2783 | extern int openp (Lisp_Object, Lisp_Object, Lisp_Object, |
| 2784 | Lisp_Object *, Lisp_Object); | 2784 | Lisp_Object *, Lisp_Object); |
| 2785 | extern int isfloat_string (const char *, int); | 2785 | Lisp_Object string_to_float (char const *, int); |
| 2786 | extern void map_obarray (Lisp_Object, void (*) (Lisp_Object, Lisp_Object), | 2786 | extern void map_obarray (Lisp_Object, void (*) (Lisp_Object, Lisp_Object), |
| 2787 | Lisp_Object); | 2787 | Lisp_Object); |
| 2788 | extern void dir_warning (const char *, Lisp_Object); | 2788 | extern void dir_warning (const char *, Lisp_Object); |