The Museum of HP Calculators

HP Forum Archive 21

[ Return to Index | Top of Index ]

[WP34s] Next problem?
Message #1 Posted by fhub on 28 June 2012, 6:35 a.m.

Good to see the usual MOD now in the current release. :-)

But now I've found another problem: contrary to all other calculators that I've checked (HP50g, HP39gII, TI-Nspire, ...) the WP34s returns a negative number for GCD whenever one of its arguments is negative.

Is this intended or just another bug?

IMO the main math functions should work as in all other calculators, else porting any programs is really a nightmare. :-(

Franz

      
Re: [WP34s] Next problem?
Message #2 Posted by Paul Dale on 28 June 2012, 6:42 a.m.,
in response to message #1 by fhub

The sign behaviour of GCD is intended, although I don't remember why I did it that way.

Fortunately, the fix isn't onerous:

        LBL'GCD'
        ABS
        x[<->] Y
        ABS
        x[<->] Y        // Leave this out if you don't care about Last X
        GCD
        END

One of the joys of a programmable calculator is you can define your own functions and variants.

MOD is by no means a certainty at this stage.

- Pauli

            
Re: [WP34s] Next problem?
Message #3 Posted by fhub on 28 June 2012, 6:51 a.m.,
in response to message #2 by Paul Dale

Quote:
Fortunately, the fix isn't onerous:
Of course not, but it's indeed not nice that the WP34s defines its own math rules. I really don't like to have a (long) list of exceptions where the WP34s return different results than every other calculator, and I would have to 'fix' all those non-standard WP34s functions myself in each program.

Absolutely bad behaviour! :-(

Franz

                  
Re: [WP34s] Next problem?
Message #4 Posted by Paul Dale on 28 June 2012, 6:58 a.m.,
in response to message #3 by fhub

Easier fix that doesn't do the right thing with Last X:

        GCD
        ABS

I don't remember why I did this so we might as well see what behaviour people want GCD and LCM to have with negative arguments?

Being different to other calculators is fine and good when the rest aren't completely correct. The 41/42 SIGN function e.g. I'm glad to be different there e.g.

- Pauli

                        
Re: [WP34s] Next problem?
Message #5 Posted by fhub on 28 June 2012, 7:04 a.m.,
in response to message #4 by Paul Dale

Quote:
Being different to other calculators is fine ...
... but not if it's completely against all math standards and different to EVERY other calculator.

And BTW, if for example -4 ENTER 6 GCD returns -2, then this is not the GCD but the LCD. ;-)

Franz

                              
Re: [WP34s] Next problem?
Message #6 Posted by Nigel J Dowrick on 28 June 2012, 10:06 a.m.,
in response to message #5 by fhub

I'm just curious: why would you ever want to use GCD or LCM with a negative number?!

Nigel (UK)

                                    
Re: [WP34s] Next problem?
Message #7 Posted by fhub on 28 June 2012, 10:15 a.m.,
in response to message #6 by Nigel J Dowrick

Quote:
I'm just curious: why would you ever want to use GCD or LCM with a negative number?!
Counter question: why not? ;-)
(division is also defined for negative numbers/integers)

Can't you imagine that you need those GCD/LCM functions in any number theory algorithm? Should you then always have to check if any of the arguments is negative to be sure that the WP34s program will work correctly also with such numbers?

Franz

Edited: 28 June 2012, 10:24 a.m.

                        
Re: [WP34s] Next problem?
Message #8 Posted by Thomas Radtke on 28 June 2012, 11:55 a.m.,
in response to message #4 by Paul Dale

Quote:
I don't remember why I did this so we might as well see what behaviour people want GCD and LCM to have with negative arguments?
A negative GCD is nonsense in any case. If you find a negative common divider, you'll immediately have a positive one which is obviously greater. Hence, the GCD is defined as element from the set of non-zero positive integers. Please correct me if I overlooked something.
                              
Re: [WP34s] Next problem?
Message #9 Posted by Paul Dale on 28 June 2012, 5:12 p.m.,
in response to message #8 by Thomas Radtke

Now apply the same logic to the LCM.....-infinity is looking good for all inputs regardless of sign :-)

- Pauli

                                    
Re: [WP34s] Next problem?
Message #10 Posted by fhub on 28 June 2012, 5:31 p.m.,
in response to message #9 by Paul Dale

Quote:
Now apply the same logic to the LCM.....-infinity is looking good for all inputs regardless of sign :-)
Sorry but that's nothing else than a bad joke.

First GCD/LCM are defined as non-negative integers ('natural numbers'), and -infinity isn't even a 'number' at all.

Franz

                                    
Re: [WP34s] Next problem?
Message #11 Posted by Thomas Radtke on 29 June 2012, 5:06 a.m.,
in response to message #9 by Paul Dale

Quote:
Now apply the same logic to the LCM.....
Pointing out a misnomer doesn't break either logic nor a definition all mathmaticians agreed upon ;-).
                                          
Re: [WP34s] Next problem?
Message #12 Posted by fhub on 29 June 2012, 5:43 a.m.,
in response to message #11 by Thomas Radtke

Good that at least one other here supported my GCD/LCM complaint. ;-)

And we have finally convinced Pauli, because it's already changed in the SVN - unfortunately not yet compiled.

Franz

                                                
Re: [WP34s] Next problem?
Message #13 Posted by fhub on 30 June 2012, 4:51 a.m.,
in response to message #12 by fhub

Quote:
And we have finally convinced Pauli, because it's already changed in the SVN - unfortunately not yet compiled.
Pauli, before you go to bed tonight could you please make a new build with the current SVN 3191?

So we would have the GCD/LCM fixed - and also your other todays 'rearrangements' are very much appreciated (at least by me)! ;-)

Franz

                        
Re: [WP34s] Next problem?
Message #14 Posted by Pete Wilson on 29 June 2012, 2:01 p.m.,
in response to message #4 by Paul Dale

Might as well use the simpler definition as the first one puts the wrong (ABS X) value in LastX anyway.

Plus, I don't see how having LastX will help you undo an incorrect GCD.

                              
Re: [WP34s] Next problem?
Message #15 Posted by fhub on 29 June 2012, 2:19 p.m.,
in response to message #14 by Pete Wilson

Quote:
Plus, I don't see how having LastX will help you undo an incorrect GCD.
And this is true for all functions with 2 operands. That's why I've suggested almost 1 year ago that for every binary operation both X and Y should be saved in L and I (as for complex operations) - but my idea didn't find any open ear.

Franz

                                    
Re: [WP34s] Next problem?
Message #16 Posted by Pete Wilson on 1 July 2012, 1:53 a.m.,
in response to message #15 by fhub

I assume by functions you are excluding basic arithmetic and powers, but LastX helps with any reversible function, such as % or Logx(Y), so it is still useful in many 2 argument functions.

      
Re: [WP34s] Next problem?
Message #17 Posted by fhub on 1 July 2012, 6:01 a.m.,
in response to message #1 by fhub

Just an info:

BSRF & BSRB missing in the last build (at least not in any catalog).

And I would also really appreciate having access to the indirect calls iBACK/iBSRF/iBSRB and even the 2 commands A..D-> and ->A..D.

Maybe there could be made a (temporary?) 'expert' build with all these commands? ;-)

Franz

Edited: 1 July 2012, 6:18 a.m.

            
Re: [WP34s] Next problem?
Message #18 Posted by Paul Dale on 1 July 2012, 6:31 a.m.,
in response to message #17 by fhub

Quote:
And I would also really appreciate having access to the indirect calls iBACK/iBSRF/iBSRB and even the 2 commands A..D-> and ->A..D.

Why? These indirect instructions are almost unusable in reality and they produce completely unmaintainable code. Please demonstrate a non-contrived use case for these, just wanting them isn't sufficient. People want everything, usually without thinking. If you do manage to demonstrate a sufficiently good usage of these, we might consider adding them to the firmware. The use case will, of course, have to be significantly better than any other alternative that doesn't use them. Even including CASE is dubious -- if XROM didn't need it, it wouldn't be there.

A..D-> and ->A..D are not going to be exposed. The stored contents disappear forever if you are not very careful -- both writing the program and when running it (they'll disappear if you stop running a program using R/S e.g.). Plus, they'll interact rather badly with the solver. Not something we want available in a "safe" programming environment.

Quote:
Maybe there could be made an 'expert' build with all these commands?

Nobody is stopping you upgrading your host machine and building your own image with these included. We, however, are not planning on doing so.

- Pauli

                  
Re: [WP34s] Next problem?
Message #19 Posted by Walter B on 1 July 2012, 10:01 a.m.,
in response to message #18 by Paul Dale

I second Pauli's opinion completely :-)

      
Re: [WP34s] Next problem?
Message #20 Posted by fhub on 3 July 2012, 6:55 a.m.,
in response to message #1 by fhub

Any plans for a new build with the last changes?

BSRF & BSRB aren't accessable in the last build, and also DBLON/DBLOFF have been moved to the MODE catalog (which is indeed to right place) but are still in P.FCN (contrary what the current manual says).

Franz

            
Re: [WP34s] Next problem?
Message #21 Posted by Walter B on 3 July 2012, 7:33 a.m.,
in response to message #20 by fhub

Quote:
DBLON/DBLOFF have been moved to the MODE catalog (which is indeed to right place) but are still in P.FCN (contrary what the current manual says).
In this rare case the SW is wrong ;-) We'll get that repaired.
                  
Re: [WP34s] Next problem?
Message #22 Posted by fhub on 3 July 2012, 7:44 a.m.,
in response to message #21 by Walter B

Quote:
In this rare case the SW is wrong ;-) We'll get that repaired.
And you've removed again BSRF/BSRB as I can see in your last SVN. Well, it seems you don't like 'experts' working with the WP34s. ;-)

BTW, the next build will be SVN 3200, a perfect number for the final version ... :-)

Franz

                        
Re: [WP34s] Next problem?
Message #23 Posted by Walter B on 3 July 2012, 7:59 a.m.,
in response to message #22 by fhub

Quote:

And you've removed again BSRF/BSRB ...


Not true - I just made that file matching the build as is :-) AFAICS there, DBLON & Co. shouldn't be in P.FCN anymore. Strange.

Number-wise, I'd prefer 3535 ;-)

Edited: 3 July 2012, 8:04 a.m. after one or more responses were posted

                              
Re: [WP34s] Next problem?
Message #24 Posted by fhub on 3 July 2012, 8:04 a.m.,
in response to message #23 by Walter B

Quote:
Not true - I just made that file matching the build as is :-)
Well, both functions BSRF/BSRB existed for a long time. 3 days ago Pauli removed them. Then 1 day later he put them back in again, and finally today you removed them again - really funny.
I know why I prefer making all my software projects myself as a single programmer - it's not nice having such troubles with a programming team. ;-)
Quote:
AFAICS there, DBLON & Co. shouldn't be in P.FCN anymore. Strange.
But they are. Putting them into MODE was Pauli's last change, but he didn't make a build after this last source change.
                                    
Re: [WP34s] Next problem?
Message #25 Posted by Walter B on 3 July 2012, 8:11 a.m.,
in response to message #24 by fhub

Well, also the expert's catalogue existed for a long time. Shall we reintroduce it? ;-) (Learning proceeds in steps sometimes ...)

                                          
Re: [WP34s] Next problem?
Message #26 Posted by fhub on 3 July 2012, 8:17 a.m.,
in response to message #25 by Walter B

Quote:
Well, also the expert's catalogue existed for a long time. Shall we reintroduce it? ;-)
Oh my god, of course not! I was the first (and only) one who complained about this arbitrary distribution of 'expert' commands into a separate catalog.
Quote:
(Learning proceeds in steps sometimes ...)
Yes, and in this case it were YOUR steps - and quite a lot I would say ... ;-)
                                                
Re: [WP34s] Next problem?
Message #27 Posted by Walter B on 3 July 2012, 8:38 a.m.,
in response to message #26 by fhub

Quote:

Yes, and in this case it were YOUR steps - and quite a lot I would say ... ;-)


If it makes you happy, so be it. And being able to learn isn't the worst insult we can get from anybody ;-) Anyway *we've made* the WP 34S while you ...?
                                                      
Re: [WP34s] Next problem?
Message #28 Posted by fhub on 3 July 2012, 8:46 a.m.,
in response to message #27 by Walter B

Quote:
Anyway *we've made* the WP 34S while you ...?
Well, just look at my website and you'll know what I have made.
http://fhub.110mb.com/

And that's only a very small part of my programming projects, not to forget even 3 programs for the WP34s: TVM, TRIGON and the Polynomial RootSolver PRS (which is no longer available though).

And should I count all my bug-reports, suggestions ... ?

Franz

                                                            
Re: [WP34s] Next problem?
Message #29 Posted by Walter B on 3 July 2012, 10:56 a.m.,
in response to message #28 by fhub

Quote:
And should I count all my bug-reports, suggestions ... ?
Yes, please ;-)
                                                                  
Re: [WP34s] Next problem?
Message #30 Posted by fhub on 3 July 2012, 11:05 a.m.,
in response to message #29 by Walter B

Quote:
Yes, please ;-)
Better not, I don't think that such a long posting would be supported by the forum software. ;-)

I'm rather waiting for the magic build number 3200 ... :-)

                                                                        
Re: [WP34s] Next problem?
Message #31 Posted by Walter B on 3 July 2012, 12:31 p.m.,
in response to message #30 by fhub

Bad luck - just wanted to keep you busy for a while ;-/

                                                                              
Re: [WP34s] Next problem?
Message #32 Posted by fhub on 3 July 2012, 1:57 p.m.,
in response to message #31 by Walter B

Quote:
Bad luck - just wanted to keep you busy for a while ;-/
Don't worry, after the next build (when DBLON/OFF is in the correct catalog) you'll not hear anything from me for a very long time, because I consider the next SVN 3200 as final version.

But there would be a much easier way for you: if you can't stand me then simply ignore my postings!

Franz

                                                                                    
Re: [WP34s] Next problem?
Message #33 Posted by Walter B on 3 July 2012, 2:22 p.m.,
in response to message #32 by fhub

Quote:
... after the next build (...) you'll not hear anything from me for a very long time...
:-D 73 and counting ;-)
                                                
Re: [WP34s] Next problem?
Message #34 Posted by Marcus von Cube, Germany on 3 July 2012, 4:44 p.m.,
in response to message #26 by fhub

Quote:
Oh my god, of course not! I was the first (and only) one who complained about this arbitrary distribution of 'expert' commands into a separate catalog.
You were not alone.
                                                      
Re: [WP34s] Next problem?
Message #35 Posted by fhub on 3 July 2012, 4:49 p.m.,
in response to message #34 by Marcus von Cube, Germany

Quote:
You were not alone.
Yes, you're right - there were even more situations where we both had the same opinion. :-)

BTW, could you please make a quick SVN build? The last version isn't up-to-date and the next build number 3200 would be a nice version number. ;-)

Edit: That was really quick - many thanks Marcus!
Now let's hope that nobody finds a bug anymore ... ;-)

Franz

Edited: 3 July 2012, 5:12 p.m.

                                                            
Re: [WP34s] Next problem?
Message #36 Posted by Dominic Richens on 3 July 2012, 7:24 p.m.,
in response to message #35 by fhub

Quote:
Now let's hope that nobody finds a bug anymore ... ;-)

That's easy. From now on we call anything unexpected a "feature".

                                                                  
Re: [WP34s] Next problem?
Message #37 Posted by fhub on 4 July 2012, 4:19 a.m.,
in response to message #36 by Dominic Richens

Quote:
That's easy. From now on we call anything unexpected a "feature".
LOL, indeed a good idea!
But it's not really a new idea, many programmers and companies already do this. ;-)


[ Return to Index | Top of Index ]

Go back to the main exhibit hall