Skip to content

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

Merged
wolfcon merged 1 commit into
CoderMJLee:masterfrom
vancucit:master
Apr 5, 2023
Merged

wolfcon merged 1 commit into
CoderMJLee:masterfrom
vancucit:master

Conversation

@vancucit

@vancucit vancucit commented Apr 2, 2023 •

Copy link
Copy Markdown
Contributor

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.

2 participants