유니티 C# 반올림, 올림, 내림, 소수점 2자리 버리기 간단 구현


유니티 C# 반올림, 올림, 내림, 소수점 2자리 버리기 간단 구현

반올림 Roundfloat myFloat = 3.6f; int myInt = Mathf.RoundToInt(myFloat); Debug.Log(myInt); // 출력: 4 반올림 Ceilfloat myFloat = 3.2f; int myInt = Mathf.CeilToInt(myFloat); Debug.Log(myInt); // 출력: 4 내림 Floorfloat myFloat = 3.8f; int myInt = Mathf.FloorToInt(myFloat); Debug.Log(myInt); // 출력: 3 소수점 전부 버리기float myFloat = 3.14159f; int myInt = Mathf.FloorToInt(myFloat); Debug.Log(myInt); // 출력: 3 소수점 1자리 ..


원문링크 : 유니티 C# 반올림, 올림, 내림, 소수점 2자리 버리기 간단 구현