Base converter with fractions?
02-21-2017, 07:30 PM (This post was last modified: 02-21-2017 07:31 PM by Han.)
Post: #21
 Han Senior Member Posts: 1,882 Joined: Dec 2013
RE: Base converter with fractions?
(02-21-2017 05:59 PM)Jan_D Wrote:
(02-03-2017 01:51 PM)Jan_D Wrote:  I slightly modified your program, not because it is not good enough but to make it better readable.

Instead of a CAS variable like tmp586605323013 it uses the CAS variable tmp.

It is also possible to make the program completely local, without using a global CAS variable tmp, and still do the calculations in CAS.

We can declare a local variable tmp, and the program will work with this local variable and use it for CAS calculations.

The only thing we have to pay attention to is that it is not allowed to use square brackets, but we have to use parentheses.

So instead of CAS("tmp[1]:=tmp[1]+d*b1^k") we have to write CAS("tmp(1):=tmp(1)+d*b1^k").

Instead of CAS("tmp(1):=tmp(1)+d*b1^k") we could also write: tmp(1):=CAS(“tmp(1)+d*b1^k").

Be careful with using non-CAS variables for CAS results. The CAS can handle integers of order larger than $$10^{15}$$ whereas we lose significant digits using non-CAS variables. So for "small" cases, your modifications would work just fine. However, for "larger" numbers (where after conversion into base 10, we would exceed the internal limit on the size of an integer), you would likely get the wrong result due to the conversion of an exact value from the CAS side into an approximate value in the non-CAS side.

Graph 3D | QPI | SolveSys
 « Next Oldest | Next Newest »

 Messages In This Thread Base converter with fractions? - Joe Horn - 01-15-2017, 05:53 AM RE: Base converter with fractions? - Jan_D - 01-22-2017, 03:13 PM RE: Base converter with fractions? - Joe Horn - 01-22-2017, 11:22 PM RE: Base converter with fractions? - Jan_D - 01-26-2017, 12:38 PM RE: Base converter with fractions? - Joe Horn - 01-26-2017, 05:18 PM RE: Base converter with fractions? - Han - 01-27-2017, 05:00 AM RE: Base converter with fractions? - Joe Horn - 01-28-2017, 03:25 AM RE: Base converter with fractions? - Dieter - 01-28-2017, 03:15 PM RE: Base converter with fractions? - Han - 01-26-2017, 06:57 PM RE: Base converter with fractions? - Jan_D - 01-28-2017, 01:42 PM RE: Base converter with fractions? - Han - 01-27-2017, 04:37 AM RE: Base converter with fractions? - Jan_D - 02-02-2017, 05:26 PM RE: Base converter with fractions? - Jan_D - 02-03-2017, 01:51 PM RE: Base converter with fractions? - Jan_D - 02-21-2017, 05:59 PM RE: Base converter with fractions? - Han - 02-21-2017 07:30 PM RE: Base converter with fractions? - Jan_D - 02-22-2017, 06:03 PM RE: Base converter with fractions? - Gerald H - 01-28-2017, 02:58 PM RE: Base converter with fractions? - Han - 02-03-2017, 02:31 PM RE: Base converter with fractions? - toml_12953 - 02-13-2017, 02:36 PM RE: Base converter with fractions? - Jan_D - 02-03-2017, 05:52 PM RE: Base converter with fractions? - Jan_D - 02-13-2017, 01:14 PM RE: Base converter with fractions? - Han - 02-13-2017, 01:27 PM

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