ghazalghorabi / TDA553-lab1

0 stars 0 forks source link

Incorrect exponentiation #36

Open martinjonsson01 opened 1 year ago

martinjonsson01 commented 1 year ago

In most programming languages ^ is not used for exponentiation, it's used for logical XOR. So you're not taking the coordinates to the power of 2 here, you're XORing them with 2. Instead, use Math.pow(a, b).

https://github.com/ghazalghorabi/TDA553-lab1/blob/01f3360df2ab6d8a3dae4522fac81312009bb5d9/src/CarShop.java#L40

martinjonsson01 commented 1 year ago

https://github.com/ghazalghorabi/TDA553-lab1/blob/7f372da30e043f0290b53230226a6b7a94890562/src/Distance.java#L6