Jump to content

Stuck with a .vi


Recommended Posts

I'm trying to do a quadratic formula .vi I have the equation complete and everything will run fine for real numbers, but when I try to get an answer for the imaginery numbers I can't display it in the indicators all I'm getting is NaN. Any help would be appreciated.

The formula nodes work with real number only and the function sqrt() returns NaN for negative arguments.

You should cast A'B'C to complex and use math nodes instead of formula nodes since they handle complex numbers.

Otherwise you have to manipulate real and imaginary parts explicitely like this (not checked for correctness):

float D;




if (D>=0)












Link to comment
Maybe I'm missing something but I do not beleive LV does the math correctly for complex numbers. Isn't the square root of -9 = to 0+3i? If so why does LV give a result of -8.13152E-20 +3 i? It's close but not correct.

That may be 1 bit flip from zero... I'm not sure. there are issues sometimes with numbers that approach zero when using double/single data types.

Besides that however, I wire a complex into the squareroot and get the correct answer out (0 + 3i)... what were you using exactly to get your result? The expression node didn't seem to work with a complex number and neither did the formula node so I couldn't figure out what you were doing.

Link to comment
  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

By using this site, you agree to our Terms of Use.