public void SetValue(float value) { #if USE_HEX_FLOAT // It is more precise technic but output looks vague and less readable uint hex = BitConverterExtensions.ToUInt32(value); m_string = $"0x{hex.ToHexString()}({value.ToString(CultureInfo.InvariantCulture)})"; m_objectType = ScalarType.String; #else m_value = BitConverterExtensions.ToUInt32(value); m_objectType = ScalarType.Single; #endif }
public void SetValue(float value) { uint hex = BitConverterExtensions.ToUInt32(value); #if USE_HEX_SINGLE // As Unity says it is more precise technic but output looks vague and less readable m_value = $"0x{hex.ToString("X8")}({value.ToString(CultureInfo.InvariantCulture)})"; #else m_value = value; #endif m_objectType = ScalarType.Single; }
public static string ToHexString(this float _this) { uint value = BitConverterExtensions.ToUInt32(_this); return(ToHexString(value)); }
public static Emitter WriteHex(this Emitter _this, float value) { return(WriteHex(_this, BitConverterExtensions.ToUInt32(value))); }