Bug #51

Int arithmetic (wrong value then VM crash)

Added by SpiceGuid - almost 17 years ago. Updated almost 17 years ago.

Status:AssignedStart date:
Priority:NormalDue date:
Assignee:Alain Prouté% Done:

0%

Category:Virtual Machine
Target version:-
Platform: Triage Stage:
Resolution:

Description

Could be a nice code example :)

Sadly some arithmetic debugging is still needed :(

// Spigot by Jeremy Gibbons, using William Gosper formula

public define Int
   div(Int a,Int b) 
     =
   if a / b is 
     {
     failure    then 0,
     success(d) then if d is (q,r) then q
     }.

global define One
  pi_gosper_gibbons(List(String) args)
  =
  ( (Int q,Int r,Int t,Int i) |-g-> 
    with
    u = 3*(3*i+1)*(3*i+2),
    y = div(q*(27*i-12)+5*r,5*t),
    print(abs_to_decimal(y));
    g(10*q*i*(2*i-1),10*u*(q*(5*i-2)+r-y*t),t*u,i+1);
    unique
  )
  (1,180,60,2).

History

#1 Updated by Alain Prouté almost 17 years ago

  • Status changed from New to Assigned

Thank you for this very nice example. Actually, division for Int is still buggy. I hope this will be fixed soon.

Also available in: Atom PDF

Redmine Appliance - Powered by TurnKey Linux