# HG changeset patch # User michael # Date 1262817652 0 # Node ID 002cd05050642c90a5ad6076a900e7a546f2d983 # Parent c4e157b47af5bb36b0217eefeb3e3166e3e9aac7 Stop the approximation in bessel() once it does no longer improve. This is faster. diff -r c4e157b47af5 -r 002cd0505064 resample2.c --- a/resample2.c Wed Jan 06 21:51:20 2010 +0000 +++ b/resample2.c Wed Jan 06 22:40:52 2010 +0000 @@ -76,11 +76,13 @@ */ static double bessel(double x){ double v=1; + double lastv=0; double t=1; int i; x= x*x/4; - for(i=1; i<50; i++){ + for(i=1; v != lastv; i++){ + lastv=v; t *= x/(i*i); v += t; }