flat assembler
Message board for the users of flat assembler.

 Index > Projects and Ideas > multiprecision calculator for win64 Goto page Previous  1, 2
Author
bitRAKE

Joined: 21 Jul 2003
Posts: 4020
Location: vpcmpistri
bitRAKE 09 Aug 2013, 13:50
So, you just want to know if a number is a perfect square? If so, then return square root? Otherwise, I'm confused.

This thread seems to cover both fast exclusion and calculation:
http://board.flatassembler.net/topic.php?p=134231#134231

Multiple limb algorithms will use a fast approximation, and newtons method. A good initial guess is just to clip the binary string to half the length.

_________________
¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup
09 Aug 2013, 13:50
tthsqe

Joined: 20 May 2009
Posts: 767
tthsqe 09 Aug 2013, 14:54
Yes - if it is a perfect square, it should return the square root, otherwise fail.
I really though you had a purely integer clever solution...
09 Aug 2013, 14:54
bitRAKE

Joined: 21 Jul 2003
Posts: 4020
Location: vpcmpistri
bitRAKE 09 Aug 2013, 15:25
I do, but it's not faster unless (r) and (s) are needed. One use was for a modified Fermat factoring algorithm. The internal square root is faster for the single limb case, and newton's is faster for multi-limb, afaik. Anyhow my cleaver implementation is at the end of that thread.

_________________
¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup
09 Aug 2013, 15:25
tthsqe

Joined: 20 May 2009
Posts: 767
tthsqe 10 Aug 2013, 13:11
Alright, the new version checks if sqrt(x) and x/y are integers during evaluation. It also has an SSA-based optimizer which can speed up loops by about 30%.
10 Aug 2013, 13:11
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

 Jump to: Select a forum Official----------------AssemblyPeripheria General----------------MainTutorials and ExamplesDOSWindowsLinuxUnixMenuetOS Specific----------------MacroinstructionsOS ConstructionIDE DevelopmentProjects and IdeasNon-x86 architecturesHigh Level LanguagesProgramming Language DesignCompiler Internals Other----------------FeedbackHeapTest Area
Goto page Previous  1, 2

Forum Rules:
 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot vote in polls in this forumYou cannot attach files in this forumYou can download files in this forum