Class MilStd1750A


  • public class MilStd1750A
    extends Object
    Some Mil1750A encoding/decoding functions. http://www.mssl.ucl.ac.uk/swift/docs/mil-std-1750a.pdf
    • Field Detail

      • MAX_FLOAT_VALUE

        public static long MAX_FLOAT_VALUE
      • MIN_FLOAT_VALUE

        public static long MIN_FLOAT_VALUE
      • MAX_FLOAT32_VALUE

        public static int MAX_FLOAT32_VALUE
      • MIN_FLOAT32_VALUE

        public static int MIN_FLOAT32_VALUE
    • Constructor Detail

      • MilStd1750A

        public MilStd1750A()
    • Method Detail

      • encode48

        public static long encode48​(double value)
        Encode double value to 48 bits 1750A floating point number. If the number is too large or too small, the MAX_FLOAT_VALUE respectively MIN_FLOAT_VALUE are returned This performs some bit operations to transform from IEE 754 binary representation to STD 1750 binary representation. No Math.pow or other expensive operations are used.
        Parameters:
        value - - double number
        Returns:
        encoded 48 bits number (the first 16 bits of the long are 0)
      • decode48

        public static double decode48​(long milstd)
        Decodes a MIL-STD 1750A 48 bit number into a double.
        Parameters:
        milstd - - number to be decoded. Only the last 48 bits are considered, the first 16 are ignored.
        Returns:
        - the decoded value
      • encode32

        public static int encode32​(double value)
        Encodes a double into a MIL-STD 1750A 32 bit number. If the number to be encoded is too large or too small, the MAX_FLOAT32_VALUE respectively MIN_FLOAT32_VALUE are returned
        Parameters:
        value -
        Returns:
      • decode32

        public static double decode32​(int milstd)
        Decodes a 32 bit MIL-STD 1750A number into a double.
        Parameters:
        milstd -
        Returns: