Calculates mathematical expressions