OT: PHP 32 bit numbers security issue

OT: PHP 32 bit numbers security issue

Nadav Har'El nyh at math.technion.ac.il
Thu Jan 6 11:49:51 IST 2011


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...

-- 
Nadav Har'El                        |     Thursday, Jan  6 2011, 1 Shevat 5771
nyh at math.technion.ac.il             |-----------------------------------------
Phone +972-523-790466, ICQ 13349191 |New! Divorcee Barbie! Comes with all the
http://nadav.harel.org.il           |usual accessories, plus all of Ken's stuff



More information about the Linux-il mailing list