|
|
| Name: |
Rational |
| Base name: |
rational |
| Description: |
Perform arithmetic operations on rational numbers |
| Related classes: |
arithmetic |
| Version: |
- |
| PHP version: |
- |
| License: |
Custom (specified in a license file) |
| All time users: |
337 users |
| All time rank: |
5493 |
| Week users: |
0 users |
| Week rank: |
2470 |
| |
|
 |
|
Innovation award
 Nominee: 3x
Winner: 1x |
This performs arithmetic operations using rational numbers.
Rational numbers are those numbers that can be represented as the ratio between two integer numbers. Any real number with a finite number decimal digits or that repeats a sequence of digits can be represented as a rational number.
This class can add, subtract, multiply, and divide rational numbers.
The results of the operations are also rational numbers, simplified to eliminate any common factors of the the numerator and denominator. This way the arithmetic operations are performed without loss of precision, a common failing of floating point arithemetic.
 February 2006
Number 4
Prize: One book of choice by O'Reilly |
PHP supports all the kinds of arithmetic operations that can be performed between numbers. However, certain operations between rational numbers may result in values that loose precision because PHP represents the results as floating point values.
This class provides means to perform basic arithmetic operations between rational numbers, in a way that the results are also rational numbers, and so they do not loose precision.
Manuel Lemos |
| Not yet rated by the users |
| |
Packages needed by this class |
|
|
| Class |
Dependency |
Why it is needed |
| Numerical |
Required |
Several functions are required for conversion to rational form and simplifying rational numbers. |
| |
Applications that use this class |
|
|
No application links were specified for this class.

If you know an application of this package, send a message to the
author to add a link here.
| |
Files |
|
|