What is the function of a basic calculator in programming?