gams:difference_between_the_-operator_and_the_power_function

**This is an old revision of the document!**

The power function `power(x,y)`

is an integer power and thus the exponent `y`

must be an integer.

This is not required for the ** operator. x**y is a real power and gets evaluated as `exp(y * log(x))`

.
However in that case `x`

must be a positive number (or `y >= 0`

, if `x = 0`

) to avoid an execution error. So:

scalar test; test = (-3)**4; * note: this is not the same as -3**4,which will be treated as -(3**4) display test;

will return an error:

**** Exec Error at line 2: rPower: FUNC DOMAIN: x**y, x < 0

This formulation will work:

scalar test; test = power(-3,4); display test;

IMPRESSUM / LEGAL NOTICE
PRIVACY POLICY
gams/difference_between_the_-operator_and_the_power_function.1207159615.txt.gz · Last modified: 2008/04/02 20:06 by support