Jason Orendorff (2013-08-01T17:13:04.000Z)
domenic at domenicdenicola.com (2013-08-04T22:59:51.097Z)
On Thu, Aug 1, 2013 at 11:46 AM, Allen Wirfs-Brock <allen at wirfs-brock.com> wrote: > ``` > Waldemar: Why isn't it variadic? > Luke: 2 or 3 is the 99% use case. > Waldemar: 2 or 3 arguments is the 99% use case for max. > Waldemar: If it's not variadic and takes only 2 or 3 arguments, you'll get silent mistakes. If you pass in four arguments, you'll get the hypot of the first three, and the last one will be silently ignored. That's bad. > ``` Heh! Thanks for the long quote. It's striking how many good points Waldemar has in this exchange. > ``` > Luke: Will go back to the experts to explore implementing variadic hypot. > ``` I don't know if I qualify as an expert, but variadic hypot would be no harder to implement than what is currently specified (probably easier, honestly), and no harder to optimize. To answer a question posed in that discussion, one way hypot(a, b) is better than sqrt(a*a + b*b) is that the latter underflows if the arguments are both small, and overflows if either argument is large.