Post Reply 
Exact integer arithmetic in Home?
10-28-2014, 03:58 AM (This post was last modified: 10-28-2014 03:10 PM by Joe Horn.)
Post: #8
RE: Exact integer arithmetic in Home?
(10-27-2014 12:43 PM)lenborje Wrote:  Is it possible to use exact integer arithmetic in Home view? And in programs?

Here's a tiny Home program which multiplies 123456789012345 (Edit: the second "4" was missing and has now been put back in... thanks, Jake!) times 234567890123456 and returns the complete correct product of 28958998520042431946358064320:

Code:
EXPORT bigmult
BEGIN
CAS("s1:=123456789012345");
CAS("s2:=234567890123456");
RETURN CAS.string(s1*s2);
END;

Some tidbits above might be unnecessary, but at least it DOES work. There are probably many ways to skin this particular cat.

If you want to input large integers, you can input them as strings, and then use CAS("var:=expr(whatever)") to turn them into actual integers. For some reason, CAS(string(var)) works differently from CAS.string(var). And be sure to use CAS.string, in lowercase, not CAS.STRING, in uppercase. Please explore such things and let us know what you find. Thanks!

<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
RE: Exact integer arithmetic in Home? - Joe Horn - 10-28-2014 03:58 AM



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