# LabVIEW

cancel
Showing results for
Did you mean:

Solved!
Go to solution

## why does Labview take 8 bits to represent a Boolean?

Since it can take only one of two values, can it not be represented by a bit?

Message 1 of 9
(2,733 Views)
Solution
Accepted by topic author AJ_CS

## Re: why does Labview take 8 bits to represent a Boolean?

The memory controllers smallest unit is a byte, and reading from memory is done 32 bit at a time, so there's no benefit to use a single bit. If you use alot of bits, you can mask them into an I32 which is often done in e.g. C.

/Y

"Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
Message 2 of 9
(2,728 Views)

## Re: why does Labview take 8 bits to represent a Boolean?

OK..I get it..I also felt there would be some thing like smallest unit or so..thank for clarifying..

Message 3 of 9
(2,722 Views)

## Re: why does Labview take 8 bits to represent a Boolean?

The benefit of booleans is that even when you're wrong, you're only a bit off. 😉

/Y

"Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
Message 4 of 9
(2,715 Views)

## Re: why does Labview take 8 bits to represent a Boolean?

@Yamaeda wrote:

The benefit of booleans is that even when you're wrong, you're only a bit off. 😉

/Y

Unless you are having fun with Type Casting

0 = False

Everything Else = True

There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 5 of 9
(2,670 Views)

## Re: why does Labview take 8 bits to represent a Boolean?

@crossrulz wrote:

@Yamaeda wrote:

The benefit of booleans is that even when you're wrong, you're only a bit off. 😉

/Y

Unless you are having fun with Type Casting

0 = False

Everything Else = True

I guess that's like arguing with girlfriend/wife; when all bits align you're right, else you're wrong! 😄

/Y

"Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
Message 6 of 9
(2,663 Views)

## Re: why does Labview take 8 bits to represent a Boolean?

Early versions of LV did use packed bits but as processors became more powerful and memory became cheaper the overhead to pack and upack the bits outweighed the smaller memory footprint.

Lynn

Message 7 of 9
(2,619 Views)

## Re: why does Labview take 8 bits to represent a Boolean?

Only for boolean arrays. And skalar booleans were 16 bit which was the standard boolean format on MacOS 6 + 7. The complication and performance loss with packing and unpacking, made the LabVIEW developers change the boolean representation in LabVIEW 5 to be byte sized, like most C++ compilers use too, and to forget about packing for boolean arrays.

Rolf Kalbermatter
My Blog
Message 8 of 9
(2,606 Views)

## Re: why does Labview take 8 bits to represent a Boolean?

Rolf,

Thank you for correcting the details.

Lynn

Message 9 of 9
(2,597 Views)