Skip to content

Commit fe7d8b8

Browse files
didiervernaevenson
authored andcommitted
Fix Incomplete TYPEP implementation for single floats.
(Didier Verna) This fixes the following problems: (typep 1.0 'number) -> T but (typep 1.0 (find-class 'number) -> NIL (typep 1.0 'real) -> T but (typep 1.0 (find-class 'read) -> NIL 2026-03-05 Didier Verna <didier@didierverna.net> * src/org/armedbear/lisp/SingleFloat.java (typep): Fast-check the type specifier against the REAL and NUMBER built-in classes; not only the symbols. c.f. <armedbear#735>
1 parent 3ffb325 commit fe7d8b8

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

src/org/armedbear/lisp/SingleFloat.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,19 +93,23 @@ public LispObject classOf()
9393
@Override
9494
public LispObject typep(LispObject typeSpecifier)
9595
{
96+
if (typeSpecifier == Symbol.SHORT_FLOAT)
97+
return T;
98+
if (typeSpecifier == Symbol.SINGLE_FLOAT)
99+
return T;
96100
if (typeSpecifier == Symbol.FLOAT)
97101
return T;
98102
if (typeSpecifier == Symbol.REAL)
99103
return T;
100104
if (typeSpecifier == Symbol.NUMBER)
101105
return T;
102-
if (typeSpecifier == Symbol.SINGLE_FLOAT)
103-
return T;
104-
if (typeSpecifier == Symbol.SHORT_FLOAT)
106+
if (typeSpecifier == BuiltInClass.SINGLE_FLOAT)
105107
return T;
106108
if (typeSpecifier == BuiltInClass.FLOAT)
107109
return T;
108-
if (typeSpecifier == BuiltInClass.SINGLE_FLOAT)
110+
if (typeSpecifier == BuiltInClass.REAL)
111+
return T;
112+
if (typeSpecifier == BuiltInClass.NUMBER)
109113
return T;
110114
return super.typep(typeSpecifier);
111115
}

0 commit comments

Comments
 (0)