Last active
December 21, 2015 15:29
-
-
Save masa795/6326698 to your computer and use it in GitHub Desktop.
string -> float -> doubleチェック
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
using UnityEngine; | |
using System.Collections; | |
using System.Collections.Generic; | |
public class test : MonoBehaviour { | |
public float m_float = 0f; | |
public double m_double = 0d; | |
public string m_input = ""; | |
public string m_out = ""; | |
void Start() | |
{ | |
for (int i = 16777000; i < 16777250; ++i) | |
{ | |
m_input = i.ToString(); | |
#if true // string -> float -> double | |
m_float = float.Parse(m_input); | |
m_double = m_float; | |
#else // string -> doiuble | |
m_double = double.Parse(m_input); | |
#endif | |
m_out = m_double.ToString(); | |
if (m_input != m_out) | |
{ | |
Debug.Log(" ++++++++++++++++++++++ "); | |
Debug.Log(m_input); | |
Debug.Log(m_out); | |
//Debug.Log(m_float.ToString("G17")); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment