added TH*F->TH*D cast