Problem with float ( differnce between float and integer)
-
Hi, Here is code : CString Valeur="1250.20"; int Fractional = ((atof(Valeur) - atoi(Valeur)) * 100); Value of Fractional variable after thsi operation is 19 ( False ) I must be 20 Where is my error Thanks in advance
-
Hi, Here is code : CString Valeur="1250.20"; int Fractional = ((atof(Valeur) - atoi(Valeur)) * 100); Value of Fractional variable after thsi operation is 19 ( False ) I must be 20 Where is my error Thanks in advance
Hello, Try this one: CString Valeur="1250.20"; int Fractional = ((atof(Valeur) - atoi(Valeur)) * 100.0); change 100 to 100.0 My month article: Game programming by DirectX by Lan Mader. Please visit in: www.geocities.com/hadi_rezaie/index.html Hadi Rezaie
-
Hi, Here is code : CString Valeur="1250.20"; int Fractional = ((atof(Valeur) - atoi(Valeur)) * 100); Value of Fractional variable after thsi operation is 19 ( False ) I must be 20 Where is my error Thanks in advance
Result of atof-atoi is converted to int before multiplication. Pavel Sonork 100.15206