calculating macros