By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,033 Members | 1,020 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,033 IT Pros & Developers. It's quick & easy.

Efficiency of math.h

P: n/a
Hi all,

Normally, I would trust that the ANSI libraries are written to be as
efficient as possible, but I have an application in which the majority of
the run time is calling the acos(...) method. So now I start to wonder how
that method, and others in the math.h library, are implemented.
Dave
Nov 14 '05
Share this Question
Share on Google+
92 Replies


P: n/a
CBFalconer wrote:
You also need to watch your back with Trollsdale around. ;-[


You need to get a job Chuck.
You spend too much time trolling in the comp.lang.c newsgroup.
If you can't get a job, retire and take up a real hobby
like fishing or card playing with the local cronies.

Nov 14 '05 #51

P: n/a
"E. Robert Tisdale" wrote:
You spend too much time trolling in the comp.lang.c newsgroup.

As always, Trollsdale speaks from personal experience.


Brian Rodenborn
Nov 14 '05 #52

P: n/a
"E. Robert Tisdale" <E.**************@jpl.nasa.gov> wrote in message
news:40**************@jpl.nasa.gov...
Mike Wahler wrote:

Ya know, I should probably just plonk you,


Not likely. Trolls never use kill files.
Their egos won't let them. They just threaten.
but you're just too darn amusing. :-)


Yes, everyone knows that you troll for fun.


So now you're a mind reader... no wait....

I'll admit to everyone here that I'm ashamed that I've
allowed myself to stoop to your level. I'll stop now.

-Mike
Nov 14 '05 #53

P: n/a
In article <uJ******************@newsread1.news.pas.earthlink .net>,
"Mike Wahler" <mk******@mkwahler.net> wrote:
"E. Robert Tisdale" <E.**************@jpl.nasa.gov> wrote in message
news:40**************@jpl.nasa.gov...
Mike Wahler wrote:

Ya know, I should probably just plonk you,


Not likely. Trolls never use kill files.
Their egos won't let them. They just threaten.
but you're just too darn amusing. :-)


Yes, everyone knows that you troll for fun.


So now you're a mind reader... no wait....

I'll admit to everyone here that I'm ashamed that I've
allowed myself to stoop to your level. I'll stop now.


Mike, you couldn't reach Tisdale's level even if you tried very very
hard.
Nov 14 '05 #54

P: n/a
Roc

"E. Robert Tisdale" <E.**************@jpl.nasa.gov> wrote in message
news:40**************@jpl.nasa.gov...
Thomas Matthews wrote:
I have over 20 years experience with the C language
and have purposely avoided the math library.
Most of the embedded systems I worked would die (come to a hault)


You probably meant halt.
or worse if the math library was included.


Why?
But, from reading your past posts, you either claim that
embedded systems don't exist or insuate


You probably meant insinuate.
that only desktop and the like exist.


Not that I recall.
Can you quote such an instance?
In smaller embbeded


You probably meant embedded.
applications, either a lookup table is used
(due to size and speed) or the numerical base is changed
so [that] floating point is not required. Many times,
the accuracy is not required to move a solenoid.

I have learned calculus and numerical analysis.
Just because I don't use all the features of the language
doesn't make me a newbie.


No.
You're a newbie because you have only 20 years experience.


Why do you digress to correcting spelling, and ending commentary with
[another] insult? The ending insult negates any claim to goodwill you think
you have with the initial spelling/grammar checks. If you truly claim to be
an adult professional, surely you know the counterproductive effect you are
having by posting ridiculous, childish replies like this.

I don't read this NG as often as I would like. When I have the chance, I
read it to *learn* more. In other threads, I saw your name (and seemingly
appropriate comments) being trashed in replies. At first, I really felt
sorry for you.

In this thread, at multiple times, you demanded people post code and
algorithms (at times, bullishly). They did. Each time you were asked to do
so, you posted nothing, or posted something similar to the above.
Furthermore, I reread threads and found a trend: you post nothing
definitive to back up your "answers", and when finally called-out, it seems
your resort to belittling and name-calling or refrain from further posting
to that thread. You really think people believe you were on a panel that
reviewed the AMD K5 after you post this crap?

So I have one semi-serious question for the NG, since I no longer feel sorry
for Tisdale... The FAQ is for frequently-asked-questions: is it possible to
add something to the FAQ about certain Trolls - since his knowledge is
frequently questioned? =)
Nov 14 '05 #55

P: n/a


E. Robert Tisdale wrote:
Nick Landsberg wrote:
I think the point of Christian's posting was that
he would like more information from the [Dave Rudolf]
[about] why the acos() function was called so often.
If it is something that requires high precision
and MUST be called often
(as in a signal processing application),
then it is one thing.

If it does not require high precision
or [high precision] is used gratuitously,
there might be better ways to accomplish the same thing.
As one poster pointed out, a rough [interpolation]
between values in a static array may satisfy the requirement.
Without knowing the degree of precision needed,
we just don't know.



Unfortunately,
I don't know what degree of precision is required either.
We can only hope that Dave Rudolf is still following this thread
and will reply with the answer.

But I'll tell you what you can do without knowing any more
about Dave Rudolf's precision requirements.
You can implement you proposed interpolation scheme
and benchmark it against the acos provided with your C compiler.
I predict that you will find that your interpolation scheme
is *slower* even if you need just a few decimal digits precision.
Please post your implementation so that we can repeat
your benchmark experiments ourselves.

There is a reason why math functions like acos
are included in the standard library.
There is *no* single portable implementation
that will deliver performance and accuracy everywhere.
Compiler developers hire experts to customize implementations
for each target platform and, usually, they are hard to beat.

I have been reading this NG for about a month or two, made a few
faux pas, kept my mouth shut for a while, then posted what I
thought was a reasonable question, based on previous posts
in the thread. This post prompted a post by the resident troll
that paraphrased my quote
and a challenge from the resident troll. Not only that, the
troll's post insinuated that I had made statements which
had been made by others. The challenge was rather blunt:

"I predict that you will find that your interpolation scheme
is *slower* even if you need just a few decimal digits precision.
Please post your implementation so that we can repeat
your benchmark experiments ourselves."

Note: Unedited, no []'s.

Primus, there was the observed hubris which attempted
to correct the grammar of my attributions and put the
troll's own spin on them. While my wording may not have been
precise, this recasting of my comments without confirmation
was downright rude! A simple "what did you mean by this"
before launching into a diatribe would have been sufficient
to clear up any misconceptions.

Secundus, it was not MY interpolation scheme,
(as the troll claims), though I have written more than
several interpolation schemes over the the course
of the last 29 years, but another poster's. I was just
referring to it. If the troll wants credibility, he should
be accurate in his accusations. Maybe he should have
noted that "XXX should post his interpolation scheme"
since the troll was so scrupulous about correcting my references
to "OP" to have the correct name in it.

Tertius, when I requested that the troll post HIS benchmarks,
to prove HIS point, I got no answer.

Prior to this incident, I sat back and tried to make my own judgement
as to this particular denizen. I have now made it.

Result: "Case closed, 30 days, next case!" *PLONK*

Or, as they say, "Illegitimus Non Carborundum!"

--

"It is impossible to make anything foolproof because fools are so
ingenious" - A. Bloch

Nov 14 '05 #56

P: n/a
"Dave Rudolf" <nu****************@hotmail.com> wrote in message news:<10*************@corp.supernews.com>...
"E. Robert Tisdale" <E.**************@jpl.nasa.gov> wrote in message
news:40**************@jpl.nasa.gov...
Nick Landsberg wrote:
I think the point of Christian's posting was that
he would like more information from the [Dave Rudolf]
[about] why the acos() function was called so often.
If it is something that requires high precision
and MUST be called often
(as in a signal processing application),
then it is one thing.

If it does not require high precision
or [high precision] is used gratuitously,
there might be better ways to accomplish the same thing.
As one poster pointed out, a rough [interpolation]
between values in a static array may satisfy the requirement.
Without knowing the degree of precision needed,
we just don't know.


Unfortunately,
I don't know what degree of precision is required either.
We can only hope that Dave Rudolf is still following this thread
and will reply with the answer.


Ya, I'm back. The signal-to-noise ratio in this thread is getting pretty
small :). In short, I don't know the exact accuracy that will be needed. I
am using the acos function do determine the angle between vectors, in order
to simulate angular spring torque in a numeric sumulation of elastic
surfaces. It's for non-scientific graphical simulation, and we do not have a
theoretically rigid physical model, so we can probably get away with some
approximation.

At any rate, I now have a number of avenues to explore. Thank you all for
your ideas.

Dave


Another possibility is changing the internal representation of your
program from rectagular vectors to a polar form. Even using both in
different places of the program.
Nov 14 '05 #57

P: n/a
Nick Landsberg wrote:

E. Robert Tisdale wrote:
Nick Landsberg wrote:
I think the point of Christian's posting was that
he would like more information from the [Dave Rudolf]
[about] why the acos() function was called so often.
If it is something that requires high precision
and MUST be called often
(as in a signal processing application),
then it is one thing.

If it does not require high precision
or [high precision] is used gratuitously,
there might be better ways to accomplish the same thing.
As one poster pointed out, a rough [interpolation]
between values in a static array may satisfy the requirement.
Without knowing the degree of precision needed,
we just don't know.
Unfortunately,
I don't know what degree of precision is required either.
We can only hope that Dave Rudolf is still following this thread
and will reply with the answer.

But I'll tell you what you can do without knowing any more
about Dave Rudolf's precision requirements.
You can implement you proposed interpolation scheme
and benchmark it against the acos provided with your C compiler.
I predict that you will find that your interpolation scheme
is *slower* even if you need just a few decimal digits precision.
Please post your implementation so that we can repeat
your benchmark experiments ourselves.

There is a reason why math functions like acos
are included in the standard library.
There is *no* single portable implementation
that will deliver performance and accuracy everywhere.
Compiler developers hire experts to customize implementations
for each target platform and, usually, they are hard to beat.


When I requested that [E. Robert Tisdale] post HIS benchmarks,
to prove HIS point, I got no answer.


I'm not the one claiming that I can beat the acos function
that came with my compiler's implementation of the standard library.
You are claiming that you can use interpolation
to beat the built-in acos function.
The burden of proof lies with you and not me.
I challenged to to demonstrate this and you failed.

This is typical of almost all such claims about the performance
of standard library functions. They collapse immediately
when you challenge them to produce benchmark results.
Result: "Case closed, 30 days, next case!" *PLONK*


In my experience, plonkers never actual use their killfile.
Their egos won't permit them to ignore what other people say about them.
But I'm certain that all of the subscribers to the comp.lang.c newsgroup
would appreciate it very much
if you did *not* respond to *any* of my postings.
We can only hope that you will keep your promise for 30 days.

Nov 14 '05 #58

P: n/a
Mac
On Wed, 25 Feb 2004 20:28:33 +0000, E. Robert Tisdale wrote:
Mac wrote:
For whatever reason,
E. Robert Tisdale modifies posts he is replying to on occasion.
Tisdale has not, to my knowledge,
offered any explicit explanation for this behavior.
What's to explain?
There is no need to quote and it is discouraged.


But you quote all the time. And it is the deliberate alteration of quoted
text that we are talking about.
It is as evil as top posting.
I fix capitalization, punctuation, spelling and grammar errors
to reflect my understanding of what was said.
I am pretty sure that Nick Landsberg meant interpolation
when he said extrapolation and that he meant Dave Rudolf
when he said OP.

I also quietly fix style and programming errors in other people's code
if they aren't essential to understanding the point in question.


There is nothing wrong with correcting the posts of others provided that
it follows usenet conventions.

There is an expectation in usenet that any line which begins with a quote
indicator (e.g., the greater than sign, '>') is a verbatim quote. If you
want to correct other's posts, do it on a separate line, and do not put a
quote indicator at the beginning of that line. Judging from your posting
history, I would say that you arleady know all of this. Which means that
you must be violating community norms deliberately. I don't really
understand this.

--Mac

Nov 14 '05 #59

P: n/a
Mac
On Thu, 26 Feb 2004 12:45:36 +0000, E. Robert Tisdale wrote:
CBFalconer wrote:
You also need to watch your back with Trollsdale around. ;-[


You need to get a job Chuck.
You spend too much time trolling in the comp.lang.c newsgroup.
If you can't get a job, retire and take up a real hobby
like fishing or card playing with the local cronies.

CBFalconer is, as far as I am concerned, a valuable poster in this
newsgroup. What's more, since he first appeared, he has shown that he can
respond to constructive criticism, and make an effort to fit in. I have
personally never seen him troll.

I am posting this for the benefit of any who might otherwise be persuaded
by E. Robert Tisdale's characterization of CBFalconer.

--Mac

Nov 14 '05 #60

P: n/a
Mac
On Thu, 26 Feb 2004 11:06:52 +0000, E. Robert Tisdale wrote:
Mike Wahler wrote:
E. Robert Tisdale:
Mike Wahler wrote:

The only conclusion I could draw from context was that
you're calling Christian a 'newbie' with C.

Yes. At 20 years, he is just getting started.

This newsgroup's archives provide much evidence to the contrary.

Get a life Mike.


I'm quite happy with my life, but thanks for your concern.
And a sense of humor to make it bearable :-)

I'm also quite satisfied with my sense of humor


It's perverse.
(some folks often ask me to 'tone it down'. :-)

Ya know, I should probably just plonk you,


Not likely. Trolls never use kill files.
Their egos won't let them. They just threaten.


Hmmm. Mike Wahler is not a troll, either. What are you talking about?

[snip]

--Mac
Nov 14 '05 #61

P: n/a
Mac
On Thu, 26 Feb 2004 16:16:38 +0000, Thomas Matthews wrote:
E. Robert Tisdale wrote:
Mike Wahler wrote:
The only conclusion I could draw from context was that you're calling
Christian a 'newbie' with C.

Yes. At 20 years, he is just getting started.
This newsgroup's archives provide much evidence to the contrary.

Get a life Mike. And a sense of humor to make it bearable :-)


Mr. E. Tisdale,

I have over 20 years experience with the C language and have
purposely avoided the math library. Most of the embedded systems
I worked would die (come to a hault) or worse if the math
library was included. But, from reading your past posts,
you either claim that embedded systems don't exist or
insuate that only desktop and the like exist.

In smaller embbeded applications, either a lookup table
is used (due to size and speed) or the numerical base
is changed so floating point is not required. Many
times, the accuracy is not required to move a solenoid.

I have learned calculus and numerical analysis. Just
because I don't use all the features of the language
doesn't make me a newbie.


Don't worry too much about E. Robert Tisdale. While I don't understand
what makes him tick, I am quite sure that he is disingenuous. Certainly
any accusation he makes will not be taken seriously by people who read
this newsgroup frequently.

--Mac

Nov 14 '05 #62

P: n/a
Something that calls itself Mac wrote:

[snip]

Go away troll.

Nov 14 '05 #63

P: n/a
Something that calls itself Mac wrote:

[snip]

Go away troll.

Nov 14 '05 #64

P: n/a
Something that calls itself Mac wrote:

[snip]

Go away troll.

Nov 14 '05 #65

P: n/a
Something that calls itself Mac wrote:

[snip]

Go away troll.

Nov 14 '05 #66

P: n/a
In article <40**************@jpl.nasa.gov>,
"E. Robert Tisdale" <E.**************@jpl.nasa.gov> wrote:
I'm not the one claiming that I can beat the acos function
that came with my compiler's implementation of the standard library.
You are claiming that you can use interpolation
to beat the built-in acos function.
The burden of proof lies with you and not me.
I challenged to to demonstrate this and you failed.


That's the Troll's method: ALWAYS demand proof for any statement or
others, never provide proof for anything you post yourself. Always
demand, demand, demand. Never give anything of value yourself.

I challenged you: ?20,000 that I can beat ANY algorithm that you post.
You are free to accept. I've got the money, you can cash in your pension
from being a JPL janitor for 25 years. So what is stopping you?
Nov 14 '05 #67

P: n/a
In article <40**************@jpl.nasa.gov>,
"E. Robert Tisdale" <E.**************@jpl.nasa.gov> wrote:
Something that calls itself Mac wrote:

[snip]

Go away troll.


You are trying to copy my "Tisdale, you are an idiot, go away" posts.

There is a difference though that readers of c.l.c will appreciate: They
have no reason whatsoever to believe that "Mac" is a troll. They know
for certain that you are an idiot.
Nov 14 '05 #68

P: n/a
Mac <fo*@bar.net> scribbled the following:
On Thu, 26 Feb 2004 12:45:36 +0000, E. Robert Tisdale wrote:
CBFalconer wrote:
You also need to watch your back with Trollsdale around. ;-[
You need to get a job Chuck.
You spend too much time trolling in the comp.lang.c newsgroup.
If you can't get a job, retire and take up a real hobby
like fishing or card playing with the local cronies.

CBFalconer is, as far as I am concerned, a valuable poster in this
newsgroup. What's more, since he first appeared, he has shown that he can
respond to constructive criticism, and make an effort to fit in. I have
personally never seen him troll. I am posting this for the benefit of any who might otherwise be persuaded
by E. Robert Tisdale's characterization of CBFalconer.


Getting called a troll by Tisdale is a sign of great respect on this
newsgroup. Therefore I am still anxiously waiting the day when Tisdale
calls me a troll.

--
/-- Joona Palaste (pa*****@cc.helsinki.fi) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"That's no raisin - it's an ALIEN!"
- Tourist in MTV's Oddities
Nov 14 '05 #69

P: n/a
In article <10*************@corp.supernews.com>,
"Dave Rudolf" <nu****************@hotmail.com> wrote:
Ya, I'm back. The signal-to-noise ratio in this thread is getting pretty
small :). In short, I don't know the exact accuracy that will be needed. I
am using the acos function do determine the angle between vectors, in order
to simulate angular spring torque in a numeric sumulation of elastic
surfaces. It's for non-scientific graphical simulation, and we do not have a
theoretically rigid physical model, so we can probably get away with some
approximation.


Since it is probably very simple to calculate the cosine of the angle,
and getting the angle is time consuming, you should consider whether you
need to know the angle at all or whether knowing the cosine is enough.

For example, for transformations in 3D space you never need to know the
angle itself, you are much better off knowing the cosine of the angle.
The same might apply to your problem; you might be able to do any
calculations without evaluating any trigonometric functions at all.
Nov 14 '05 #70

P: n/a
"Roc" <no****@aqssys.com> wrote in message news:<10*************@corp.supernews.com>...

<snipped rant-ish text>
So I have one semi-serious question for the NG, since I no longer feel sorry
for Tisdale... The FAQ is for frequently-asked-questions: is it possible to
add something to the FAQ about certain Trolls - since his knowledge is
frequently questioned? =)


Unfortunately, the typical response you are going to get to that
from the trolls mentioned in the FAQ is going to be along the
lines of

"<blush> I'm Famous!!!"
goose,
hand
Nov 14 '05 #71

P: n/a
Christian Bau wrote:
.... snip ...
For example, for transformations in 3D space you never need to
know the angle itself, you are much better off knowing the
cosine of the angle. The same might apply to your problem; you
might be able to do any calculations without evaluating any
trigonometric functions at all.


As another example, in 0 through pi/4 - epsilon, if you need only
a magnitude relationship between tan(x) and tan(y), you only need
to compare x and y. To replace atan computations, look at the
theta function in Sedgewicks Algorithms.

--
Chuck F (cb********@yahoo.com) (cb********@worldnet.att.net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net> USE worldnet address!
Nov 14 '05 #72

P: n/a
Roc
[snip]
So I have one semi-serious question for the NG, since I no longer feel sorry for Tisdale... The FAQ is for frequently-asked-questions: is it possible to add something to the FAQ about certain Trolls - since his knowledge is
frequently questioned? =)


Unfortunately, the typical response you are going to get to that
from the trolls mentioned in the FAQ is going to be along the
lines of

"<blush> I'm Famous!!!"


I'm thinking about the infrequent & new readers of the NG. Many of you
provide valuable, informative help with kids' homework assignments. If by
reading the FAQ they can avoid misinformation by avoiding certain Trolls,
wouldn't that offset the c.l.c worry of immortalizing said Troll(s)? Just
an idea... =)
Nov 14 '05 #73

P: n/a
Roc wrote:

<snip>
I'm thinking about the infrequent & new readers of the NG. Many of you
provide valuable, informative help with kids' homework assignments. If by
reading the FAQ they can avoid misinformation by avoiding certain Trolls,
wouldn't that offset the c.l.c worry of immortalizing said Troll(s)? Just
an idea... =)


Perhaps it would be more appropriate and useful to provide general
guidelines on how to identify good advice.

Although lots of people here call Tisdale a troll, I'm not actually sure
whether "troll" is the right word. He might just be stupid. It's hard to
tell. But, ideally, such guidelines as I suggest would deal with either
possibility, since neither trolls nor stupid people give good advice.
--
Richard Heathfield : bi****@eton.powernet.co.uk
"Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
K&R answers, C books, etc: http://users.powernet.co.uk/eton
Nov 14 '05 #74

P: n/a
Richard Heathfield <in*****@address.co.uk.invalid> scribbled the following:
Roc wrote:
<snip>
I'm thinking about the infrequent & new readers of the NG. Many of you
provide valuable, informative help with kids' homework assignments. If by
reading the FAQ they can avoid misinformation by avoiding certain Trolls,
wouldn't that offset the c.l.c worry of immortalizing said Troll(s)? Just
an idea... =)
Perhaps it would be more appropriate and useful to provide general
guidelines on how to identify good advice. Although lots of people here call Tisdale a troll, I'm not actually sure
whether "troll" is the right word. He might just be stupid. It's hard to
tell. But, ideally, such guidelines as I suggest would deal with either
possibility, since neither trolls nor stupid people give good advice.


No, I cannot join this diagnosis. Trollsdale is not just stupid. He's
downright malicious.

--
/-- Joona Palaste (pa*****@cc.helsinki.fi) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"That's no raisin - it's an ALIEN!"
- Tourist in MTV's Oddities
Nov 14 '05 #75

P: n/a
>
Ya, I'm back. The signal-to-noise ratio in this thread is getting pretty
small :). In short, I don't know the exact accuracy that will be needed. I am using the acos function do determine the angle between vectors, in order to simulate angular spring torque in a numeric sumulation of elastic
surfaces. It's for non-scientific graphical simulation, and we do not have a theoretically rigid physical model, so we can probably get away with some approximation.

At any rate, I now have a number of avenues to explore. Thank you all for your ideas.

Dave


Another possibility is changing the internal representation of your
program from rectagular vectors to a polar form. Even using both in
different places of the program.


Interesting proposition, but there would be a lot of conversion going on. I
would have to do a lot of sines and cosines (or arc-tangents) so I don't
think that there would be much savings.

Dave
Nov 14 '05 #76

P: n/a
Nick Landsberg wrote:

E. Robert Tisdale wrote:
Christian Bau wrote:
If you read an article about the Dolph-Chebychev window function,
the first thing that you see is that Chebychev functions
are defined as cos (n*acos(x)) - and they are easily calculated
using a trivial recursion formula that doesn't need anything
more complicated than adding and multiplying.


Please show us the formula.


P.S. - the above formula, expanded, becomes
cos(n) * cos(acos(x)) ---


In which universe is cos(a*b) equal to cos(a)*cos(b) ?

Nov 14 '05 #77

P: n/a
Nick Landsberg wrote:
I also did not put []'s around the word "interpolation."


Actually, You originally wrote "extrapolation". It was Tisdale who
changed "extrapolation" to "interpolation" when he modified your post.

Nov 14 '05 #78

P: n/a
"E. Robert Tisdale" wrote:

Something that calls itself Mac wrote:

[snip]

Go away troll.


Can't handle the truth, huh Trollsdale. You've been busted on this habit
of changing people's quotes so much, it's become pretty obvious to even
the most kind-hearted that YOU are the troll. And one of the most
dishonest ones I've ever seen.

Changing quotes is one of the lowest things. If you had any shame (and
it's clear you don't) you'd be deeply ashamed of yourself.

Dry up and go away, you are a menance to proper learning of the C
language.

Brian Rodenborn
Nov 14 '05 #79

P: n/a
Richard Heathfield wrote:
Although lots of people here call Tisdale a troll, I'm not actually sure
whether "troll" is the right word. He might just be stupid. It's hard to
tell. But, ideally, such guidelines as I suggest would deal with either
possibility, since neither trolls nor stupid people give good advice.

Sorry, I can't go along with that. His tactics of spreading
misinformation are too blatant to be put to simple ignorance. He is a
troll, pure and simple.

Brian Rodenborn
Nov 14 '05 #80

P: n/a
Roc wrote:

[snip]
So I have one semi-serious question for the NG, since I no
longer feel sorry for Tisdale... The FAQ is for frequently-
asked-questions: is it possible to add something to the FAQ
about certain Trolls - since his knowledge is frequently
questioned? =)


Unfortunately, the typical response you are going to get to that
from the trolls mentioned in the FAQ is going to be along the
lines of

"<blush> I'm Famous!!!"


I'm thinking about the infrequent & new readers of the NG. Many
of you provide valuable, informative help with kids' homework
assignments. If by reading the FAQ they can avoid misinformation
by avoiding certain Trolls, wouldn't that offset the c.l.c worry
of immortalizing said Troll(s)? Just an idea... =)


For one thing, the troll population changes much more rapidly than
the FAQ does. For another, some trolls have been known to
reform. At most the FAQ could contain generic advice about
identifying trolls and idiots, and lurking.

Fortunately most trolls are not consciously malicious.
Unfortunately we seem to have an exception to that rule.

--
Chuck F (cb********@yahoo.com) (cb********@worldnet.att.net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net> USE worldnet address!

Nov 14 '05 #81

P: n/a
E. Robert Tisdale wrote:

Mac wrote:
For whatever reason,
E. Robert Tisdale modifies posts he is replying to on occasion.
Tisdale has not, to my knowledge,
offered any explicit explanation for this behavior.


What's to explain?
There is no need to quote and it is discouraged.
It is as evil as top posting.
I fix the quotes, to reflect my understanding of what was said,
because I'm too stupid to understand the difference
between a quote and a reply.


Well, now that I've tried it, I can see the appeal.

--
pete
Nov 14 '05 #82

P: n/a
pete <pf*****@mindspring.com> scribbled the following:
E. Robert Tisdale wrote:
Mac wrote:
> For whatever reason,
> E. Robert Tisdale modifies posts he is replying to on occasion.
> Tisdale has not, to my knowledge,
> offered any explicit explanation for this behavior.
What's to explain?
There is no need to quote and it is discouraged.
It is as evil as top posting.
I fix the quotes, to reflect my understanding of what was said,
because I'm too stupid to understand the difference
between a quote and a reply.

Well, now that I've tried it, I can see the appeal.


5 Euros says Tisdale will now insult and flame you and call you a troll
because you claimed he said something he did not say.

--
/-- Joona Palaste (pa*****@cc.helsinki.fi) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"I will never display my bum in public again."
- Homer Simpson
Nov 14 '05 #83

P: n/a
Joona I Palaste wrote:

pete <pf*****@mindspring.com> scribbled the following:
E. Robert Tisdale wrote:
Mac wrote:
> For whatever reason,
> E. Robert Tisdale modifies posts he is replying to on occasion.
> Tisdale has not, to my knowledge,
> offered any explicit explanation for this behavior.

What's to explain?
There is no need to quote and it is discouraged.
It is as evil as top posting.
I fix the quotes, to reflect my understanding of what was said,
because I'm too stupid to understand the difference
between a quote and a reply.

Well, now that I've tried it, I can see the appeal.


5 Euros says Tisdale will now insult and flame you
and call you a troll
because you claimed he said something he did not say.


I quoted exactly what he meant.
When you think that somebody has made a mistake in their post:
you quote the suspect portion of the post correctly
and you address the matter in your reply, don't you ?
Doesn't everybody ?

--
pete
Nov 14 '05 #84

P: n/a

"Joona I Palaste" <pa*****@cc.helsinki.fi> wrote in message
Getting called a troll by Tisdale is a sign of great respect on this
newsgroup. Therefore I am still anxiously waiting the day when
Tisdale calls me a troll.

This was a perfectly good and interesting thread on how to implement or
optimise the acos() function, ruined by this sort of C content-free
bickering.
Nov 14 '05 #85

P: n/a
Malcolm <ma*****@55bank.freeserve.co.uk> scribbled the following:
"Joona I Palaste" <pa*****@cc.helsinki.fi> wrote in message
Getting called a troll by Tisdale is a sign of great respect on this
newsgroup. Therefore I am still anxiously waiting the day when
Tisdale calls me a troll.
This was a perfectly good and interesting thread on how to implement or
optimise the acos() function, ruined by this sort of C content-free
bickering.


I think Tisdale is to blame for that.

--
/-- Joona Palaste (pa*****@cc.helsinki.fi) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"This is a personnel commuter."
- Train driver in Scientific American
Nov 14 '05 #86

P: n/a
In article <c1**********@news7.svr.pol.co.uk>,
"Malcolm" <ma*****@55bank.freeserve.co.uk> wrote:
"Joona I Palaste" <pa*****@cc.helsinki.fi> wrote in message
Getting called a troll by Tisdale is a sign of great respect on this
newsgroup. Therefore I am still anxiously waiting the day when
Tisdale calls me a troll.

This was a perfectly good and interesting thread on how to implement or
optimise the acos() function, ruined by this sort of C content-free
bickering.


If you want a very fast implementation of the acos() function with good
precision: Have a look first at the cephes implementation to get an idea
how their method works. Download

http://www.netlib.org/cephes/cmath.tgz

The acos function is together with asin in asin.c

Now do a few improvements to make it faster:

1. The cephes implementation uses an approximation by a rational
function (one polynomial divided by another polynomial). It is better to
use a single polynomial of higher degree to avoid division. Evaluating
high degree polynomials is _not_ done using the Horner scheme because
latency kills you; for example a polynomial of degree 7 might be
evaluated as

((ax+b)*x^2 + (cx+d))*x^4 + ((ex+f)*x^2 + (gx+h))

This will need some experimentation which scheme is fastest on your
processor.

2. For x > 0.5, the cephes scheme calculates 2*asin (sqrt ((1-x)/2)).
Change this as follows: If you substitute the asin formula then you will
get an odd polynomial in sqrt ((1-x)/2). That is the same as
sqrt((1-x)/2) multiplied by a polynomial in ((1-x)/2). Calculate
(1-x)/2, then calculate the square root and the polynomial in parallel
to avoid latency. The code for square root needs to be inlined; it can
be simplified because you know the range of the argument. And I hope you
know how to calculate a square root without using divisions.

3. Instead of using two different methods for x <= 0.5 and x > 0.5, use
a different point for the switch between these methods. The reason is
that the method used for large values is slower; if you restrict the
range where the slower method is used to fewer arguments then the
average runtime will be better.
Nov 14 '05 #87

P: n/a
Christian Bau wrote:
If you want a very fast implementation of the acos() function
with good precision, have a look first at the cephes implementation
to get an idea how their method works. Download

http://www.netlib.org/cephes/cmath.tgz
I did. I can't get it to build. Can you?

The acos function is together with asin in asin.c

Now do a few improvements to make it faster:

1. The cephes implementation uses an approximation by a rational
function (one polynomial divided by another polynomial).
It is better to use a single polynomial of higher degree
to avoid division. Evaluating high degree polynomials
is _not_ done using the Horner scheme because latency kills you;
for example, a polynomial of degree 7 might be evaluated as

((ax+b)*x^2 + (cx+d))*x^4 + ((ex+f)*x^2 + (gx+h))

This will need some experimentation
which scheme is fastest on your processor.
Don't forget to test against the built-in function.
2. For x > 0.5, the cephes scheme calculates 2*asin (sqrt ((1-x)/2)).
Change this as follows: If you substitute the asin formula
then you will get an odd polynomial in sqrt ((1-x)/2).
That is the same as sqrt((1-x)/2) multiplied by a polynomial in ((1-x)/2). Calculate (1-x)/2, then calculate the square root
and the polynomial in parallel to avoid latency.
Exactly how does one effect this "parallel" calculation?
The code for square root needs to be inlined;
it can be simplified because you know the range of the argument.
And I hope you know how to calculate a square root
without using divisions.
Please show us how to calculate a square root without using division.
3. Instead of using two different methods for x <= 0.5 and x > 0.5,
use a different point for the switch between these methods.
The reason is that the method used for large values is slower;
if you restrict the range where the slower method is used
to fewer arguments then the average runtime will be better.


Have you ever done this before Christian?
If so, please post your code so that we can test it ourselves.

Nov 14 '05 #88

P: n/a
In article <40**************@jpl.nasa.gov>,
"E. Robert Tisdale" <E.**************@jpl.nasa.gov> wrote:
Christian Bau wrote:
If you want a very fast implementation of the acos() function
with good precision, have a look first at the cephes implementation
to get an idea how their method works. Download

http://www.netlib.org/cephes/cmath.tgz


I did. I can't get it to build. Can you?


Why would I try? I said "look first at the cephes implementation".
"Look". Can't you read?

The acos function is together with asin in asin.c

Now do a few improvements to make it faster:

1. The cephes implementation uses an approximation by a rational
function (one polynomial divided by another polynomial).
It is better to use a single polynomial of higher degree
to avoid division. Evaluating high degree polynomials
is _not_ done using the Horner scheme because latency kills you;
for example, a polynomial of degree 7 might be evaluated as

((ax+b)*x^2 + (cx+d))*x^4 + ((ex+f)*x^2 + (gx+h))

This will need some experimentation
which scheme is fastest on your processor.


Don't forget to test against the built-in function.
2. For x > 0.5, the cephes scheme calculates 2*asin (sqrt ((1-x)/2)).
Change this as follows: If you substitute the asin formula
then you will get an odd polynomial in sqrt ((1-x)/2).
That is the same as sqrt((1-x)/2) multiplied by a polynomial

in ((1-x)/2). Calculate (1-x)/2, then calculate the square root
and the polynomial in parallel to avoid latency.


Exactly how does one effect this "parallel" calculation?


Inline the sqrt implementation and use a good compiler. Come on, you are
programming since 30 years. Haven't you learned anything in the last 29?
The code for square root needs to be inlined;
it can be simplified because you know the range of the argument.
And I hope you know how to calculate a square root
without using divisions.


Please show us how to calculate a square root without using division.


Hint: Why do PowerPC and AMD processors have an "inverse square root
estimate"?
3. Instead of using two different methods for x <= 0.5 and x > 0.5,
use a different point for the switch between these methods.
The reason is that the method used for large values is slower;
if you restrict the range where the slower method is used
to fewer arguments then the average runtime will be better.


Have you ever done this before Christian?
If so, please post your code so that we can test it ourselves.


Troll Troll Troll Troll Troll.

My offer for a bet is still standing. ?20,000 for an acos implementation
that is faster than anything you can find.
Nov 14 '05 #89

P: n/a
In <c1**********@news-rocq.inria.fr> Grumble <in*****@kma.eu.org> writes:
Nick Landsberg wrote:
I also did not put []'s around the word "interpolation."


Actually, You originally wrote "extrapolation". It was Tisdale who
changed "extrapolation" to "interpolation" when he modified your post.


And, for once, he did the *right* thing and marked his editorial change
with the []'s.

Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
Nov 14 '05 #90

P: n/a
In <40***********@mindspring.com> pete <pf*****@mindspring.com> writes:
Joona I Palaste wrote:

pete <pf*****@mindspring.com> scribbled the following:
> E. Robert Tisdale wrote:
>> Mac wrote:
>> > For whatever reason,
>> > E. Robert Tisdale modifies posts he is replying to on occasion.
>> > Tisdale has not, to my knowledge,
>> > offered any explicit explanation for this behavior.
>>
>> What's to explain?
>> There is no need to quote and it is discouraged.
>> It is as evil as top posting.
>> I fix the quotes, to reflect my understanding of what was said,
>> because I'm too stupid to understand the difference
>> between a quote and a reply.

> Well, now that I've tried it, I can see the appeal.


5 Euros says Tisdale will now insult and flame you
and call you a troll
because you claimed he said something he did not say.


I quoted exactly what he meant.
When you think that somebody has made a mistake in their post:
you quote the suspect portion of the post correctly
and you address the matter in your reply, don't you ?
Doesn't everybody ?


It depends on the context. If the mistake is an *obvious* typo, I prefer
to silently correct it and pretend that it didn't exist in the original
message. Then spend my time addressing the *real* issue of the OP.

No one blamed me, until now, for this "unfair" quoting practice.

While other people prefer to post corrections to the typo and ignore the
real problem raised by the OP...

Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
Nov 14 '05 #91

P: n/a
Dan Pop wrote:
.... snip ...
It depends on the context. If the mistake is an *obvious* typo,
I prefer to silently correct it and pretend that it didn't exist
in the original message. Then spend my time addressing the
*real* issue of the OP.

No one blamed me, until now, for this "unfair" quoting practice.

While other people prefer to post corrections to the typo and
ignore the real problem raised by the OP...


Horrors. I suspect nobody noticed it because you use discretion
and knowledge, unlike Trollsdale. Now you have given it an excuse
(albeit an invalid one).

You will now be watched by various hawks. Prepare for flames. :-)

--
Chuck F (cb********@yahoo.com) (cb********@worldnet.att.net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net> USE worldnet address!

Nov 14 '05 #92

P: n/a
Joona I Palaste wrote:

<snip>

I think Tisdale is to blame for that.


You can have only one prima donna in an opera. There are some around
here in this theatre, and they want to fight it out.

Ignoring someone (or at least pretending to do) is much more
discouraging than this stupid bickering. And if some people want do it,
they simply should do it by eMail: most of us around here should have
access to a computer. So to *ALL* flaming/insulting/trolling: simply
spare us from this childish stuff and fight your petty little wars
somewere else, ok?

Nov 14 '05 #93

92 Replies

This discussion thread is closed

Replies have been disabled for this discussion.