DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    Victor Guest

    float queries...


    can i change from exponential form (1.0000e-1) to the decimal format (0.00001)??

  2. #2
    jonnin Guest

    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)??



  3. #3
    Danny Kalev Guest

    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)??


  4. #4
    Victor Guest

    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)??



  5. #5
    Tim Mathias Guest

    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)??
    >



Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


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


Sponsored Links