比方说3.1415926,我现在想传给后台的是3.14,类型是必须是float类型,该怎么样做?
还有即便通过运算得到了3.14,然后我要是按float传过去,是不是本质上传的还是3.1400000?
怪我咯2017-04-18 09:59:04
It should be possible to use string formatting, because what is received in the background is also a string type, not a float type, just use .2f directly
伊谢尔伦2017-04-18 09:59:04
Why are all strings transmitted from the front to the backend? Float doesn’t have any number of decimal places, or bigdecimal
PHPz2017-04-18 09:59:04
The double type is more accurate. You can also try the NSDecimalNumber class