ソースコード
using System; public static class FloatExtensions { public static bool IsZero( this float self ) { return self.IsZero( float.Epsilon ); } public static bool IsZero( this float self, float epsilon ) { return Math.Abs( self ) < epsilon; } }
使用例
Debug.Log( 1.0f.IsZero() ); // False Debug.Log( 0.0f.IsZero() ); // True