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    
Ratings Unique User Downloads Download Rankings
StarStarStar 53%Total: 1,115 This week: 1All time: 3,377 This week: 560Up
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
Picture of Protung Dragos
Name: Protung Dragos is available for providing paid consulting. Contact Protung Dragos .
Classes: 10 packages by
Country: Romania Romania
Age: 40
All time rank: 281 in Romania Romania
Week rank: 52 Down1 in Romania Romania Equal
Innovation award
Innovation award
Nominee: 3x

Details

_____________________________________________________ Calculator - Version 1 November 2006 _____________________________________________________ Copyright (c) 2006 Dragos Protung _______________________ CONTENTS _______________________ 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 $calc->addNumber("9283476109487129740712657109832.78"); or $calc->addNumber("4386120876213943720417240982137.23"); To get the result use call $calc->calc(); ______________ 3. Contact ______________ Please send your suggestions, bug reports and general feedback to dragos@protung.ro Also visit http://www.protung.ro 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  
 0%
Total:1,115
This week:1
All time:3,377
This week:560Up
 User Ratings  
 
 All time
Utility:66%StarStarStarStar
Consistency:66%StarStarStarStar
Documentation:66%StarStarStarStar
Examples:66%StarStarStarStar
Tests:-
Videos:-
Overall:53%StarStarStar
Rank:2209