Compute area under curve only when possible