PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
ob_implicit_flush();
set_time_limit(0);
echo 'This is going to take forever...<br /><br />';
$test = (double)0xAABBCC;
$val = bcpow(538759009, $test, 5);
print "val=" . $val;
Like I said in your other thread you need to use bcpow for arbitrary length numbers, I'm not going to run this code myself but it should work, the reason I'm not running it is it's going to take possibly hours to evaluate something like that. I did test it with smaller numbers, worked fine.
ob_implicit_flush();
set_time_limit(0);
echo 'This is going to take forever...<br /><br />';
$test = (double)0xAABBCC;
$val = bcpow(538759009, $test, 5);
print "val=" . $val;
Like I said in your other thread you need to use bcpow for arbitrary length numbers, I'm not going to run this code myself but it should work, the reason I'm not running it is it's going to take possibly hours to evaluate something like that. I did test it with smaller numbers, worked fine.
I'm not raising 538759009 to the power of 0xAABBCCDD. I'm XORing the two values.
unfortunately, floats and doubles are handled slightly differingly as well. Either get ahold of a large integer library for php, or write your own binary xor function..
feyd wrote:unfortunately, floats and doubles are handled slightly differingly as well. Either get ahold of a large integer library for php, or write your own binary xor function..
feyd wrote:unfortunately, floats and doubles are handled slightly differingly as well. Either get ahold of a large integer library for php, or write your own binary xor function..
I decided to write my own binary functions and they work except for one small bug. For example when I do 2864434397 % 2 I get -1. What is the reason for this and how can I fix this?
your version of php converts the value 2864434397 to -716950749, I believe... it's negative for sure, because 2147483647 is the maximum positive value for a signed 32-bit integer.
feyd wrote:your version of php converts the value 2864434397 to -716950749, I believe... it's negative for sure, because 2147483647 is the maximum positive value for a signed 32-bit integer.
So there is no way to make a float variable or unsigned int that can handle all these problems?