Don’t forget to read the last blog on Int, Float, and Double Data Types! Are you new here? Start at the beginning, Intro to C!

Now that you’ve seen the basics, it’s important for you to understand how floating point numbers are actually stored. Floating point numbers are stored in scientific notation.

If you need a refresher on scientific notation, that’s fine. Essentially, we can represent a number as multiplied by 10 to some power.

So 24000 becomes 2.4 X 10^4 = 24,000.

We can also have 10 to a negative power. So .000045 becomes 4.5 X 10^-5.

The number that is being multiplied actually has a fancy name. It’s called **the mantissa**. They call the other part the exponent, but always remember it’s times 10 raised to that exponent, not just the number itself. 2.4 to the fourth power is much different than 2.4 x 10 to the fourth power.

Sometimes it is actually easier to input our data in the form of scientific notation. The way we do that is to use an e. This basically means “times 10 to the power of” and then use a number either positive or negative. Let’s try converting our number to scientific notation for the input and make sure we get exactly the same output.

*int dogs = 2.5e4; // *same as* dogs = 25000*. This is a great time for me to introduce a new keyword to you…**hardcoding**. Hardcoding is when we type in a value in the code directly rather than getting the value from the input, a database or something like that.

Sometimes hardcoding is okay, but in this situation we don’t want to hardcode the value of these variables. As we have it, this program can take a couple specific values and output them. But imagine if we took any input in the form of scientific notation and it converted it to decimal notation. Then our program would be legit sauce. That’s what we are going to be talking about in the next blog.

Are you ready to learn more? Learn about Format Characters for Float and Double in the next blog!

## Leave a Reply