Bugfix for fmt_int() found by creating regressions.

This commit is contained in:
Revar Desmera 2020-06-14 23:53:10 -07:00
parent 761421a148
commit e2c0d6dc98
2 changed files with 3 additions and 3 deletions

View file

@ -435,9 +435,9 @@ function str_strip(s,c) = str_strip_trailing(str_strip_leading(s,c),c);
// fmt_int(123456789012345); // Returns "123456789012345" // fmt_int(123456789012345); // Returns "123456789012345"
// fmt_int(-123456789012345); // Returns "-123456789012345" // fmt_int(-123456789012345); // Returns "-123456789012345"
function fmt_int(i,mindigits=1) = function fmt_int(i,mindigits=1) =
i<0? str("-", fmt_int(-i)) : i<0? str("-", fmt_int(-i,mindigits)) :
let(i=floor(i), e=floor(log(i))) let(i=floor(i), e=floor(log(i)))
i==0? "0" : i==0? str_join([for (j=[0:1:mindigits-1]) "0"]) :
str_join( str_join(
concat( concat(
[for (j=[0:1:mindigits-e-2]) "0"], [for (j=[0:1:mindigits-e-2]) "0"],

View file

@ -8,7 +8,7 @@
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
BOSL_VERSION = [2,0,336]; BOSL_VERSION = [2,0,337];
// Section: BOSL Library Version Functions // Section: BOSL Library Version Functions