Map() function for curve

Attached are some procedures, from a much larger sketch, that I've used to scale and curve the outputs of a 2-axis Hall-effect sensor joystick whose normal outputs run from 0.05V to 4.95 V (assuming 5V reference source). These procedures:
(1) reduce output to 0 for voltages < 0.05V and > 4.95 V as that indicates a broken or shorted lead or internal joystick failure.
(2) establishes a deadband as no joystick will perfectly self-center.
(3) maps the voltage to a -1000 to +1000 scale (distinguishing between forward/reverse or left/right).
(4) applies five levels of scaling ranging from linear to squared.
The result to this point is illustrated in the attached graph.

After that, these functions:
(5) re-map the throttle axis to a new when going in reverse, and re-map the steering axis, with different steering sensitivities when going forward or revers.
(6) re-map Throttle and Steering in accord with a Speedpot connected to third analog input pin.

As the results of these calculations are fed into a CANbus network, there are probably some lines of code that refer to sending CAN messages, and I have not included the #define statements or variable declarations that precede all of this, but this does illustrate one way that one can get curving and scaling and so on using entirely integer arithmetic. It's probably not the most efficient code for this, so any suggestions would, of course, be welcome.
Ciao,
Lenny

READ_JOYSTICK.ino (4.08 KB)