mirror of
https://github.com/php/php-src.git
synced 2024-09-21 18:07:23 +00:00
ee22612856
Add coverage for: * different formats of zero (0, 0.0) * small integers and decimals * large integers and large decimals with large fractional part * negative numbers for all of the above ones
27 lines
652 B
PHP
27 lines
652 B
PHP
<?php
|
|
|
|
const STRING_PADDING = 30;
|
|
|
|
function run_bcmath_tests(
|
|
$firstTerms,
|
|
$secondTerms,
|
|
$symbol,
|
|
$bcmath_function
|
|
) {
|
|
$scales = [0, 10];
|
|
foreach ($scales as $scale) {
|
|
foreach ($firstTerms as $firstTerm) {
|
|
echo "Number \"$firstTerm\" (scale $scale)\n";
|
|
foreach ($secondTerms as $secondTerm) {
|
|
echo $firstTerm,
|
|
" $symbol ",
|
|
str_pad($secondTerm, STRING_PADDING),
|
|
" = ",
|
|
$bcmath_function($firstTerm, $secondTerm, $scale),
|
|
"\n";
|
|
}
|
|
echo "\n";
|
|
}
|
|
}
|
|
}
|