Talk:Long multiplication: Difference between revisions
Content added Content deleted
m (Agreed.) |
(→BigNum) |
||
Line 3: | Line 3: | ||
Wouldn't it be appropriate to replace this task with [http://en.wikipedia.org/wiki/Bignum arbitrary-precision arithmetic] implementation? I.e. long to long +, -, *, /, and long to short +, -, *, /. The divisions are to be implemented in a complete form (result + remainder). |
Wouldn't it be appropriate to replace this task with [http://en.wikipedia.org/wiki/Bignum arbitrary-precision arithmetic] implementation? I.e. long to long +, -, *, /, and long to short +, -, *, /. The divisions are to be implemented in a complete form (result + remainder). |
||
Hi [[Dmitry-kazakov]]. Yes that makes sense. |
Hi [[User_talk:Dmitry-kazakov]]. Yes that makes sense. |
||
For the moment I'll switch this task to be a member of [[:Category:Arbitrary precision]]. |
|||
IIRC the Newton Raphson Kontorovich method can be used to speed up the division. It |
|||
looks interesting.... |
|||
Re: long/short implementations... I spotted the Ada Rational Arithmetic |
|||
sample code with "'''long''' + '''short'''" and considered replicating. |
|||
But by the time if counted all the combinations I ran out of |
|||
fingers and toes. E.g. one would have to combine the '''short...''', |
|||
'''short''' '''short''', '''short''', '''long''', '''long''' '''long''', |
|||
'''long...''' for '''int''', '''real''', '''compl''' for the operators |
|||
"+", "-", "/", "*", "%", "%*", "**", etc ... ALSO: ×, ÷, ... |
|||
'''abs''', '''over''', '''mod''' '''up''', '''bin''' etc ... together |
|||
with "+:=", "-:=" etc ... |
|||
Result: No more toes... I think C++/Ada templates can manage this kind of |
|||
complexity. |
|||
The [[[ALGOL 68]]] standard had a shorthand/template ≮L≯ for this. e.g. |
|||
'''op''' ≮÷*, %*, ÷×, %×, '''mod'''≯ = (L '''int''' a, i) L '''int''': ... |
|||
But this for the compiler writer, and not available to programmers. |
|||
[[User:NevilleDNZ|NevilleDNZ]] 10:56, 26 February 2009 (UTC) |