Class F16Dot16


  • public class F16Dot16
    extends java.lang.Object
    Constants and operations on fixed 16.16 numbers. The value v is represented by the int value 2^16 * v.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int ONE  
      static int ONE_HALF  
      static int ZERO  
    • Constructor Summary

      Constructors 
      Constructor Description
      F16Dot16()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int divide​(int v1, int v2)
      Divide a 16.16 by a 16.16, result is a 16.16.
      static int fromDouble​(double v)
      Convert a double to a 16.16.
      static int fromInt​(int v)
      Convert an int to a 16.16.
      static int multiply​(int v1, int v2)
      Multiply two 16.16, result is a 16.16.
      static int multiplyByF2Dot14​(int v1, int v2)
      Multiply a 16.16 by a 2.14, result is 16.16.
      static int multiplyDivide​(int v1, int v2, int v3)
      Multiply a 16.16 by a 16.16 and divive by a 16.16, result is a 16.16.
      static int round​(int v)
      Round a 16.16, half-up , result is a 16.16.
      static int square​(int v)
      Square of a 16.16, result is a 16.16.
      static double toDouble​(int v)
      Convert a 16.16 to a double.
      static java.lang.String toString​(int v)
      Convert a 16.16 to a decimal representation.
      static int truncate​(int v)
      Truncate the decimal part of a 16.16, result is a 16.16.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • F16Dot16

        public F16Dot16()
    • Method Detail

      • truncate

        public static int truncate​(int v)
        Truncate the decimal part of a 16.16, result is a 16.16.
      • multiply

        public static int multiply​(int v1,
                                   int v2)
        Multiply two 16.16, result is a 16.16.
      • square

        public static int square​(int v)
        Square of a 16.16, result is a 16.16.
      • multiplyByF2Dot14

        public static int multiplyByF2Dot14​(int v1,
                                            int v2)
        Multiply a 16.16 by a 2.14, result is 16.16.
      • multiplyDivide

        public static int multiplyDivide​(int v1,
                                         int v2,
                                         int v3)
        Multiply a 16.16 by a 16.16 and divive by a 16.16, result is a 16.16.
      • divide

        public static int divide​(int v1,
                                 int v2)
        Divide a 16.16 by a 16.16, result is a 16.16.
      • round

        public static int round​(int v)
        Round a 16.16, half-up , result is a 16.16.
      • toDouble

        public static double toDouble​(int v)
        Convert a 16.16 to a double.
      • fromDouble

        public static int fromDouble​(double v)
        Convert a double to a 16.16.
      • fromInt

        public static int fromInt​(int v)
        Convert an int to a 16.16.
      • toString

        public static java.lang.String toString​(int v)
        Convert a 16.16 to a decimal representation.