org.apache.commons.imaging.common

## Class RationalNumber

- java.lang.Object
- - java.lang.Number
  - - org.apache.commons.imaging.common.RationalNumber

- All Implemented Interfaces:
    Serializable

      public class RationalNumber
      extends Number

  Rational number, as used by the TIFF image format.
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `int` | `divisor`
    `int` | `numerator`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `RationalNumber(int numerator, int divisor)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `double` | `doubleValue()`
    `float` | `floatValue()`
    `int` | `intValue()`
    `long` | `longValue()`
    `RationalNumber` | `negate()`
    `String` | `toDisplayString()`
    `String` | `toString()`
    `static RationalNumber` | `valueOf(double value)` Calculate rational number using successive approximations.

    - ### Methods inherited from class java.lang.Number

      `byteValue, shortValue`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### numerator

          public final int numerator

    - #### divisor

          public final int divisor

  - ### Constructor Detail

    - #### RationalNumber

          public RationalNumber(int numerator,
                                int divisor)

  - ### Method Detail

    - #### negate

          public RationalNumber negate()

    - #### doubleValue

          public double doubleValue()

      Specified by:
        `doubleValue` in class `Number`

    - #### floatValue

          public float floatValue()

      Specified by:
        `floatValue` in class `Number`

    - #### intValue

          public int intValue()

      Specified by:
        `intValue` in class `Number`

    - #### longValue

          public long longValue()

      Specified by:
        `longValue` in class `Number`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### toDisplayString

          public String toDisplayString()

    - #### valueOf

          public static RationalNumber valueOf(double value)

      Calculate rational number using successive approximations.
      Parameters:
        `value` - rational number double value
      Returns:
        the RationalNumber representation of the double value

Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.