Help with map() function!!

Hi everyone, am using MG811 CO2 sensor

It gives output voltage between 0-2V. I get the 2 Volt when the CO2 concentration is normal in the rum and the voltage decrease as the CO2 concentration increase. So I want to use the map function as this way

volts=map(volts,1.95,0.2,350,10000);
Serial.println("CO2: ");
Serial.print(volts);
Serial.print("ppm");
Serial.println("");

So if the concentration is 2 volts then the CO2 concen. is 350 ppm and when the output voltage is near 0 volts then the CO2 is near 10000... But the function don't works as it should!! anybody knows why or have some comments about it??
NEED HELP =(

I get the volts number from this function:

float MGRead(int mg_pin) //I give the function the analogRead value on mg_pin
{
int i;
float v=0;
for (i=0;i<READ_SAMPLE_TIMES;i++) //READ_SAMPLE_INTERVAL 50 milliseconds
{
v += analogRead(mg_pin);

delay(READ_SAMPLE_INTERVAL); //READ_SAMPLE_TIMES is 5 milliseconds
}
v = (v/READ_SAMPLE_TIMES) *5/1024 ;
return v;
}

From what I can tell, map() does not work with floats. It's return data type is long.
Multiply everything by 1000 or 1000000 and cast to long then map() and divide the result by the multiplier into a float.

edit:
For the mathematically inclined, here's the whole function

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;
}

Thanx for ur response, it works nice now :wink: