See my notes below
Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com
----- Original Message -----
From: "zelnaga" <[email protected]>
To: <[email protected]>
Sent: Wednesday, February 25, 2009 9:37 PM
Subject: Re: [fw-general] pure-PHP BigInteger support
thomasW wrote:
There is already a pure PHP solution within ZF which can be used.
Zend_Locale_Math is a bcmath clone which does automatically use BCMath
and
when it's not available switch to pure PHP implementation. For examples
on
usage look at Zend_Locale_Format or Zend_Measure_Abstract.
http://framework.zend.com/svn/framework/standard/trunk/library/Zend/Locale/Math/PhpMath.php
Interesting. Correct me if I'm wrong, but it appears to me that when
bcmath
is unavailable that library ceases to be a multiple precision integer
arithmetic library (ie. BigInteger) and instead supports regular old
32-bit
integers (or 64-bit for 64-bit machines)?
No, it does not limit to 32 bit integer. Still there is a sort of limitation
which is related to the usecase this lib was created for.
If so, I'm not even sure it'd be
accurate to say that it "falls back" on anything - if bcmath is
unavailable
its feature set becomes completely different.
No it does not.
If you absolutely need
128-bit integers and bcmath is unavailable that library isn't going to be
sufficient
We're calculating dates with a unixtimestamp from BC (-4000) which extends
32bit with ease.
and if you have bcmath and can live with 32-bit integers that
library is probably going to slow things down for you
Why should it ?
When BCMath is available you will get the result from BCMath and not the
lib.
(bcadd(), I suspect, can't compare in speed to the + operator).
You have to decide if you are in need of BCMath or of PHP limited integer.
This is a design decision and not a fault or problem of a class.
You are ALWAYS slower when you have to use a component or extension than
using PHP native "+" notation.
If that library actually does support integers of any length regardless of
whether or not bcmath is installed then shouldn't that library - and not
Zend_Crypt_Math_BigInteger - be used by Zend_Crypt_DiffieHellman?
Can't say anything about that. Zend_Crypt is no longer developed by it's
maintainer and unchanged in incubator since mid 2008.
So I expect that this component is dead.
--
View this message in context:
http://www.nabble.com/pure-PHP-BigInteger-support-tp22068811p22211234.html
Sent from the Zend Framework mailing list archive at Nabble.com.