Bringing Back Boolean (And Other) Data Types

Last year, James Colvin wrote a guide to understanding the different data types that are commonly used by programmers. While he focused specifically on Boolean data, he also talks about others. Since it’s been a while, we thought it was time to revisit his guide!

“In a broad sense, data types are ways to represent different kinds of information in a computer processor or FPGA. Today we will be discussing booleans, integers, chars, and floating point numbers, all of which are commonly known as primitive data types,” said James.

Okay, a quick run-through.

Boolean data is that which represents “true” or “false” information. This is represented by ones and zeroes. A character,or a char, is an array of bits that define the visual representation of a symbol. When you see ASCII characters, this is what they are — the appropriate array of bits. Integers, usually shortened to just “int” in programming, are the standard way to store numbers within your code. These are whole numbers, so any decimals will be truncated. Finally, there is the floating point data type. A “float” accepts up to seven decimal places via a type of scientific notation that uses of 32 bits, eight of which are devoted to the decimals.

A breakdown of a 32 bit float -- Image from this Wikipedia page by Fresheneesz
A breakdown of a 32 bit float — Image from this Wikipedia page by Fresheneesz.

All of these data types have their specific uses and applications, it’s just a matter of deciding which is right for your programming endeavor! For more in-depth informations, see James’ original post.

 

Author

  • Amber Mear

    I was the Digilent blog editor, and now I'm a contributor. I love learning about wearables and writing about social issues in STEM. Outside of work, I can be found watching Netflix with my cat, working on an art project, or trying to find new, delicious local foods.

Be the 1st to vote.

About Amber Mear

I was the Digilent blog editor, and now I'm a contributor. I love learning about wearables and writing about social issues in STEM. Outside of work, I can be found watching Netflix with my cat, working on an art project, or trying to find new, delicious local foods.

View all posts by Amber Mear →

Leave a Reply

Your email address will not be published. Required fields are marked *