function graph_number_format($n) { return number_format_human($n); }
break; case "decreases": $change_text = "decreased"; break; case "decreases_by": $change_text = "decreased by at least " . number_format_human($notification['trigger_value']) . ($notification['is_percent'] ? '%' : " " . $value_label); break; case "below": $change_text = "decreased below " . number_format_human($notification['trigger_value']) . " " . $value_label; break; default: throw new JobException("Unknown trigger condition for change text: '" . $notification['trigger_condition'] . "'"); } // send the email if ($user['email']) { $args = array("name" => $user['name'] ? $user['name'] : $user['email'], "url" => absolute_url(url_for('wizard_notifications')), "profile" => absolute_url(url_for('profile')), "last_value" => number_format_human($notification['last_value']), "current_value" => number_format_human($current_value), "value_label" => $value_label, "value_delta" => number_format_human($value_delta), "percent" => $percent === null ? "infinite%" : number_format_human($percent * 100, -1), "change_text" => $change_text, "period" => $notification['period']); switch ($notification['notification_type']) { case "ticker": $email_template = 'notification_ticker'; $args += array("exchange" => get_exchange_name($account['exchange']), "currency1" => get_currency_abbr($account['currency1']), "currency2" => get_currency_abbr($account['currency2'])); break; case "summary_instance": $email_template = 'notification_summary_instance'; if (substr($account['summary_type'], 0, strlen('totalmh_')) == 'totalmh_') { $currency = substr($account['summary_type'], strlen('totalmh_')); $args += array("label" => "total " . get_currency_abbr($currency) . " hashrate"); } else { if (substr($account['summary_type'], 0, strlen('total')) == 'total') { $currency = substr($account['summary_type'], strlen('total')); $args += array("label" => "total " . get_currency_abbr($currency)); } else {
function testNumberFormatHuman() { $this->assertSame("1", number_format_human("1.000")); $this->assertSame("1.1", number_format_human("1.100")); $this->assertSame("0.01", number_format_human("0.010")); $this->assertSame("0.0110", number_format_human("0.011")); $this->assertSame("0.0110", number_format_human("0.0110001")); $this->assertSame("0.00001", number_format_human("0.00001")); $this->assertSame("0.000001", number_format_human("0.000001")); $this->assertSame("0.00000010", number_format_human("0.0000001")); }