Hi
Is there a function similar to "SetDlgItemInt()" which is able to work with non integers (decimals)?
Apparently SetDlgItemInt() is not required for float or double types, what do you recommend?
Thank you
This is a discussion on Variable Type issue within the Windows Programming forums, part of the Platform Specific Boards category; Hi Is there a function similar to "SetDlgItemInt()" which is able to work with non integers (decimals)? Apparently SetDlgItemInt() is ...
Hi
Is there a function similar to "SetDlgItemInt()" which is able to work with non integers (decimals)?
Apparently SetDlgItemInt() is not required for float or double types, what do you recommend?
Thank you
You could use SetDlgItemText() - then just create the text that you want to see.
gg
Ok That was actually my solution before... I can stick to that
But In that case I have problems with determination of number of decimals...
The program does not determine the decimals on its own so I have to do sprintf(char*, "%.*f", iDecimalPlaces, iInteger);
Do you have a solution for this?
Last edited by Gordon; 02-11-2008 at 01:01 PM.
Sorry still donīt get it... Just tried a few possibilities but all failed...
This is one of them sprintf(chTotal, "%f", iTotal);
Seems like sprintf always return 6 decimals even if they are equal to NULL.
Yes that is actually my problem...
I need a function that determines for me number of decimals of the double type.
Then I use the returned value as you did
All right
What else do you recommend me. I agree this is not the best solution in this case
The number of decimal points to show is completely up to you. What does the value represent? A measurement? Money?
Are you looking for locale dependant information - like the number of decimal points to show for a money value?
gg
I am creating a little calculator... So I need my answers to be in correct count of decimals...
If I process 1/8 it should return 0.125 not 0.125000 or 0
Sorry I did not state that its for calculator use before
Just pass %f, and it will print any available decimals.
Beware that floating points in somewhat inaccurate, so 1/8 can also return 0.12500001 or something. Don't know if it can happen to this particular equation, but it can happen to certain ones.
1/8 is integer - that's why it is 0
use 1.0/8 or 1/8.0
To be or not to be == true
What Every Computer Scientist Should Know About Floating-Point Arithmetic
End the end, if you want exact precision - use a 3rd party library like GMP.
gg