Hello,
i started working on variables that are more precise i.e. 3.25456987895787 * 0.0000059988565
But i cant find find any way to do calculation on this much precise value, i tried cout.setf(ios_base::fixed,ios_base::floatfield);
but its kinda messed up!
Can anyone help through this?
setf will only work on what is displayed, but not the actual values themselves. If you need more precision than what standard double and long long values offer you could try GNU GMP. It's made for working with numbers of arbitrary precision.
i have to submit my code as assignment so i cant use another libraries!!!
i have to use default libraries. Can you tell me how to do so using long double !?
It's not entirely clear whether you're concerned with the precision of your variables and calculations or with the displayed precision of your output. In the example you gave, both of those numbers can be represented by a double, though you will lose some accuracy on the result. To retain some of it, you could declare the variables & result to be long doubles. Though you need to really take a good look at your problem to see if that is warranted.
but lets say, i want to use i=0.00009 instead of i=0.000094 (upto 5 decimals) for calculation and i dont want to declare another variable for that. So how to do that?