Question

i'm using BCmath to do math with 64 bit unsigned integers, i want to make a bcmath-object to a normal int (high, low part) how can i achieve that ?

Thank you for your help

Was it helpful?

Solution

The inbuilt BCMath functions don't deal with BCMath objects as such, they just process on strings to achieve arbitrary precision computation. So you can convert back to a native php int with a normal cast.

$val = (int) bcmod( bcpow( "9392", "394" ), "100" );

From http://php.net/manual/en/book.bc.php, method signatures are

string bcmod ( string $left_operand , string $modulus )
string bcpow ( string $left_operand , string $right_operand [, int $scale ] )
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top