Cascaded resonant lp/hp filter

Type : lp+hp
References : Posted by tobybear[AT]web[DOT]de
Notes :
// Cascaded resonant lowpass/hipass combi-filter
// The original source for this filter is from Paul Kellet from
// the archive. This is a cascaded version in Delphi where the
// output of the lowpass is fed into the highpass filter.
// Cutoff frequencies are in the range of 0<=x<1 which maps to
// 0..nyquist frequency

// input variables are:
// cut_lp: cutoff frequency of the lowpass (0..1)
// cut_hp: cutoff frequency of the hipass (0..1)
// res_lp: resonance of the lowpass (0..1)
// res_hp: resonance of the hipass (0..1)

Code :
var n1,n2,n3,n4:single; // filter delay, init these with 0!
    fb_lp,fb_hp:single; // storage for calculated feedback
const p4=1.0e-24; // Pentium 4 denormal problem elimination

function dofilter(inp,cut_lp,res_lp,cut_hp,res_hp:single):single;

from : office[AT]hermannseib[DOT]com
comment : I guess the last line should read result:=inp-n4; Right? Bye, Hermann

from : couriervst[AT]hotmail[DOT]com
comment : excuse me which type is? 6db/oct or 12 or what? thanks

from : christianalthaus[AT]gmx[DOT]de
comment : result := n2-n4 :)

from : voss[AT]alinear[DOT]net
comment : WOW this is old but handy. Anyway what to do about the divide-by-zero caused by the feedback calc if the cutoff is set to 1.0? Also, should the feedback for the hpf be: fb_hp:=res_hp+res_hp/(1-cut_hp); not: fb_hp:=res_hp+res_hp/(1-cut_lp); ? Thanks NV

from : Gsound[AT]gmail[DOT]com
comment : Nobody can see ? There is two lowpass filters in series, no differences between them.