Efficient way to calculate value for mathematical function from db?

Css registry 2012
In. NET, another window or a web application,
To perform various mathematical functions such as sqrt, max, min, average, count with larger data sets.
Using stored procedures or program logic with normal iteration.
What is the best way to do it.?
