Noob question. But could not find anything.
I have a variable say
double a= 123.07
when I use a
double b = a;
it assign value of a as 123.1 instead of 123.07
How can I remove this rounding off while assigning a double value to another double variable.
About this value what i am doing is , parsing a file into tokens, one of these tokens being the value of variable a.
after breaking the value of token is assigned to a string and then to a float using
double a= atof(amount.c_str());
Now, i am sending this value to a data structure Class created by me.
In the class constructor i initialize a double type class variable by this value.
Class definition :
sortTran(string trantype,string ts,string buf, string amount, double bal, long ts2)
Now when i call class member using object->varname which is nothing but the very same value of double,
i get the value rounded off.
i tried to create a local variable in the calling function and even that is rounding off.
I am stumped !! i could not find anything as my project's output file's binary code is matched with desired output's binary. and even a space bar can screw up the complete thing for me.