pitermarx / NCalc-Edge

A clone of NCalc. Latest source. Published to Nuget.org. version 1.4.3
http://ncalc.codeplex.com/
MIT License
53 stars 35 forks source link

Power operator? #24

Closed DaveMartel closed 5 years ago

DaveMartel commented 5 years ago

The wiki (operators page) mentions "Power" as a possible operator or operator type. The standard notation for power as far as I understand it elsewhere would be '^'. However '^' is used as the operator for bitwise or. After mentioning that power is possible, there is nothing further as to what the actual operator is.

I know there is Power (x, y) in the functions.

It is just that I am fairly confident that my users are going to expect to type (x^2) to square a number and I have check that the evaluator does in fact do a bit wise or of 2 against x.

Thanks for any enlightenment.

pitermarx commented 5 years ago

the power is done via the function POW https://github.com/pitermarx/NCalc-Edge/wiki/Functions imagem

^ is the operator for bitwise xor https://github.com/pitermarx/NCalc-Edge/wiki/Operators

I'll investigate if there is a power operator, or if it is a bug in the wiki

pitermarx commented 5 years ago

After reading the code, I think this is a bug in the wiki. I'll remove it. Thanks for the warning

DaveMartel commented 5 years ago

Thanks. I understand that ^ is the operator for bitwise xor.

My biggest issue is going to be the fact my users are used to ^ being the power operator and I am pretty sure they are going to try and use it that way. Now got to work out how to warn them, or override what they type... :-)

AlizerUncaged commented 6 months ago

is there any way to override the ^ operator? my end users will be typing ^ not Power

pitermarx commented 6 months ago

no, I don't think there is