diff --git a/src/intrprtr.c b/src/intrprtr.c index 9763b76dab8..92b872026d4 100644 --- a/src/intrprtr.c +++ b/src/intrprtr.c @@ -1804,7 +1804,10 @@ static Obj ConvertFloatLiteralEager(Obj str) SET_LEN_STRING(str, len - 2); chars[len - 2] = '\0'; } - return CALL_2ARGS(CONVERT_FLOAT_LITERAL_EAGER, str, ObjsChar[(UInt)mark]); + Obj res = CALL_2ARGS(CONVERT_FLOAT_LITERAL_EAGER, str, ObjsChar[(UInt)mark]); + if (res == Fail) + ErrorQuit("failed to convert float literal", 0, 0); + return res; } void IntrFloatExpr ( diff --git a/tst/testinstall/float.tst b/tst/testinstall/float.tst index 38446591c4b..4f7b238673f 100644 --- a/tst/testinstall/float.tst +++ b/tst/testinstall/float.tst @@ -237,6 +237,27 @@ false gap> EqFloat(0.0,0.0/0.0); false +# +# float literals in the REPL +# +gap> 1.1; +1.1 +gap> 1.1_; +1.1 +gap> 1.x1; +Syntax error: Badly formed number in stream:1 +1.x1; + ^ +gap> 1.1xx; +Syntax error: Badly formed number in stream:1 +1.1xx; + ^ + +# The following is potentially correct, *if* there is a conversion handler for +# 'x' installed, which normally isn't the case. +gap> 1.1x; +Error, failed to convert float literal + # # float literal expressions in functions #