| daniel added a comment. |
New test cases to add to DecimalMathTest::roundToDigitProvider:
$argLists[] = array( new DecimalValue( '+1.45' ), 1, '+1' ); $argLists[] = array( new DecimalValue( '+1.45' ), 3, '+1.5' ); $argLists[] = array( new DecimalValue( '+1.45' ), 4, '+1.45' );
$argLists[] = array( new DecimalValue( '+1.99' ), 1, '+2' ); $argLists[] = array( new DecimalValue( '+1.99' ), 3, '+2.0' ); $argLists[] = array( new DecimalValue( '+1.99' ), 4, '+2.00' ); $argLists[] = array( new DecimalValue( '+1.499' ), 1, '+1' ); $argLists[] = array( new DecimalValue( '+1.499' ), 3, '+1.5' ); $argLists[] = array( new DecimalValue( '+1.499' ), 4, '+1.50' ); $argLists[] = array( new DecimalValue( '+14.99' ), 1, '+10' ); $argLists[] = array( new DecimalValue( '+14.99' ), 2, '+15' ); $argLists[] = array( new DecimalValue( '+14.99' ), 4, '+15.0' ); $argLists[] = array( new DecimalValue( '+9.5' ), 1, '+10' ); $argLists[] = array( new DecimalValue( '+9.5' ), 3, '+9.5' );
(untested, there may be mistakes in there, look closely)
Note that currently, "significant digits" includes the decimal point. That's against common conventions. We should fix that while we are at it.
TASK DETAIL
EMAIL PREFERENCES
To: daniel
Cc: thiemowmde, Aklapper, Zppix, daniel, D3r1ck01, Izno, Wikidata-bugs, aude, Mbch331
Cc: thiemowmde, Aklapper, Zppix, daniel, D3r1ck01, Izno, Wikidata-bugs, aude, Mbch331
_______________________________________________ Wikidata-bugs mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs
