working implementation of sine function.