jkuchar/BigFileTools

Do not hard-depend on BcMath or GMP

Closed this issue · 6 comments

Please make it possible to use floats. It is likely that their precision is sufficient to be exact, at least on most x86 platforms. And even if floats are not exact, their precision may be sufficient for some use-cases.

Makes sense... What about having base class with abstract methods and Child classes one for bcmath, one for GMP, one for float implementation...

Btw.: Why do you need to make it GMP/bcmath independent? These libraries are included in nearly every PHP installation...

If you want to go the object-oriented way, I would probably suggest using Math_BigInteger of phpseclib, which is a wrapper around GMP/BcMath/OpenSSL and a native PHP implementation based on floats or 64bit integers. Unfortunately all you need is addition, so not sure whether that makes sense. See https://github.com/phpseclib/phpseclib/blob/master/phpseclib/Math/BigInteger.php

I basically only need the filesize for statistics, it's not important whether a file has 7GiB or 8GiB.

This will be probably BC break, created branch: https://github.com/jkuchar/BigFileTools/tree/newStructureExperiment

Todo: in initialization it should evaluate environment and if possible use curl (or any responsible module) to get all information about that file. (also if it is file, if it is readable, etc.)

can be solver by brick/math