Is there a map()-like function that returns floats instead of ints?

So I'd like more than integer resolution for a map command I'm working with, but the common map() function only does integer math: http://arduino.cc/en/Reference/Map

I looked around and couldn't find any posted code besides in this thread that's not quite the answer: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1253687840

Did I miss something?

From the reference page you linked to:

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

Hardly seems worth the bother of encapsulating it in a function, but if you take that bit of code and replace all the longs with floats you'll get what you want.

Or you can #define it as a macro to make it type-less

define MAP (X,in_min,in_max, out_min, out_max) (((X) - (in_min)) * ((out_max) - (out_min)) / ((in_max) - (in_min)) + (out_min))

// hope I didn't miss a ()

but be aware that you should not use statements in it as it will cause side effects

y = MAP(X, i++, j--, p++, q*q); // really sick code ;)

depending on the mapping the formula can be simpler (especially if the point (0,0) is a valid mapping)