using System; namespace Robust.Shared.Maths; /// /// Marker type to indicate floating point values that should preserve NaNs across the network. /// /// /// Robust's network serializer may be configured to flush NaN float values to 0, /// to avoid exploits from lacking input validation. Even if this feature is enabled, /// NaN values passed in this type are still untouched. /// /// The actual inner floating point value /// public readonly record struct UnsafeHalf(Half Value) { public static implicit operator Half(UnsafeHalf f) => f.Value; public static implicit operator UnsafeHalf(Half f) => new(f); } /// /// Marker type to indicate floating point values that should preserve NaNs across the network. /// /// /// Robust's network serializer may be configured to flush NaN float values to 0, /// to avoid exploits from lacking input validation. Even if this feature is enabled, /// NaN values passed in this type are still untouched. /// /// The actual inner floating point value /// public readonly record struct UnsafeFloat(float Value) { public static implicit operator float(UnsafeFloat f) => f.Value; public static implicit operator UnsafeFloat(float f) => new(f); } /// /// Marker type to indicate floating point values that should preserve NaNs across the network. /// /// /// Robust's network serializer may be configured to flush NaN float values to 0, /// to avoid exploits from lacking input validation. Even if this feature is enabled, /// NaN values passed in this type are still untouched. /// /// The actual inner floating point value /// public readonly record struct UnsafeDouble(double Value) { public static implicit operator double(UnsafeDouble f) => f.Value; public static implicit operator UnsafeDouble(double f) => new(f); public static implicit operator UnsafeDouble(float f) => new(f); public static implicit operator UnsafeDouble(UnsafeFloat f) => new(f); }