I may have discovered a bug in the input function...
09-09-2017, 04:01 AM
Post: #5
 Joe Horn Senior Member Posts: 2,009 Joined: Dec 2013
RE: I may have discovered a bug in the input function...
There is a huge difference between "integers" in Home and in CAS.

In Home, an "integer" has a "#" sign in front of it, and is displayed in the current base (decimal, hex, octal, or binary). Without the "#" sign, all numbers are reals, whether they have a decimal point or not.

In CAS, an "integer" is any number without a decimal point in it. They are always displayed in base 10. A real (AKA a "float") is any number with a decimal point in it, even if it has no fractional part. Numbers with "#" in front are not allowed in CAS. If typed, they are converted immediately to CAS integers.

To make matters even more complicated, there is a difference between the TYPE() and type() commands in CAS, and the values returned by type() differ between CAS and Home.

CAS: TYPE(123) --> 0.
CAS: type(123) --> DOM_INT
CAS: type(123)+0. --> 2.
CAS: TYPE(123.4) --> 0.
CAS: type(123.4) --> DOM_FLOAT
CAS: type(123.4)+0. --> 1.

Home: The above all return 0.
Home: TYPE(#123) --> 1
Home: type(#123) --> 1

Home integers are limited in size by the current wordsize setting. The largest possible wordsize setting is 64, so integers greater than 2^64-1 are not possible in Home.

CAS integers, on the other hand, can be huge, up to a maximum of 2^8599-1, and they can be either positive or negative.

<0|ΙΈ|0>
-Joe-
 « Next Oldest | Next Newest »

 Messages In This Thread I may have discovered a bug in the input function... - webmasterpdx - 09-08-2017, 10:37 AM RE: I may have discovered a bug in the input function... - toml_12953 - 09-08-2017, 01:15 PM RE: I may have discovered a bug in the input function... - webmasterpdx - 09-08-2017, 04:23 PM RE: I may have discovered a bug in the input function... - Carlos295pz - 09-09-2017, 02:56 AM RE: I may have discovered a bug in the input function... - Joe Horn - 09-09-2017 04:01 AM RE: I may have discovered a bug in the input function... - Kevin Ouellet - 03-03-2022, 11:00 AM RE: I may have discovered a bug in the input function... - parisse - 03-04-2022, 03:48 PM

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