(((difference - previousStep)/1000)^2)
//difference and previousStep are both doubles
Why can't I use the ^ operator with doubles? I just want to know why. Luckily for me I can just multiple difference - previousStep by itself because i'm just squaring it, but if i need to bring it to the Nth power, then this would be a problem. So why can't you ^ doubles and is there a way around this?
The ^
operator isn't the exponentiation operator in Java; it's the bitwise XOR operator, which doesn't make much sense with double
arguments.
You can either multiply the value by itself or you can call Math.pow(yourValue, 2)
for exponentiation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With