Average Error: 0.1 → 0.1
Time: 2.5min
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(y + z\right)\right)} \]
    Proof
    (fma.f64 x (log.f64 y) (neg.f64 (+.f64 y z))): 0 points increase in error, 0 points decrease in error
    (fma.f64 x (log.f64 y) (neg.f64 (Rewrite<= +-commutative_binary64 (+.f64 z y)))): 0 points increase in error, 0 points decrease in error
    (Rewrite<= fma-neg_binary64 (-.f64 (*.f64 x (log.f64 y)) (+.f64 z y))): 2 points increase in error, 1 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.4
Cost7116
\[\begin{array}{l} t_0 := x \cdot \log y\\ t_1 := t_0 - y\\ \mathbf{if}\;x \leq -1.5 \cdot 10^{+70}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 9.8 \cdot 10^{+14}:\\ \;\;\;\;\left(-z\right) - y\\ \mathbf{elif}\;x \leq 1.45 \cdot 10^{+165}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0 - z\\ \end{array} \]
Alternative 2
Error9.3
Cost6984
\[\begin{array}{l} t_0 := x \cdot \log y - y\\ \mathbf{if}\;x \leq -1.7 \cdot 10^{+70}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 9.5 \cdot 10^{+14}:\\ \;\;\;\;\left(-z\right) - y\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 3
Error12.7
Cost6856
\[\begin{array}{l} t_0 := x \cdot \log y\\ \mathbf{if}\;x \leq -1.25 \cdot 10^{+154}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 6.4 \cdot 10^{+142}:\\ \;\;\;\;\left(-z\right) - y\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 4
Error0.1
Cost6848
\[\left(x \cdot \log y - z\right) - y \]
Alternative 5
Error30.8
Cost392
\[\begin{array}{l} \mathbf{if}\;z \leq -1450000000:\\ \;\;\;\;-z\\ \mathbf{elif}\;z \leq 1.75 \cdot 10^{+108}:\\ \;\;\;\;-y\\ \mathbf{else}:\\ \;\;\;\;-z\\ \end{array} \]
Alternative 6
Error21.2
Cost256
\[\left(-z\right) - y \]
Alternative 7
Error42.0
Cost128
\[-y \]
Alternative 8
Error62.5
Cost64
\[y \]

Error

Reproduce

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