A89: TIOS int format


[Prev][Next][Index][Thread]

A89: TIOS int format




This is primarily addressed to Zeljko, although if anyone else here can help
me out I'd appreciate it.

How does TIOS store and reference integers?  I took the 582-character value
2^2000-1 and found that it would occupy approximately 242 bytes as binary,
which is exactly the amount of space it takes up according to the var-link
menu (there would obviously be another 2 bytes specifying the size, but the
would not be totaled, just like other variables), so it's obviously a binary
number - but exactly what format does TI use for an arbitrarily-long binary
integer?

In other words, getting to the root of my inquiry, what would be the C
structure that would be used to represent any arbitrarily-long binary
integer?  I can also see that TI cuts it off after a certain value and
references the number as infinity (with a warning on the bottom); what is
this cutoff? [er, ignore that last question - I just found out it through
some tests that 2^(255*8)-1 is about the largest number, indicating a
255-byte cutoff - but don't try entering that in TIOS, since it'll overflow
to decimal on the first power of two before it finishes calculations]

Also, how would two extermely long binary integers be multiplied and
divided?  Does TIOS have its own binary (hex? larger base?) multiplication
routine somewhere in the ROM?  Something that works similarly to BCD
multiplication/division, I'm guessing?

And how long is type "long long" on GCC-68k?  How are those
multiplied/divided/etc when compiled?

    -Scott