Hello all,
This is my first post in thins forum and I hope a newbie like me makes some sense with my questions.
I have a floating value

float f = 5.3606;

and I output a value


when n goes above 6, the representation of the floating number changes

as I increase n the precision after the decimal point goes on reducing , say after n = 5 , the value is a perfect integer and above that it gives me solution in the scientific format.
I need values in the standard floating point format with precision after the decimal point uncompromised.
What can i do ?


Ajay Nair

Use manipulators.

cout << setiosflags(ios::fixed)  << pow(f,n);
int someNumber  = 10;
cout.precision( someNumber );

Use type double instead. This will give you about 15 digits precision, compared to a float's 7 digits.

And an alternative to the formatting:

cout.precision(10); //substitute the # digits you want after decimal
	cout << fixed  << showpoint;
        cout << pow( f, n );