Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
array length of numToString is 1 too short
Browse files Browse the repository at this point in the history
- use a simpler popBack loop
  • Loading branch information
MartinNowak committed Jul 7, 2015
1 parent 893cc05 commit d119481
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/core/time.d
Expand Up @@ -4832,13 +4832,9 @@ string numToString(double value) @safe pure nothrow
result ~= '.';
result ~= numToString(cast(long)(_abs((value - cast(long)value) * 1000000)));

int i = cast(int)result.length - 1;
for (; i >= 0; --i)
{
if(result[i] != '0')
break;
}
return result[0 .. (i > 0 ? i - 1 : 0)];
while (result[$-1] == '0')
result = result[0 .. $-1];
return result;
}

unittest
Expand Down

0 comments on commit d119481

Please sign in to comment.