r47419 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r47418‎ | r47419 | r47420 >
Date:05:12, 18 February 2009
Author:werdna
Status:deferred
Tags:
Comment:
Handle precision=0 correctly in bcround (it's the default anyway!)
Modified paths:
  • /trunk/extensions/ParserFunctions/Expr.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ParserFunctions/Expr.php
@@ -661,7 +661,8 @@
662662 function bcround($strval, $precision = 0) {
663663 if (false !== ($pos = strpos($strval, '.')) &&
664664 ( strlen($strval) - $pos - 1) > $precision ) {
665 - $zeros = str_repeat("0", $precision);
 665+
 666+ $zeros = ($precision > 0) ? str_repeat("0", $precision) : '';
666667
667668 if ( bccomp( $strval, 0 ) >= 0 ) {
668669 return bcadd($strval, "0.{$zeros}5", $precision);

Status & tagging log