Skip to content

Pythagoras' theorem wrongly implemented #5

@Pecnut

Description

@Pecnut

The brackets are misplaced in Pythagoras' theorem in distance_to_coords:

The function distance_to_coords says

def distance_to_coords(self, lat_a, lon_a):
        self.distance = (abs(self.lat - lat_a) ** 2) + (abs(self.lon - lon_a) ** 2) ** .5

but of course should be

def distance_to_coords(self, lat_a, lon_a):
        self.distance = ((self.lat - lat_a) ** 2 + (self.lon - lon_a) ** 2) ** .5

Currently it's working out "a^2 + √b^2" instead of "√(a^2 + b^2)"

(I've also removed the abs commands which are of course not needed)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions