<?PHP
function x($a)
{
$b = substr(abs(crc32($a)), 0, 1);
return ($a-$b > 0 ? $a-$b : 1);
}
echo x(46);
?>
function non_linear_decrease($input)
{
if ($input < 0 ) { return 0; }
$input_temp = $input;
$multiplier = 1;
while (($input_temp / 10) ) > 10) {
$multiplier = $multiplier * .9;
$input_temp = $input_temp / 10;
}
return $input * $multiplier;
}
<?php
// CONSTRAINED ASYMPTOTE ALGORITHM
// http://en.wikipedia.org/wiki/Asymptote
define("MINMIN", 0.0);
define("MAXMIN", 25.0); // NOT USED, PRESENT FOR ILLUSTRATION
define("MAXMAX", 10000.0);
define("MINPCT", 0.1);
define("MAXPCT", 0.999);
function asymptote($value) {
// NO VALUES BELOW MINIMUM THRESHOLD
if ($value <= MINMIN) {
return FALSE;
}
// COMPUTE A PERCENTAGE
$percent = $value / MAXMAX;
// CONSTRAIN MINIMUM
if ($percent < MINPCT) {
return $value - ( $value * MINPCT );
}
// CONSTRAIN MAXIMUM
if ($percent > MAXPCT) {
return $value - ( $value * MAXPCT );
}
// WITHIN CONSTRAINTS RETURN DIMINISHED VALUE
return $value - ( $value * $percent );
} // END function asymptote()
$kount = 1.0;
while ($kount < MAXMAX) {
$asymptote = asymptote($kount);
$pctg = 1.0 - $asymptote / $kount; // PERCENTAGE OF REDUCTION INCREASES AS VALUE INCREASES
echo "<br /> $kount $asymptote $pctg \n";
$kount++;
}
?>
If you are experiencing a similar issue, please ask a related question
Title | # Comments | Views | Activity |
---|---|---|---|
PHPStorm debugging issues | 1 | 45 | |
Display Calender only When events is scheduled in Worpdress? | 1 | 23 | |
Wordpress Pagination Function Not working ? | 7 | 31 | |
PHP: Insert Data into MySQL | 5 | 40 |
Join the community of 500,000 technology professionals and ask your questions.