当前位置:网站首页>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;
}
边栏推荐
- 力扣27. 移除元素
- Unity packaging failure solution
- Royal Albert Hall, a popular landmark in London
- Ripple effect of mouse click (unity & shader)
- 【Paper】2021_ Observer-Based Controllers for Incrementally Quadratic Nonlinear Systems With Disturbanc
- Force buckle 977 Square of ordered array
- Using the command line to convert JSON to dart file in fluent
- Singapore must visit these scenic spots during the Spring Festival
- [UAV] gyroscope data analysis, taking Victor intelligent jy901b as an example
- MySQL query gadget (I) replace a property value of the object in the JSON array in the JSON format string field
猜你喜欢
Royal Albert Hall, a popular landmark in London
【Paper】2016_ A Learning-Based Fault Tolerant Tracking Control of an Unmanned Quadrotor Helicopter
Unity script life cycle and execution sequence
Have a heart beating Valentine's day in Singapore
Parkour demo
Unity realizes rotation and Revolution
【Paper】2019_ Consensus Control of Multiple AUVs Recovery System Under Switching Topologies and Time D
Why does the computer have no network after win10 is turned on?
Sailing experience not to be missed in New York Tourism: take you to enjoy the magnificent city scenery from different perspectives
Output directory of log files after unity3d packaging
随机推荐
Redis cluster concept
Force buckle 704 Binary search
One interview question and one joint index every day
Connect to the database and run node JS running database shows that the database is missing
Some books you should not miss when you are new to the workplace
Check London attractions suitable for parents and children in winter vacation
Steamvr causes abnormal scene camera
Unit screenshot saved on the phone
Unity download and installation website
Deeply understand the function calling process of C language
National Museum of Singapore - give you spiritual and physical satisfaction
Keywords implements and @override
C # equipment synthesis
LXC 和 LXD 容器总结
力扣(LeetCode)180. 连续出现的数字(2022.06.29)
Solution to Autowired annotation warning
Circle center technology, very anxious?
Force buckle 349 Intersection of two arrays
Software digital signature certificate
【Paper】2015_ Coordinated cruise control for high-speed train movements based on a multi-agent model