Function Pow() returns INF

Asked

Viewed 124 times

2

Galera is the following to tried makes power followed by modulation -> mod, but the function Pow() returns "INF" and the other functions like bcpow and bcpowmod return as non-existent functions within the class. The version of mine: PHP7.

$m = 726;
$d = 71;
$n = 1073;
$c = pow($m,$d) % $n // INF
$c = bcpow($m,$d) % $n; // Fatal error: undefined function bcpow()...
$c = bcpowmod($m,$d,$n); // Fatal error: undefined function bcpowmod()...

Does anyone know why?

  • You’re missing a period and a comma on the fourth line. See here which is working: http://sandbox.onlinephpfunctions.com/code/fd75850c5babf53f4dd9701bee9d9bc9276fd7

  • In the sandbox: pow() // retorna zero
bcpow // retorna 301
bcpowmod // retorna 436 correto. Mas na minha class:
pow() // INF
bcpow()// undefined
bcpowmod // undefined

  • 5

    Probably the bcmath is not installed. A phpinfo(); is enough to check these things. As for the pow, is normal, after all the numbers you used exceed the storage capacity.

  • Success! Thank you very much.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.