Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

C#

is a float variable the same as a double variable

when I was watching the c# video on variable types, I didn't see the float variable. in its place (or I thought was its place) was the double variable.... doesn't the float variable have the double value? example: float number = 5.564;

1 Answer

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there, Tucker Kunkle! There is a data type in C# named float as well as double and decimal. All are "floating point types." The difference between them really is the minimum and maximum size. A float is the smallest, double is the middle size, and decimal is the largest. I would say that double is probably used most often just because it is the mid-range size.

Here's some documentation on floating point types in C#

Hope this helps! :sparkles:

thank you! this answered my question perfectly!