Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

有关float的相等判断 #6

Closed
SoloChow opened this issue Sep 10, 2018 · 5 comments
Closed

有关float的相等判断 #6

SoloChow opened this issue Sep 10, 2018 · 5 comments

Comments

@SoloChow
Copy link

有关float的相等判断,建议改用 exp (A - B) < 0.01或其它更准确的判断方式。因为精度问题,在判断上时常会导致布局错乱。

@czl0325
Copy link
Owner

czl0325 commented Sep 17, 2018

是哪个布局需要加这个?

@SoloChow
Copy link
Author

attributes.frame = CGRectMake([xFill floatValue]==edgeInsets.left?[xFill floatValue]:[xFill floatValue]+minimumInteritemSpacing, [yFill floatValue]==maxYOfFill?[yFill floatValue]:[yFill floatValue]+minimumLineSpacing, self.isFloor?floor(itemSize.width):itemSize.width, itemSize.height);

@czl0325
Copy link
Owner

czl0325 commented Sep 19, 2018

奇怪,我是向下取整了,照理应该不会出现问题才对,顶多就是重新换行而已啊。

@SoloChow
Copy link
Author

你的宽度向下取整了,但是高度没有,所以也会引起这个问题。

@czl0325
Copy link
Owner

czl0325 commented Oct 18, 2018

已修改好

@SoloChow SoloChow closed this as completed Nov 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants