### Author Topic: What calculator do you use ?  (Read 118759 times)

0 Members and 1 Guest are viewing this topic.

#### slateraptor

• Frequent Contributor
• Posts: 833
• Country:
##### Re: What calculator do you use ?
« Reply #100 on: April 23, 2012, 11:38:17 pm »
So financial calculations must be done either with integers (representing cents), or decimal (BCD) representations.

Learn something new everyday. I suppose that would explain the BCD-encoded registers in older HP CPU architectures.

Are there any handheld calculators that actually use double-precision floats?

EDIT: Evidently, a few Sharp querty handhelds fit the bill...doesn't seem to be many without diving into the user-space realm.
« Last Edit: April 24, 2012, 01:09:14 am by slateraptor »

#### saturation

• Super Contributor
• Posts: 4783
• Country:
• Doveryai, no proveryai
##### Re: What calculator do you use ?
« Reply #101 on: April 24, 2012, 01:54:58 am »
Sometimes from metrology labs, 'estimates' could refer to uncertainty in the LSD presented, not so much from the calculation, but the actual measurements 99.99% confidence interval, and thus estimates are good only to so many digits.

I hope you'll excuse me for raising an eyebrow when a NIST engineer speaks of numerical "estimates".

Rounding errors make more sense, I stand corrected.  However, if more digits were used in the calculation the rounding error can be masked, once rounded to a penny, but that may be too much to expect of lower cost hand held calculator.

For example, for financial transactions try this simple mortgage table:

200000 (1 + 0.06/360)^(360*30)

Casio scientifics have a small rounding issue, as seen in the FX260 and other models, it returns 1209747.95.

The right answer is 1209748.04, which can be done with higher precision calculators or better rounding.

Not a big deal for 9c difference, unless your a hacker stealing 9c from millions of accounts

Even in the simplest use, debt or mortgage calculations, actual results by banks use very high precision numbers, 2-30x more than a general scientific calculator.

This is actually a myth propagated by financial types who don't understand math.  Financial transactions are rounded to the nearest penny, and intermediate values in a financial calculation will be rounded aggressively at every step along the way.  ...
« Last Edit: April 24, 2012, 02:02:44 am by saturation »
Best Wishes,

Saturation

#### baljemmett

• Supporter
• Posts: 666
• Country:
##### Re: What calculator do you use ?
« Reply #102 on: April 24, 2012, 02:52:49 am »
For example, for financial transactions try this simple mortgage table:

200000 (1 + 0.06/360)^(360*30)

Casio scientifics have a small rounding issue, as seen in the FX260 and other models, it returns 1209747.95.

The right answer is 1209748.04, which can be done with higher precision calculators or better rounding.

Interesting -- the Casios have obviously gone backwards sometime since the mid-80s/early-90s, then!  Just tried that on my fx-7000GB and got 1209748.042; doing it in Fix2 mode also gives 1209748.04.

• Frequent Contributor
• Posts: 990
• Country:
##### Re: What calculator do you use ?
« Reply #103 on: April 24, 2012, 02:53:00 am »
To be precise, my own calculator based on rational numbers says the answer is
1209748.03722963021023976099764994429324362344006195944401452964332492379118987483444215101643363697513166243909463144784174311993772628

Trying is the first step towards failure - Homer J. Simpson

#### Lawsen

• Regular Contributor
• Posts: 249
• Country:
##### Re: What calculator do you use ?
« Reply #104 on: April 24, 2012, 04:55:51 am »
This depends upon what type of mathematics you are doing and how small you want it.  It is a complicated question, because there are so many options and choices that were not available a few years ago.  You could have a complete calculator with an app software for an I Pod touch or I pad or Android telephone or tablet.  I use a Casio fx-10cg (20cg outside of North America.  It is a back lit color LCD display graphing calculator, very large.  On the small is a common solar cell TI-30sx, just numerics.  I have an HP Kinpo made HP-49G+.  I like the color one more.  I have an old TI-92 with the Motorola 68000 CMOS processor inside it.  It is an 16 years old math ship, too big to be a calculator.  I like the TI Nspire CAS CX in color, but I already have a color Casio, so no need.

#### saturation

• Super Contributor
• Posts: 4783
• Country:
• Doveryai, no proveryai
##### Re: What calculator do you use ?
« Reply #105 on: April 24, 2012, 09:07:50 am »
Yes, it affects only the generation of FX that look like the FX260.  Here is a 'family' photo spanning 30 years.

Once in the VPAM or graphing Casios, that error is not there.

The left is the FX-100 that I used in college in the late 1970s.  The lower right is the credit card FX-98, which is nearly identical to the 100 except its 8 digits, and thus, rounds out the same error.  Finally on the right is the modern Fx-260.

For example, for financial transactions try this simple mortgage table:

200000 (1 + 0.06/360)^(360*30)

Casio scientifics have a small rounding issue, as seen in the FX260 and other models, it returns 1209747.95.

The right answer is 1209748.04, which can be done with higher precision calculators or better rounding.

Interesting -- the Casios have obviously gone backwards sometime since the mid-80s/early-90s, then!  Just tried that on my fx-7000GB and got 1209748.042; doing it in Fix2 mode also gives 1209748.04.
Best Wishes,

Saturation

#### amspire

• Super Contributor
• Posts: 3633
• Country:
##### Re: What calculator do you use ?
« Reply #106 on: April 24, 2012, 09:30:21 am »
So financial calculations must be done either with integers (representing cents), or decimal (BCD) representations.

Learn something new everyday. I suppose that would explain the BCD-encoded registers in older HP CPU architectures.

Are there any handheld calculators that actually use double-precision floats?

EDIT: Evidently, a few Sharp querty handhelds fit the bill...doesn't seem to be many without diving into the user-space realm.
As far as I know, all HP calculators use BCD binary internally. The modern calculators using ARM processors(or whatever they use) are running emulators of the older HP calculator processor chips which are all based around BCD registers.

Richard.

#### baljemmett

• Supporter
• Posts: 666
• Country:
##### Re: What calculator do you use ?
« Reply #107 on: April 24, 2012, 09:32:34 am »
Yes, it affects only the generation of FX that look like the FX260.  Here is a 'family' photo spanning 30 years.

Once in the VPAM or graphing Casios, that error is not there.

Yes, I just grabbed my other two and tried the same thing; the fx-6300G (early-90s 'baby graphic', newer than the one I tried at work) gives exactly the rounding error you mentioned, 1209747.95, whereas the CFX-9850G (mid-90s colour 'power graphic') gives the correct (to displayed resolution) 1209748.037.

I wish I knew where the 'just a normal scientific calculator' fx-85M and fx-85V models I remember using as a kiddie had got to, would be interesting to try it on them too...

I guess it goes to show how valuable it can be to characterise your tools, to work out what level of precision you can depend upon!

#### HLA-27b

• Guest
##### Re: What calculator do you use ?
« Reply #108 on: April 24, 2012, 09:51:55 am »
Casio fx-5800P displays 1209748.037
SpeedCrunch which I use instead of windows calculator displays 1209748.037229630210239761

SpeedCrunch is highly recommended btw.

#### saturation

• Super Contributor
• Posts: 4783
• Country:
• Doveryai, no proveryai
##### Re: What calculator do you use ?
« Reply #109 on: April 24, 2012, 10:04:43 am »
Yes, since all calculators have to round in the end, the more digits or bits it uses to represent a digit, the less likely the rounding error will appear.   Of course, some algorithms are worse than others depending on how they round and what they round.

I recall some calculator-nuts did benchmark testing using formulas designed to 'expose' these types of errors, see here and enjoy!

http://www.rskey.org/~mwsebastian/miscprj/forensics.htm

http://voidware.com/calcs/torturetest.htm

Casio fx-5800P displays 1209748.037
SpeedCrunch which I use instead of windows calculator displays 1209748.037229630210239761

SpeedCrunch is highly recommended btw.
Best Wishes,

Saturation

#### IanB

• Super Contributor
• Posts: 8400
• Country:
##### Re: What calculator do you use ?
« Reply #110 on: April 24, 2012, 11:41:20 am »
The problem is simply that (binary) floating point arithmetic of any precision is unsuitable for financial transactions because certain values are not representable.  You can't represent $0.10 exactly in as floating point number. When written in base 2, the number 1/10 is an infinitely repeating fraction, so it can't be captured exactly with any finite width number. This argument is entirely bogus. How do you represent$10/3 exactly in BCD? It's just as impossible as representing $0.10 in binary. It doesn't matter, you argue? Well what happens with interest calculations? Suppose you need to add 5.7% per annum to a balance on a monthly basis. Are you going to do that precisely in BCD? Not a chance! Ultimately the only way to get decently accurate answers is to use enough extra digits of precision (and careful arrangement of calculation order) so that rounding errors are insignificant. It ultimately makes no difference whether you do that in BCD or in binary. The results will be identical. For instance, this is what my (binary) calculator says about 200000 * (1 + 0.06/360)^(360*30): 1209748.03723 Apparently binary arithmetic works. I'm not an EE--what am I doing here? #### slateraptor • Frequent Contributor • Posts: 833 • Country: ##### Re: What calculator do you use ? « Reply #111 on: April 24, 2012, 12:14:05 pm » This argument is entirely bogus. How do you represent$10/3 exactly in BCD? It's just as impossible as representing $0.10 in binary. Undoubtedly, eliminating error altogether is unrealistic, but that doesn't mean that the effort is futile. If it can be eliminated for select common cases, wouldn't it make sense, budget permitting, to design a system that has the potential to minimize compounded sources of error, viz. which has higher propensity for error: 16-decimal BCD or 16-bit binary? Seems to be the philosophy back in the day; in the case of HP, investing in a custom ASIC for their lineup was justified. Not so much the case today, where relatively formidable computational power is ubiquitous and quad precision can be had with little effort. #### HLA-27b • Guest ##### Re: What calculator do you use ? « Reply #112 on: April 24, 2012, 01:50:42 pm » On a side note here is something that I wasn't aware of until recently. A NOVA film from 1985 about some of the more intricate and controversial aspects of mathematics. Quote For over a decade, Bertrand Russell tried to find a certainty through mathematics by reducing it to logic. In his massive work, Principia Mathematica, it took him 362 pages to prove that 1 + 1 = 2 Twenty years later, another mathematician, Kurt Gödel, proved that mathematics would never be completely certain. What does the last sentence even mean? Now if a video from 1985 starts with rolling on the screen Fermat's Last Theorem The Goldbach's Conjecture The Riemann Hypothesis Classification Problem for 4-D Manifolds P?NP Problem Invariant Subspace Problem for Hilbert Spaces then you know it is about some serious stuff. But do these even matter? To me they do matter, in a certain way. They form a benchmark. If they don't matter for what I'm doing then I'm not doing something terribly fundamental or important, gives a sense of scale so to speak. Some of the things presented here you may have heard before, but I for example was not aware of the Bertrand Russel's paradox of catalogues and metacatalogues. It is also very interesting how mathematics can find out its own mistakes and limitations without external reference. also check out here for a summary and some more clues http://faculty.etsu.edu/gardnerr/Math-Mystery-Tour/mathematical-Mystery-Tour.htm #### IanB • Super Contributor • Posts: 8400 • Country: ##### Re: What calculator do you use ? « Reply #113 on: April 24, 2012, 02:06:24 pm » Quote Twenty years later, another mathematician, Kurt Gödel, proved that mathematics would never be completely certain. What does the last sentence even mean? Maybe you already know this, but it means there are some true statements in any system of logic that cannot be proven. It comes from the idea that mathematicians had, that mathematics, being a pure system of abstract thought separated from reality, was one place where you could achieve a notion of certainty, where you could say "this statement is true and I can prove it so" for all true statements. Gödel showed that is was impossible, that you could never achieve such a thing. There will always be statements that are true, but which nevertheless cannot be proven to be true. Mathematics will always be incomplete. I'm not an EE--what am I doing here? #### HLA-27b • Guest ##### Re: What calculator do you use ? « Reply #114 on: April 24, 2012, 02:20:21 pm » Maybe you already know this, but it means there are some true statements in any system of logic that cannot be proven. It comes from the idea that mathematicians had, that mathematics, being a pure system of abstract thought separated from reality, was one place where you could achieve a notion of certainty, where you could say "this statement is true and I can prove it so" for all true statements. Gödel showed that is was impossible, that you could never achieve such a thing. There will always be statements that are true, but which nevertheless cannot be proven to be true. Mathematics will always be incomplete. It is funny how casually we talk about it. The guy went on and made certain that certainty is unmakable and we talk about it as if it was just a matter of putting in the man-hours. « Last Edit: April 24, 2012, 02:39:10 pm by HAL-42b » #### slateraptor • Frequent Contributor • Posts: 833 • Country: ##### Re: What calculator do you use ? « Reply #115 on: April 24, 2012, 03:08:04 pm » On a side note here is something that I wasn't aware of until recently. A NOVA film from 1985 about some of the more intricate and controversial aspects of mathematics. That video was fun. Thanks for indirectly coercing me into burning away an hour of productivity. #### HLA-27b • Guest ##### Re: What calculator do you use ? « Reply #116 on: April 24, 2012, 03:37:06 pm » That video was fun. Thanks for indirectly coercing me into burning away an hour of productivity. What do you mean, Burning away an hour in order to produce productivity, or Burning away productivity in order to produce an hour? #### cybergibbons • Frequent Contributor • Posts: 401 ##### Re: What calculator do you use ? « Reply #117 on: April 24, 2012, 05:55:02 pm » The problem is simply that (binary) floating point arithmetic of any precision is unsuitable for financial transactions because certain values are not representable. You can't represent$0.10 exactly in as floating point number.  When written in base 2, the number 1/10 is an infinitely repeating fraction, so it can't be captured exactly with any finite width number.

This argument is entirely bogus. How do you represent $10/3 exactly in BCD? It's just as impossible as representing$0.10 in binary.

It doesn't matter, you argue? Well what happens with interest calculations? Suppose you need to add 5.7% per annum to a balance on a monthly basis. Are you going to do that precisely in BCD? Not a chance!

Ultimately the only way to get decently accurate answers is to use enough extra digits of precision (and careful arrangement of calculation order) so that rounding errors are insignificant. It ultimately makes no difference whether you do that in BCD or in binary. The results will be identical.

For instance, this is what my (binary) calculator says about 200000 * (1 + 0.06/360)^(360*30): 1209748.03723

Apparently binary arithmetic works.

The problem is with floating point arithmetic using binary representation, not with binary arithmetic. It is certainly an issue. IEEE floating point can't represent the most basic of numbers in base 10 with decent precision.

Most languages, if you do something like provide 2.35, will convert to floating point, and then when displayed back you will get 2.3500000000000001. There are lots of examples of this on the internet.

Normally the biggest issue isn't the accumulation of errors as numbers grow, but the fact they rarely cancel out. You end up with tiny balances of 0.000000000000001.

BCD means that the errors you see are the same as with base 10 systems. 0.1 = 0.1. 1/3 = 0.3333333333. You can accurately represent any two decimal place number in BCD, but not with floating point.

#### ejeffrey

• Super Contributor
• Posts: 1530
• Country:
##### Re: What calculator do you use ?
« Reply #118 on: April 24, 2012, 06:24:16 pm »
This argument is entirely bogus. How do you represent $10/3 exactly in BCD? It's just as impossible as representing$0.10 in binary.

That is true, but irrelevant.  You never make a transaction of $10/3, but you do make transactions of$.10.  You can't have 3 1/3 dollars in your bank account.  If you buy oranges 3/$1, one costs$.33, not $.33333. Two cost$.67.  If you buy one today and come back for one tomorrow, they each cost $.33 -- you don't still owe the merchant an ephemeral third of a penny. Quote It doesn't matter, you argue? Well what happens with interest calculations? Suppose you need to add 5.7% per annum to a balance on a monthly basis. Are you going to do that precisely in BCD? Not a chance! At every compounding period, you round the interest to the nearest penny. Something you can't do if the balance is represented as dollars in floating point. Quote Ultimately the only way to get decently accurate answers is to use enough extra digits of precision (and careful arrangement of calculation order) so that rounding errors are My point, which you completely missed, is that financial calculations do not need extreme accuracy in the sense that scientists and engineers are used to. They need a specifically defined behavior which can only be accomplished through the use of integer or BCD arithmetic and correct coding. Quote insignificant. It ultimately makes no difference whether you do that in BCD or in binary. The results will be identical. No, they wont. Quote For instance, this is what my (binary) calculator says about 200000 * (1 + 0.06/360)^(360*30): 1209748.03723 Unfortunately, that is wrong. Well, you have correctly calculated the given expression to the desired precision, but that is not the answer you get if you deposit$200,000 in a bank account with 6% interest compounded daily for 30 years of 360 days (!).  The answer to that question would be the recurrence relation:

Code: [Select]
x_0 = 200,000y_n = x_{n-1} * (0.06/360)x_n = x_{n-1} + y_n
Where x_n is the balance on the nth day, and y_n is the interest payment on the nth day, which should be rounded to the penny.  This is the only way that your balance (and the bank's balance which isn't shown) are legal values at the end of every day.

The end result is: \$1,209,748.66 -- although I am still not 100% sure I got the rounding correct (round to nearest with ties going to the even number) since I was using integer arithmetic.  You end up with a bit more than if you solve the the entire problem with high precision and then round at the end, because for the specific values chosen you happen to win a few more times than you lose on the rounded penny.

#### saturation

• Super Contributor
• Posts: 4783
• Country:
• Doveryai, no proveryai
##### Re: What calculator do you use ?
« Reply #119 on: April 25, 2012, 09:57:32 pm »
I just tried some of these tests:

http://www.eevblog.com/forum/general-chat/what-calcultator-do-you-use/msg106609/#msg106609

On freeware RealCalc on Android.  Its >= to my Casios, and its free.

Best Wishes,

Saturation

#### T4P

• Super Contributor
• Posts: 3706
• Country:
##### Re: What calculator do you use ?
« Reply #120 on: April 26, 2012, 12:26:16 am »
Here's my list of emu's and calcs :
Droid48 (HP-48 RPN)
MobiCalc (Cube Calc)
RealCalc
Scientific Calculator
Andie Graph ( TI-86 ROM installed )
Graph 89 with TI-89 v2.05 ROM installed

#### amspire

• Super Contributor
• Posts: 3633
• Country:
##### Re: What calculator do you use ?
« Reply #121 on: April 26, 2012, 12:09:24 pm »
To be precise, my own calculator based on rational numbers says the answer is
1209748.03722963021023976099764994429324362344006195944401452964332492379118987483444215101643363697513166243909463144784174311993772628

I thought I better check your calculations are correct - there are a few digits there that just look wrong.

Here is my Sinclair Scientific after calculating (1 + 0.06/360):

Now the rest of the calculation:

Before you get too tough on my Sinclair Scientific, when this came out, there was only the HP35 at 1/5th the cost of a new VW beetle and the HP45 was a bargain if you had just won the lottery.

The Sinclair was brilliant compared to a slide rule or log tables. And it was sold as a kit! You built it yourself, and when it didn't work, Clive would replace it with a  working one for a bit under 3 British Pounds.

Unfortunately for Sinclair, HP and TI started bringing out excellent programmable scientific calculators the next year that were more affordable then the HP35, making my Sinclair Scientific obsolete.

Clive Sinclair took an early 70's TI 9 digit calculator chip designed for x / + - fixed point calculations only and crammed a 5 digit resolution floating point RPN calculator in the same mask ROM space. Notice how there is no equal/enter key or decimal point key - who needs them anyway? Don't need exponentials either when you have a perfectly good log/antilog function.

Richard
« Last Edit: April 26, 2012, 12:27:35 pm by amspire »

• Super Contributor
• Posts: 1008
• Country:
##### Re: What calculator do you use ?
« Reply #122 on: April 26, 2012, 02:05:04 pm »
Mostly my HP-28S and (when it is feeling in the mood) Casio FX-3600P.

Oh, and the one in my profile pic

Actually no, not that one, the CFX-200 in that condition is worth way too much to wear regularly. It only comes out for special geek occasions.

I wrote a blog article nearly a year ago on the subject of modern calculators and how useless they are. 12 months on and I still haven't bought a new one!  http://electronicsdesigner.blogspot.co.uk/2011/05/difficult-calculations.html

#### slateraptor

• Frequent Contributor
• Posts: 833
• Country:
##### Re: What calculator do you use ?
« Reply #123 on: April 26, 2012, 03:30:37 pm »
55378008

Really?

• Super Contributor
• Posts: 1008
• Country:
##### Re: What calculator do you use ?
« Reply #124 on: April 27, 2012, 01:17:56 am »

I took the photo for the Pistonheads forum. What can I say, it is all about cars. People often claim to have things that aren't actually theirs (to put it in context, there are people there who do own interesting metal like XJ220s, F40s, McLaren F1 etc) and someone calls for a Custard Test. Originally this involved getting a tin of Birds custard in the same shot as the car which the author claims to be theirs.

e.g. http://img444.imageshack.us/img444/1222/12072007080dr4.jpg

Jason Plato (British Touring Car Championship winner) http://images.pistonheads.com/nimg/23419/Plato%20custard_1-L.jpg
Chris Harris (journo and owner of a fleet of Porsches) http://thumbsnap.com/eJdsqIcS

Jason even got custard into a Porsche 911 review on Channel 5 TV. In my case, Custard Test was called, and that was the request. Yes of course it's childish. I'm too old to grow up now.

Smf