Follow-up from "Make calo ADC and Digit packing compatible with other packed classes"
The following discussion from !3943 (merged) should be addressed:
-
@sponce started a discussion: (+11 comments) First I would not call that "safe_sqrt", as it's not in my view. Something safe would not return when it cannot return something sensible. In other term, it should rather fail with an exception to be safe instead of returning, which is a very standard value. It could alternatively return nan (though I'm not a fan), but that's actually what sqrt does, so the function would be useless then.
Now I'm wondering why you need such code ? The caller of sqrt should ALWAYS check first that it sends a positive number. Or whether a nan came back. So this method looks to me like a blessing to write bad code... not so nice.