<?php
require_once("calculator.php");
// example 1
$calc = new calculator();
$calc->addNumber("9283476109487129740712657109832.21341234");
$calc->addNumber("4386120876213943720417240982137.43937502");
$result = $calc->calc();
print "\nThe result is: ".$result."\n\n\n";
// example 2
$calc = new calculator();
// generate a very big numer
$number = "8347610948712974071265710983243861208762139437204172409821378273618976529283476109487129740712657109";
$number = str_repeat($number, 10000);
$calc->addNumber($number);
$calc->addNumber($number);
$time_start = microtime(true);
$result = $calc->calc();
$time_end = microtime(true);
print "\nThe number has ".strlen($number)." digits. ";
print "\nThe result has ".strlen($result)." digits. ";
print "\nThe result is: ".$result;
print "\nThe sum was executed in ".($time_end-$time_start)." seconds.";
?>
|