diff options
| author | Richard M. Stallman | 1993-06-01 03:38:24 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1993-06-01 03:38:24 +0000 |
| commit | d28c4332f58a978177ca3c7a80c7999614695077 (patch) | |
| tree | d2ae092c786ac18ea5486bf73d87fc80b740711d /src | |
| parent | f526b95587c92c411d42e8bc3d6881d97a341db5 (diff) | |
| download | emacs-d28c4332f58a978177ca3c7a80c7999614695077.tar.gz emacs-d28c4332f58a978177ca3c7a80c7999614695077.zip | |
(internal_equal): Don't let ints be equal to floats.
Diffstat (limited to 'src')
| -rw-r--r-- | src/fns.c | 10 |
1 files changed, 5 insertions, 5 deletions
| @@ -820,7 +820,9 @@ DEFUN ("equal", Fequal, Sequal, 2, 2, 0, | |||
| 820 | They must have the same data type.\n\ | 820 | They must have the same data type.\n\ |
| 821 | Conses are compared by comparing the cars and the cdrs.\n\ | 821 | Conses are compared by comparing the cars and the cdrs.\n\ |
| 822 | Vectors and strings are compared element by element.\n\ | 822 | Vectors and strings are compared element by element.\n\ |
| 823 | Numbers are compared by value. Symbols must match exactly.") | 823 | Numbers are compared by value, but integers cannot equal floats.\n\ |
| 824 | (Use `=' if you want integers and floats to be able to be equal.)\n\ | ||
| 825 | Symbols must match exactly.") | ||
| 824 | (o1, o2) | 826 | (o1, o2) |
| 825 | register Lisp_Object o1, o2; | 827 | register Lisp_Object o1, o2; |
| 826 | { | 828 | { |
| @@ -838,10 +840,8 @@ do_cdr: | |||
| 838 | QUIT; | 840 | QUIT; |
| 839 | if (EQ (o1, o2)) return Qt; | 841 | if (EQ (o1, o2)) return Qt; |
| 840 | #ifdef LISP_FLOAT_TYPE | 842 | #ifdef LISP_FLOAT_TYPE |
| 841 | if (NUMBERP (o1) && NUMBERP (o2)) | 843 | if (FLOATP (o1) && FLOATP (o2)) |
| 842 | { | 844 | return (extract_float (o1) == extract_float (o2)) ? Qt : Qnil; |
| 843 | return (extract_float (o1) == extract_float (o2)) ? Qt : Qnil; | ||
| 844 | } | ||
| 845 | #endif | 845 | #endif |
| 846 | if (XTYPE (o1) != XTYPE (o2)) return Qnil; | 846 | if (XTYPE (o1) != XTYPE (o2)) return Qnil; |
| 847 | if (XTYPE (o1) == Lisp_Cons | 847 | if (XTYPE (o1) == Lisp_Cons |