4 ms·
That will not handle -0.0 unfortunately since 0 == -0.
by Kranar 5y ago
That will not handle -0.0 unfortunately since 0 == -0.
- alisonkisk 5y agoThat doesn't matter because Math.max() knows the difference between +0.0 and -0.0. Try it and you'll see.
- bordercases 5y agoIt does that because of the way they implement arithmetic, not about an inherent property of the mathematical function `max`. The problem has to be solved once.