|
| 1 | +# The bcmath library |
| 2 | + |
| 3 | +This is a fork of the bcmath library initially created by Phil Nelson in May |
| 4 | +2010. |
| 5 | + |
| 6 | +Bcmath is a library of arbitrary precision math routines. These routines, in a |
| 7 | +different form, are the routines that to the arbitrary precision calculations |
| 8 | +for GNU bc and GNU dc. |
| 9 | + |
| 10 | +This library is provided to make these routines useful in a larger context with |
| 11 | +less restrictions on the use of them. |
| 12 | + |
| 13 | +These routines do not duplicate functionality of the GNU gmp library. The gmp |
| 14 | +library is similar, but the actual computation is different. |
| 15 | + |
| 16 | +Initial library (version 0.1) has been created in 2000-05-21 and then forked and |
| 17 | +bundled 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 | + |
| 41 | +Phil Nelson (philnelson@acm.org) wrote bcmath library. |
| 42 | + |
| 43 | +## License |
| 44 | + |
| 45 | +The bcmath library is released under the GNU Lesser General Public License v2.1. |
0 commit comments