Update formats.js

Implementation of C&E rule code.