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

Charts/Classes/Utils/ChartUtils.swift error #1611

Closed
jackywongcw opened this issue Oct 5, 2016 · 1 comment
Closed

Charts/Classes/Utils/ChartUtils.swift error #1611

jackywongcw opened this issue Oct 5, 2016 · 1 comment

Comments

@jackywongcw
Copy link

jackywongcw commented Oct 5, 2016

Hello,

Not sure if anyone encountered this before (I've searched from the issue)
//
fatal error: Double value cannot be converted to Int because it is either infinite or NaN
(lldb)
//

I got this error message when I'm entering a screen to display the chart.

// here's your method
internal class func decimals(_ number: Double) -> Int
{
if number.isNaN || number.isInfinite || number == 0.0
{
return 0
}

    let i = roundToNextSignificant(number: Double(number))

    if i.isInfinite
    {
        return 0
    }

    return Int(ceil(-log10(i))) + 2 
}

//
return Int(ceil(-log10(i))) + 2 // <------------------------
Unable to convert the return value to int, so I tried using Int(round(ceil(-log10(i))) + 2), gives the same error. Could it be something wrong with the calculations inside?

Please advice.
Thank you!

@pmairoldi
Copy link
Collaborator

This had been fixed by #1558

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