Esempio n. 1
0
        public void f123dot456()
        {
            float  f            = 123.456f;
            ushort compressed   = HalfPrecision.Compress(f);
            float  decompressed = HalfPrecision.Decompress(compressed);

            Assert.AreEqual(f, decompressed, 0.1);
            Assert.AreNotEqual(f, decompressed);
        }
Esempio n. 2
0
        public void f123456()
        {
            float  f            = 123456f;
            ushort compressed   = HalfPrecision.Compress(f);
            float  decompressed = HalfPrecision.Decompress(compressed);

            Assert.True(decompressed <= ushort.MaxValue + 1);
            Assert.True(ushort.MaxValue <= decompressed);
        }
Esempio n. 3
0
 public static f32 f32HalfPeek <TReader>(this TReader self) where TReader : IBitBufferReader
 =>
 HalfPrecision.Decompress((u16)self.u32(16));
Esempio n. 4
0
 public static f32 f32Half(this IBitBufferReader self)
 =>
 HalfPrecision.Decompress((u16)self.u32(16));