calculate macros