2007-04-29 14:45:44 +00:00
|
|
|
<?php
|
2008-08-05 22:43:14 +00:00
|
|
|
// This file is part of BOINC.
|
|
|
|
// http://boinc.berkeley.edu
|
|
|
|
// Copyright (C) 2008 University of California
|
|
|
|
//
|
|
|
|
// BOINC is free software; you can redistribute it and/or modify it
|
|
|
|
// under the terms of the GNU Lesser General Public License
|
|
|
|
// as published by the Free Software Foundation,
|
|
|
|
// either version 3 of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// BOINC is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
// See the GNU Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Lesser General Public License
|
|
|
|
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
|
2006-09-28 17:15:07 +00:00
|
|
|
|
2008-05-28 21:08:26 +00:00
|
|
|
function credit_to_ops($credit, &$ops, &$unit) {
|
2006-10-19 15:08:26 +00:00
|
|
|
// 100 units of credit is 86400*10^9 ops
|
|
|
|
// 1 unit of credit is 864*10^9 ops
|
2008-05-28 21:08:26 +00:00
|
|
|
$ops_trillion = ($credit*864)/1000;
|
2006-10-19 15:08:26 +00:00
|
|
|
$unit = "trillion";
|
|
|
|
$ops = $ops_trillion;
|
|
|
|
if ($ops_trillion > 1000) {
|
|
|
|
$ops = $ops_trillion/1000;
|
|
|
|
$unit = "quadrillion";
|
|
|
|
}
|
|
|
|
if ($ops_trillion > 1000000) {
|
|
|
|
$ops = $ops_trillion/1000000;
|
2006-09-28 17:15:07 +00:00
|
|
|
$unit = "quintillion";
|
|
|
|
}
|
2006-10-19 15:08:26 +00:00
|
|
|
if ($ops_trillion > 1000000000) {
|
|
|
|
$ops = $ops_trillion/1000000000;
|
2006-09-28 17:15:07 +00:00
|
|
|
$unit = "sextillion";
|
|
|
|
}
|
|
|
|
$ops = number_format($ops, 2);
|
|
|
|
}
|
|
|
|
|
2008-05-28 21:08:26 +00:00
|
|
|
function credit_string($credit, $bolden) {
|
|
|
|
$cobbs = number_format($credit, 0);
|
2006-09-28 17:15:07 +00:00
|
|
|
|
2008-05-28 21:08:26 +00:00
|
|
|
credit_to_ops($credit, $ops, $unit);
|
2006-09-28 17:15:07 +00:00
|
|
|
|
|
|
|
if ($bolden) {
|
|
|
|
$lbold="[[";
|
|
|
|
$rbold="]]";
|
|
|
|
} else {
|
|
|
|
$lbold=""; $rbold="";
|
|
|
|
}
|
|
|
|
return " $lbold$cobbs Cobblestones$rbold of computation ($ops $unit floating-point operations)";
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|