ID:141665
 
Code:
mob/verb/Algorithm_Test()
var/x = input("Value of X for the equation","X") as num
var/y = 125*(x^2)-125*x+1000
src << "[y]"


Problem description:

I created the equation 125*(x^2)-125*x+1000 using a program called Graph. The numbers that are suppose to show are as followed:

x=1 than Y=1000
x=2 than y=1250
x=3 than y=1750
x=4 than y=2500
x=5 than y=3500
x=6 than y=4750
x=7 than y=6250
etc

When I put those numbers in however, I get this

x=1 than Y=1250
x=2 than y=750
x=3 than y=750
x=4 than y=1250
x=5 than y=1250
x=6 than y=750
x=7 than y=750

can someone tell me what I am doing wrong?
In BYOND, ^ is a bit-operator known as XOR

For "to the power of", you need to use **

so:
x^2 <-- WRONG in BYOND
x**2 <-- CORRECT in BYOND
The ^ operator isn't "to the power of". Read the DM guide on the ^ operator. What you want is the ** operator which is the exponent operator. Again, read the DM guide on it.
As others have told you, ^ is XOR and ** is exponents. If you want to optimize that though, using x*x instead of x**2 would be faster here.