473,378 Members | 1,066 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Meaning of "most significant digits" in the printf documentation

What is meant by the "most significant digits" in the following
statement?

<BLOCKQUOTE>
With %g and %G, the precision modifier determines the maximum number
of significant digits displayed.</BLOCKQUOTE>

The statement appears here: http://www.cppreference.com/stdio/printf.html

Also, what do we mean by the magnitude of a floating point number?

I understand that the magnitude of an integral is equal to its
absolute value. However, I do not understand the meaning of the
magnitude of a floating point.

For a citation, please note the sentence below:

<BLOCKQUOTE>A float number is typically a 32-bit quantity, with at
least six significant digits and magnitude generally between about
10^(-38) and 10^(+38).</BLOCKQUOTE>

Source: K & R, Page 9, Second Edition

Jun 16 '07 #1
2 3449
Mu***************@yahoo.com writes:
What is meant by the "most significant digits" in the following
statement?

<BLOCKQUOTE>
Don't bother with markup like this. Usenet news is a plain text
medium. People sometimes use markers for humorous effect
(e.g. <sarcasm>really?</sarcasm>) but don't try to effect the llok of
your post with HTML or similar.
With %g and %G, the precision modifier determines the maximum number
of significant digits displayed.</BLOCKQUOTE>
You say "most" at the top but the quote has "maximum" so I am i bit
confused about what is bothering you. The precision determines how
much of number gets represented. Obviously only the most significant
digits are used but you can say "no more than X digits". There may
be other stuff printed, because %g might use scientific notation, but
the precision limits the number of significant digits printed. The
number you give is a maximum because fewer may be sufficient:

4.0e30 using %.3g prints "4e+30"
4.3e30 using %.1g prints "4e+30"
4.3e30 using %.2g prints "4.1e+30"
The statement appears here:
http://www.cppreference.com/stdio/printf.html
Look like a C++ reference. This may lead you astray if you are using
it for C. Read the C FAQ instead: http://c-faq.com/
Also, what do we mean by the magnitude of a floating point number?

I understand that the magnitude of an integral is equal to its
absolute value. However, I do not understand the meaning of the
magnitude of a floating point.
It usually means exactly the same -- the absolute value. It certainly
does in the quote you cite from K&R:
A float number is typically a 32-bit quantity, with at
least six significant digits and magnitude generally between about
10^(-38) and 10^(+38).

Source: K & R, Page 9, Second Edition
--
Ben.
Jun 16 '07 #2
In article <11**********************@i38g2000prf.googlegroups .com>
<Mu***************@yahoo.comwrote:
>What is meant by the "most significant digits" in [printf %g formats]
Actually, it is just "significant digits", with no "most"
qualifier.

For much about this and about your earlier question about floating
point, see <http://web.torek.net/torek/c/numbers.html>.
--
In-Real-Life: Chris Torek, Wind River Systems
Salt Lake City, UT, USA (40°39.22'N, 111°50.29'W) +1 801 277 2603
email: forget about it http://web.torek.net/torek/index.html
Reading email is like searching for food in the garbage, thanks to spammers.
Jun 17 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: PipHans | last post by:
Hi, Given 2 tables: Table1: id Auto,int,PrimKey table2id int txt nvarchar50 Table2:
3
by: D Denholm | last post by:
I am a Access newbie... Hopefully somebody can help me figure this out. I have a database that looks like: Asset Economic Minimum ----- ---------------- 10555 ...
12
by: erikcw | last post by:
Hi all, I have a collection of ordered numerical data in a list. The numbers when plotted on a line chart make a low-high-low-high-high-low (random) pattern. I need an algorithm to extract the...
8
by: | last post by:
The New York Times and many other online publications automatically generate "most popular article" lists that cover, say, the last 24 hours. I am looking for guidance and/or code on the best way...
4
by: zacks | last post by:
Most applications whose purpose is to work with various types of files implement a "Most Recent Files" list, where the last, say, four files accessed by the application can quickly be re-opened by...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.