-3

I have a UInt128 holding a massive number like 2000009100000000000000 and I want to divide it by 1/10^30

How do I do that?

Zack Shapiro
  • 6,648
  • 17
  • 83
  • 151

1 Answers1

1

Possibly by using NSDecimalNumber. For example,

let num1 = NSDecimalNumber(string: "2000009100000000000000")
let num2 = NSDecimalNumber(mantissa: 10, exponent: 30, isNegative: false)
let result = num1.dividing(by: num2)
Tom Harrington
  • 69,312
  • 10
  • 146
  • 170