Class FloatCRTMath

  • All Implemented Interfaces:
    java.io.Serializable
    Direct Known Subclasses:
    FloatCarryCRTStepStrategy

    public class FloatCRTMath
    extends FloatBaseMath
    Basic arithmetic for calculating the Chinese Remainder Theorem. Works for the float type.
    Version:
    1.6
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      FloatCRTMath​(int radix)
      Creates a carry-CRT math using the specified radix.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      float add​(float[] src, float[] srcDst)
      Adds three words.
      float compare​(float[] src1, float[] src2)
      Compares three words.
      float divide​(float[] srcDst)
      Divides three words by the base to produce two words.
      void multiply​(float[] src, float factor, float[] dst)
      Multiplies two words by one word to produce a result of three words.
      void subtract​(float[] src, float[] srcDst)
      Subtracts three words.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • INVERSE_MAX_POWER_OF_TWO_BASE

        private static final double INVERSE_MAX_POWER_OF_TWO_BASE
        See Also:
        Constant Field Values
      • base

        private double base
    • Constructor Detail

      • FloatCRTMath

        public FloatCRTMath​(int radix)
        Creates a carry-CRT math using the specified radix.
        Parameters:
        radix - The radix that will be used.
    • Method Detail

      • multiply

        public final void multiply​(float[] src,
                                   float factor,
                                   float[] dst)
        Multiplies two words by one word to produce a result of three words. Most significant word is stored first.
        Parameters:
        src - Source array, first multiplicand.
        factor - Second multiplicand.
        dst - Destination array.
      • compare

        public final float compare​(float[] src1,
                                   float[] src2)
        Compares three words. Most significant word is stored first.
        Parameters:
        src1 - First operand.
        src2 - Second operand.
        Returns:
        Less than zero if src1 < src2, greater than zero if src1 > src2 and zero if src1 == src2.
      • add

        public final float add​(float[] src,
                               float[] srcDst)
        Adds three words. Most significant word is stored first.
        Parameters:
        src - First operand.
        srcDst - Second operand, and destination of the operation.
        Returns:
        Overflow carry bit.
      • subtract

        public final void subtract​(float[] src,
                                   float[] srcDst)
        Subtracts three words. Most significant word is stored first.
        Parameters:
        src - First operand.
        srcDst - Second operand, and destination of the operation.
      • divide

        public final float divide​(float[] srcDst)
        Divides three words by the base to produce two words. Most significant word is stored first.
        Parameters:
        srcDst - Source and destination of the operation.
        Returns:
        Remainder of the division.