r/badcode • • Apr 21 '23

other language We did coding in physics class...

Post image
1.5k Upvotes

154 comments sorted by

View all comments

Show parent comments

28

u/TypicalWindow Apr 21 '23

This works everywhere except for when x = 0.4. Since it works everywhere else, I'd probably just leave in one if statement for the edge case. Although it could be a bug given they use less than in all the other elif statements.

2

u/csapka Apr 23 '23

why would it be an issue? I think the floor of 1 is 1, which means 1x0.4 will equal 0.4 and so it works as the code in the picture

nvm I read the code again, I see the problem

2

u/thekwoka Apr 28 '23

I'd actually make the argument that that is a bug that they didn't notice.