xref: /PHP-7.0/ext/bcmath/libbcmath/FAQ (revision c476bce2)
1BCMATH FAQ:
2
31) Why BCMATH?
4
5The math routines of GNU bc become more generally useful in a
6library form.  By separating the BCMATH library from GNU bc,
7GNU bc can be under the GPL and BCMATH can be under the LGPL.
8
92) Why BCMATH when GMP exists?
10
11GMP has "integers" (no digits after a decimal), "rational numbers"
12(stored as 2 integers) and "floats".  None of these will correctly
13represent a POSIX BC number.  Floats are the closest, but will not
14behave correctly for many computations.  For example, BC numbers have
15a "scale" that represent the number of digits to represent after the
16decimal point.  The multiplying two of these numbers requires one to
17calculate an exact number of digits after the decimal point regardless
18of the number of digits in the integer part.  GMP floats have a
19"fixed, but arbitrary" mantissa and so multiplying two floats will end
20up dropping digits BC must calculate.
21
22