(12C) Signum Function
03-04-2019, 10:49 AM
Post: #21
 Dieter Senior Member Posts: 2,398 Joined: Dec 2013
RE: (12C) Signum Function
(03-03-2019 06:52 PM)Gerson W. Barbosa Wrote:  That’s what I get on my TI 57, but on my 12c Prestige (and on the latest Platinums, I presume), arguments on the display cannot be reused after an operator.

But it seems to have worked on early 12CPs, as Robert noted.

(03-03-2019 06:52 PM)Gerson W. Barbosa Wrote:  IMHO, this is a feature, not a bug. Although the old behavior is apparently more convenient in some situations, I prefer this new one

I prefer the other way as it can shorten and simplify quite a lot of calculations. For instance the sum formula (n²+n)/2, that's simply + x² / 2. Add an "=" before the division, if required.

On some (many, most, all?) TIs, e.g. the 58/59, there even was a way to re-enter the displayed value during a calculation by means of the CE key, as in

5 x ( CE + 1 ) / 2 =

I really appreciated this as it helped overcome the limitations of AOS (a bit).

But then...
(03-03-2019 06:52 PM)Gerson W. Barbosa Wrote:  (or at least I would if I chose ALG, which I never will).

That's what I really love about RPN: it's direct, straightforward and unambiguos. It simply does what you tell it to do and intermediate results can be freely stored on the stack.

Dieter
03-04-2019, 10:57 AM
Post: #22
 Dieter Senior Member Posts: 2,398 Joined: Dec 2013
RE: (12C) Signum Function
(03-02-2019 03:00 AM)Gerson W. Barbosa Wrote:
Code:
01 ENTER  02 CHS 03 x<=y 04 CHS 05 x=0 06 n! 07 /

That's a nice one. I probably would have used e^x to convert 0 into 1, but n! does it either, and maybe it's a tiiiiiiiiiny bit faster.

This also makes a nice ABS code:

Code:
01 ENTER  02 CHS 03 x<=y 04 CHS

This leaves the original input in Y and its absolute value in X.
And again it does not have the problems of the x² √x method: it neither underflows for very small values not does it cause inaccuracies for about one out of five arguments (cf. Thomas' post).

Dieter
03-04-2019, 08:11 PM (This post was last modified: 03-04-2019 08:16 PM by Gerson W. Barbosa.)
Post: #23
 Gerson W. Barbosa Senior Member Posts: 1,177 Joined: Dec 2013
RE: (12C) Signum Function
(03-04-2019 10:57 AM)Dieter Wrote:  This also makes a nice ABS code:

Code:
01 ENTER  02 CHS 03 x<=y 04 CHS

This leaves the original input in Y and its absolute value in X.

In order to use that as a function I’d rather get rid of the original input, but I cannot do it in less than five steps on the HP-12C:

Code:
 01 0 02 x<=y 03 x<>y 04 - 05 CHS

On the HP-25 it can be done with four steps:

Code:
 01 0 02 x>y 03 x<>y 04 -

It won’t beat the usual method, though:

Code:
 01 x^2 02 sqrt

|-3.43142| = 3.431420001 might not be much of problem for most applications, I think.

Gerson.
 « Next Oldest | Next Newest »

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