Actions
Bug #51
openInt arithmetic (wrong value then VM crash)
Bug #51:
Int arithmetic (wrong value then VM crash)
Start date:
Due date:
% Done:
0%
Estimated time:
Platform:
Resolution:
Triage Stage:
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).
Updated by Alain Prouté about 18 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.
Actions