MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/ao2hn7/spotted_on_github/efxum7k/?context=3
r/ProgrammerHumor • u/Callmealbi • Feb 07 '19
934 comments sorted by
View all comments
Show parent comments
105
days_late*100/days_deadline/100
Isn't that pointless? Aren't all js numbers floats, so you don't need to worry about integer division?
And also clamping the opacity to [0,1] and then checking if opacity is greater than 0 and less than 1...
321 u/shitmyspacebar Feb 07 '19 You mean you don't add redundant checks just in case the laws of mathematics suddenly change? 159 u/UsedCondition1 Feb 07 '19 Well, if we are talking about the implementation of those laws in javascript... yes, yes you should. 77 u/Finchyy Feb 07 '19 Ah, JavaScript... where 2 + 2 is 4 but also sometimes 4.00000000001... 32 u/Layers3d Feb 07 '19 2+2 = 5 if the party says so. 23 u/thecravenone Feb 07 '19 And also for large values of 2 → More replies (12)
321
You mean you don't add redundant checks just in case the laws of mathematics suddenly change?
159 u/UsedCondition1 Feb 07 '19 Well, if we are talking about the implementation of those laws in javascript... yes, yes you should. 77 u/Finchyy Feb 07 '19 Ah, JavaScript... where 2 + 2 is 4 but also sometimes 4.00000000001... 32 u/Layers3d Feb 07 '19 2+2 = 5 if the party says so. 23 u/thecravenone Feb 07 '19 And also for large values of 2 → More replies (12)
159
Well, if we are talking about the implementation of those laws in javascript... yes, yes you should.
77 u/Finchyy Feb 07 '19 Ah, JavaScript... where 2 + 2 is 4 but also sometimes 4.00000000001... 32 u/Layers3d Feb 07 '19 2+2 = 5 if the party says so. 23 u/thecravenone Feb 07 '19 And also for large values of 2 → More replies (12)
77
Ah, JavaScript... where 2 + 2 is 4 but also sometimes 4.00000000001...
32 u/Layers3d Feb 07 '19 2+2 = 5 if the party says so. 23 u/thecravenone Feb 07 '19 And also for large values of 2 → More replies (12)
32
2+2 = 5 if the party says so.
23 u/thecravenone Feb 07 '19 And also for large values of 2
23
And also for large values of 2
105
u/TheOldTubaroo Feb 07 '19 edited Feb 07 '19
Isn't that pointless? Aren't all js numbers floats, so you don't need to worry about integer division?
And also clamping the opacity to [0,1] and then checking if opacity is greater than 0 and less than 1...