Dear all,

I have a very basic (maybe stupid) question. I need to evaluate a piecewise function many times. My naive approach is to do something like:

```
function myPiecewise(a,b)
if a < 0
return 0.5*a + b
else
return - 2.5*a + b
end
end
```

Is that an efficient way of implementing piecewise functions? I could just create two functions, one for the negative case and another for the positive case. Would that be better in terms of performance?

Thanks!