Class LongApfloatImpl

  • All Implemented Interfaces:
    java.io.Serializable, ApfloatImpl

    public class LongApfloatImpl
    extends LongBaseMath
    implements ApfloatImpl
    Immutable apfloat implementation class for the long data element type.

    The associated DataStorage is assumed to be immutable also. This way performance can be improved by sharing the data storage between different ApfloatImpl's and by only varying the ApfloatImpl specific fields, like sign, precision and exponent.

    This implementation doesn't necessarily store any extra digits for added precision, so the last digit of any operation may be inaccurate.

    Version:
    1.11.0
    See Also:
    Serialized Form
    • Field Detail

      • sign

        private int sign
      • precision

        private long precision
      • exponent

        private long exponent
      • radix

        private int radix
      • hashCode

        private int hashCode
      • initialDigits

        private int initialDigits
      • isOne

        private int isOne
      • leastZeros

        private volatile long leastZeros
      • size

        private volatile long size
    • Constructor Detail

      • LongApfloatImpl

        private LongApfloatImpl​(int sign,
                                long precision,
                                long exponent,
                                DataStorage dataStorage,
                                int radix)
      • LongApfloatImpl

        public LongApfloatImpl​(java.lang.String value,
                               long precision,
                               int radix,
                               boolean isInteger)
                        throws java.lang.NumberFormatException,
                               ApfloatRuntimeException
        Create a new LongApfloatImpl instance from a String.
        Parameters:
        value - The string to be parsed to a number.
        precision - The precision of the number (in digits of the radix).
        radix - The radix in which the number is created.
        isInteger - Specifies if the number to be parsed from the string is to be treated as an integer or not.
        Throws:
        java.lang.NumberFormatException - If the number is not valid.
        ApfloatRuntimeException
      • LongApfloatImpl

        public LongApfloatImpl​(long value,
                               long precision,
                               int radix)
                        throws java.lang.NumberFormatException,
                               ApfloatRuntimeException
        Create a new LongApfloatImpl instance from a long.
        Parameters:
        value - The value of the number.
        precision - The precision of the number (in digits of the radix).
        radix - The radix in which the number is created.
        Throws:
        java.lang.NumberFormatException - If the number is not valid.
        ApfloatRuntimeException
      • LongApfloatImpl

        public LongApfloatImpl​(double value,
                               long precision,
                               int radix)
                        throws java.lang.NumberFormatException,
                               ApfloatRuntimeException
        Create a new LongApfloatImpl instance from a double.
        Parameters:
        value - The value of the number.
        precision - The precision of the number (in digits of the radix).
        radix - The radix in which the number is created.
        Throws:
        java.lang.NumberFormatException - If the number is not valid.
        ApfloatRuntimeException
      • LongApfloatImpl

        public LongApfloatImpl​(java.io.PushbackReader in,
                               long precision,
                               int radix,
                               boolean isInteger)
                        throws java.io.IOException,
                               java.lang.NumberFormatException,
                               ApfloatRuntimeException
        Create a new LongApfloatImpl instance reading from a stream.

        Implementation note: this constructor calls the in stream's single-character read() method. If the underlying stream doesn't explicitly implement this method in some efficient way, but simply inherits it from the Reader base class, performance will suffer as the default Reader method creates a new char[1] on every call to read().

        Parameters:
        in - The stream to read from.
        precision - The precision of the number (in digits of the radix).
        radix - The radix in which the number is created.
        isInteger - Specifies if the number to be parsed from the stream is to be treated as an integer or not.
        Throws:
        java.io.IOException - If an I/O error occurs accessing the stream.
        java.lang.NumberFormatException - If the number is not valid.
        ApfloatRuntimeException