this post was submitted on 11 Mar 2025
21 points (100.0% liked)

Programmer Humor

21779 readers
1509 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS
 

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 33 points 1 week ago (1 children)

whats wrong? they're the same value no?

[–] [email protected] 14 points 1 week ago* (last edited 1 week ago) (3 children)

I think they're pointing out that Python outputs E notation vs JavaScript which outputs the decimal notation.

Edit: Wasn't agreeing with it, just explaining what they were pointing out.

[–] [email protected] 26 points 1 week ago

Yeah, but that… doesn't really matter. So it doesn't really make sense to post that here, especially with that headline.

[–] [email protected] 12 points 1 week ago* (last edited 1 week ago)

Would this cause a problem? I'm assuming this would be deserialized to the same value, no?

[–] [email protected] 1 points 1 week ago

But that's a stringify method, tho.
JS passes a float to the console. Console prints the float however it wants to.

Just do strict comparison when you want to compare a variable to1e-5.
Cause a string of 0.00001 should be passed through parseFloat (or whatever your language equivalent is) before you compare it to a variable with the value f0.00001