Helper class to perform Half/Float conversion. Code extract from paper : www.fox-toolkit.org/ftp/fasthalffloatconversion.pdf by Jeroen van der Zijp
Example #1
0
 /// <summary>
 /// Converts an array of half precision values into full precision values.
 /// </summary>
 /// <param name = "values">The values to be converted.</param>
 /// <returns>An array of converted values.</returns>
 public static float[] ConvertToFloat(Half[] values)
 {
     float[] results = new float[values.Length];
     for (int i = 0; i < results.Length; i++)
     {
         results[i] = HalfUtils.Unpack(values[i].RawValue);
     }
     return(results);
 }
Example #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Half" /> structure.
 /// </summary>
 /// <param name = "value">The floating point value that should be stored in 16 bit format.</param>
 public Half(float value)
 {
     this.value = HalfUtils.Pack(value);
 }