Confused with variable types

Ive come across a variable named float which has a range of 3.4E to 38.

I understand that its for floating point devision numbers.

But i dont understand the range numbers, what does the letter "E" mean or represent after the 3.4 number?

Im new to programming btw

Thanks :)
that's scientific notation and isn't really specific to programming. It's more of a mathematical thing.

3.4e38 is 3.4 * 10^38 or 340000000000 ... (37 zeros)
ermm ok....

can you tell me in words whats going on there?
Its a way to separate the digits of a number from their magnitude in 'powers of ten'. Instead of writing down bunches of zeros all the time mathematicians came up with a short hand notation where they just write the number of zeros down rather than the zeros themselves.

So instead of writing 100000000 I can just say 1x108

That works because 108 = 10x10x10x10x10x10x10x10 = 100000000
Last edited on
ok thanks, i kinda get that, but im just wondering, what actual word the "e" short for, is it short for a word, or is "e" just "e" on its own :)
It is short for 'exponent'.

1.2e4 is the same as 1.2x104 is the same as 12000.

Hope this helps.
thanks for all the replies, its coming clearer :)

its confusing me because in my book ive got it says:

type: float values: 3.4e +/- 38 (seven significant digits)
that's saying the largest number is 3.4e38 and the smallest (nonzero) number is 3.4e-38

negative exponents are the same thing. 1.2e-4 is the same as 1.2x10-4 is the same as 0.00012
Thanks alot
oh, one last thing, what does the"(seven significant digits)" mean
It means that while numbers can be very large or very small, they can only have 7 (nonzero) digits.

For example the number 76543210000000 probably could be represented, but the number 11111111111111 probably couldn't be.

Even though 111... is smaller than 765.... it has more significant digits.
ok, so because the value of float is 3.4e +/- 38, does this mean this is correct:

the largest number is:

340000000000000000000000000000000000000 (37 zeros)

and the smallest number is:

00000000000000000000000000000000000000.34 (37 zeros)

are floating point numbers just numbers with decimal places, which are used for precise variables?
Almost! Watch where you put your points :-)

0.000000000000000000000000000000000000034 (37 zeros)
not
00000000000000000000000000000000000000.34 (37 zeros)

floats will probably do you for most purposes. If you really need something more precise then use a double (which has a greater range)
http://www.cplusplus.com/doc/tutorial/variables/
oh yh lol

Thanks
Topic archived. No new replies allowed.