Post Reply 
WP 34S mini-challenge
01-22-2014, 05:27 PM
Post: #48
RE: WP 34S mini-challenge
(01-22-2014 01:12 PM)Dieter Wrote:  
(01-21-2014 04:07 PM)Didier Lachieze Wrote:  Well, here is a solution working on both the 42S and WP 34S, not limited to integers and where I don't see the rounding error highlighted above:
Code:
00 {15-Byte Prgm}
01 LBL "GS"
02 X^2
03 RCL+ ST L
04 1/X
05 RCL+ ST X
06 1/X
07 END

Have you tried n = 7 ?-)

Consecutive 1/x commands are prone to roundoff errors. I do not have a safe five-step solution, but if one additional step is okay, this should yield accurate results:

Code:
01 LBL "GS"
02 X^2
03 RCL+ L
04 SIGN
05 STO+ X
06 STO/ L
07 X<> L
08 END

Dieter

What is wrong with 28.0000000001? That's a perfect 28 for all practical purposes :-)
Of course the original formula (n^2 + n)/2 is better because it always yields exact results for integer arguments (even when using binary number formats), but occasional errors of a few ULP's are acceptable (and expected) when using a digital computer or calculator, IMHO.

Regards,

Gerson.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
WP 34S mini-challenge - Gerson W. Barbosa - 01-21-2014, 02:02 AM
RE: WP 34S mini-challenge - Paul Dale - 01-21-2014, 07:29 AM
RE: WP 34S mini-challenge - walter b - 01-21-2014, 07:59 AM
RE: WP 34S mini-challenge - walter b - 01-21-2014, 08:26 AM
RE: WP 34S mini-challenge - Paul Dale - 01-21-2014, 11:34 AM
RE: WP 34S mini-challenge - walter b - 01-21-2014, 12:20 PM
RE: WP 34S mini-challenge - Paul Dale - 01-21-2014, 11:51 AM
RE: WP 34S mini-challenge - walter b - 01-21-2014, 12:24 PM
RE: WP 34S mini-challenge - walter b - 01-21-2014, 11:08 AM
RE: WP 34S mini-challenge - Paul Dale - 01-21-2014, 08:24 AM
RE: WP 34S mini-challenge - Paul Dale - 01-21-2014, 11:29 AM
RE: WP 34S mini-challenge - nsg - 01-21-2014, 10:46 PM
RE: WP 34S mini-challenge - Dieter - 01-22-2014, 01:12 PM
RE: WP 34S mini-challenge - Gerson W. Barbosa - 01-22-2014 05:27 PM
RE: WP 34S mini-challenge - Paul Dale - 01-21-2014, 11:55 AM
RE: WP 34S mini-challenge - walter b - 01-21-2014, 12:29 PM
RE: WP 34S mini-challenge - walter b - 01-21-2014, 01:20 PM
RE: WP 34S mini-challenge - Paul Dale - 01-21-2014, 11:48 AM
RE: WP 34S mini-challenge - Dieter - 01-21-2014, 08:43 PM
RE: WP 34S mini-challenge - Paul Dale - 01-21-2014, 10:13 PM
RE: WP 34S mini-challenge - walter b - 01-22-2014, 05:15 AM
RE: WP 34S mini-challenge - Thomas Klemm - 01-22-2014, 05:47 AM
RE: WP 34S mini-challenge - walter b - 01-22-2014, 07:04 AM
RE: WP 34S mini-challenge - walter b - 01-22-2014, 08:16 AM
RE: WP 34S mini-challenge - Thomas Klemm - 01-22-2014, 06:02 AM
RE: WP 34S mini-challenge - Dieter - 01-22-2014, 01:20 PM
RE: WP 34S mini-challenge - Thomas Klemm - 01-22-2014, 06:35 PM
RE: WP 34S mini-challenge - Dieter - 01-22-2014, 08:27 PM



User(s) browsing this thread: 8 Guest(s)