Map function ide 2

Hi ,
I’m using the MAP function on IDE 2.3.2

The auto complete is showing long variable type, I thought map used ints ?

From Arduino.h

long map(long, long, long, long, long);

A long is an int :slight_smile: It's short for long int.

Here's a quote from reference.arduino.cc/reference/en/language/functions/math/map/:

Appendix

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

Try this link for help: C - Type - What are uint8_t, uint16_t, uint32_t and uint64_t? | BadproG.com

Every day etc etc .

Of course , getting mixed up in my mind with floats.Although I had previously thought was only upto 2byte ints.(uint_16 t)

Thx

signed long int

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.