From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
01-02-2017 12:31 PM
Hello,
I am with a problem regarding the calculation of capacitator reactance (XC=1/WC), i have a problem when my capacitator is 0 ( i can adjust the value with a knob) the display number will be INF, because i am dividing for 0.
Is there a way to display 0 when this happens?
When capacitator is 0 i want to display that my XC is also 0 and it keeps displaying INF.
Thanks in advance,
Montjack
Solved! Go to Solution.
01-02-2017 01:28 PM - edited 01-02-2017 01:28 PM
Just check for zero and conditionally substitute a different code path. Can you show us your code?
01-02-2017 01:49 PM - edited 01-02-2017 01:51 PM
I was able to switch the maximum to display at max 16 bits (32768), even tho it wont display INF, but it will display the 32768, which doesnt solve at all my problem.
The problem is that by showing the max number it will affect all my program, that is why i need to fix this issue.
Thanks,
Montjack
01-02-2017 01:55 PM
01-02-2017 02:03 PM
You could also just set the input range of the knob such that zero is not allowed.
01-02-2017 02:06 PM - edited 01-02-2017 02:07 PM
Hi Montjack,
please post your questions here in the forum, using PMs isn't the right way!
Why do you use FXP datatype as shown in your PM?
I give you a hint on how to implement the algorithm:
Btw. to calculate the reciprocal you could find a specialized function called reciprocal… 😄
01-02-2017 02:18 PM
Thank you for the help, i managed to do it 🙂
01-02-2017 02:22 PM
What's the point of the weird output configuration? Just keep it all DBL!
01-02-2017 02:24 PM
It was when i was trying different data types 🙂 I will change, Thank you 🙂