C# Class Reko.Core.Rational

Simplistic implementation of rational numbers.
Datei anzeigen Open project: uxmal/reko Class Usage Examples

Public Properties

Property Type Description
Denominator long
Numerator long

Public Methods

Method Description
FromDouble ( double x ) : Rational

Use a sequence of continued fractions to find a good rational approximation to the double precition provided number

http://jonisalonen.com/2012/converting-decimal-numbers-to-ratios/

FromIntegers ( long num, long den ) : Rational
Rational ( long num, long den ) : System
Reciprocal ( ) : Rational
ToDouble ( ) : double
ToString ( ) : string
operator ( ) : Rational

Private Methods

Method Description
gcd ( long a, long b ) : long

Method Details

FromDouble() public static method

Use a sequence of continued fractions to find a good rational approximation to the double precition provided number
http://jonisalonen.com/2012/converting-decimal-numbers-to-ratios/
public static FromDouble ( double x ) : Rational
x double
return Rational

FromIntegers() public static method

public static FromIntegers ( long num, long den ) : Rational
num long
den long
return Rational

Rational() public method

public Rational ( long num, long den ) : System
num long
den long
return System

Reciprocal() public method

public Reciprocal ( ) : Rational
return Rational

ToDouble() public method

public ToDouble ( ) : double
return double

ToString() public method

public ToString ( ) : string
return string

operator() public static method

public static operator ( ) : Rational
return Rational

Property Details

Denominator public_oe property

public long Denominator
return long

Numerator public_oe property

public long Numerator
return long