use log-exp V3 for reducing control flow overhead.