PHP Classes

Big Number Calculator: Add arbitrary precision numbers in pure PHP

Recommend this page to a friend!
  Info   View files View files (4)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2009-04-15 (10 years ago) RSS 2.0 feedNot enough user ratingsTotal: 1,106 All time: 3,356 This week: 344Up
Version License PHP version Categories
bignumbercalculator 1.0GNU Lesser Genera...5PHP 5, Math
Description Author

This class can be used to add arbitrary precision numbers in pure PHP.

It takes two decimal numbers represented as strings of unlimited length and performs an addition digit by digit.

The result is another decimal number represented as a string.

Innovation Award
PHP Programming Innovation award nominee
December 2006
Number 5

Prize: One subscription to the PDF edition of the magazine by PHP Architect
Arbitrary precision numbers can be used to perform mathematical operations without loosing the precision of the results.

PHP applications can use the bcmath extension to perform arbitrary precision operations. However, this extension is not always available in all PHP installations.

This class provides a pure PHP based solution to perform basic operations with arbitrary precision numbers. It can be used in environments where bcmath extension is not available.

Manuel Lemos
Name: Protung Dragos is available for providing paid consulting. Contact Protung Dragos .
Classes: 10 packages by
Country: Germany Germany
Age: 36
All time rank: 292 in Germany Germany
Week rank: 45 Down4 in Germany Germany Down
Innovation award
Innovation award
Nominee: 3x



                   Calculator - Version 1
                         November 2006

                Copyright (c) 2006 Dragos Protung



1. Description
2. System Requirements
3. How to use
4. Contact


1. Product Description

A PHP class that can add positive floating numbers with precision even if they are infinite big.


2. System Requirements

PHP 5.x


3. How to use

Create a new object
$calc = new calculator();

You can add numbers using the addNumber method like

To get the result use call $calc->calc();


3. Contact

Please send your suggestions, bug reports and general feedback to
Also visit

Out for now ;)
  Files folder image Files  
File Role Description
Plain text file calculator.php Class Main class
Accessible without login Plain text file example.php Example Example of usage
Accessible without login Plain text file license.txt Lic. License file
Accessible without login Plain text file readme.txt Doc. Documentation

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:3,356
This week:344Up