Created
June 15, 2018 13:27
-
-
Save todorok1/bb929ecf2ae2b1b598fb0c051f8e632b to your computer and use it in GitHub Desktop.
無限大について全力で考えてみる
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void CompareInfinity(){ | |
// floatのInfinityをキャストするとdoubleではどうなるか | |
double infFromFloat = float.PositiveInfinity; | |
Debug.Log("infFromFloat : " + infFromFloat); | |
// MathfのInfinityをキャストするとdoubleではどうなるか | |
double infFromMathf = Mathf.Infinity; | |
Debug.Log("infFromMathf : " + infFromMathf); | |
// floatでの計算結果が最大値を超える場合はどうなるか | |
double overMax = float.MaxValue + 1.0e+33f; | |
Debug.Log("overMax : " + overMax); | |
// doubleのInfinityをキャストするとfloatではどうなるか | |
float infFromDouble = (float) double.PositiveInfinity; | |
Debug.Log("infFromDouble : " + infFromDouble); | |
// floatの最大値を超えるdoubleの値をキャスト | |
float overMaxFromDouble = (float) 1.0e+200; | |
Debug.Log("overMaxFromDouble : " + overMaxFromDouble); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment