Hi all,
As fate would have it, today's my birthday (don't ask) so I think that a little commemorative mini-challenge is in order, namely:
The commemorative mini-challenge
Write a short program or code snippet to evaluate a given polynomial at any given particular argument X, without explicitly using either multiplication/division operators (*, /)(that excludes reciprocals as well) or addition/subtraction operators (+, -).
For good measure, any and all kinds of conditional, looping, or Go-To statements or constructions are forbidden as well so no equivalents to IF, GOTO, SELECT, CASE, UNTIL, WHILE, LOOP, FOR, ... you get the point.
To simplify matters a little you can particularize your code to evaluate this particular 5th-degree polynomial:
y = 5 x5 + 8 x4 + 4 x3 + 2 x2 + 3 x + 1
for any given argument X (the generalization to arbitrary polynomials is obviously straightforward).
Assorted HP models can be used for this challenge (not all can deliver) but in case your particular model has a built-in (or library's) polynomial evaluation functionality (say "CALL POLYEV(coefficients, X)") you're asked not to use it lest you'll ruin the challenge for yourself.
I'll give a 3-line HP-71B solution, which runs like this:
>RUN
? PI ( X value )
2463.56024568 ( P(x) )
>RUN
? -7
-66121
Try your hand at it, it's actually quite easy !
Best regards from V.