Jump to content

Archived

This topic is now archived and is closed to further replies.

stijn0713

wrong math answer

Recommended Posts

What makes you think it should be 100?

Share this post


Link to post
Share on other sites

Why are you using the bc functions for one operation but not the other?

Share this post


Link to post
Share on other sites

Why are you using the bc functions for one operation but not the other?

 

$r = bcmod(bcpow(254, 187), 319); // 100

 

Edit: damn 30 seconds late

 

Edit: Actually

 

echo bcmod(bcpow(254,187),319) = 100;

 

Returns an error ;)

Share this post


Link to post
Share on other sites

Then I'd go with use the right function.

 

<?php
$pow = bcpow(254, 187);
echo $pow.'<br>';
echo bcmod($pow, 319);
?>

 

I got 100.

Share this post


Link to post
Share on other sites

echo bcmod(bcpow(254,187),319) = 100;
Returns an error ;)

 

No need for the = 100.

echo bcmod(bcpow(254,187),319);

Share this post


Link to post
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.