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

Problem with big numbers #92

Closed
Xpycts opened this issue Apr 14, 2017 · 2 comments
Closed

Problem with big numbers #92

Xpycts opened this issue Apr 14, 2017 · 2 comments

Comments

@Xpycts
Copy link

Xpycts commented Apr 14, 2017

Try use this function
echo NumberHumanizer::metricSuffix(1240);
but always return "-0P"

Problem with big number, two array keys on \Coduo\PHPHumanizer\String\MetricSuffix $binaryPrefixes have wrong values when use print_r for this class:
Array ( [-1530494976] => #.##P [-727379968] => #.##T [1000000000] => #.##G [1000000] => #.##M [1000] => #.#k [0] => #.# )

how I can resolve this? sorry for my english =)

@Xpycts
Copy link
Author

Xpycts commented Apr 15, 2017

Users with 32bit system can't work with integer over 2147483647, this is 4 bytes. For check system may execute var_dump(PHP_INT_MAX); for get max value or var_dump(PHP_INT_SIZE); for get bytes. 4 is 32 bit, 8 is 64 bits. (for PHP over 5.0.5)
Think need some code fix.

@Xpycts
Copy link
Author

Xpycts commented Apr 15, 2017

Sorry, use old version script without this line

/*
         * Workaround for 32-bit systems which ignore array ordering when
         * dropping values over 2^32-1
         */
        krsort($this->binaryPrefixes);

problem resolved

@Xpycts Xpycts closed this as completed Apr 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant