diff --git a/basis/bootstrap/image/primitives/primitives.factor b/basis/bootstrap/image/primitives/primitives.factor index 7c149b9db9..5ffd047ad6 100644 --- a/basis/bootstrap/image/primitives/primitives.factor +++ b/basis/bootstrap/image/primitives/primitives.factor @@ -404,7 +404,7 @@ CONSTANT: all-primitives { "(format-float)" ( n fill width precision format locale -- byte-array ) "format_float" { float byte-array fixnum fixnum byte-array byte-array } { byte-array } - make-foldable + make-flushable } } } diff --git a/core/math/parser/parser-tests.factor b/core/math/parser/parser-tests.factor index 4b8bbd1e35..24ccd1aab8 100644 --- a/core/math/parser/parser-tests.factor +++ b/core/math/parser/parser-tests.factor @@ -1,4 +1,5 @@ -USING: layouts literals math math.parser.private sequences tools.test ; +USING: kernel layouts literals math math.parser.private sequences +strings tools.test ; IN: math.parser { f } @@ -473,3 +474,16 @@ unit-test { "" } [ 33.4 "" 4 4 "f" "missing" format-float ] unit-test + +! Literal byte arrays are mutable, so (format-float) isn't foldable. +: trouble ( -- str ba ) + 155000.0 B{ } -1 3 B{ 69 0 } [ + B{ 67 0 } (format-float) >string + ] keep ; + +{ + "1.55E+05" + "1.550e+05" +} [ + trouble CHAR: e 0 rot set-nth trouble drop +] unit-test