#include <stdio.h>
#include <math.h>
#include <assert.h>
#include "gpk_std.h"
#include "romberg.h"

struct xx_s     {void *cc; integrand_function ff;};
LOCAL double funclog(double x, void *q, int nc);

method_fr midexp(integrand_function func, double a, double b,
				int n, void *c, int nc)
{
 struct xx_s q;

 assert(a >= 0.0);
 assert(b >= 0.0);
 q.cc = (double *)c;
 q.ff = func;
 return midpnt(funclog, exp(-b), exp(-a), n, &q, nc);
}

LOCAL double funclog(double x, void *qq, int nc)
{
 struct xx_s *q = (struct xx_s *)qq;
 return (*q->ff)(-log(x), q->cc, nc)/x;
}
