【C#】float 型から浮動小数点以下の数値を取得する拡張メソッド

ソースコード public static class FloatExt { public static float GetAfterDecimalPoint( this float self ) { return self % 1; } } 使い方 Debug.Log( 1f.GetAfterDecimalPoint() ); // 1 Debug.Log( 1.23f.GetAfterDecimalPoint() ); // 0.23 関連記事