I'm using unsigned 16 bit integers (uint16_t) so I'd assume that will work?

No it will not.

your input values are in the range "1080 and 1750" squaring it gives values between 1 and 4 million, will not fit in an 16 bit.

OK the subtraction of 1080 makes it max 700^2 == 490.000 which still will not fit in a 16 bit int by a factor 7.

However if you persist to do only 16 bit math and you accept a (~1%) error you could apply the division in steps to keep the result under max unint16. The prices is less accuracy and some "staircasing" in the graph due to less distinct values. I used a spreadsheet to model the results below.

(original code, 2 long multiplies and one long division)

long t = x-1080;

t = t * t * 10;

y = t / 8978 + 1500; (will have 445 distinct values)

**Note: 8978 = 2x67x67** t = x-1080; // t = 0..700

t = t/67; // t = 0..11 (oops only 12 distinct values BAD)

t = t * t * 5;

y = t + 1500; // still only 12 distinct values TOO ROUGH

**8978 is almost 8980 = 2.2.5.449** t = x-1080; // t = 0..700

t1 = t/2; // t1 = 0..350 (350 distinct values OK!)

t2 = t/5; // t2 = 0..140 (140 disctinct values OK!)

*note that using two distinct dividers give more distinct values in the end.*t = t1 * t2; // t = 0..44890

t = t / 89; // (remaining factors result in => 2*449/10 = 89 (328 distinct values)

t = t + 1500;

if (t > 2000) t = 2000; // max error is 4

Other

**8978 is ~8982 = 2.3.3.499 **===> using 2 and 3 will result in an overflow (700^2 /6 >> 65535)

===> using 3 and 6 will give less distinct values than 2 and 5

===> using 1 and 9 is interesting as you need one division less! and it will map 1750 on 2000

t = x-1080; // t = 0..700

t1 = t/9; // t1 = 0..77

t = t1 * t; // t = 0..49580

t = t / 99; // 280 distinct values

t = t + 1500;

So using these values produces slightly less distinct values but its codesize is also less (faster) AND still using only 16 bit math!.

another one to consider

**8978 is ~8976 = 2.2.2.2.3.11.17**==> using 2 and 4 is interesting as two divisions would result in a shift (fast)

t = x-1080;

t1 = t/2;

t2 = t/4;

t = t1 * t2; // t = 0..55945

t = t / 111; // => 262 distinct values (max error 6)

t = t + 1500;

if (t > 2000) t = 2000;

**Epilog:**If small errors are acceptable one can improve the speed and the footprint of the algorithm quite a lot.