⚠️ Warning: This is a draft ⚠️

This means it might contain formatting issues, incorrect code, conceptual problems, or other severe issues.

If you want to help to improve and eventually enable this page, please fork RosettaGit's repository and open a merge request on GitHub.

==BigNum==

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 [[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)

== Wrong algorithms ==

Some of the examples seem to call an outside algorithm:

• ALGOL 68 (1st example), calls operator * of LONG LONG INT
• BBC BASIC (1st example), calls FNMAPM_Multiply
• Bracmat, calls operator *
• C++, calls operator * of cln::cl_I
• C#, calls Multiply of System.Numerics.BigInteger
• D (1st example), calls operator * of BigInt from std.bigint
• F#, calls operator *
• Groovy, calls operator *
• Icon and Unicon, calls operator *
• Java, calls multiply of java.math.BigInteger
• Liberty BASIC, calls operator *
• PHP, calls bcmul
• PicoLisp, calls operator *
• Prolog, calls operator *
• PureBasic, calls TimesDecimal of decimal.pbi
• Python (1st example), calls operator *
• R (1st example), calls mul.bigz of gmp
• REXX, calls operator *
• Scheme, calls operator *
• Seed7, calls operator *
• Slate, calls operator *
• Smalltalk, calls operator *

For these examples, I would like some assurance that the outside algorithm really is long multiplication, and not some other algorithm (such as Karatsuba or Toom multiplication). Examples that use the wrong algorithm are incorrect. Further, I would like to clarify the task, to prohibit the use of outside algorithms, unless those algorithms do long multiplication. I think that [[Arbitrary-precision integers (included)]] is a better place to call outside algorithms. --[[User:Kernigh|Kernigh]] 00:36, 20 March 2012 (UTC)

: What kind of assurance would be acceptable? Since I wrote my personal assurance of REXXes algorithm, it was ''still'' flagged as incorrect. I've been using REXX for over 30 years and it was always thus. I've seen the original (assembler) source. REXX does explicit long multiplication (as well as addition, subtraction, and division). -- [[User:Gerard Schildberger|Gerard Schildberger]] ([[User talk:Gerard Schildberger|talk]]) 06:55, 13 May 2013 (UTC)

At the moment, I believe that $2^\left\{64\right\}$ and $2^\left\{128\right\}$ are so small that most outside algorithms would use long multiplication. (In [[MRI]] Ruby, the threshold for Karatsuba multiplication seems to be around $2^\left\{2240\right\}$ or $2^\left\{4480\right\}$.) --[[User:Kernigh|Kernigh]] 03:03, 20 March 2012 (UTC)

: REXX can handle (at least up to) 2^2,111,222,333 using exact multiplication. I'm not vouching for how long it takes. -- [[User:Gerard Schildberger|Gerard Schildberger]] ([[User talk:Gerard Schildberger|talk]]) 06:55, 13 May 2013 (UTC)

:: I Marked many of these as wrong, since the least that should be done is uniform treatment of all bignum implementations as wrong. If it's fine to use bignums (regardless of range or speed), then it should be very clear, and the wrong comments should be removed from all of the implementations, IMO. --[[User:Elibarzilay|Elibarzilay]] ([[User talk:Elibarzilay|talk]]) 07:09, 13 May 2013 (UTC)

== PLI Fails for me ==

With

*process source xref attributes;

m: Proc Options(Main);;

Dcl a(2) Dec fixed(1) Init(1,2);

Dcl b(2) Dec fixed(1) Init(1,2);

Dcl c(5) Dec fixed(1) Init((5)0);

Call multiply(a,b,c);

I get FIXEDOVERFLOW

Can you please add a valid main program? --[[User:Walterpachl|Walterpachl]] ([[User talk:Walterpachl|talk]]) 21:52, 13 May 2013 (UTC)

==negative numbers==

Most of the programming examples don't appear to handle ''negative'' numbers. -- [[User:Gerard Schildberger|Gerard Schildberger]] ([[User talk:Gerard Schildberger|talk]]) 20:25, 25 July 2015 (UTC)

==integers or numbers?== It doesn't specifically mention that only integers are to be used (although it did mention that ''one possible approach to arbitrary-precision integer algebra''). -- [[User:Gerard Schildberger|Gerard Schildberger]] ([[User talk:Gerard Schildberger|talk]]) 20:25, 25 July 2015 (UTC)