Solved

precision past decimal

Posted on 1998-08-24
3
164 Views
Last Modified: 2010-04-01
I am working on a calculation that needs to be able output
the product with a precision of at minimum of 10 digits behind the decimal point. I have been able to get 6 digits using standard output. Does any one know how I might be able to do this? Without ending up with something like
3.3333e-05
0
Comment
Question by:bbarnette
  • 2
3 Comments
 
LVL 23

Accepted Solution

by:
chensu earned 20 total points
Comment Utility
double a = 0.123456789;
printf("%.10e", a);
0
 
LVL 23

Expert Comment

by:chensu
Comment Utility
Or printf("%.10f", a);

printf("%.10g", a);
0
 

Author Comment

by:bbarnette
Comment Utility
"f", did it thanks
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now