Added reference implementation for trig