Pseudo sinusoidal waveform

I needed a small routine to generate a cyclic waveform resembling sin(x) to test a CODEC board. This is what I came up with:

float pseudoSin(float x)
  return (1.0f-x*x)*x

This produces the following waveform over the domain [-1,1]:


The derivative of the function is 1-3x^2 . The maximum and minimum occur at x = \sqrt{ \frac{1}{3} } and x = -\sqrt{ \frac{1}{3} }, respectively. The function has maximum and minimum values of \frac{2}{3} \sqrt{ \frac{1}{3} } \approx 0.38490 and -\frac{2}{3} \sqrt{ \frac{1}{3} } \approx -0.38490 .

The amplitude normalisation factor is approximately 2.5981. For completeness, here is the error of the function with respect to a real sin(x):


The error maximum is about 16.3%.