LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Odd even number and Boolean indicator


@johnsold wrote:

I also tried Rotate with Carry. 


Me too 😄

0 Kudos
Message 11 of 17
(1,308 Views)

I love it when a homework question (d)evolves into something like this.  😄

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 12 of 17
(1,293 Views)

@jcarmody wrote:

I love it when a homework question (d)evolves into something like this.  😄


We can only hope the OP tunes in and learns something new.

 

@ Altenbach:  Sooo, the LSB of the binary representation of number is like the result of an isOdd() function.  Smiley Surprised Completely obvious but I never thought of it that way. 

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 13 of 17
(1,286 Views)

Honestly, i disregarded performance (speed and memory wise) consciously because he might have the task to develop code which does not determine even or odd, but maybe something with more options.

Therefore, the hint to Q&R is imho essential as it is a very powerful, but simple to use option for numeric "evaluations".

 

Norbert

 

EDIT: But i do like the discussions about performance and better (advanced) options to squeeze the last bit and byte out of a computer system!

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 14 of 17
(1,263 Views)

@Norbert. I saw your edit and agree. This sort of task certainly tickles the little grey cells.

 

With that in mind here is another contender ... not quite as fast as the AND, but not too shabby. Smiley Happy

 

Loop.jpg

 

 

0 Kudos
Message 15 of 17
(1,254 Views)

Well, you are taking a 32 bit integer, coverting it to an 8 bit integer, then to a 8x larger (in memory) boolean array, then throwing 7/8 of the information away, retaining only 1/8 of the data. That seems lik a lot of unecessary data manipulation. 😄

 

(It is possible that the compiler can streamline some of this under the hood, but that does not make it right).

0 Kudos
Message 16 of 17
(1,242 Views)

 

... just trying a few ideas and seeing what LV makes of 'em.

 

"(It is possible that the compiler can streamline some of this under the hood, but that does not make it right)."

 

I don't see any broken lines so where is the wrong bit ? Smiley Very Happy

 

0 Kudos
Message 17 of 17
(1,234 Views)