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

fix: safely convert floats to int #294

Merged
merged 4 commits into from
Feb 7, 2025
Merged

Conversation

ioannisj
Copy link
Contributor

@ioannisj ioannisj commented Feb 7, 2025

💡 Motivation and Context

Closes #293

💚 How did you test it?

let nanNumber = NSNumber(value: CGFloat.nan) // NaN
let frNumber = NSNumber(value: CGFloat(4.5)) // 4.1
let gfmNumber = NSNumber(value: CGFloat.greatestFiniteMagnitude) // 1.797693134862316E+308

nanNumber.intValue // 0
gfmNumber.intValue // Int.max (9,223,372,036,854,775,807)
frNumber.intValue // 4

📝 Checklist

  • I reviewed the submitted code.
  • I added tests to verify the changes.
  • I updated the docs if needed.
  • No breaking change or entry added to the changelog.

@ioannisj ioannisj requested a review from marandaneto as a code owner February 7, 2025 10:17
@marandaneto
Copy link
Member

the unit tests could be part of the tests instead of the PR description :)

@ioannisj
Copy link
Contributor Author

ioannisj commented Feb 7, 2025

the unit tests could be part of the tests instead of the PR description :)

Yeap, done :)

@ioannisj ioannisj merged commit f98a8c8 into main Feb 7, 2025
6 checks passed
@ioannisj ioannisj deleted the fix/session-replay-int-overflow branch February 7, 2025 11:09
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.

Crash on iPad using sessionReplay = true
2 participants