Maxscript "(-1)^1 = 0" !?

even better… (-n)^1 = -n-1
WTH bro? Someone make me feel less crazy.:?:

I dunno what the correct math is in Max but in Maya/MEL you have to use reserved names for special mathematical operations such as exponentiation.
Example: pow(2,3)
Returns 8

I think what you’re seeing has to do with the way that Max handles integer values.

-1^1 = 0
(-1.0 as integer)^1 = 0

-1.0^1 = -1
(-1 as float)^1 = -1

That’s it. So strange. Thanks.

Yeah, it isn’t at all intuitive, but the docs do at least make mention of the behavior that you were seeing.

http://docs.autodesk.com/3DSMAX/15/ENU/MAXScript-Help/index.html?url=files/GUID-B57EA575-DCDE-42F5-9D30-88E3EB41F350.htm,topicNumber=d30e155094
“If the first number is an integer, the result is a rounded integer.”