Arduino inputing sine wave

Hello
I have problem getting sine wave. I gave 10Hz AC signal to A0 and I expected to see a clean sine wave on sketch plotter,but my graph was showing me that waves are clipped off from the top (shown below).
and this is my code:

void setup(){

Serial.begin(9600);
}

void loop(){
int sensorValue = analogRead(A0);
float a=min(sensorValue,0);
float b=max(sensorValue,5);
float voltage = sensSine(sensorValue,0,1023,a,b);

Serial.println(voltage);
delay(10);
}

float sensSine(float x,long in_min,long in_max,long out_min,long out_max)
{
long map(long x, long in_min, long in_max, long out_min, long out_max);

return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;

}

please help me to fix my code and be able to see clean sine wave.
Thank you

Start by plotting the values from analogRead() what does that look like. What is all the rest of the junk supost to do?

Mark

ALL WAYS AUTO FORMAT CODE BEFORE POSTING IT AND ALWAYS POST CODE IN CODE TAGS

Bias the sine wave with an opamp. A DC offset is needed.

Get it so the sine wave centres around 2.5v and has a trough at 0v and a peak at 5v.

Looks like your clean sin wave is too big for the D/A.

Have you biased the input at 2.5V?
Have you AC coupled into this bias network?

If you have not done these things then it will not work correctly.