Skip to content

Commit

Permalink
Add support for using none default base value in log function (#134)
Browse files Browse the repository at this point in the history
* Update tests with log using base parameter

* Ensure base parameter is allowed for log function
  • Loading branch information
beblife authored Feb 15, 2024
1 parent a1f86ab commit dca855e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/NXP/MathExecutor.php
Original file line number Diff line number Diff line change
Expand Up @@ -468,9 +468,9 @@ protected function defaultFunctions() : array
return $this->execute($falseval);
},
'intdiv' => static fn($arg1, $arg2) => \intdiv($arg1, $arg2),
'ln' => static fn($arg) => \log($arg),
'ln' => static fn($arg1, $arg2 = M_E) => \log($arg1, $arg2),
'lg' => static fn($arg) => \log10($arg),
'log' => static fn($arg) => \log($arg),
'log' => static fn($arg1, $arg2 = M_E) => \log($arg1, $arg2),
'log10' => static fn($arg) => \log10($arg),
'log1p' => static fn($arg) => \log1p($arg),
'max' => static function($arg1, ...$args) {
Expand Down
2 changes: 2 additions & 0 deletions tests/MathTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ public static function providerExpressions()
['hypot(1.5, 3.5)'],
['intdiv(10, 2)'],
['log(1.5)'],
['log(1.5, 3)'],
['log10(1.5)'],
['log1p(1.5)'],
['max(1.5, 3.5)'],
Expand Down Expand Up @@ -1148,6 +1149,7 @@ public static function providerExpressionValues()
['decbin(10)', \decbin(10)],
['lg(2)', \log10(2)],
['ln(2)', \log(2)],
['ln(2, 5)', \log(2, 5)],
['sec(4)', 1 / \cos(4)],
['tg(4)', \tan(4)],
];
Expand Down

0 comments on commit dca855e

Please sign in to comment.