This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class A { | |
public int $value; | |
public function __add(int $other, bool $left): A | |
{ | |
$return = new A(); | |
$return->value = $this->value + $other; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Samsara\Fermat\Values\Algebra; | |
use Samsara\Exceptions\SystemError\PlatformError\MissingPackage; | |
use Samsara\Exceptions\UsageError\IntegrityConstraint; | |
use Samsara\Fermat\Numbers; | |
use Samsara\Fermat\Types\Base\Interfaces\Numbers\DecimalInterface; | |
use Samsara\Fermat\Types\Base\Interfaces\Evaluateables\FunctionInterface; | |
use Samsara\Fermat\Types\Base\Interfaces\Numbers\NumberInterface; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
protected function translateToParts($left, $right, $identity = 0): array | |
{ | |
switch (gettype($right)) { | |
case 'integer': | |
case 'double': | |
$right = Numbers::make(Numbers::IMMUTABLE, $right); | |
break; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function multiply($num) | |
{ | |
[ | |
$thatRealPart, | |
$thatImaginaryPart, | |
$thisRealPart, | |
$thisImaginaryPart, |