 
 import XCTest
 @testable import GeodesySpherical
+
+extension Double {
+    func rounded(to places: Int) -> Double {
+        let factor = pow(10.0, Double(places))
+        return (self * factor).rounded() / factor
+    }
+}
 
 final class GeodesySphericalTest: XCTestCase {
     

        let bearing = Degrees(300.7)
        
        let destination = greenwich.destination(with: distance, bearing: bearing)
        let destinationFormatted = String(format: "%.6f,%.6f", destination.latitude, destination.longitude)
        
        XCTAssertEqual(destinationFormatted, "51.513546,-0.098345")
    }
    
    func testIntersection() {

        let distance1 = Coordinate(53.2611, -0.7972).crossTrackDistanceToPath(from: bradwell, to: Coordinate(53.1887, 0.1334))
        let distance2 = Coordinate(10, 1).crossTrackDistanceToPath(from: Coordinate(0, 0), to: Coordinate(0, 2))
        
        XCTAssertEqual(distance1.rounded(to: 1), -307.5)
        XCTAssertEqual(distance2.rounded(to: 1), -1111949.3)
    }
    
    func testMaxLatitude() {
