code for latest cdp version, with error rounding to zero