using UnityEngine;
using System.Collections;
public class Chap3 : MonoBehaviour {
// Use this for initialization
void Start () {
float f1 = 0.1f - 0.2f;
float f2 = 43.1f - 43.2f;
double d3 = 0.1 - 0.2;
print("0.1-0.2=" + f1);
print ("43.1f-43.2f = " + f2);
if(f1 == f2)
{
print("Equal");
}
else{
print ("Not Equal");
}
}
// Update is called once per frame
void Update () {
}
실수형은 실수를 많이 한다.
using UnityEngine;
using System.Collections;
public class Chap3 : MonoBehaviour {
// Use this for initialization
void Start () {
decimal a = 0.1m - 0.2m;
decimal b = 43.1m - 43.2m;
print (" 0.1m - 0.2m = " + a);
print (" 43.1m - 43.2m = " + b);
if(a == b)
print ("equal");
else
print ("Not Equal");
}
// Update is called once per frame
void Update () {
}
'Computer Language > 유니티' 카테고리의 다른 글
이스케이프 문자 (0) | 2014.03.31 |
---|---|
문자형 (0) | 2014.03.31 |
자료형(실수) (0) | 2014.03.31 |
자료형(정수) (0) | 2014.03.31 |
왼쪽 오른쪽 이동 그리고 정지 (0) | 2014.03.31 |