iOS 划分时出现 INFINITY 问题
我在 iPhon 应用程序中遇到无穷大问题。问题很奇怪。我需要使用以下公式计算缩放限制。
zoomLimit = 1/(mapState.iBufferMult*0.75);
mapState.iBufferMult 的值 = 3
问题是大多数类型的公式给出的正确值是 0.44。但有时它会给出无限。
谁能告诉我为什么会这样。
I am getting infinity problem in an iPhon application. The problem is very strange. I need to calculate the zoom limit using the following formula.
zoomLimit = 1/(mapState.iBufferMult*0.75);
The value of mapState.iBufferMult = 3
The problem is that most of the type the formula gives the correct value 0.44. But sometimes it gives INFINITY.
Can anyone tell me why it is doing like that.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
因为当表达式为 INFINITY 时,
mapState.iBufferMult
为 0。你的程序中的某些东西将其设置为 0。记录它和除法的结果并每次检查。Because
mapState.iBufferMult
is 0 in the cases where the expression is INFINITY. Something in your program is setting it to 0. Log it and the result of the division and check every time.因为有时
mapState.iBufferMult
==0
。检查你没有悬空指针。
because sometimes
mapState.iBufferMult
==0
.Check you haven't got a dangling pointer.
是的,我可以:当
mapState.iBufferMult
为0
(零)时:解决
mapState.iBufferMult
问题,您就解决了这个问题。Yes, I can: when
mapState.iBufferMult
is0
(zero) then:Solve the
mapState.iBufferMult
problem and you've solved this one.因为某些有时,
mapState
为 nil 或mapState.iBufferMult
为 0。或者问题出在该行之外。
也许在那里设置一个断点,并在 ZoomLimit 为 INFINITY 时停止。
Because some of the time,
mapState
is nil ormapState.iBufferMult
is 0.Or the problem lies outside of this line.
Maybe set a breakpoint there and halt when zoomLimit is INFINITY.