Beta function #444
Replies: 3 comments 1 reply
-
Thanks for getting in touch. What error are you receiving? Also, I’m confused when you say the inputs are strings. In your example Please provide as much context as is needed to reproduce your issue, like a complete function, CLI statement, or php file. The unit testing suite includes your specific example:
|
Beta Was this translation helpful? Give feedback.
-
Hi @thedailygrinder, The public static function beta(float $a, float $b): float PHP has loose typing, so if you pass a number as a string, PHP will coerce the value into a number and work like you had passed in a number type. However, if the calling code is in a file that declared It sounds like you have declared declare(strict_types=1); Mark |
Beta Was this translation helpful? Give feedback.
-
Happy New Year! Yeah, strict types is a bit unintuitive. You can force your own code to respect scalar types in code it calls, but you can't force other code to respect your own types when it calls your functions. |
Beta Was this translation helpful? Give feedback.
-
Hello guys,
I'm trying to run the Beta function as described in the documentation:
// Beta function
[$x, $y] = [1, 2];
$β = Special::beta($x, $y);
$lβ = Special::logBeta($x, $y);
However, it appears that the function is not accepting inputs as strings. Are there any specific nuances to be aware of or is this a bug?
Many thanks!
Beta Was this translation helpful? Give feedback.
All reactions