World's most popular travel blog for travel bloggers.

# [Answers] Program transformations for numeric stability

, ,
Problem Detail:

There's tons of research on program transformations for optimization. Is there any research on transformations that improve numeric stability? Examples of such transformations might include:

• Transform \$\log(\exp(a)+\exp(b))\$ into \$\max(a,b)+\log(\exp(a-\max(a,b))+\exp(b-\max(a,b)))\$
• Convert multiplication of an inverse matrix times a vector into the solution to a linear system solver.
• Automatically perform multiplications of small numbers in the log domain.

All the tricks I'm aware of for better numeric stability like this are pretty standard and something that every "good" numeric programmer always does. Since the tricks are so standard and always applied, it makes sense that the compiler might be able to do them for us.

#### Answered By : AlexSanchezStern

There actually is some research on improving the numerical stability of floating point expressions, the Herbie project. Herbie is a tool to automatically improve the accuracy of floating point expressions. It's not quite comprehensive, but it will find a lot of accuracy improving transformations automatically.

Cheers,

Alex Sanchez-Stern

###### Best Answer from StackOverflow

Question Source : http://cs.stackexchange.com/questions/44263

3.2K people like this