Source for file Fraction.php
Documentation is available at Fraction.php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
// +----------------------------------------------------------------------+
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2004 The PHP Group |
// +----------------------------------------------------------------------+
// | This source file is subject to version 3.0 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available through the world-wide-web at the following url: |
// | http://www.php.net/license/3_0.txt. |
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to |
// | license@php.net so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// | Authors: Kouber Saparev <kouber@php.net> |
// +----------------------------------------------------------------------+
// $Id: Fraction.php,v 1.3 2007/07/18 14:53:31 kouber Exp $
* Math_Fraction: class to represent and manipulate fractions (n = a/b)
* @author Kouber Saparev <kouber@php.net>
* The numerator of the fraction
* The denominator of the fraction
* Constructor for Math_Fraction
* @param mixed $num Integer for the Numerator or a Float that the fraction will be built from.
* @param int $den Denominator
* @return object Math_Fraction
// the fraction is built from a float
$this->_num = & $fr->getNum ();
$this->_den = & $fr->getDen ();
// classical construction with numerator and denominator
// signature = (int, int)
// just one parameter is passed to the constructor
// invalid signature = (int)
// try to create a fraction from string
$this->_num = & $fr->getNum ();
$this->_den = & $fr->getDen ();
// denominator is negative => set the sign of the entire fraction
* Returns the numerator of the fraction
* Returns the denominator of the fraction
* Float evaluation of the fraction
* String representation of the fraction
Documentation generated on Mon, 11 Mar 2019 15:07:36 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|