title: Index out of range for function to convert large number to number with suffix (million, billion....)
body: <p>I am a new programmer building my first incremental game for iOS. I wrote a small function to convert my large number to smaller number with suffix.</p>
  
  <pre><code>func numberConverter(_ number: Double) -&gt; String {
  
      let intermediate = floor(log10(number)/3)
      let numberSuffix: [String] = ["K", "M", "B", "T", "Qa", "Qi", "Sx", "Sp", "Oc", "No", "Dc", "UDc", "DDc", "TDc", "QaDc"]
      let convertedNumber: String = "\(round(number / pow(10.0, intermediate * 3.0) * 1000) / 1000) \(numberSuffix[Int(intermediate) - 1])"
  
      return convertedNumber
  }
  </code></pre>
  
  <p>When I do the conversion, I always get the "Index out of range" error.</p>
  
  <p>I already tried many different searches for this, but until now no answer.</p>
  
  <p>Can anyone have a look? Thanks a lot for your help.</p>