OT: PHP 32 bit numbers security issue
Uri Even-Chen
uri at speedy.net
Thu Jan 6 15:02:03 IST 2011
On Thu, Jan 6, 2011 at 11:49, Nadav Har'El <nyh at math.technion.ac.il> wrote:
> On Thu, Jan 06, 2011, Uri Even-Chen wrote about "Re: OT: PHP 32 bit numbers security issue":
>> By the way, although I know hardware can be used to calculate floating
>> point operations, I would prefer to use software - because of the
>> ability to be flexible and let the user or programmer define the
>> number of bits necessary for accuracy and the exponent. I think
>> calculating integer operations is enough for hardware - the rest can
>> be done by software.
>
> What you're describing is exactly what was common on cheap computers of
> the 1980's.
>
> The 8086, Intel's circa 1978 CPU that is the ancestor of all of today's
> PC CPUs, didn't have floating-point instructions. But clearly, the software
> floating point performance wasn't good enough, because two years later, in
> 1980, intel came out with the 8087, but these so-called "math coprocessors"
> were still not common at the time.
>
> A book about the assembly language of another cheap computer from the same era,
> the Commodore 64, contains the following quote about why the commodore 64 did
> floating-point in software: "you pay a tremendous amount for having floating-
> point instructions, because computers which have them are so much more
> expensive than microcomputers".
>
> Fractint (http://en.wikipedia.org/wiki/Fractint) is an example of a project
> that came out in the era (1988) when the math coprocessors were still not
> common, and they did everything humanly possible to avoid using floating-point
> operations, and use integers instead (the word "int" even appears in the
> project's name).
>
> So, sure, if your application is a desktop calculator, performance is not
> important, and convenience and accuracy is what matters, so go with arbitrary
> precision in software. But if your application really depends on calculating
> quickly, doing arbitrary precision in software instead of floating-point in
> hardware is just about the worst thing you could do to your application...
When I was programming Apple 2e machine language during the 1980s, the
CPU couldn't even multiply or divide - this was done with software.
The CPU could add or subtract, but only 8 bit integers. I guess this
was prehistory...
Uri Even-Chen
Mobile Phone: +972-50-9007559
E-mail: uri at speedy.net
Website: http://www.speedy.net/
More information about the Linux-il
mailing list