patch 8.2.2948: substitute() accepts a number but not a float expression
Problem: Substitute() accepts a number but not a float expression.
Solution: Also accept a float. (closes #8331)
diff --git a/src/typval.c b/src/typval.c
index f08d1aa..a17dbef 100644
--- a/src/typval.c
+++ b/src/typval.c
@@ -462,8 +462,13 @@
break;
case VAR_FLOAT:
#ifdef FEAT_FLOAT
- emsg(_(e_float_as_string));
- break;
+ if (strict)
+ {
+ emsg(_(e_float_as_string));
+ break;
+ }
+ vim_snprintf((char *)buf, NUMBUFLEN, "%g", varp->vval.v_float);
+ return buf;
#endif
case VAR_STRING:
if (varp->vval.v_string != NULL)