Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
無限大について全力で考えてみる
void FourArithmeticInfinity(){
// 足し算
// 無限大に数値を足す
float additionToInf = Mathf.Infinity + 1.0e+38f;
Debug.Log("additionToInf : " + additionToInf);
// 無限大に無限大を足す
float additionInfToInf = Mathf.Infinity + Mathf.Infinity;
Debug.Log("additionInfToInf : " + additionInfToInf);
// 引き算
// 無限大から数値を引く
float subtractionFromInf = Mathf.Infinity - 1.0e+38f;
Debug.Log("subtractionFromInf : " + subtractionFromInf);
// 無限大から無限大を引く
float subtractionInfFromInf = Mathf.Infinity - Mathf.Infinity;
Debug.Log("subtractionInfFromInf : " + subtractionInfFromInf);
// 掛け算
// 無限大に数値を掛ける
float multiplicationInf = Mathf.Infinity * 1.0e+38f;
Debug.Log("multiplicationInf : " + multiplicationInf);
// 無限大に無限大を掛ける
float multiplicationInfByInf = Mathf.Infinity * Mathf.Infinity;
Debug.Log("multiplicationInfByInf : " + multiplicationInfByInf);
// 無限大に0を掛ける
float multiplicationInfByZero = Mathf.Infinity * 0f;
Debug.Log("multiplicationInfByZero : " + multiplicationInfByZero);
// 割り算
// 無限大を数値で割る
float divisionInf = Mathf.Infinity / 1.0e+38f;
Debug.Log("divisionInf : " + divisionInf);
// 無限大を無限大で割る
float divisionInfByInf = Mathf.Infinity / Mathf.Infinity;
Debug.Log("divisionInfByInf : " + divisionInfByInf);
// 無限大を0で割る
float divisionInfByZero = Mathf.Infinity / 0f;
Debug.Log("divisionInfByZero : " + divisionInfByZero);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.