Re: Interesting math



In article <jYKdnWNDhvBa0AjbnZ2dnUVZ_uygnZ2d@xxxxxxxxxxxx>,
Purl Gurl <purlgurl@xxxxxxxxxxxx> wrote:
blmblm wrote:

Purl Gurl wrote:
blmblm wrote:

(snipped)

A C Float Number must have six or more significant digits

I am unable to find in the above-cited Web page any support
for the curious notion that floating-point constants in
program source code must be written with exactly six digits


Ahem...

"...must have six or more significant digits...."

"or more" is a key phrase.

I was sure I had remembered your saying elsewhere that a
"C Float Number" must have "exactly six digits after the
decimal place, no more and no less". However, I can't find
that phrase in my saved copies of messages, nor in the
long-ago thread in comp.lang.perl.misc, so apparently I'm
misremembering, and I apologize for misrepresenting what
you said.

I did not write "exactly six digits."

I did not write about constants in source code.

Well, that's true enough. But the Perl code we're talking
about seems to me to be designed to determine whether a
particular text string is "a [something] number".

Let's back up a step. What is the purpose of your code?
What are some circumstances (in a real program) where you
would want code such as this?

For a purpose of labeling a number as C Float, six or more
significant digits. This is "labeling" by my program and
does not refer to coding use. My program determines if
input data is a legit number, and labels accordingly.

Here's the point:

The "six or more significant digits" requirement has little
to do with text representations of data. It means that
a standard-conforming implementation of C must provide a
data type called "float" that can represent floating-point
numbers with at least six significant (base-10) digits'
worth of precision.

There is no guarantee that the data type "float" can represent
numbers with greater accuracy -- it might or it might not.

You and Evan need to slow down with your reading and
pay closer attention. This is creating a label for
a type of number, nothing more.

I can't speak for Evan, but what I'm suspecting is that
you're confusing the internal floating-point representation
of a number with its text representation. That wouldn't be
an uncommon mistake for someone whose programming skills
are self-taught, as I'm guessing yours might be, and it's
consistent with what you've been saying here. But I could
easily be mistaken.

Let me ask you again: What is the purpose of your Perl
code? What are some situations in which it could be used?
As far as I can tell, Perl gives you no way to directly
access the internal floating-point representation of a
number, so I'm not sure how you could, in Perl, determine
anything about how many significant figures ....

The more I think about it, the more I think I have no idea
what you're talking about -- to me it sounds like utter
confusion, or an attempt to troll, or -- I don't know.

To qualify as a C Float Number, a number must have six or more
significant digits. The decimal point, of course, floats.



http://en.wikipedia.org/wiki/IEEE_754

http://en.wikipedia.org/wiki/Floating_point

Interesting, but also totally irrelevant.

No, you missed the relevancy. Graphics in one of those
links points to how data is stored in memory blocks
and why specific types of floats are declared.

I still can't imagine what you think any of this has to do
with code that examines text strings meant to represent
numbers.

I will admit that I did not read carefully the two
articles above. This is material I believe I understand
pretty well, and on a quick skim I didn't notice anything
that contradicts my understanding.

You need to read slower and more carefully. This is not
material which can be skimmed nor scanned. This is material
which requires careful in-depth reading for comprehension.

What material are we talking about here? The two Wikipedia
articles, or your posts?

If it's the Wikipedia articles: First, they do seem fairly
sound, but Wikipedia is not an authoritative source, and anyone
planning to spend time reading carefully should find something
more authoritative, in my opinion. Second, you do realize
that what you're doing here feels to me like the equivalent of
me suggesting you go read a book on English grammar, right?
In general I consider it gauche to flaunt credentials (and
am a little embarrassed about making reference upthread to
my decades of experience with programming), but you're really
tempting me here.

If it's your posts: You are quite correct that I don't read
them as carefully as I might. There's a limit to how much
time and energy I'm willing to invest in looking for the pony,
and the way in which you talk about technical subjects is,
hm, "different from what I'm accustomed to, and difficult for
me to make sense of"? I apologize for the occasions on which
I've misunderstood through lack of careful reading, though.

(It's too bad Franke isn't reading this thread; at this point
he might want to chide me for falling back into the sniveling
persona, when I was doing so well -- I think -- at displaying
something a little more assertive.)

--
Decline To State
(But the e-mail address in the header should work.)
.



Relevant Pages

  • Re: Rounding a floating point number
    ... double roundto(double x, int digits) ... if (digits> DBL_DIG) ... rounding the value 1.2345 to 2 decimal ... What is the purpose of rounding a floating-point value to N decimal ...
    (comp.lang.c)
  • Re: INT defect: Please try this on 2007 for me
    ... Not that I would object to a calculation option that would do just that, namely: force the result of all formulas to be rounded to 15 significant digits, not unlike the "Precision as displayed" option, but more generally applied. ... That would legitimatize some of the heuristics that Excel has implemented to try to ameliorate the aberrations due to binary floating point arithmetic. ...
    (microsoft.public.excel.worksheet.functions)
  • Re: loan amortization
    ... you have about 14 significant digits. ... your are working on a $100,000.00 mortgage. ... An insurance company insider told me that they once spotted a penny difference ...
    (comp.lang.java.programmer)
  • Re: Adding Zeros as placeholders
    ... significant digits. ... >> Seth, ... >>> this works for items that are left justified and entries ...
    (microsoft.public.excel.worksheet.functions)
  • variable-precision arithmetic and floating-point arithmetic
    ... precision arithmetic and floating-point arithmetic. ... it says that "the default value of digits is 32, ... roundoff error due to the finite representation. ... suffers from a sever roundoff error with which I can not ...
    (comp.soft-sys.matlab)

Loading