LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

expression node

Solved!
Go to solution

What is the correct syntax for an exponent with the expression node?
I looked in LabVIEW help, and it looked like it was the '^' character,

except that doesnt appear to be correct:

 

expression node.PNG

 

The correct output should be 2, but LabVIEW returns 3.

Cory K
Message 1 of 6
(7,477 Views)
Solution
Accepted by topic author Cory_K
It's **. ^ is bitwise XOR.
Message 2 of 6
(7,473 Views)

Sorry to bother you guys, I answered my own question.

I forgot that in some text languages the syntax for an exponent is:
2 ** x.

That gave me the correct output.

 

Edit: Good, someone beat me to the punch so I can mark them as the solution Smiley Wink

Message Edited by Cory K on 08-12-2009 01:26 PM
Cory K
0 Kudos
Message 3 of 6
(7,471 Views)
That is easily in my top 2 or 3 LV pet peeves.  I use exponentiation countless times and the next time I use bit-wise XOR in a LV text formula will be my first.  Why couldn't LV be like every other program/language I have used and use ^ for exponentiation?
0 Kudos
Message 4 of 6
(7,461 Views)
Aha, that's why I got "Your number must be an integer",  which is easily understood for bit-wise X-or, but hard to figure out the true meaning of, as long as you think you do exponentiation. Thanks guys. / Ake
0 Kudos
Message 5 of 6
(7,367 Views)

@Darin.K wrote:
That is easily in my top 2 or 3 LV pet peeves.  I use exponentiation countless times and the next time I use bit-wise XOR in a LV text formula will be my first.  Why couldn't LV be like every other program/language I have used and use ^ for exponentiation?

Define your definition of every other programming language!

 

There are Ada, Bash, COBOL, Fortran, FoxPro, Gnuplot, OCaml, Perl, PL/I, Python, Rexx, Ruby, SAS, Seed7, Tcl, ABAP, Haskell (for floating-point exponents), Turing, VHDL which do just as LabVIEW, Algol, Commodore BASIC which use a special symbol ↑, and some like Java who don't even have a special exponentiation operator, but require the call of a math library function.

 

BASIC, J, MATLAB, R, Microsoft Excel, TeX (and its derivatives), TI-BASIC, bc (for integer exponents), Haskell (for nonnegative integer exponents), Lua, ASP and most computer algebra systems do use indeed the ^ symbol, but in Bash, C, C++, C#, Java, JavaScript, Perl, PHP, Python and Ruby, the symbol ^ is used for the XOR operator and the LabVIEW formula node borrowed a lot of syntax from C and is in its current incarnation in fact a limited C syntax environment, so that leaves the ^symbol not available for the exponentiation anymore.

 

Also I would say that LabVIEW is indeed more a programming language and not a computer algebra system.

 

Rolf Kalbermatter
My Blog
0 Kudos
Message 6 of 6
(6,541 Views)