# exponents in Robotc

I was looking on the forums and I couldn’t find a thread that was updated on exponents. I found one or two from 2012 when they first came out but for some reason the syntax didn’t work right when I tried it. I am using it to flatten out my motor curve for the drive motors using this code:
ch1=2^((1/18)*(vexRT[Ch1]));
ch1 being an integer outputting to the motor. It seems like it doesn’t do order of operations right and I cant seem to find out why. If there’s an easier way to shallow out the motor curve I would take that too if you don’t mind. Please help?

Instead of using the caret (^) symbol, use the pow(base, exponent) function. The caret is a bitwise logical operator (a comparison of individual bits in two variables).

so do ch1=pow((1/18)*(vexRT[ch1]));?

You would do

``````
ch1 = pow(2, (vexRT[ch1] / 18));

``````

18 is way too little, full forward on joystick would come out to 16384 motor power
may want to rethink your truespeed equation entirely actually

Also make sure you can multiply the sign of the input or else you will never be able to run the motor backwards because a negative exponent just becomes a fraction that’s inverted from the input you want.

Actually no. At full power with 2^((1/18)*127) is 133 motor power.