some thing is strang in double type
-
HI ALL :) I want make simple calculator so I get some problems like : - try do that : double d1 = 5/3 ; //same (5/3) double d2 = 3/2 ; and you get this result (1) when you do that in Calculator program(by Microsft) the result is (1.6666666666666666666666666666667) and (1.5) the problem here the value after the point didn't appeare I tried by VISUAL C++6 using (CEDIT box) - next problem ,when you try to show larg number in (CEDIT box) the CEDIT box show the number with (e+) like(8.98765431209876e+016) how I can disable or enable this(e+) THANK YOU AHMAD ALWASHALI
-
HI ALL :) I want make simple calculator so I get some problems like : - try do that : double d1 = 5/3 ; //same (5/3) double d2 = 3/2 ; and you get this result (1) when you do that in Calculator program(by Microsft) the result is (1.6666666666666666666666666666667) and (1.5) the problem here the value after the point didn't appeare I tried by VISUAL C++6 using (CEDIT box) - next problem ,when you try to show larg number in (CEDIT box) the CEDIT box show the number with (e+) like(8.98765431209876e+016) how I can disable or enable this(e+) THANK YOU AHMAD ALWASHALI
-
> double d1 = 5/3 ; The calculation 5/3 is done with integer values, so the result is 1. If you want a double result, convert the operands to double _before_ the calculation: double d1 = 5.0/3.0;