C# 클래스 Rolcore.Math.Fraction

A fraction.
파일 보기 프로젝트 열기: Rollins/Rolcore 1 사용 예제들

공개 메소드들

메소드 설명
Duplicate ( ) : Fraction

The function replicates current Fraction object

Equals ( object obj ) : bool

checks whether two fractions are equal

Fraction ( ) : System

Constructor.

Fraction ( double decimalValue ) : System
Fraction ( long wholeNumber ) : System

Initializes a new instance of Fraction initialized to the specified whole-number value.

Fraction ( long numerator, long denominator ) : System
Fraction ( string s ) : System
GetHashCode ( ) : int

returns a hash code for this fraction

Inverse ( Fraction frac1 ) : Fraction

The function returns the inverse of a Fraction object

ReduceFraction ( Fraction frac ) : void

The function reduces(simplifies) a Fraction object by dividing both its numerator and denominator by their GCD

ToDouble ( ) : double

The function returns the current Fraction object as double

ToFraction ( double dValue ) : Fraction

The function takes a floating point number as an argument and returns its corresponding reduced fraction

ToFraction ( string strValue ) : Fraction

The function takes an string as an argument and returns its corresponding reduced fraction the string can be an in the form of and integer, double or fraction. e.g it can be like "123" or "123.321" or "123/456"

ToString ( ) : string

The function returns the current Fraction object as a string

operator ( ) : Fraction
operator ( ) : bool

비공개 메소드들

메소드 설명
Add ( Fraction frac1, Fraction frac2 ) : Fraction

internal functions for binary operations

GreatestCommonDenominator ( long iNo1, long iNo2 ) : long

The function returns GCD of two numbers (used for reducing a Fraction)

Initialize ( long numerator, long denominator ) : void

Internal function for constructors

Multiply ( Fraction frac1, Fraction frac2 ) : Fraction
Negate ( Fraction frac1 ) : Fraction

internal function for negation

메소드 상세

Duplicate() 공개 메소드

The function replicates current Fraction object
public Duplicate ( ) : Fraction
리턴 Fraction

Equals() 공개 메소드

checks whether two fractions are equal
public Equals ( object obj ) : bool
obj object
리턴 bool

Fraction() 공개 메소드

Constructor.
public Fraction ( ) : System
리턴 System

Fraction() 공개 메소드

public Fraction ( double decimalValue ) : System
decimalValue double
리턴 System

Fraction() 공개 메소드

Initializes a new instance of Fraction initialized to the specified whole-number value.
public Fraction ( long wholeNumber ) : System
wholeNumber long Specifies the initial value of the fraction.
리턴 System

Fraction() 공개 메소드

public Fraction ( long numerator, long denominator ) : System
numerator long
denominator long
리턴 System

Fraction() 공개 메소드

public Fraction ( string s ) : System
s string
리턴 System

GetHashCode() 공개 메소드

returns a hash code for this fraction
public GetHashCode ( ) : int
리턴 int

Inverse() 공개 정적인 메소드

The function returns the inverse of a Fraction object
public static Inverse ( Fraction frac1 ) : Fraction
frac1 Fraction
리턴 Fraction

ReduceFraction() 공개 정적인 메소드

The function reduces(simplifies) a Fraction object by dividing both its numerator and denominator by their GCD
public static ReduceFraction ( Fraction frac ) : void
frac Fraction
리턴 void

ToDouble() 공개 메소드

The function returns the current Fraction object as double
public ToDouble ( ) : double
리턴 double

ToFraction() 공개 정적인 메소드

The function takes a floating point number as an argument and returns its corresponding reduced fraction
public static ToFraction ( double dValue ) : Fraction
dValue double
리턴 Fraction

ToFraction() 공개 정적인 메소드

The function takes an string as an argument and returns its corresponding reduced fraction the string can be an in the form of and integer, double or fraction. e.g it can be like "123" or "123.321" or "123/456"
public static ToFraction ( string strValue ) : Fraction
strValue string
리턴 Fraction

ToString() 공개 메소드

The function returns the current Fraction object as a string
public ToString ( ) : string
리턴 string

operator() 공개 정적인 메소드

public static operator ( ) : Fraction
리턴 Fraction

operator() 공개 정적인 메소드

public static operator ( ) : bool
리턴 bool