Ok..
Here you can't achive it from the function directly.
If you use SQL Server 2000,
You have to use extended stored procedure
- a com program which will evaluate the given fromula and return back the value
- need to register that com dll on the db server
If you use SQL Server 2005,
You have to use the CLR function
- a simple C#/VB.NET code which will evulate the expression.
Let me know the version of SQL Server.. I will try to help you on this.