Average Error: 0.1 → 0.1
Time: 8.6s
Precision: binary64
Cost: 13184
\[\left(x \cdot \log y - z\right) - y \]
\[\mathsf{fma}\left(x, \log y, \left(-z\right) - y\right) \]
(FPCore (x y z) :precision binary64 (- (- (* x (log y)) z) y))
(FPCore (x y z) :precision binary64 (fma x (log y) (- (- z) y)))
double code(double x, double y, double z) {
	return ((x * log(y)) - z) - y;
}
double code(double x, double y, double z) {
	return fma(x, log(y), (-z - y));
}
function code(x, y, z)
	return Float64(Float64(Float64(x * log(y)) - z) - y)
end
function code(x, y, z)
	return fma(x, log(y), Float64(Float64(-z) - y))
end
code[x_, y_, z_] := N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision] - y), $MachinePrecision]
code[x_, y_, z_] := N[(x * N[Log[y], $MachinePrecision] + N[((-z) - y), $MachinePrecision]), $MachinePrecision]
\left(x \cdot \log y - z\right) - y
\mathsf{fma}\left(x, \log y, \left(-z\right) - y\right)

Error

Derivation

  1. Initial program 0.1

    \[\left(x \cdot \log y - z\right) - y \]
  2. Simplified0.1

    \[\leadsto \color{blue}{\mathsf{fma}\left(x, \log y, \left(-z\right) - y\right)} \]
    Proof
    (fma.f64 x (log.f64 y) (-.f64 (neg.f64 z) y)): 0 points increase in error, 0 points decrease in error
    (fma.f64 x (log.f64 y) (Rewrite=> sub-neg_binary64 (+.f64 (neg.f64 z) (neg.f64 y)))): 5 points increase in error, 0 points decrease in error
    (fma.f64 x (log.f64 y) (Rewrite<= distribute-neg-in_binary64 (neg.f64 (+.f64 z y)))): 0 points increase in error, 5 points decrease in error
    (Rewrite<= fma-neg_binary64 (-.f64 (*.f64 x (log.f64 y)) (+.f64 z y))): 0 points increase in error, 0 points decrease in error
    (Rewrite<= associate--l-_binary64 (-.f64 (-.f64 (*.f64 x (log.f64 y)) z) y)): 0 points increase in error, 0 points decrease in error
  3. Final simplification0.1

    \[\leadsto \mathsf{fma}\left(x, \log y, \left(-z\right) - y\right) \]

Alternatives

Alternative 1
Error9.2
Cost6985
\[\begin{array}{l} \mathbf{if}\;z \leq -95 \lor \neg \left(z \leq 49000\right):\\ \;\;\;\;\left(-z\right) - y\\ \mathbf{else}:\\ \;\;\;\;x \cdot \log y - y\\ \end{array} \]
Alternative 2
Error9.4
Cost6984
\[\begin{array}{l} t_0 := x \cdot \log y\\ \mathbf{if}\;z \leq -85:\\ \;\;\;\;t_0 - z\\ \mathbf{elif}\;z \leq 245000:\\ \;\;\;\;t_0 - y\\ \mathbf{else}:\\ \;\;\;\;\left(-z\right) - y\\ \end{array} \]
Alternative 3
Error13.4
Cost6857
\[\begin{array}{l} \mathbf{if}\;x \leq -7.8 \cdot 10^{+92} \lor \neg \left(x \leq 6.1 \cdot 10^{+56}\right):\\ \;\;\;\;x \cdot \log y\\ \mathbf{else}:\\ \;\;\;\;\left(-z\right) - y\\ \end{array} \]
Alternative 4
Error0.1
Cost6848
\[\left(x \cdot \log y - y\right) - z \]
Alternative 5
Error30.7
Cost260
\[\begin{array}{l} \mathbf{if}\;y \leq 5.9 \cdot 10^{+50}:\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;-y\\ \end{array} \]
Alternative 6
Error21.7
Cost256
\[\left(-z\right) - y \]
Alternative 7
Error42.1
Cost128
\[-y \]

Error

Reproduce

herbie shell --seed 2022343 
(FPCore (x y z)
  :name "Statistics.Distribution.Poisson:$clogProbability from math-functions-0.1.5.2"
  :precision binary64
  (- (- (* x (log y)) z) y))