Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

in 64bit php, everything between 0x7ffffffffffffE00 - PHP_INT_MAX is returned as float #8

Closed
divinity76 opened this issue Oct 23, 2016 · 1 comment
Labels

Comments

@divinity76
Copy link

divinity76 commented Oct 23, 2016

the following code should echo FOUND after 1 attempt(s) ,
and it works as expected in 32bit php, but in 64bit php it echos FOUND after 513 attempt(s)

for($i = PHP_INT_MAX; $i > 0; -- $i) {
    if (! is_float ( ShortURL::decode ( ShortURL::encode ( $i ) ) )) {
        //var_dump ( $i );
        die ( 'FOUND after '.((PHP_INT_MAX-$i)+1).' attempt(s)' );
    }
}
die ( 'NOT FOUND' );
@divinity76 divinity76 changed the title in 64bit php, everything between 9223372036854775296 - PHP_INT_MAX is returned as float in 64bit php, everything between 0x7ffffffffffffe00 - PHP_INT_MAX is returned as float Oct 23, 2016
@divinity76 divinity76 changed the title in 64bit php, everything between 0x7ffffffffffffe00 - PHP_INT_MAX is returned as float in 64bit php, everything between 0x7ffffffffffffE00 - PHP_INT_MAX is returned as float Oct 23, 2016
divinity76 added a commit to divinity76/ShortURL that referenced this issue Oct 23, 2016
@ocram ocram added the invalid label Oct 23, 2016
@ocram
Copy link
Contributor

ocram commented Oct 23, 2016

Thanks for your effort here!

We should definitely do something to find out the limit, as I said in #7, but I think what you did is the wrong direction, isn't it? You found the largest number, other than PHP_INT_MAX in 64-bit PHP, that doesn't work. But what we need is actually the smallest such number, which requires much more computing power or time.

@ocram ocram closed this as completed Oct 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants