-
float queries...
can i change from exponential form (1.0000e-1) to the decimal format (0.00001)??
-
Re: float queries...
Yes. floats are all stored the same way, in binary IEEE format. Display
routines convert them into ascii based on some settings. If using cin cout,
you need to play with iomanip.h and setprecision. printf can be done by
printf("%f1.5", floatnum); for 5 decimal places. adding an e makes it exponential
again i think.
"Victor" <wuhanvic@singnet.com.sg> wrote:
>
>can i change from exponential form (1.0000e-1) to the decimal format (0.00001)??
-
Re: float queries...
yes, use the 'fixed' i/o manipulator:
double f;
cout<<fixed<<f<<endl;
Danny
Victor wrote:
>
> can i change from exponential form (1.0000e-1) to the decimal format (0.00001)??
-
Re: float queries...
thnaks..but wat about usage in mfc..?
Danny Kalev <dannykk@inter.net.il> wrote:
>yes, use the 'fixed' i/o manipulator:
>
>double f;
>
>cout<<fixed<<f<<endl;
>
>Danny
>Victor wrote:
>>
>> can i change from exponential form (1.0000e-1) to the decimal format (0.00001)??
-
Re: float queries...
Have you tried "sprintf", eg:
char my_str [100] = "Not set yet";
double my_float = 0.0000001;
sprintf (my_str, "my_float = %9.7lf", my_float);
AfxMessageBox (my_str);
I hope this helps.
Regards,
Tim.
"Victor" <wuhanvic@singnet.com.sg> wrote:
>
>thnaks..but wat about usage in mfc..?
>
>Danny Kalev <dannykk@inter.net.il> wrote:
>>yes, use the 'fixed' i/o manipulator:
>>
>>double f;
>>
>>cout<<fixed<<f<<endl;
>>
>>Danny
>>Victor wrote:
>>>
>>> can i change from exponential form (1.0000e-1) to the decimal format
(0.00001)??
>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks