Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/Common/Common/NumberUtilities_strtod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2199,7 +2199,7 @@ static int RoundTo(byte *pbSrc, byte *pbLim, int nDigits, __out_bcount(nDigits+1
{
int i = nDigits;

if( pbSrc[i] >= 5 )
if( pbSrc[i] > 5 )
{
// Add 1 to the BCD representation.
for( i = nDigits - 1; i >= 0; i-- )
Expand Down Expand Up @@ -2322,7 +2322,7 @@ int Js::NumberUtilities::FDblToStr(double dbl, Js::NumberUtilities::FormatType f
else
{
//Special case: When negative power of 10 is more than most significant digit.
if( rgb[0] >= 5 )
if( rgb[0] > 5 )
{
rgbAdj[0] = 1;
wExp10 += 1;
Expand Down
5 changes: 5 additions & 0 deletions test/Number/toString.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ function runTest(numberToTestAsString)
writeLine("n.toPrecision(5): " + n.toPrecision(5));
writeLine("n.toPrecision(20): " + n.toPrecision(20));

// test toFixed toString round formatting
if ( !(1.25499999999999989342.toFixed(2) + "" == "1.25") ||
!(1.255.toFixed(2) + "" == "1.25") ) {
throw Error("1.255.toFixed(2) != 1.25 ??");
}
writeLine("");
}

Expand Down