iOS 划分时出现 INFINITY 问题

发布于 2024-10-06 10:11:58 字数 221 浏览 4 评论 0原文

我在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

懷念過去 2024-10-13 10:11:58

因为当表达式为 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.

烟燃烟灭 2024-10-13 10:11:58

因为有时 mapState.iBufferMult == 0

检查你没有悬空指针。

because sometimes mapState.iBufferMult == 0.

Check you haven't got a dangling pointer.

拔了角的鹿 2024-10-13 10:11:58

谁能告诉我为什么会这样。

是的,我可以:当 mapState.iBufferMult0(零)时:

zoomLimit = 1/(mapState.iBufferMult*0.75)
          = 1/(0*0.75)
          = 1/0
          = INFINITY

解决 mapState.iBufferMult 问题,您就解决了这个问题。

Can anyone tell me why it is doing like that.

Yes, I can: when mapState.iBufferMult is 0 (zero) then:

zoomLimit = 1/(mapState.iBufferMult*0.75)
          = 1/(0*0.75)
          = 1/0
          = INFINITY

Solve the mapState.iBufferMult problem and you've solved this one.

路弥 2024-10-13 10:11:58

因为某些有时,mapState 为 nil 或 mapState.iBufferMult 为 0。

或者问题出在该行之外。

也许在那里设置一个断点,并在 ZoomLimit 为 INFINITY 时停止。

Because some of the time, mapState is nil or mapState.iBufferMult is 0.

Or the problem lies outside of this line.

Maybe set a breakpoint there and halt when zoomLimit is INFINITY.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文