Author Topic: Arbitrary precision operations  (Read 10579 times)

0 Members and 1 Guest are viewing this topic.

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: Arbitrary precision operations
« Reply #15 on: February 16, 2011, 10:43:42 pm »
As long as it's not with labels I think I'd be fine :)

EDIT: Oh ... oh God...

EDIT2: Still pretty fast, so great job :D

EDIT3: Those are some awesome optimizations...
« Last Edit: February 16, 2011, 10:45:21 pm by Deep Thought »




Offline AngelFish

  • Is this my custom title?
  • Administrator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3242
  • Rating: +270/-27
  • I'm a Fishbot
    • View Profile
Re: Arbitrary precision operations
« Reply #16 on: February 16, 2011, 10:44:30 pm »
Er...

>_>
<_<

EDIT: Optimizations?  ???
« Last Edit: February 16, 2011, 10:46:03 pm by Qwerty.55 »
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ

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: Arbitrary precision operations
« Reply #17 on: February 16, 2011, 10:47:03 pm »
Er...

>_>
<_<

EDIT: Optimizations?  ???

I mean the way you set it up. Coulda used some For(s, though ;)
« Last Edit: February 16, 2011, 10:49:11 pm by Deep Thought »




Offline AngelFish

  • Is this my custom title?
  • Administrator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3242
  • Rating: +270/-27
  • I'm a Fishbot
    • View Profile
Re: Arbitrary precision operations
« Reply #18 on: February 16, 2011, 10:48:48 pm »
For( loops would have required that I update more variables than were necessary and I didn't want to destroy to many global variables when there are only 37 available. DSC<( loops were better in my opinion.
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ

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: Arbitrary precision operations
« Reply #19 on: February 16, 2011, 10:49:22 pm »
Hmm, for

Code: (TI-BASIC) [Select]
:Lbl 01
:L1(D)+L2(D→L1(D
:DS<(D,1
:Goto 01

why not just L1+L2→L1?
« Last Edit: February 16, 2011, 10:49:55 pm by Deep Thought »




Offline AngelFish

  • Is this my custom title?
  • Administrator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3242
  • Rating: +270/-27
  • I'm a Fishbot
    • View Profile
Re: Arbitrary precision operations
« Reply #20 on: February 16, 2011, 10:50:15 pm »
No idea. It was like 1 AM when I wrote that  :P
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ

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: Arbitrary precision operations
« Reply #21 on: February 16, 2011, 10:53:33 pm »
Oh, and another huge optimization:

Instead of

Code: (TI-BASIC) [Select]
:DelVar Bdim(L1→D
:dim(L2→E
:If D>E:Then
:L2→L3
:L1→L2
:0L2→L2
:dim(L3→B
:D→C
:Lbl 00
:L3(B→L2(C
:C-1→C
:DS<(B,1
:Goto 00
:End

just

Code: (TI-BASIC) [Select]
:DelVar L3D-E→dim(L3
:augment(L3,L2→L2

Smaller and faster? :)
« Last Edit: February 16, 2011, 10:58:34 pm by Deep Thought »




Offline AngelFish

  • Is this my custom title?
  • Administrator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3242
  • Rating: +270/-27
  • I'm a Fishbot
    • View Profile
Re: Arbitrary precision operations
« Reply #22 on: February 16, 2011, 10:55:41 pm »
* Qwerty.55 facepalms

Thanks DThought
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ

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: Arbitrary precision operations
« Reply #23 on: February 16, 2011, 10:58:11 pm »
Actually...

Code: (TI-BASIC) [Select]
:dim(L1)-dim(L2
:If Ans
:not(binomcdf(Ans,0→L2
:L1+L2→L1

Destroys no variables. At all. And only 36 bytes :D

EDIT: I really miss programming BASIC now...

EDIT2: Edited to fix a bug. Now at 40 bytes.
« Last Edit: February 16, 2011, 11:41:07 pm by Deep Thought »




Offline Hot_Dog

  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3006
  • Rating: +445/-10
    • View Profile
Re: Arbitrary precision operations
« Reply #24 on: February 16, 2011, 11:17:41 pm »
Can you show a screenshot of 15-digit precision?

Offline AngelFish

  • Is this my custom title?
  • Administrator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3242
  • Rating: +270/-27
  • I'm a Fishbot
    • View Profile
Re: Arbitrary precision operations
« Reply #25 on: February 16, 2011, 11:22:07 pm »
Sure. I'll post something later tonight when I build up an interface around this.

EDIT: DThought, Neither of our routines propagates the carry correctly. I'll fix it in the update.
« Last Edit: February 16, 2011, 11:36:52 pm by Qwerty.55 »
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ

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: Arbitrary precision operations
« Reply #26 on: February 16, 2011, 11:39:37 pm »
Hmm, you have something figured out already?

And yeah, forgot about the carry...
« Last Edit: February 16, 2011, 11:39:53 pm by Deep Thought »




Offline AngelFish

  • Is this my custom title?
  • Administrator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3242
  • Rating: +270/-27
  • I'm a Fishbot
    • View Profile
Re: Arbitrary precision operations
« Reply #27 on: February 17, 2011, 03:19:11 am »


The operation 31,415,926,535,897,932,384+115.

Both my program and wolfram alpha return 31,415,926,535,897,932,499 which is an odd number. TI-OS returns that the number is even.

I'm working on converting the answer back to a more easily readable string format, but that's not yet finished.

BTW: For the curious, yes, that is indeed pi*10^20.

EDIT: Also, to demonstrate carrying:
« Last Edit: February 17, 2011, 03:34:29 am by Qwerty.55 »
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ

Offline Hot_Dog

  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3006
  • Rating: +445/-10
    • View Profile
Re: Arbitrary precision operations
« Reply #28 on: February 17, 2011, 03:49:50 am »
Once you get the string format done, this is going to rock!  It does already, but still

Offline AngelFish

  • Is this my custom title?
  • Administrator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3242
  • Rating: +270/-27
  • I'm a Fishbot
    • View Profile
Re: Arbitrary precision operations
« Reply #29 on: February 17, 2011, 03:50:36 am »
Thanks  :)
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ