Click here to Skip to main content
15,895,777 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: It's not very pretty, is it... Pin
Jochen Arndt11-Apr-16 0:03
professionalJochen Arndt11-Apr-16 0:03 
GeneralRe: It's not very pretty, is it... Pin
Chris C-B11-Apr-16 0:33
Chris C-B11-Apr-16 0:33 
GeneralRe: It's not very pretty, is it... Pin
Jochen Arndt11-Apr-16 1:08
professionalJochen Arndt11-Apr-16 1:08 
GeneralRe: It's not very pretty, is it... Pin
Chris C-B11-Apr-16 2:53
Chris C-B11-Apr-16 2:53 
GeneralRe: It's not very pretty, is it... Pin
Kornfeld Eliyahu Peter10-Apr-16 23:18
professionalKornfeld Eliyahu Peter10-Apr-16 23:18 
GeneralRe: It's not very pretty, is it... Pin
Jörgen Andersson10-Apr-16 23:27
professionalJörgen Andersson10-Apr-16 23:27 
GeneralRe: It's not very pretty, is it... Pin
Kornfeld Eliyahu Peter10-Apr-16 23:39
professionalKornfeld Eliyahu Peter10-Apr-16 23:39 
GeneralRe: It's not very pretty, is it... Pin
Daniel Pfeffer11-Apr-16 1:08
professionalDaniel Pfeffer11-Apr-16 1:08 
A simple ipow(X, N) function may be written that requires a maximum of 2*log2[N] multiplications (may be off-by-one), and a possible division (if N was negative). If all N are known, it is possible to optimize ipow() even further, by writing custom code for each power.

For summation of polynomials, note that there are special cases where the Horner polynomial calculation may be optimized:

Even polynomials p(x) = a0 + a2*x^2 + a4*x^4 ... ==> y = x^2; p(y) = a0 + a2*y + a4*y^2 ...
Odd polynomials p(x) = a1*x + a3*x^3 + a5*x^5 ... ==> y = x^2; q(y) = a1 + a3*y + a5*y^2 ... ; p(x) = q(y) * x
...

One advantage of the alternate forms is that they preserve mathematical identities such as p(x) == p(-x) for even polynomials, and p(x) = -p(-x) for odd polynomials.

Note that using Horner polynomial evaluation Horner's method - Wikipedia, the free encyclopedia[^] saves many multiplications - you only need a maximum of 2*(N-1) multiplications and (N-1) additions for the entire polynomial.

EDIT - corrected information about polynomial evaluation
If you have an important point to make, don't try to be subtle or clever. Use a pile driver. Hit the point once. Then come back and hit it again. Then hit it a third time - a tremendous whack.

--Winston Churchill


modified 11-Apr-16 7:17am.

GeneralRe: It's not very pretty, is it... Pin
Chris C-B11-Apr-16 4:52
Chris C-B11-Apr-16 4:52 
GeneralRe: It's not very pretty, is it... Pin
BillWoodruff11-Apr-16 2:34
professionalBillWoodruff11-Apr-16 2:34 
GeneralRe: It's not very pretty, is it... Pin
Chris C-B11-Apr-16 3:02
Chris C-B11-Apr-16 3:02 
GeneralRe: It's not very pretty, is it... Pin
Mark_Wallace11-Apr-16 7:52
Mark_Wallace11-Apr-16 7:52 
GeneralWho's up for the CCC ? Pin
pkfox10-Apr-16 22:39
professionalpkfox10-Apr-16 22:39 
GeneralRe: Who's up for the CCC ? Pin
Pirate Guy10-Apr-16 22:44
Pirate Guy10-Apr-16 22:44 
GeneralRe: Who's up for the CCC ? Pin
pkfox10-Apr-16 23:27
professionalpkfox10-Apr-16 23:27 
JokeBegun, the training has! Pin
Johnny J.10-Apr-16 22:20
professionalJohnny J.10-Apr-16 22:20 
GeneralRe: Begun, the training has! Pin
HobbyProggy10-Apr-16 22:41
professionalHobbyProggy10-Apr-16 22:41 
GeneralRe: Begun, the training has! Pin
User 1013254610-Apr-16 22:59
User 1013254610-Apr-16 22:59 
GeneralRe: Begun, the training has! Pin
  Forogar  11-Apr-16 3:52
professional  Forogar  11-Apr-16 3:52 
GeneralRe: Begun, the training has! Pin
User 1013254611-Apr-16 4:01
User 1013254611-Apr-16 4:01 
GeneralRe: Begun, the training has! Pin
  Forogar  11-Apr-16 4:03
professional  Forogar  11-Apr-16 4:03 
GeneralRe: Begun, the training has! Pin
User 1013254611-Apr-16 4:27
User 1013254611-Apr-16 4:27 
GeneralRe: Begun, the training has! Pin
Corporal Agarn11-Apr-16 7:00
professionalCorporal Agarn11-Apr-16 7:00 
GeneralRe: Begun, the training has! Pin
Mark_Wallace11-Apr-16 7:54
Mark_Wallace11-Apr-16 7:54 
GeneralFSOW OTD 2016-04-11 - we have a winner Pin
Duncan Edwards Jones10-Apr-16 21:59
professionalDuncan Edwards Jones10-Apr-16 21:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.