Post Reply 
All decimal digits of reals in CAS
04-10-2015, 02:55 PM (This post was last modified: 04-11-2015 03:10 AM by compsystems.)
Post: #2
RE: "dec": All decimal digits of reals in CAS
Thank You
I'm porting the code to other models of calculators, ti68k not have the XPON() command that I know, What does this function? mathematically (algorithm)

ti68k & tinspireCAS code

Code:

fileName: main.dec.89f: unlock(dec): unarchive(dec):

dec(x)
Func
  ©// By Joe Horn 2015, ti68k port by jaimeza AKA compSystems
  Local p,s,f

  If x=0
    Return "0"

  sign(x)→f
  abs(x)→x
  xpon(x)→p
  x/10^p→x

  If int(x)=0 Then
    p-1→p
    x*10→x
  EndIf

  string(int(x))&"."→s
  fpart(approx(x))→x
  While x>0 and dim(s)<1000
    x*10→x
    s&string(int(x))→s
    fpart(approx(x))→x
  EndWhile

  If f<0
    "-"&s→s
  If p>0
    s&"E+"&string(p)→s
  If p<0
    s&"E-"&string(abs(p))→s
  Return s

EndFunc
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: "dec": All decimal digits of reals in CAS - compsystems - 04-10-2015 02:55 PM



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