Udostępnij za pośrednictwem


Rational(Int32, Int32) Constructor

Definition

Create a Rational with a given numerator and denominator.

[Android.Runtime.Register(".ctor", "(II)V", "")]
public Rational (int numerator, int denominator);
[<Android.Runtime.Register(".ctor", "(II)V", "")>]
new Android.Util.Rational : int * int -> Android.Util.Rational

Parameters

numerator
Int32

the numerator of the rational

denominator
Int32

the denominator of the rational

Attributes

Remarks

Create a Rational with a given numerator and denominator.

The signs of the numerator and the denominator may be flipped such that the denominator is always positive. Both the numerator and denominator will be converted to their reduced forms (see #equals for more details).

For example, <ul> <li>a rational of 2/4 will be reduced to 1/2. <li>a rational of 1/-1 will be flipped to -1/1<li>a rational of 5/0 will be reduced to 1/0<li>a rational of 0/5 will be reduced to 0/1</ul>

Java documentation for android.util.Rational.Rational(int, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to