Bug/Gross InEfficiency in HeathField's fgetline program

  • Thread starter Antoninus Twink
  • Start date
R

Richard Heathfield

[citation needed!]

Richard Heathfield said:
Nevertheless, alas, I am not yet convinced that I am wrong. Not being a
mathematician, I have little recourse but to look at the mathematical
equivalent of Wikipedia

....by which I was intending to refer to "mathworld.wolfram.com" - apologies
for the omission.
and hope that it's a bit more accurate

(that is, more accurate than the Wikipedia equivalent of Wikipedia!)
 
C

Chris Dollin

Richard said:
Chris Dollin said:



Natch. :)


This, however, is interesting. If I'm wrong, two useful things happen:

1) I get egg all over my face for incorrectly tweaking RB's nose;
2) I learn something.

Nevertheless, alas, I am not yet convinced that I am wrong. Not being a
mathematician, I have little recourse but to look at the mathematical
equivalent of Wikipedia and hope that it's a bit more accurate. Here is
what it has to say about theorems:

"A theorem is a statement that can be demonstrated to be true by accepted
mathematical operations and arguments. In general, a theorem is an
embodiment of some general principle that makes it part of a larger
theory. The process of showing a theorem to be correct is called a proof."

"Can be demonstrated [to be true]" is wishful thinking. "Has been demonstrated,
as best as we can tell" is nearer the mark. Which means there can be (and
have been) "theorems" that are unproven because their proofs turn out to
be buggy. Rather than theoremhood being instantaneously removed from the
statement, debugging happens. Hence my claim:

It's certainly /desirable/ that theorems have valid proofs; I'm not
saying there are /lots/ of unproven theorems around, or that it's
desirable that there be unproven theorems; I'm just saying that /insisting/
that some statement has, right now, a unholed proof, in order to be (called)
a theorem, is a tad on the strong side.

That's my assessment from the reading around maths that I've done. If there
are actual practicing mathematicians reading here who can offer current
practice, I'm willing to take over Richard H's egg.
 
U

user923005

Tor Rustad said:



Yes, that's right, I did. And the introduction of a discussion of multiple
currencies blurred the issue in my mind for a little while. Taking a step
back and thinking about it, I realised it represented a completely
separate issue.

I still stand by my statement that you can do double-entry book-keeping
*exactly*.

I disagree. If there are any rational or exponential calculations,
then it is not possible.
Examples:
Depreciation calculations
Interest calculations
Investments (Future value, Present value, Annuities...)
 
P

pete

Chris said:
Richard Heathfield wrote:

Richard is referring (if I am not mistaken)
to the Church-Turing /thesis/.

I don't know about that, but my entire tenth grade math education
consisted of memorizing a few axioms
and proofs of ten fundamental theorems,
which I then used to proove other theorems
and so on and so forth, for the rest of the year.

In physics the following year,
I learned of the hierarchy of observation, conjecture,
hypothesis, theory, and law;
in which "theories"
are not generally considered to have been prooven.
 
W

William Hughes

What a load of rubbish.

Fermat's last theorem wasn't "proven" until 1994.

And as eveyone an his dog is fond of pointing out
"Fermat's last theorem" was not actually a theorem until
after Wiles' proof.

How many legs does a horse have if you call a tail
a leg? Four, calling a tail a leg does not make a tail
a leg.

- William Hughes
 
J

J. J. Farrell

The rest of RH's snipped paragraph goes on to say:

] (Fermat's Last Theorem was for centuries a
] misnomer, because it hasn't been proved. Now it's a misnomer because
] the proof was supplied by Wiles, not Fermat.)
What a load of rubbish.

Fermat's last theorem wasn't "proven" until 1994.

You chose to comment on a snipped quotation rather the original message,
which distorts the discussion somewhat. There's certainly a sense in
which you're both wrong. Fermat proved his last theorem before he wrote
it down (or so he said) but the proof was never recorded or was lost.
Whether that's enough for it to be called a theorem in a technical
sense, I've no idea.
 
U

user923005

The rest of RH's snipped paragraph goes on to say:

] (Fermat's Last Theorem was for centuries a
] misnomer, because it hasn't been proved. Now it's a misnomer because
] the proof was supplied by Wiles, not Fermat.)
What a load of rubbish.
Fermat's last theorem wasn't "proven" until 1994.

You chose to comment on a snipped quotation rather the original message,
which distorts the discussion somewhat. There's certainly a sense in
which you're both wrong. Fermat proved his last theorem before he wrote
it down (or so he said) but the proof was never recorded or was lost.
Whether that's enough for it to be called a theorem in a technical
sense, I've no idea.

It's extremely doubtful that Fermat ever had created such a proof,
written down or not.
If he had such a proof, why did he labor so intensely in the future,
for proofs of simple, special cases?
He did offer a correct proof for N=4, but never (for instance) for 3
or 5.
 
J

jacob navia

William said:
And as eveyone an his dog is fond of pointing out
"Fermat's last theorem" was not actually a theorem until
after Wiles' proof.

How many legs does a horse have if you call a tail
a leg? Four, calling a tail a leg does not make a tail
a leg.

- William Hughes

http://dictionary.reference.com/browse/theorem

the·o·rem /ˈθiərəm, ˈθɪərəm/ Pronunciation Key - Show Spelled
Pronunciation[thee-er-uhm, theer-uhm] Pronunciation Key - Show IPA
Pronunciation
–noun
1. Mathematics. a theoretical proposition, statement, or formula
embodying something to be proved from other propositions or formulas.
2. a rule or law, esp. one expressed by an equation or formula.
3. Logic. a proposition that can be deduced from the premises or
assumptions of a system.
4. an idea, belief, method, or statement generally accepted as true or
worthwhile without proof.
[Origin: 1545–55; < LL theÅréma < Gk theréma spectacle, hence, subject
for contemplation, thesis (to be proved), equiv. to theÅré-, var. s. of
theÅreÇn to view + -ma n. suffix]


Can you read?
"something to be proved from other propositions or formulas" (1)

Wikipedia says:
"... On the other hand, a deep theorem may be simply stated, but its
proof may involve surprising and subtle connections between disparate
areas of mathematics. Fermat's last theorem is a particularly well-known
example of such a theorem"

Of course Wikipedia is nothing... but the evil empire
says:
http://encarta.msn.com/encyclopedia_701614117/Theorem.html
<quote>
Theorem, proposition or formula in mathematics or logic that is provable
from a set of postulates and basic assumptions
<end quote>

But OF COURSE in c.l.c the ONLY opinion that counts is the opinion
of Heathfield even if he says nonsense or make affirmations
without any proof like above.

There are MANY meanings to the word "theorem" and in many it
is something to be PROVED.

There is one interesting (proven) theorem: Goedel proved that there are
an infinite number of theorems that are neither true or false, i.e.
they can never be proved in a given system of axioms.

Then those theorems are... well "UNPROVEN" theorems. PERIOD.
 
M

Malcolm McLean

Flash Gordon said:
That theorem I know, I just did not make the connection from what Malcolm
said. However, has anyone proved that C without pointers is Turing
complete? If not, then that needs to be done before Malcolm can use that
theorem.
You need IO. However we can easily write a Turing machine in C using an
array, an index, and a set of states.
We can then implement a C interpreter with our Turing machine, and so we can
run programs written with pointers.
 
J

J. J. Farrell

jacob said:
William said:
And as eveyone an his dog is fond of pointing out
"Fermat's last theorem" was not actually a theorem until
after Wiles' proof.

How many legs does a horse have if you call a tail
a leg? Four, calling a tail a leg does not make a tail
a leg.
- William Hughes

http://dictionary.reference.com/browse/theorem

the·o·rem /ˈθiərəm, ˈθɪərəm/ Pronunciation Key - Show Spelled
Pronunciation[thee-er-uhm, theer-uhm] Pronunciation Key - Show IPA
Pronunciation
–noun
1. Mathematics. a theoretical proposition, statement, or formula
embodying something to be proved from other propositions or formulas.
2. a rule or law, esp. one expressed by an equation or formula.
3. Logic. a proposition that can be deduced from the premises or
assumptions of a system.
4. an idea, belief, method, or statement generally accepted as true
or worthwhile without proof.
[Origin: 1545–55; < LL theÅréma < Gk theréma spectacle, hence, subject
for contemplation, thesis (to be proved), equiv. to theÅré-, var. s. of
theÅreÇn to view + -ma n. suffix]


Can you read?
"something to be proved from other propositions or formulas" (1)

Wikipedia says:
"... On the other hand, a deep theorem may be simply stated, but its
proof may involve surprising and subtle connections between disparate
areas of mathematics. Fermat's last theorem is a particularly well-known
example of such a theorem"

Of course Wikipedia is nothing... but the evil empire
says:
http://encarta.msn.com/encyclopedia_701614117/Theorem.html
<quote>
Theorem, proposition or formula in mathematics or logic that is provable
from a set of postulates and basic assumptions
<end quote>

But OF COURSE in c.l.c the ONLY opinion that counts is the opinion
of Heathfield even if he says nonsense or make affirmations
without any proof like above.

Why do you insist on making a fool of yourself with silly sarcasm like
this? You've found evidence that Heathfield's statement was wrong, and
you've presented it. Why follow it with this ridiculous nonsense? Crow
about proving him wrong if you like, but parading this big chip on your
shoulder just makes you look daft.
 
U

user923005

And as eveyone an his dog is fond of pointing out
"Fermat's last theorem" was not actually a theorem until
after Wiles' proof.
How many legs does a horse have if you call a tail
a leg? Four, calling a tail a leg does not make a tail
a leg.
- William Hughes

http://dictionary.reference.com/browse/theorem

the·o·rem / i r m, r m/ Pronunciation Key - Show Spelled
Pronunciation[thee-er-uhm, theer-uhm] Pronunciation Key - Show IPA
Pronunciation
-noun
1. Mathematics. a theoretical proposition, statement, or formula
embodying something to be proved from other propositions or formulas.
2. a rule or law, esp. one expressed by an equation or formula.
3. Logic. a proposition that can be deduced from the premises or
assumptions of a system.
4. an idea, belief, method, or statement generally accepted as true or
worthwhile without proof.
[Origin: 1545-55; < LL the réma < Gk theréma spectacle, hence, subject
for contemplation, thesis (to be proved), equiv. to the ré-, var. s. of
the re n to view + -ma n. suffix]

Can you read?
"something to be proved from other propositions or formulas" (1)

Wikipedia says:
"... On the other hand, a deep theorem may be simply stated, but its
proof may involve surprising and subtle connections between disparate
areas of mathematics. Fermat's last theorem is a particularly well-known
example of such a theorem"

Of course Wikipedia is nothing... but the evil empire
says:http://encarta.msn.com/encyclopedia_701614117/Theorem.html
<quote>
Theorem, proposition or formula in mathematics or logic that is provable
from a set of postulates and basic assumptions
<end quote>

But OF COURSE in c.l.c the ONLY opinion that counts is the opinion
of Heathfield even if he says nonsense or make affirmations
without any proof like above.

There are MANY meanings to the word "theorem" and in many it
is something to be PROVED.

There is one interesting (proven) theorem: Goedel proved that there are
an infinite number of theorems that are neither true or false, i.e.
they can never be proved in a given system of axioms.

Then those theorems are... well "UNPROVEN" theorems. PERIOD.

Actually, I agree with Jacob here. Here is a mathematical definition
of theorem, and I think it agrees with the general sense:
http://mathworld.wolfram.com/Theorem.html
 
F

Flash Gordon

Malcolm McLean wrote, On 05/11/07 21:54:
You need IO. However we can easily write a Turing machine in C using an
array, an index, and a set of states.

When you use the array name it decays to a pointer, so you are still
using pointers.
We can then implement a C interpreter with our Turing machine, and so we
can run programs written with pointers.

Apart from the fact you have just used a pointer according to the
definition of the C language, since array indexing is defined in terms
of pointer arithmetic.
 
J

jacob navia

J. J. Farrell said:
Why do you insist on making a fool of yourself with silly sarcasm like
this? You've found evidence that Heathfield's statement was wrong, and
you've presented it. Why follow it with this ridiculous nonsense? Crow
about proving him wrong if you like, but parading this big chip on your
shoulder just makes you look daft.

Well... you have a bit of truth here. The problem is that
I have the last discussions in my mind, and I can't
abstract from them so easily.

Last time Mr Heathfield got carried away saying that strncmp
wasn't a string copy function... Incredible. When confronted
with evidence from the standard text, and from the semantics of
strncmp he argued that away. What surprised me was that nobody
(besides santosh) was ready to contradict him.

Now, this theorem stuff is much more milder (it could be
just a stupid remark somewhere) but again, only a few
people dare contradict Him (with guru uppercase).

Anyway, maybe just taking a bit of fresh air will do
a good thing to forget c.l.c and discuss normally.
 
R

Richard Heathfield

user923005 said:
[...] the introduction of a discussion of
multiple currencies blurred the issue in my mind for a little while.
Taking a step back and thinking about it, I realised it represented a
completely separate issue.

I still stand by my statement that you can do double-entry book-keeping
*exactly*.

I disagree. If there are any rational or exponential calculations,
then it is not possible.
Examples:
Depreciation calculations
Interest calculations
Investments (Future value, Present value, Annuities...)

Yes, but it's the same blurring. The "how much interest should be added?"
question cannot be answered exactly (except by chance, of course) - it
must be rounded. But double-entry book-keeping is about putting one
*monetary* amount into two ledgers, once on the debit side and once on the
credit side. This can be done exactly.
 
R

Richard Heathfield

pete said:
I don't know about that, but my entire tenth grade math education
consisted of memorizing a few axioms
and proofs of ten fundamental theorems,
which I then used to proove other theorems
and so on and so forth, for the rest of the year.

In physics the following year,
I learned of the hierarchy of observation, conjecture,
hypothesis, theory, and law;
in which "theories"
are not generally considered to have been prooven.

Yes, but there is a difference between a "theory" (which is a science
concept) and a "theorem" (which is a formal systems concept).
 
R

Richard Heathfield

J. J. Farrell said:
jacob navia wrote:


Why do you insist on making a fool of yourself with silly sarcasm like
this? You've found evidence that Heathfield's statement was wrong,

....evidence, perhaps, but not proof. On the subject of mathematics, I'd
back Wolfram over Encarta or Wikipedia any day of the week. I'd also back
mathematicians such as Douglas Hofstadter over those sources. Here is his
definition of "theorem": "It means some statement in ordinary language
which has been proven to be true by a rigorous argument" - if Jacob Navia
wishes to argue with Hofstadter's and Wolfram's position on the matter,
that's up to him, but to claim that it is my *opinion* is simply wrong,
just as it would be wrong to say that it's my *opinion* that Dennis
Ritchie's middle initial is M.

Please also note that, whatever Mr Navia seems to think, I have never
claimed (unless, perhaps, in jest) that my opinion is normative in this
newsgroup.
 
K

Keith Thompson

jacob navia said:
Well... you have a bit of truth here. The problem is that
I have the last discussions in my mind, and I can't
abstract from them so easily.

Try harder.
Last time Mr Heathfield got carried away saying that strncmp
wasn't a string copy function... Incredible. When confronted
with evidence from the standard text, and from the semantics of
strncmp he argued that away. What surprised me was that nobody
(besides santosh) was ready to contradict him.

Neither of the first two arguments to strncpy() needs to be a pointer
to a string. The fact that its name starts with "str", or that it's
in the "String handling" section of the standard, doesn't make it a
string function.

How exactly do you define the term "string function"?
Now, this theorem stuff is much more milder (it could be
just a stupid remark somewhere) but again, only a few
people dare contradict Him (with guru uppercase).

Oh, good grief. There seem to be several different definitions of the
word "theorem". Richard's statement may or may not have been 100%
correct, but it was not unreasonable.

People tend not to agree with Richard Heathfield when he's right.
Anyway, maybe just taking a bit of fresh air will do
a good thing to forget c.l.c and discuss normally.

Good idea.
 
R

Richard Heathfield

Keith Thompson said:

People tend not to agree with Richard Heathfield when he's right.

Yeah, I noticed that too.

Unfortunately, they don't agree with me when I'm wrong, either. If they
did, life would be so much simpler.
 
F

Flash Gordon

Richard Heathfield wrote, On 05/11/07 23:40:
user923005 said:
[...] the introduction of a discussion of
multiple currencies blurred the issue in my mind for a little while.
Taking a step back and thinking about it, I realised it represented a
completely separate issue.

I still stand by my statement that you can do double-entry book-keeping
*exactly*.
I disagree. If there are any rational or exponential calculations,
then it is not possible.
Examples:
Depreciation calculations
Interest calculations
Investments (Future value, Present value, Annuities...)

Yes, but it's the same blurring. The "how much interest should be added?"
question cannot be answered exactly (except by chance, of course) - it
must be rounded.

In the case of interest calculations (an a lot of other financial
calculations), the rounding is actually part of the definition of the
algorithm you are required to use in calculating the new value. So it
can be argued that such calculations always provide an exact answer.
But double-entry book-keeping is about putting one
*monetary* amount into two ledgers, once on the debit side and once on the
credit side. This can be done exactly.

Not only can, but is actually required to be done exactly.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Fibonacci 0
Adding adressing of IPv6 to program 1
C language. work with text 3
code review 26
Can't solve problems! please Help 0
compressing charatcers 35
Strange bug 65
K&R exercise 5-5 10

Members online

Forum statistics

Threads
474,262
Messages
2,571,056
Members
48,769
Latest member
Clifft

Latest Threads

Top