Yuriy Gromchenko

35%
Flag icon
Whatever its choice, this is definitely not sqrt's problem. By expressing the domain of the square root function in the precondition of the sqrt routine, you shift the burden of correctness to the caller—where it belongs. You can then design the sqrt routine secure in the knowledge that its input will be in range.
The Pragmatic Programmer
Rate this book
Clear rating
Open Preview