HP Prime CAS & Large numbers
08-10-2017, 08:27 AM
Post: #1
 Bipman Junior Member Posts: 16 Joined: Apr 2017
HP Prime CAS & Large numbers
Hi

I've been looking on the internet for answers to this question but can't find anything. When using the CAS for very large numbers for example (256^256)*2^40, how do I convert this to scientific format (exact or otherwise)? I can do it online of course but wondered if I can do it on the calculator. I've tried setting scientific format with say 8 digits but it doesn't do anything and of course if I copy the number to the home screen I just get infinity.

Bipman
08-10-2017, 11:35 AM
Post: #2
 Arno K Senior Member Posts: 440 Joined: Mar 2015
RE: HP Prime CAS & Large numbers
Simply type Shift Enter instead of Enter, this provides the result in scientific format.
Hth Arno
08-10-2017, 11:39 AM
Post: #3
 Bipman Junior Member Posts: 16 Joined: Apr 2017
RE: HP Prime CAS & Large numbers
If I try that I get +Inf.

Bipman
08-10-2017, 12:31 PM
Post: #4
 Joe Horn Senior Member Posts: 1,671 Joined: Dec 2013
RE: HP Prime CAS & Large numbers
That's because floating-point numbers in Prime's CAS are limited to a maximum of roughly 10^308. Anything greater than that will be returned as infinity.

Examples:
2^1023.9999 --> 1.79756853259e308
2^1024. --> +Inf (notice the decimal point in the input)

Here's a trick: If your CAS result is too big for CAS to convert to a real, but smaller than 500 digits, you can easily convert it to a real by importing it into Home. Just press Home, Menu (the physical Menu key), Get from CAS, then select the number. Unfortunately, your example, (256^256)*2^40, is too big even for Home to handle (it's 629 digits long). If you want to see how long it is, just use size(string(Ans)).

You can also use the following "biglog" program to return the common log of large CAS integers. It works with CAS integers of any size.

#cas
biglog(d):=
BEGIN
LOCAL j,k;
IF type(d)<>DOM_INT THEN RETURN "Argument not integer" END;
d:=abs(d);
k:=string(d);
return size(k)-1+evalf(log10(j),13);
END;
#end

<0|ɸ|0>
-Joe-
08-10-2017, 02:03 PM
Post: #5
 Bipman Junior Member Posts: 16 Joined: Apr 2017
RE: HP Prime CAS & Large numbers
Thanks, that's great!

Bipman
08-12-2017, 06:12 PM
Post: #6
 Joe Horn Senior Member Posts: 1,671 Joined: Dec 2013
RE: HP Prime CAS & Large numbers
Ooh ooh ooh, here's a nifty way to convert any large CAS integer into floating-point notation:

format(2^7777,"d20") --> "1.2890693393361565650e+2341"

Change the "20" in the input to however many significant digits you want. Cool, huh?

<0|ɸ|0>
-Joe-
08-13-2017, 09:11 AM
Post: #7
 Bipman Junior Member Posts: 16 Joined: Apr 2017
RE: HP Prime CAS & Large numbers
That's cool!

Bipman
 « Next Oldest | Next Newest »

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