 # Map function resolution ?

I am trying to map 0,862 to 0,25 I would like to get 0.5 steps posible 0.25 on the output but I can't seem to get what i am looking for

snips of the code to follow

``````int sensorValue8 = 0;
float sensorValue8m = 0;

in the loop
sensorValue8m = map(sensorValue8, 0, 862, 0.00, 25.00);
lcd.setCursor(0, 0);
lcd.print(sensorValue8);
lcd.setCursor(0, 1);
lcd.print(sensorValue8m);
``````

When it prints I only get full int example 1.00 2.00 3.00

What am I missing or can the map() not do what I want

This is the map 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; }

as you can see it works with longs. Try this:

double modifiedMap(double x, double in_min, double in_max, double out_min, double out_max) { double temp = (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; temp = (int) (4*temp + .5); return (double) temp/4; }

and replace your map function with: modifiedMap(.. )