             return Int(octal, radix: 8)
         }
         if scalar.contains(":") {
-            var sign = 1
-            if scalar.hasPrefix("-") {
-                sign = -1
-                scalar = scalar.substring(from: scalar.index(after: scalar.startIndex))
-            } else if scalar.hasPrefix("+") {
-                scalar = scalar.substring(from: scalar.index(after: scalar.startIndex))
-            }
-            let digits = scalar.components(separatedBy: ":").flatMap({ Int($0) }).reversed()
-            var base = 1
-            var value = 0
-            digits.forEach {
-                value += $0 * base
-                base *= 60
-            }
-            return sign * value
+            return Int(sexagesimal: scalar)
         }
         return Int(scalar)
     }

        return substring(with: lowerBound..<upperBound)
    }
}

        default:
            scalar = scalar.replacingOccurrences(of: "_", with: "")
            if scalar.contains(":") {
                return Double(sexagesimal: scalar)
            }
            return Double(scalar)
        }
