README.md
1# The bcmath library
2
3This is a fork of the bcmath library initially created by Phil Nelson in May
42000.
5
6Bcmath is a library of arbitrary precision math routines. These routines, in a
7different form, are the routines that to the arbitrary precision calculations
8for GNU bc and GNU dc.
9
10This library is provided to make these routines useful in a larger context with
11less restrictions on the use of them.
12
13These routines do not duplicate functionality of the GNU gmp library. The gmp
14library is similar, but the actual computation is different.
15
16Initial library (version 0.1) has been created in 2000-05-21 and then forked and
17bundled into PHP with version 0.2 released in 2000-06-07.
18
19## FAQ
20
21* Why BCMATH?
22
23 The math routines of GNU bc become more generally useful in a library form. By
24 separating the BCMATH library from GNU bc, GNU bc can be under the GPL and
25 BCMATH can be under the LGPL.
26
27* Why BCMATH when GMP exists?
28
29 GMP has "integers" (no digits after a decimal), "rational numbers" (stored as
30 2 integers) and "floats". None of these will correctly represent a POSIX BC
31 number. Floats are the closest, but will not behave correctly for many
32 computations. For example, BC numbers have a "scale" that represent the number
33 of digits to represent after the decimal point. The multiplying two of these
34 numbers requires one to calculate an exact number of digits after the decimal
35 point regardless of the number of digits in the integer part. GMP floats have
36 a "fixed, but arbitrary" mantissa and so multiplying two floats will end up
37 dropping digits BC must calculate.
38
39## Credits
40
41Phil Nelson (philnelson@acm.org) wrote bcmath library.
42
43## License
44
45The bcmath library is released under the GNU Lesser General Public License v2.1.
46