Example #1
0
/**
 * Note that due to autoprecision this just makes a mess, there is no precision.
 * Consider using {@link #number_format_precision_html()} instead.
 */
function number_format_html($n, $precision, $suffix = false)
{
    return "<span title=\"" . number_format_autoprecision($n, 8) . ($suffix ? $suffix : "") . "\">" . number_format_precision($n, $precision) . ($suffix ? $suffix : "") . "</span>";
}
Example #2
0
 function testNumberFormatPrecision()
 {
     $this->assertSame("1", number_format_precision("1.000", 0));
     $this->assertSame("1", number_format_precision("1.100", 0));
     $this->assertSame("0", number_format_precision("0.010", 0));
     $this->assertSame("0", number_format_precision("0.011", 0));
     $this->assertSame("0", number_format_precision("0.0110001", 0));
 }