Interpret StackyMath!
Ruby, 412 410 404 392 380 377 characters

def e m,x='Exception';warn m+x+?!*3;exit;end
def o;e'StackUnderflow'if$*==[];$*.pop;end
u=-&gt;n{e'DivisionByZero'if n.infinite?;e'NumberOverflow'if n&gt;2**64;$*&lt;&lt;n}
f=-&gt;n{e'NegativeFactorial'if n&lt;0;e'FloatingFactorial'if n.to_i&lt;n;n&lt;2?1:f[n-1]*n}
gets.gsub(/(\d+)|([+*\/%^-])|(!)|D/){$1?u[$1.to_f]:$2?u[eval"o#{$2&gt;?A?:**:$2}o"]:$3?u[f[o]]:u[x=o]+u[x]}
e'EmptyProgram',''if$*==[]
p o


This is regular precision version using Float. The result precision is as in the sample code, but numeric overflow detection is not exact.

Sample run:

bash-4.3$ ruby StackyMath.rb &lt;&lt;&lt; '654,489,48,43/5*7D+-*%'
77.68749999999909


Ruby, 378 377 characters

def e m,x='Exception';warn m+x+?!*3;exit;end
def o;e'StackUnderflow'if$*==[];$*.pop;end
u=-&gt;n{e'NumberOverflow'if n&gt;2**64;$*&lt;&lt;n}
f=-&gt;n{e'NegativeFactorial'if n&lt;0;e'FloatingFactorial'if n.to_i&lt;n;n&lt;2?1:f[n-1]*n}
gets.gsub(/(\d+)|([+*\/%^-])|(!)|D/){$1?u[Rational$1]:$2?u[eval"o#{$2&gt;?A?:**:$2}o"]:$3?u[f[o]]:u[x=o]+u[x]}rescue e'DivisionByZero'
e'EmptyProgram',''if$*==[]
p o.to_f


This is high precision version using Rational. The result precision is not always the same as in the sample code, but numeric overflow detection is exact.

Sample run:

bash-4.3$ ruby StackyMath-hi.rb &lt;&lt;&lt; '654,489,48,43/5*7D+-*%'
77.6875