Re: Standard library praise and challenge
- Posted by bill Sep 22, 2011
- 2629 views
Objects:
you said:
Agreed. Even sqrt(-1) dies instead of returning NaN, despite the latter behavior being explicitly allowed by the floating point standard. I think this is also keeping with the design principle of "Fail Early."
Sqrt(-1) should not return NaN because i is not anything like a real or a sequence. There cannot be an order for complex numbers unless you define 2 numbers as being equal if the distance from (0,0) (or (0,0,0) ... etc is the same) (metric spaces).
If max({}) fails what of max({ {} }). Are you say max() can only return a number?
Bill