03-03-2016 03:39 AM
Hello,
The conversion Boolean to (0,1) does exist.
What about inverse conversion, i.e. (0,1) to Boolean.
Actually I'm trying to convert Sign function output (-1, 0, 1) to Boolean.
With ABS function I can reduce (-1, 0, 1) to (0, 1), but then ... how to proceed ?
Thanks
Solved! Go to Solution.
03-03-2016 03:45 AM
Ok, the solution is quite simple - equal comparator.
Sorry for this post
03-03-2016 03:55 AM
03-03-2016 03:59 AM
Thanks Sam,
Sign function has 15-bit precision, I think for my case it will be sufficient.
At other side the problem revealed a little bit more complicated, i.e. (-1, 0, 1) to boolean - using ABS just converts -1 to 1, wheras I want -1 and 0 --> FALSE, 1 --> TRUE
03-03-2016 04:06 AM
Here is a solution
03-03-2016 04:07 AM
Just use something like this:
As for your 'other side the problem' - just use a simple select/case structure to get the appropriate value out. Post your code because it sounds like you're over-complicating things.
03-03-2016 04:12 AM
Thanks Sam,
It seems that I've found a solution (post above).
Quite simple, isn't it ?
03-03-2016 04:49 AM
@Pavel_47 wrote:What about inverse conversion, i.e. (0,1) to Boolean.
The exact inverse is Not Equal To Zero. It will take even give a TRUE value for your -1 case as well.
03-03-2016 06:19 AM
For my case the truth table is as follows:
-1, 0 => FALSE
1 => TRUE
I think the solution using increment (as it's shown above) isn't so bad.
03-03-2016 06:31 AM