mirror of
https://github.com/php/php-src.git
synced 2024-12-15 12:54:57 +08:00
22 lines
902 B
Plaintext
22 lines
902 B
Plaintext
BCMATH FAQ:
|
|
|
|
1) Why BCMATH?
|
|
|
|
The math routines of GNU bc become more generally useful in a
|
|
library form. By separating the BCMATH library from GNU bc,
|
|
GNU bc can be under the GPL and BCMATH can be under the LGPL.
|
|
|
|
2) Why BCMATH when GMP exists?
|
|
|
|
GMP has "integers" (no digits after a decimal), "rational numbers"
|
|
(stored as 2 integers) and "floats". None of these will correctly
|
|
represent a POSIX BC number. Floats are the closest, but will not
|
|
behave correctly for many computations. For example, BC numbers have
|
|
a "scale" that represent the number of digits to represent after the
|
|
decimal point. The multiplying two of these numbers requires one to
|
|
calculate an exact number of digits after the decimal point regardless
|
|
of the number of digits in the integer part. GMP floats have a
|
|
"fixed, but arbitrary" mantissa and so multiplying two floats will end
|
|
up dropping digits BC must calculate.
|
|
|