当前位置:网站首页>Unity notes_ SQL Function
Unity notes_ SQL Function
2022-06-30 04:58:00 【Bigfield】
float Round(float num, int length)//0.58
{
string str = num.ToString();
// Pass in an integer , There is no decimal point
if (!str.Contains("."))
{
return num;
}
else // There's a decimal point
{
float _num = Mathf.Abs(num);
float temp = _num * Mathf.Pow(10, length + 1);
float rem = temp % 10f; // and 10 Remainder Take a single
float res = temp / 10f;
if ((int)rem <= 4) // give up
{
return ((int)res) / Mathf.Pow(10, length)*(num/ _num);
}
if ((int)rem >= 6) return ((int)(res + 1)) / Mathf.Pow(10, length);
if ((int)rem == 5)
{
if (rem > 5) return ((int)(res + 1)) / Mathf.Pow(10, length) * (num / _num);
else
{
if (((int)(res % 10f)) % 2 == 0)
return ((int)res) / Mathf.Pow(10, length) * (num / _num);
else return ((int)(res + 1)) / Mathf.Pow(10, length) * (num / _num);
}
}
}
return num;
}边栏推荐
- One interview question every day to talk about the process of TCP connection and disconnection
- Introduction to some representations, neighbors and degrees of Graphs
- Pourquoi l'ordinateur n'a - t - il pas de réseau après l'ouverture du Hotspot win10?
- Output directory of log files after unity3d packaging
- A collection of errors encountered in machine learning with unity
- Qos(Quality of Service)
- Unity download and installation website
- LxC and LXD container summary
- Solution to Autowired annotation warning
- pycharm 数据库工具
猜你喜欢

Qos(Quality of Service)

Check London attractions suitable for parents and children in winter vacation

Unity script life cycle and execution sequence

【Paper】2021_ Observer-Based Controllers for Incrementally Quadratic Nonlinear Systems With Disturbanc

【Paper】2006_ Time-Optimal Control of a Hovering Quad-Rotor Helicopter

为什么win10开热点后电脑没有网络?

Redis cluster concept

Force buckle 349 Intersection of two arrays

Unity3d realizes Google Digital Earth

【Paper】2017_ Research on coordinated control method of underwater vehicle formation marine survey
随机推荐
Unity3d Google Earth
Force buckle 59 Spiral matrix II
Arsenal Stadium Tour - take you to the front and back of Arsenal Stadium
One interview question every day to talk about the process of TCP connection and disconnection
Singapore must visit these scenic spots during the Spring Festival
Universal Studios Singapore: a good place for a one-day parent-child tour in Singapore
Collective system
Draw on screen border in Commodore 64
A virtual reality secret room escape adventure, let you see Technology Singapore
What is multimodal interaction?
Solution to Autowired annotation warning
Static keyword
力扣292周赛题解
One interview question a day the difference between B tree and b+ tree
One command to run rancher
Brew install NVM command not found solution
harbor api 2.0查询
SSL update method
Force buckle 209 Minimum length subarray
Special folders in unity3d and their meanings