Swift runtime failure: Double value cannot be converted to Int because the result would be less than Int.min
- Dominant language
- Swift
- Stars
- 28k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
* [x ] I've read, understood, and done my best to follow the [*CONTRIBUTING guidelines](https://github.com/jjatie/Charts/blob/master/CONTRIBUTING.md).
## What did you do?
We are using the CombinedChartView and get this fatalError when a value gets updated.
Swift runtime failure: Double value cannot be converted to Int because the result would be less than Int.min
## What did you expect to happen?
The code should check if the numbers could lead to a crash.
## What happened instead?
This line fails:
https://github.com/danielgindi/Charts/blob/313c285db2686c0ebb9a9ca2aebcd29f558c511c/Source/Charts/Renderers/XAxisRenderer.swift#L83
But it's not possible to find a number small enough to reproduce this error.
let intervalMagnitude = pow(10.0, Double(Int(log10(interval)))).roundedToNextSignificant()
## Charts Environment
**Charts version/Branch/Commit Number:**
4.1
**Xcode version:**
14.0
**Swift version:**
4.2
**Platform(s) running Charts:**
iOS/iPadOS 15-16
Contributor guide
Assessment
This issue has not been assessed yet.