Just a thought I had--a 35S Trig fix


Helllo all,

It just popped in my head. With regard to two of the 35S bugs:

For the cos(x) bug where x is close to 90, why not normalise x to (90-x) and take the sine instead?

For the issue of tan(x) where x is 3000 or above, again, normalise the angle so that x is within the correct quadrant and below 720º.

Would those approaches help?


This should work, but honestly why?

It is a calculator, it should be doing the work for you not making you do things like this.

- Pauli


"It is a calculator, it should be doing the work for you not making you do things like this"

Spoken like someone who has actually designed a calculator or something...


Yes, I realise that but, the 35S truly is a powerful machine. To junk it for some bugs that can be adjusted by just writing a program that gets around the glitch is quite challenging, remedies the shortfall and allows for more possibilities to expand the functionality.

As an example, since I own both the 25 and 29C, I noticed that neither the 25 nor 29 had a register exchange function. So, without even peeking through my HP-35 Math Pack, I set a goal to write code with the least amount of programming steps and preserves the stack as much as possible to do the exchange operation. Next, as I was browsing the 25 manual about its statistical functions, I noticed that the summation for y^2 was missing. So, I wrote some code to sum the y^2 value in R2 and then execute the summation function.

Edited: 25 Mar 2012, 7:38 p.m.


In that case cut out the possibly flawed algorithms completely and go back to a lovely book of tables. No bugs to worry about there. Not even a concern about batteries going flat. I'd recommend Abramowitz and Stegun since it is very comprehensive and also contains lots of really useful formulas for approximating functions with. This will also remind you why we use calculators :-)

There is a difference between working around missing features and working around bugs.

- Pauli


In that case cut out the possibly flawed algorithms completely and go back to a lovely book of tables.. I'd recommend Abramowitz and Stegun

It appears the tables have been edited from that work
but unabridged versions are available
in pdf and tiff formats.

This will also remind you why we use calculators :-)

Indeed it does. It also reminds how mind-numbingly spectacular
and far reaching the collective effort totalled in deriving the
body of work in their absence. Shoulders of giants..


You need sum of y^2 for the least squares method, as described on the HP-25 Applications Manual. I suspect there was little ROM space available when the function set was defined. x^2 was needed for standard deviation, so it was implemented.

Just my AR$ 0.10


Or you can run a user program more reliable than the built-in one:



Pauli, I was just offering a suggestion. Although, looking at that program and the results table, I see your point about the severity of errors (especially around the value of n*pi). I'm wondering if perhaps, HP's choice of algorithms is at fault here or perhaps the number of iterations. Perhaps, if they had the right algorithms, then iterating them til there's only an error of one count in the 15th digit (or no error in digit 15 at all) would've made all the difference.

Edited: 25 Mar 2012, 8:59 p.m.


I'd rather pay the extra $100 and get an old reliable. I have a stack of 'em already:-)

Collectors are the most difficult customers to satisfy with new products because we actually know rather more comprehensively what was possible. And we also buy these new, cheap products out of curiosity and if they don't pan out at some point they go in the bin. That's how I am feeling about the 33s and 35s.

From an historical point, note that when the 33s came out, HP had only recently completely gotten out of the calculator business. All pioneer production had been halted, Champagne production halted as well. 49G was available but thought to be out of productions as well. It looked like the end. Prices on pioneers and champagnes SOARED.

33S and the 49G+ came along and we thought, "wow, maybe they are recommitting to the game" and then we all dove in and bought stuff to try it out. The 49G+ was nearly a disaster. Fortunately I didn't buy one. HP seemed to be listening--the early 33s development went through some iterations and some obvious bugs were fixed.

The 35s turned out to be a major disappointment. Unlike the 33s development, as far as I can tell, HP has never done anything about the problems. This is rather bemusing because the team there now seems very focused--perhaps they are focused on the new products (30b etc and the new paradigm grapher) and maybe the 35s is going over the event horizon soon.


Yes, I too find that calculators, especially HPs, definitely HPs, should be the pinnacle of technology and mathematical accuracy and yes, the quality of HP calcs in the post-Pioneer and Post-Voyager era has been sadly lackluster. But, as fond as I am of HP and especially their calculators, I'm willing to bend my fickle precision boundary.

Yes, it's very disappointing to see HP drop the ball after such an outstanding run of Pioneers and Voyagers as well as the grandparents--the Classics 35, 45, 65, 67 and 55, Bonnie & Clyde (19C/29C) as well as the rest of the Woodstocks. I'm even rather impressed with the Spices. And that's why, I like to put HP in a respectable light. But yes, being a veteran from the day I got my first HP, a 32E back in 79, I was hooked and I never was as fond of TIs as I had been before. Ever since then, I'm the proud parent of a 34C, 15C, 28S, 42S, 32SII, 48GX as well as the 33s, 35s and now, the 50G.

I'm so devoted to HP, that I went way out of my budget to get a 21, 29C, 35A, 67 and replaced my retired 32E off of eBay.

I say all this because I love mathematics and I love calculators. I also love programming my HPs. And to support HP, although it may mean they've had a bum season or just a couple of duds in the calculator line, which pulls the rug out from under me, creating a workaround due to a shortcoming in a 33s or 35s or even a 25, is all worth it.

Edited: 26 Mar 2012, 12:12 a.m.


No offence, but I'm getting sick and tired of your posts... Let others say something too...


Not the kind of reaction we got used to here.

Sorry, but I for one disagree with you.

Many contributors (regular, old chaps) have not yet complained so far. And for the records, the activity has been enhanced.

The only guy who has the right to complaint to this extent is Dave Hicks.

What about not to read them, instead?

Luiz (Brazil)

Edited: 26 Mar 2012, 1:04 a.m.



Many contributors (regular, old chaps) have not yet complained so far.

So should I wait until one of the above decides so?
And how should I not read every second posting in the forum?


I just expressed my thoughts as well.

If no one answers a particular message, the thread itself will not prevail. And we must agree with the fact that basic forum premises have been followed so far, no misdirections observed.

There have been annoying 'contributors' in the past that were actually 'set apart' by simply having their requests not answered. People who have not contributed at all and usually posted about their own needs. In this particular case, I agree with the fact that old subjects have been brought back, but many known contributors have been participating. I actually thought this was kind of an old contributor maneuver to bring these subjects back, but it was just a thought of mine.

You see, I would have sent the guy a private e-mail in order to suggest a slowing down, if so. My way of acting in someone else's environment, though.

Luiz (Brazil)


Well said, Luiz!


HP Forum Commandment 5 in the HP Museum Terms of Use states that:

"Thou shalt remember that we love to help out, so please don't be shy and feel free to ask any question regardless of how silly you may feel asking it, and we'll be happy to help."





Thank you for that very nice comment.


De nada




Maybe, is it you who needs to chill out? No offence.


Actually I have rather enjoyed these posts. I have not responded to all, maybe not even most, but I, personally, have no issues with the questions being asked. If I am not interested in a thread I simply don't read it.

At least there has been some activity here. There have been times in the past when activity on this forum slowed down so much that I could come back once every three days and not miss a thing. I much prefer this level of activity to the other.

Just my 0.02...




Why don't just skip what you are not interested in, and let others talk about their calculators and related interests?

(I apologize in advance if my imperfect command of the English language prevents this message to convey its intended, friendly meaning).


Postel's Law: "be conservative in what you do, be liberal in what you
accept from others" (concerning mail often interpreted as "be conservative in what you send, liberal in what you accept").

(rfc793: 2.10).


As an engineer I have to toss in my 2 cents of opinion into this discussion as well.

While this behaviour of the 35S may certainly not be in line with former products of HP and also does not really help to make it the superior product compared to other calculator models on the market, the question I have to ask from an engineering point of view is this:

Honestly, who needs a 15-digit accuracy for calculations??? In the engineering world I live in we accept that physics and math will, for almost all problems, only give us an approximation that is within 5-10% of the true value. I don't even display the full mantissa on my calculators, 4 to 6 digits are enough for my calculations.

The link to finetune.jp only seems to support this, since the table indicates that the accuracy of the 35S trig functions seems to be always better than 5 digits. So for me, all that talk about inaccurate sin/cos/tan functions sounds like a problem of pure luxury. And it's certainly not worth heating up discussion about it either...

Kind regards,


Ditto! (from another engineer, electrical one)

Luiz (Brazil)


That reminds me of the following joke in this thread:

A mathematician, a physicist and an engineer are all placed 8 feet from a beautiful woman with the stipulation that at each time interval, they may move half of the remaining distance towards her.

The mathematician concludes that after N iterations there will be 8 divided by 2N feet remaining which will never equal zero so he gives up on the spot.

The physicist opines that if each iteration requires a finite amount of energy then the energy expended in the approach will be inversely proportional to the distance remaining and also gives up on the spot.

The engineer says "8 feet, 4 feet, 2 feet, 1 foot, 6 inches, good enough for practical purposes".

And as an engineer myself, I agree :-)





Luiz (Brazil)


That large????

- Pauli


We use metrical system here, it did not occurred to me how far (that large!) was a '6 inches'... Gee!

Edited: 26 Mar 2012, 6:35 a.m.


Great! Thanks!


Thanks for bringing that back to my mind :-) And three Royal Thumbs are not too large, are they?


A really good one, thanks Bart!!



So clearly, this is why there are more engineers than scientists.


I tell this joke regularly and botch it every time. Now I have a script to follow--Thanks!


Hmmm.... The bottom-line sees to be that either the engineer did not understand the rules, or he attempted a seemingly impossible task. Neither is very flattering, I must say. Can we not have a version starring an intelligent and educated engineer, well versed in greek and ancient history, on Zeno paradoxes, and on the theory of limits? He would still get the girl...

As an (electrical) engineer myself, I'm not very keen on this story about sloppy engineers, even though one has to admire the type of character you portrayed: unreliable, incapable of stricly following or deeply understanding a simple set of rules, with only a fuzzy and approximate notion of reality, but the one who, due to it all, ends up propagating his own DNA (assuming he did not cow in the end).

"Trust me, I'm an engineer."...



Paulo, as an EE you can just rely on the electro magnetic force to bridge the gap. This way you'll get the girl without breaking any rules. :-)

Edited: 27 Mar 2012, 3:00 a.m.


But for that, you either need approaching quite a *bit* closer or waiting some e9 years - the latter decreasing DNA propagation odds significantly ;-)


Indeed, Marcus, one might. In fact, relying on electro-magnetic force is my big hope for the future :-)



And what would we have built if like the mathematician and physicist we gave up at the first hurdle?

Next chapter: at 6 inches he is close enough to ask the girl out to a place where the rule doesn't exist - the mathematician and physicist didn't even get that far.

And "close enough" is not about sloppy engineering, but knowing how much effort is required.
Taking that back HP calculators, Dave Packard knew when it wasn't good enough (HP-35 2.02 ln ex bug), and we can question whether the modern HP company has that integrity. As has been mentioned, the loss of accuracy of Cos near 90o is a problem for iterative calculations e.g. in a program.
But then engineers should know that trig functions can be problematic near certain points.
And that iterative calculations increase error.
I have had this with the 50g.
and fx-9860Gii
and Excel VBA
to name a few...

just my 2p worth :-)


What no 34S in there????

- Pauli


Maybe there's a reason ... ;-)


Only Time.

Conversion of my most used routines to the 34s is a work in progress, it's just that there's always something else more urgent to do...

And yes, keeping a car running and a kitchen tap working does take precedence - at least in keeping "that voice" at bay ;-)


Understood... if you don't take care of the household chores then no algorithm on any calculator is going to help you get closer than 6 inches to "that voice". ;-)



Neither is very flattering, I must say. Can we not have a version starring an intelligent and educated engineer, well versed in greek and ancient history, on Zeno paradoxes, and on the theory of limits?

Us engineers are always "filling the gap" to turn impractical science into something usable and economical. It's the ability to judge that something is "close enough" to work.

I was watching Vi Hart's video trying to convince the viewer that .99999... = 1 and chuckled to myself that as an engineering, I am capable of believing sometimes that .9000 = 1



Hello to everyone,

Even if I don't show up that often, I really enjoy reading this fine forum each day. Well, I've been a bit surprised to see things heat up, which makes me think that everyone is right, indeed.

A 6 to 7-digit accuracy is more than we need in every day computations. Absolutely right... for a non-programmable calculator.

But what if you have to trust calculations resulting from many iterations, just as the ones a programmable machine was designed to do ? Remember the great articles from Prof. W. Kahan, the man behind hp accuracy, 30 years ago ? I'm not sure he'd be very happy with a 35s...

Of course it's a theoretical point of view, we use other computing gear for complex calculations, just as NASA engineers who used big computers to send men to the moon : calculations were done with 1000-digit accuracy if I'm not wrong.

Anyway I find it interesting in that we face this quality problem in many other fields : as a former electronics engineer, I really have nightmares with China-made lab equipment. Ironically, now there's more Chinese stuff at my work than in my home lab...... sigh

Just my 2 (euro) cents :-)
Best regards,


Actually, it can be a problem. Coding a microcode transcendental package, a team wasted a man-month searching for errors because the package's output did not match that from several calculators. Fresh eye on the problem said "Hmmm ...", wrote independent code on a different computer to slowly calculate exceedingly precise values of the functions at a hundred places in the primary range (64 bit input, 64 bit output, correctly rounded.)

We found a lot of tiny errors in a lot of calculator values (sorry, didn't report them elsewhere; we probably should have) and some that we did report -- as they'd caused our search for problems in our new package's code, which was actually far better than we expected.


Hi Marc (and all the others as well)!

Thanks for this feedback. Actually, you are quite right that accuracy does indeed play a vital role for calculations that rely on multiple iterations. I've experienced this numerous times when I was still "number-crunching" using Matlab/Simulink some years ago.

However, when you have a problem that required such calculations in engineering this is what you actually do - you use a sophisticated tool like Matlab/Simulink, Maple, etc.

I don't think that any engineer today who is not totally out of his or her mind (or a fanatic calculator geek) would simulate the behaviour of, just an example from my previous work, a servo-hydraulic actuation system using his 35S or 48GX/50G. That's just not practicable, even if these calculators did feature the required accuracy.

What I was talking about is automation of some chain calculations that you need to do every now and then or solving simple transcendental equations. And for those problems, 6 digits (and these only in some rare cases) are more than enough in my opinion.

The message I want to transport is just that, for me, there is a difference between a completely flawed product that is prone to error whenever you turn it on (and, honestly, some posts about the 35S have that sound) or a basically very useful machine that in some "extreme" cases suffers from certain errors and / or inaccuracies.

Please do not get me wrong, I do not want to end the bug hunting and bug posting in this forum. Far from it, the better we know these calculators the better you can judge how useful they are for your work. And for me as an engineer the 35S ist exactly this - a very useful tool that you just have to know in order to get the best performance and accuracy from it.

Apart from that I still think that the 35S lacks full matrix support as well as alphanumeric program lables and variables... ;)

Kind regards,

Edited: 27 Mar 2012, 4:07 a.m.


My sentiments exactly. HP calcs (and others) do what they what they were intended do best. Although yes, a finer degree of accuracy would go a long way. But, to put double-precision accuracy and ROMs which hold multi-thousand line algorithms in a consumer calculator is just not practical. ALTHOUGH, the re-engineered alternatives of a WP-34S or HP-41CL are certainly feasible and possible and very marketable to the niche markets. I was considering a 41CL myself but, the halfnut I have doesn't qualify.

But, from a consumer standpoint, to market a calculator with the ROM size adequate for double-precision algorithms for log, trig, SOLVE, INTEGRATE, and so forth, puts the calculator in the price bracket of the iPad or even a NetBook.

So, the alternative of a niche market company (Systemide, for example) to throttle up HP-41CX spped and functionality or the Sourceforge/Calculator Store WP-34S is a nice compromise to serve those of us who want the HP-41 or HP-35 that should have been.

Edited: 27 Mar 2012, 4:05 p.m.


The WP 34S has double precision! Most algorithms are good to more then 30 digits, many to the full internal precision of 39 which is then rounded to 16 (single precision) or 34 (double precision). The storage formats are variants of decimal64 and decimal128 respectively. Just as a reminder: We do this with 2 KB of NV RAM, 4 KB of scratch RAM and 128 KB of flash ROM. I think this is all a matter of commitment. A more powerful hardware would allow to add typed values, named variables, better UI with menus and more.

The most striking problem is to have professionally built hardware. We depend on the 20b/30b for now with a DIY keyboard overlay. I wish we had a chance to have the keys properly painted or moulded on a future device.


And you should know that some of us love you guys for that. All the effort you've put into providing us with a numerically reliable calculator is invaluable, IMO. Tools must be reliable. Fawcets should not drip; cars should not choke; calculating machines should be numerically accurate. IMHO, it's either that, or don't show the non-significant digits at all. The numerical precision affordable by your 16(34)/39 scheme is, from my point of view, your strongest point (without demerit for all the other strong points, of course).

We've all spent too much time learning and teaching error propagation, bashing students for presenting and trying to read meaningless digits, and struggling with the need to have discrete-time, discrete-space, discrete-frequency, or discrete-whatever models still performing under extreme numerical conditions, to not value the effort involved in attempting to suplly as much precision as possible.

It may well be that packages like Matlab (not the best numerical example, BTW), Maple, Mathematica or whatever, makes calculators dispensable. But until then, if we're getting digits out of our hand tools, I'd like them to be either correct or blank. Your WP34s is invaluable, on that account.

Please, all of you guys of the "Good enough is good, by definition" point if view: don't kill me on this. At least, not before the weekend :-)



Paolo, there are still some issues with the accuracy of some transcendental functions. They do not surface in single precision but in double precision some of the digits may be wrong. I had my fights against Gamma and I'm only confident that 30 digits are accurate. I've made no attempt at deleting the questionable digits off the tail though. Maybe I should...


First of all I have to say again, how impressed I am by the 34S. It is amazing what you guys have achieved!

About the accuracy:
1.) 30 digits is way better than other calculators
2.) I don't see much difference in the last few digits not beeing correct vs. them beeing changed to zeros (which aren't correct either) if the digits are available and shown.


Marcus, I'm inclined to think that 30 correct decimal digits is sufficient. (I suspect you meant bits? Some of the calculator values I referred to above were less than 20 bits correct!)

In some ways -- not all! -- having a function be strictly increasing (or decreasing) and not returning the same result for neighboring input values can be more useful than having strictly correct results. It's also very good if f'(f(x))=x, or so close to x, x+d, that f'(f(x+d))=x, or x+d. Sometimes values are changing so fast or so slowly these conditions are difficult.

(nb. We did have some HP calculators in the lab; their values were the best of the calculators, period.)


Marcus, I'm inclined to think that 30 correct decimal digits is sufficient. (I suspect you meant bits? Some of the calculator values I referred to above were less than 20 bits correct!)

Not bits, definitely decimal digits.

30 bits in less than ten decimal digits, not even remotely good enough.

- Pauli


Thirty decimal digits for a trancendental maths package in a calculator is very well done! Congratulations.


Most of the more basic functions (trig, logs, exponentials) will be closer to 34 digits :-) Gamma is a bad case only achieving 30 - 32 digits. This flows on to functions that use gamma (zeta, factorial, permutations).

- Pauli


I've played around with Victor Toth's algorithm for arbitrary precision and changed the Lanczos coefficients several times. It looks like a hard job to achieve higher accuracy. I even tried to increase the internal BCD precision and checked how accurate the LN and EXP functions were but gave up at one point. I may need to reevaluate Gamma for some cases and compare the results to a proven source. I'm confident we can rely on 30 digits in most cases.


It's an interesting academic exercise, but I find it to be a bit like trying to buff the rust off a Reliant Robin. :)


Thanks to all you, friends, for the contribute to this topic, it was really a pleasure to read it entirerely. A special thanks to Luiz, "old and wise" who take care of the board! It happens sometime to be taken complitely for the matter of the topic so that a "cup" of humor is always welcome for all!

Edited: 26 Mar 2012, 10:29 a.m.


Grazie tanti, mio caro! I appreciate.



Possibly Related Threads…
Thread Author Replies Views Last Post
  Trig vs hyperbolic handling differences in Prime CAS Michael de Estrada 3 1,542 11-08-2013, 06:26 PM
Last Post: Mark Hardman
  HHC 2013 RPN Programming Challenge - Final Thought Jeff O. 7 2,336 10-17-2013, 11:02 AM
Last Post: Jeff O.
  Trig Functions Howard Owen 11 3,452 09-16-2013, 02:53 PM
Last Post: Fred Lusk
  trig scales on the Post Versalog slide rule Al 12 3,625 09-15-2013, 06:01 AM
Last Post: John I.
  SCIOVR and ENGOVR in FIX mode Andrew Nikitin 5 1,795 07-02-2013, 04:46 AM
Last Post: Victor Koechli
  Some trig help, please Matt Agajanian 33 7,101 04-12-2013, 06:39 PM
Last Post: Matt Agajanian
  Trig Identity question Namir 13 3,437 03-04-2013, 07:45 PM
Last Post: Eric Smith
  Question about trig functions approximation Namir 8 2,463 01-10-2013, 06:49 AM
Last Post: Valentin Albillo
  A temporary "fix", the Casio Prism (fx-CG10) LHH 5 2,022 08-25-2012, 07:39 PM
Last Post: LHH
  Craigslist find and fix - HP 19C Matt Fegenbush 12 3,693 08-13-2012, 02:57 PM
Last Post: Matt Fegenbush

Forum Jump: