Post Reply 
HP Prime Miscalculating
10-23-2015, 05:41 AM
Post: #2
RE: HP Prime Miscalculating
(10-23-2015 02:35 AM)luc4as Wrote:  When I try to calculate 3.6^2-4*3.24 in CAS mode, the calculator doesn't return 0, which is the correct answer. Home mode calculates it just fine.

Short answer: It's wrong in CAS for the same reason that .5-.3-.2 doesn't return 0, namely, garbage in garbage out. You THINK you put 3.6 and 3.24 into CAS, but you didn't.

Long answer: It's because Home uses BCD (which can represent 3.6 and 3.24 exactly) and CAS uses binary floating point (which can't). When you type 3.6 in Home, it's EXACTLY 3.6, but when you type 3.6 in CAS, it actually generates this value:

3.599999999999994315658113919198513031005859375 (exactly)

... because that's the largest number less than or equal to 3.6 which is representable with a 48-bit mantissa. For what it's worth, it's stored internally in hex scientific notation as 1.CCCCCCCCCCCCp+1 where "p" means "times 2 to the power of".

Quote: Does anyone know how to fix it?

Yes. You have two options:

Option #1: Use Home for all your floating-point math needs, and ONLY use CAS for EXACT & SYMBOLIC math (that is, integers with no decimal point, and variables).

Option #2: If you INSIST on doing that problem in CAS (why why why?) then type the decimal fractions as exact ratios of integers, like this:

Instead of: \({ 3.6 }^{ 2 }-4\times 3.24\), type this instead: \({ \left( \frac { 36 }{ 10 } \right) }^{ 2 }-4\times \frac { 324 }{ 100 } \)

CAS is designed for exact math, like that. Floating point reals with decimal points in them are usually NOT "exact" in CAS. If that makes CAS seem more complicated that it should be, see Option #1 above. Knowing when to use Home, and when to use CAS, is part of learning how to use the HP Prime.

"If Home and CAS behaved exactly the same, there would be no need for both to exist." -- Joe Horn

<0|ɸ|0>
-Joe-
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
HP Prime Miscalculating - luc4as - 10-23-2015, 02:35 AM
RE: HP Prime Miscalculating - Joe Horn - 10-23-2015 05:41 AM
RE: HP Prime Miscalculating - retoa - 10-24-2015, 12:48 PM
RE: HP Prime Miscalculating - parisse - 10-25-2015, 09:13 AM
RE: HP Prime Miscalculating - Tim Wessman - 10-23-2015, 02:54 PM
RE: HP Prime Miscalculating - retoa - 10-23-2015, 04:43 PM
RE: HP Prime Miscalculating - Tim Wessman - 10-23-2015, 04:54 PM
RE: HP Prime Miscalculating - Archanus - 10-23-2015, 07:38 PM
RE: HP Prime Miscalculating - Nigel (UK) - 10-23-2015, 10:12 PM
RE: HP Prime Miscalculating - Wes Loewer - 11-01-2015, 01:16 PM
RE: HP Prime Miscalculating - Vtile - 11-01-2015, 02:05 PM
RE: HP Prime Miscalculating - Wes Loewer - 11-04-2015, 05:57 PM
RE: HP Prime Miscalculating - Vtile - 11-04-2015, 08:36 PM
RE: HP Prime Miscalculating - CyberAngel - 09-02-2018, 04:32 PM
RE: HP Prime Miscalculating - retoa - 10-23-2015, 09:33 PM
RE: HP Prime Miscalculating - retoa - 10-23-2015, 10:04 PM
RE: HP Prime Miscalculating - Archanus - 10-24-2015, 02:20 AM
RE: HP Prime Miscalculating - parisse - 10-24-2015, 06:37 AM
RE: HP Prime Miscalculating - dan_h - 10-24-2015, 02:14 PM
RE: HP Prime Miscalculating - retoa - 10-30-2015, 01:34 PM
RE: HP Prime Miscalculating - parisse - 10-31-2015, 06:34 AM
RE: HP Prime Miscalculating - Vtile - 10-31-2015, 10:50 AM
RE: HP Prime Miscalculating - Joe Horn - 11-01-2015, 02:12 AM
RE: HP Prime Miscalculating - parisse - 11-06-2015, 07:55 AM



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