Class Rational

java.lang.Object
java.lang.Number
com.twelvemonkeys.imageio.metadata.tiff.Rational
All Implemented Interfaces:
Serializable, Comparable<Rational>

public final class Rational extends Number implements Comparable<Rational>
Represents a rational number with a long numerator and long denominator. Rational numbers are stored in reduced form with the sign stored with the numerator. Rationals are immutable.

Adapted from sample code featured in "Intro to Programming in Java: An Interdisciplinary Approach" (Addison Wesley) by Robert Sedgewick and Kevin Wayne. Permission granted to redistribute under BSD license.

Version:
$Id: Rational.java,v 1.0 Nov 18, 2009 1:12:00 AM haraldk Exp$
Author:
Harald Kuhr, Robert Sedgewick and Kevin Wayne (original version), last modified by $Author: haraldk$
See Also:
  • Constructor Details

    • Rational

      public Rational(long pNumber)
    • Rational

      public Rational(long pNumerator, long pDenominator)
  • Method Details