int a=5;
float b=a;
long c=100;
long result;
result=(long)((1+b/100)*c);
//以上代码在windows平台运算结果正确 105,但在安卓或ios平台结果为104.。。
//以下几种修改方式
result=(long)Math.Round((1f+b/100)*c);
//或者分母为float
result=(long)((1+b/100f)*c);
以上代码在unity打出的包里呈现。
int a=5;
float b=a;
long c=100;
long result;
result=(long)((1+b/100)*c);
//以上代码在windows平台运算结果正确 105,但在安卓或ios平台结果为104.。。
//以下几种修改方式
result=(long)Math.Round((1f+b/100)*c);
//或者分母为float
result=(long)((1+b/100f)*c);
以上代码在unity打出的包里呈现。