Class Rational

  • All Implemented Interfaces:
    java.io.Serializable

    @Immutable
    public class Rational
    extends java.lang.Number
    Author:
    Fabrizio Giudici
    See Also:
    Serialized Form
    • Constructor Detail

      • Rational

        public Rational​(double d)
        Parameters:
        d -
    • Method Detail

      • doubleValue

        public final double doubleValue()
        Specified by:
        doubleValue in class java.lang.Number
      • floatValue

        public final float floatValue()
        Specified by:
        floatValue in class java.lang.Number
      • byteValue

        public final byte byteValue()
        Overrides:
        byteValue in class java.lang.Number
      • intValue

        public final int intValue()
        Specified by:
        intValue in class java.lang.Number
      • longValue

        public final long longValue()
        Specified by:
        longValue in class java.lang.Number
      • shortValue

        public final short shortValue()
        Overrides:
        shortValue in class java.lang.Number
      • divide

        @Nonnull
        public final Rational divide​(double det)
        Parameters:
        det -
        Returns:
      • getReciprocal

        @Nonnull
        public final Rational getReciprocal()
      • isInteger

        public final boolean isInteger()
      • toString

        @Nonnull
        public final java.lang.String toString()
        Overrides:
        toString in class java.lang.Object