Posts: 27
Threads: 10
Joined: Jan 1970
I am sure there is a reason for this explained somewhere in the manual, but I am hoping that someone knows the answer off the top of their head. As an example,why is it that I get the following - equating:
'5/3' (or 3, 'SPC', 5, /) = 1.66666666667 (which gives me '5/3' if i put it back as a fraction.
But if I do '5*(1/3)' (or 5,'SPC', 3, '1/x', x) = 1.66666666666 (which gives me '62500000003/37500000002' as a fraction; which is of course the exact solution of the 1.66...6 solution).
How do I prevent getting the second answer?(other than just by entering the equation in using the first method). Reason that I ask is that during exams I don't want to have to be always worrying about what format I should be entering the problem (so as to not get a large fraction as above.) I am supposing that there is a setting that I may need to change. Can anyone point me in the right direction here? Thanks
Posts: 362
Threads: 30
Joined: Jul 2005
My 48 ran out of batteries but my 49 suggests that using ->QPi (where Pi is the greek letter) should help.
Or if you have a connection cable you should try: QPI from hpcalc.org
Arnaud
Edited: 7 Nov 2005, 9:04 a.m.
Posts: 120
Threads: 9
Joined: Aug 2005
I would hazzard a guess that it is to do with the order that the expression is calculated.
5 * (1 / 3) = 5 * (0.333333333....) = 1.666666666666......5 and rounded 1.666666666666....6
5 / 3 = 1.666666666666666666666.........6 and rounded 1.6666666666666666...7
You can replicate this problem with any calculator.
Edited: 7 Nov 2005, 11:37 a.m.
Posts: 3
Threads: 1
Joined: Jan 1970
That would have been my guess as well. But my 12C Platinum calculates 1.666666667 either way.
Posts: 27
Threads: 10
Joined: Jan 1970
Yeah my Casio gives the me correct fraction regardless of how I enter it......
What confuses me again is this:
'2/3' = 0.666666666667 (which in turn gives me '2/3' as a fraction.
But if I do '2(1/3)' = 0.6666666666666 - this gives me '2/3' as a fraction.
Can anyone figure out the inconsistency from this and the initial problem I mentioned?
Edited: 7 Nov 2005, 3:48 p.m.
Posts: 32
Threads: 2
Joined: Dec 2006
Quote:
That would have been my guess as well. But my 12C Platinum calculates 1.666666667 either way.
It depends on the rounding. 0.33...333 * 5 is 1.66...665. This is one digit too much, so the final 5 has to be either truncated or rounded. ...665 is right between ...660 and ...670, and there are different methods in use. Half-up always rounds 5 up, and so the result is ...67. Half-even (sometimes called banker's rounding) rounds fives to the nearest even digit, which in this case is 6.
The advantage of half-even rounding is that it gives a better statistical distribution of errors, because 5 really is right between 0 and 10, and always rounding up isn't fair.
Posts: 10
Threads: 0
Joined: Jan 1970
I stumbled across the solution to this recently. Just change the display mode to FIX.
Posts: 27
Threads: 10
Joined: Jan 1970
Hey thanks for that.....It seems to solve the problem! Genius!
However is there another way of doing this (so you don't have all these decimal places after a whole number for example.(like having just '3' on the stack and not '3.00000000...', depending on what FIX number you set)?
Edited: 7 Nov 2005, 9:24 p.m.
Posts: 1,755
Threads: 112
Joined: Jan 2005
Hi, Gunnar:
This link features an interesting and worthwhile discussion on rounding, and includes simple code to implement most usual rounding strategies.
Best regards from V.
Posts: 32
Threads: 2
Joined: Dec 2006
Thank you, It is very interesting.
I knew about the difference between VBA and Excel, but I was not aware that they had such a mess across their product line, and I had not noticed that Java had a homebrew not-seen-anywhere-else round() function.
Mike Cowlishaw's General Decimal Arithmetic Specification has a list of all the rounding modes you may need when things are actually designed, and not just happens.
This is a superset of the modes described in the IEEE 854 standard, and implemented in the HP 71B.
He has the following note:
Quote:
The term ‘round to nearest’ is not used because it is ambiguous. round-half-up is the usual round-to-nearest algorithm used in European countries, in international financial dealings, and in the USA for tax calculations. round-half-even is often used for other applications in the USA, where it is usually called ‘round to nearest’ and is sometimes called ‘banker’s rounding’.
Posts: 412
Threads: 40
Joined: Mar 2006
Another example of half-even rounding (in Saturn-based HP calculators):
1E12 1 - 2 / gives 500000000000 (rounded up from 499999999999.5)
1E12 3 - 2 / gives 499999999998 (rounded down from 499999999998.5)
J-F