src/Samsara/Fermat/Values/MutableNumber.php 1 location
|
@@ 20-31 (lines=12) @@
|
| 17 |
|
return (new MutableNumber(bcmod($this->getValue(), $mod), $this->getPrecision()))->convertFromModification($oldBase);
|
| 18 |
|
}
|
| 19 |
|
|
| 20 |
|
public function continuousModulo($mod)
|
| 21 |
|
{
|
| 22 |
|
|
| 23 |
|
$mod = Numbers::makeOrDont(Numbers::IMMUTABLE, $mod);
|
| 24 |
|
|
| 25 |
|
$multiple = $this->divide($mod)->floor();
|
| 26 |
|
|
| 27 |
|
$remainder = $this->subtract($mod->multiply($multiple));
|
| 28 |
|
|
| 29 |
|
return Numbers::make(Numbers::MUTABLE, $remainder->getValue());
|
| 30 |
|
|
| 31 |
|
}
|
| 32 |
|
|
| 33 |
|
/**
|
| 34 |
|
* @param $value
|
src/Samsara/Fermat/Values/Currency.php 1 location
|
@@ 43-52 (lines=10) @@
|
| 40 |
|
return (new Currency(bcmod($this->getValue(), $mod), $this->getPrecision(), $this->getBase()))->convertFromModification($oldBase); |
| 41 |
|
} |
| 42 |
|
|
| 43 |
|
public function continuousModulo($mod) |
| 44 |
|
{ |
| 45 |
|
$mod = Numbers::makeOrDont(Numbers::IMMUTABLE, $mod); |
| 46 |
|
|
| 47 |
|
$multiple = $this->divide($mod)->floor(); |
| 48 |
|
|
| 49 |
|
$remainder = $this->subtract($mod->multiply($multiple)); |
| 50 |
|
|
| 51 |
|
return $remainder; |
| 52 |
|
} |
| 53 |
|
|
| 54 |
|
public function compoundInterest($interest, $periods) |
| 55 |
|
{ |
src/Samsara/Fermat/Values/ImmutableNumber.php 1 location
|
@@ 20-31 (lines=12) @@
|
| 17 |
|
return (new ImmutableNumber(bcmod($this->getValue(), $mod), $this->getPrecision(), $this->getBase()))->convertFromModification($oldBase);
|
| 18 |
|
}
|
| 19 |
|
|
| 20 |
|
public function continuousModulo($mod)
|
| 21 |
|
{
|
| 22 |
|
|
| 23 |
|
$mod = Numbers::makeOrDont(Numbers::IMMUTABLE, $mod, 100);
|
| 24 |
|
|
| 25 |
|
$multiple = $this->divide($mod)->floor();
|
| 26 |
|
|
| 27 |
|
$remainder = $this->subtract($mod->multiply($multiple));
|
| 28 |
|
|
| 29 |
|
return $remainder;
|
| 30 |
|
|
| 31 |
|
}
|
| 32 |
|
|
| 33 |
|
/**
|
| 34 |
|
* @param $value
|