 }
 
 func loadGradient(_ filename: String) -> Gradient? {
-    let gradient = Gradient()
-
-    gradient.colors.append(GradientColor(0.0, 0.0, 0.0, 0.0))
-    gradient.colors.append(GradientColor(1.0, 1.0, 1.0, 1.0))
+    var gradient = Gradient()
+
+    gradient.colors.append(GradientColor(pos: 0.0, r: 0.0, g: 0.0, b: 0.0))
+    gradient.colors.append(GradientColor(pos: 1.0, r: 1.0, g: 1.0, b: 1.0))
 
     do {
         let contentsOfFile = try String(contentsOfFile: filename)

    case GETTIME
}

class GradientColor {
    var pos: Double
    var r, g, b: Double

    init(_ pos: Double, _ r: Double, _ g: Double, _ b: Double) {
        self.pos = pos
        self.r = r
        self.g = g
        self.b = b
    }
}

class Gradient {
    var colors = [GradientColor]()
}


    return abs(absA - absB) <= max(absA, absB) * DBL_EPSILON
}

func gradientGetIndexOfColorAtPosition(_ gradient: Gradient, _ pos: Double) -> Int? {
    for i in 0..<gradient.colors.count {
        if equalEnough(gradient.colors[i].pos, pos) {
            return i
        }
    }

