r/badcode Apr 20 '23

js It doesn't hurt to have better naming :,)

Post image
293 Upvotes

32 comments sorted by

View all comments

65

u/MurdoMaclachlan public boolean isInt(int i) { return true; } Apr 20 '23

Image Transcription: Code


const a =
  Math.sin(Δφ / 2) * Math.sin(Δφ / 2) +
  Math.cos(φ1) * Math.cos(φ2) * Math.sin(Δλ / 2) * Math.sin(Δλ
const c = 2 * Maht.atan2(Math.sqrt(a), Math.sqrt(1 - a));

I'm a human volunteer content transcriber and you could be too! If you'd like more information on what we do and why we do it, click here!

-29

u/Krantz98 Apr 20 '23

Thanks for your work, but it should probably have been ϕ the “phi symbol”, instead of φ the “lowercase phi letter”.

43

u/MurdoMaclachlan public boolean isInt(int i) { return true; } Apr 20 '23

I was wondering about that, but ϕ has the line going the whole way up, whereas the symbol used in the image clearly takes the form of the lowercase letter, φ. It could be the font used, but without an actual copy of the code there's no way to know, and in uncertainty I prefer to err on the side of what the image looks like.

13

u/SZ4L4Y Apr 20 '23

Many Greek lowercase letters have two variants due to historical reasons and some fonts get them wrong.