int desiredQuality = call.arguments[@"desiredQuality"]; //BETWEEN 0 AND 1602
float calculatedQuality = desiredQuality/1602; //RETURNS 0
日志:
APP: this is the desiredQuality: 802
APP: this is the calculatedQuality: 0.000000
我尝试将calculateQuality更改为int或double,但我得到相同的结果。我做错了什么?
答案 0 :(得分:1)
这是int
师
float calculatedQuality = desiredQuality/1602; //RETURNS 0
如果数字小于1602,它将返回0,您需要将其转换为
float calculatedQuality = desiredQuality/1602.0; //RETURNS 0.5