function that computes double