Class OtpErlangDouble

  • All Implemented Interfaces:, java.lang.Cloneable
    Direct Known Subclasses:

    public class OtpErlangDouble
    extends OtpErlangObject
    Provides a Java representation of Erlang floats and doubles. Erlang defines only one floating point numeric type, however this class and its subclass OtpErlangFloat are used to provide representations corresponding to the Java types Double and Float.
    See Also:
    Serialized Form
    • Constructor Detail

      • OtpErlangDouble

        public OtpErlangDouble​(double d)
        Create an Erlang float from the given double value.
      • OtpErlangDouble

        public OtpErlangDouble​(OtpInputStream buf)
                        throws OtpErlangDecodeException
        Create an Erlang float from a stream containing a double encoded in Erlang external format.
        buf - the stream containing the encoded value.
        OtpErlangDecodeException - if the buffer does not contain a valid external representation of an Erlang float.
    • Method Detail

      • doubleValue

        public double doubleValue()
        Get the value, as a double.
        the value of this object, as a double.
      • toString

        public java.lang.String toString()
        Get the string representation of this double.
        Specified by:
        toString in class OtpErlangObject
        the string representation of this double.
      • encode

        public void encode​(OtpOutputStream buf)
        Convert this double to the equivalent Erlang external representation.
        Specified by:
        encode in class OtpErlangObject
        buf - an output stream to which the encoded value should be written.
      • equals

        public boolean equals​(java.lang.Object o)
        Determine if two floats are equal. Floats are equal if they contain the same value.
        Specified by:
        equals in class OtpErlangObject
        o - the float to compare to.
        true if the floats have the same value.