Author Topic: Optimizing lists and matrices for save files.  (Read 7225 times)

0 Members and 1 Guest are viewing this topic.

Offline Broseph Radson

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 295
  • Rating: +20/-1
  • Its 0x1A4 somewhere
    • View Profile
Optimizing lists and matrices for save files.
« on: December 07, 2011, 10:42:38 am »
Im not sure if this has been posted before, so here goes.
Using iPart() and fPart(), you can save lists or matrices with 2 entries per cell. {1.1} rather than  {1,1}. Every 2 entries saves 9 bytes with this method.
Loading is as simple as iPart(L1(A)) for the first entry in a cell, and 10fPart(L1(A)) for the second (the 10 is there because fPart returns the decimal as a decimal.)

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: Optimizing lists and matrices for save files.
« Reply #1 on: December 07, 2011, 10:47:47 am »
Yes, it is a very effective way to save space.
However, it depends ;)
-If you prefer saving space in the executable rather than in the list
-If you store something else than a number between 0 and 10.

For everything else, it works very well :thumbsup:
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Optimizing lists and matrices for save files.
« Reply #2 on: December 07, 2011, 06:27:04 pm »
More generally, you can save up to 7 values between 0 and 99 in one element (one real number) in the form 0.AABBCCDDEEFFGG, where each pair of letters is a value to save. To get the xth value in variable Y, use iPart(E2fPart(YE[2x].
« Last Edit: December 07, 2011, 06:27:56 pm by Deep Thought »




Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Optimizing lists and matrices for save files.
« Reply #3 on: December 07, 2011, 06:36:59 pm »
More generally, you can save up to 7 values between 0 and 99 in one element (one real number) in the form 0.AABBCCDDEEFFGG, where each pair of letters is a value to save. To get the xth value in variable Y, use iPart(E2fPart(YE[2x].
Actually it's closer to 6 values, as TI squanders a digit's worth of precision if the number is 14 digits long in the fpart/ipart section.

Offline Broseph Radson

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 295
  • Rating: +20/-1
  • Its 0x1A4 somewhere
    • View Profile
Re: Optimizing lists and matrices for save files.
« Reply #4 on: December 07, 2011, 07:36:10 pm »
Now that is cool :o

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Optimizing lists and matrices for save files.
« Reply #5 on: December 07, 2011, 07:38:24 pm »
More generally, you can save up to 7 values between 0 and 99 in one element (one real number) in the form 0.AABBCCDDEEFFGG, where each pair of letters is a value to save. To get the xth value in variable Y, use iPart(E2fPart(YE[2x].
Actually it's closer to 6 values, as TI squanders a digit's worth of precision if the number is 14 digits long in the fpart/ipart section.

It does?  I believe it carries all 14 digits at all times without rounding, it just doesn't display them all when you use Disp or access on the homescreen

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Optimizing lists and matrices for save files.
« Reply #6 on: December 07, 2011, 07:43:54 pm »
More generally, you can save up to 7 values between 0 and 99 in one element (one real number) in the form 0.AABBCCDDEEFFGG, where each pair of letters is a value to save. To get the xth value in variable Y, use iPart(E2fPart(YE[2x].
Actually it's closer to 6 values, as TI squanders a digit's worth of precision if the number is 14 digits long in the fpart/ipart section.
Oh right, it does. I've personally had trouble with it, but it doesn't always happen for some reason, and doesn't make sense to me anyway ??? Keep it at six to be safe.
« Last Edit: December 07, 2011, 07:44:06 pm by Deep Thought »




Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Optimizing lists and matrices for save files.
« Reply #7 on: December 07, 2011, 08:59:09 pm »
More generally, you can save up to 7 values between 0 and 99 in one element (one real number) in the form 0.AABBCCDDEEFFGG, where each pair of letters is a value to save. To get the xth value in variable Y, use iPart(E2fPart(YE[2x].
Actually it's closer to 6 values, as TI squanders a digit's worth of precision if the number is 14 digits long in the fpart/ipart section.

It does?  I believe it carries all 14 digits at all times without rounding, it just doesn't display them all when you use Disp or access on the homescreen
Huh, what do I know?  I was trying to make a screenie proving you wrong and instead proved myself wrong.  I guess it's all in how the code is coded on a given day.  Personally, this was the first time I tried coding it with the 10^(-2I part.
« Last Edit: December 07, 2011, 09:19:56 pm by ztrumpet »

Offline Broseph Radson

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 295
  • Rating: +20/-1
  • Its 0x1A4 somewhere
    • View Profile
Re: Optimizing lists and matrices for save files.
« Reply #8 on: December 12, 2011, 09:29:10 am »
More generally, you can save up to 7 values between 0 and 99 in one element (one real number) in the form 0.AABBCCDDEEFFGG, where each pair of letters is a value to save. To get the xth value in variable Y, use iPart(E2fPart(YE[2x].

So i finally got around to testing this, and i cannot for the life of me figure out how im supposed to type this into my calc. If i write it like this, it gives me a syntax error. If i write it like in that screen, it always returns 0. ???