Throw exception if the parameter is not valid
Add missing include statement
pow() is included in <cmath>