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

fixed crash loop infinitive when compare float by using FLT_EPSILON #1581

Merged
merged 1 commit into from
Apr 5, 2023

Conversation

vancucit
Copy link
Contributor

@vancucit vancucit commented Apr 2, 2023

This PR is to improvement fix this crash

#1461

Look compare float equal on not correct in some case

https://stackoverflow.com/questions/4732645/iphone-objective-c-comparing-doubles-not-working

This debug log has demonstrated this issue

if (fabs(self.scrollView.mj_insetT - insetT) > FLT_EPSILON) {
      self.scrollView.mj_insetT = insetT;
  }else{
    if (self.scrollView.mj_insetT != insetT ) {
      NSLog(@"_--------- same value dif epsilon %f  %f ", self.scrollView.mj_insetT, insetT);
    }
  }

2023-04-02 10:09:15.886546+0700 App[58013:10076967] _--------- same value dif epsilon 172.333333 172.333333

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

Successfully merging this pull request may close these issues.

None yet

2 participants