Calculates the value of a function at a value.