Esempio n. 1
0
        internal static unsafe FP16 SingleToHalf(float single)
        {
            uint value = *((uint *)&single);

            ushort result = (ushort)(baseTable[(value >> 23) & 0x1ff] + ((value & 0x007fffff) >> shiftTable[value >> 23]));

            return(FP16.ToHalf(result));
        }
Esempio n. 2
0
 internal static FP16 Abs(FP16 floatHalfPrecision) => FP16.ToHalf((ushort)(floatHalfPrecision.Value & 0x7fff));
Esempio n. 3
0
 internal static FP16 Negate(FP16 floatHalfPrecision) => FP16.ToHalf((ushort)(floatHalfPrecision.Value ^ 0x8000));