idontknownothing:
I know. But if the star have ar coordenates llike 14 h 13m, i write 14.13 for better use and in the program e divide 14 and 13.

Oh no, you should do that as two separate variables then. Or keep it in an int or a long without a decimal and just know which digits are which. Remember floats are approximations and sometimes funny things happen to numbers when one can’t be stored exactly in a float.

If you don’t believe me go calculate the powers of 2 with the pow() function which returns a float, but store the results in an int instead and print them. When you learn that 2 squared is 3 and 2 cubed is 7 you’ll understand what I mean about floats being imprecise.

Why are you so stuck on storing those in a single variable. The two numbers need to be two variables. If you want a single handle for them then write a class or a struct to hold them. But cramming them into a single number like that is just asking for trouble later.

Delta_G:
Oh no, you should do that as two separate variables then. Or keep it in an int or a long without a decimal and just know which digits are which. Remember floats are approximations and sometimes funny things happen to numbers when one can't be stored exactly in a float.

If you don't believe me go calculate the powers of 2 with the pow() function which returns a float, but store the results in an int instead and print them. When you learn that 2 squared is 3 and 2 cubed is 7 you'll understand what I mean about floats being imprecise.

All values that can be represented by a 16-bit int can be represented exactly by a float. The pow() function just happens not to return exact values in all cases, even with integer arguments.

(In fact, you can store all integers +/- 8388608 exactly in a float.)

The OP was trying to store two separate numbers one on each side of the decimal. Are you telling me you think that was OK? Or are you just being pedantic about what values work or don't work in a float? The OP wasn't trying to store integers.

Delta_G:
The OP was trying to store two separate numbers one on each side of the decimal. Are you telling me you think that was OK?

No, not in the way OP was trying to do it.

Or are you just being pedantic about what values work or don't work in a float? The OP wasn't trying to store integers.

My intent was to point out that using the pow() function to illustrate the imprecision of floats is misleading, because floats really can be more exact than most people think.

christop:
My intent was to point out that using the pow() function to illustrate the imprecision of floats is misleading, because floats really can be more exact than most people think.

My intent was just to show that what looks like 8 sometimes turns out to be 7. If you ran pow and kept the result in a float and printed it you'd see 8.00 for 2 cubed. But as an int it turns into 7. My point was just that it isn't always what it appears to be with floats.