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

Error

Derivation

  1. Initial program 0.1

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(x, \log y, \log t\right) - \left(y + z\right)} \]
    Proof
    (-.f64 (fma.f64 x (log.f64 y) (log.f64 t)) (+.f64 y z)): 0 points increase in error, 0 points decrease in error
    (-.f64 (Rewrite<= fma-def_binary64 (+.f64 (*.f64 x (log.f64 y)) (log.f64 t))) (+.f64 y z)): 1 points increase in error, 0 points decrease in error
    (-.f64 (Rewrite<= +-commutative_binary64 (+.f64 (log.f64 t) (*.f64 x (log.f64 y)))) (+.f64 y z)): 0 points increase in error, 0 points decrease in error
    (Rewrite<= associate-+r-_binary64 (+.f64 (log.f64 t) (-.f64 (*.f64 x (log.f64 y)) (+.f64 y z)))): 0 points increase in error, 0 points decrease in error
    (+.f64 (log.f64 t) (Rewrite<= associate--l-_binary64 (-.f64 (-.f64 (*.f64 x (log.f64 y)) y) z))): 0 points increase in error, 0 points decrease in error
    (Rewrite<= +-commutative_binary64 (+.f64 (-.f64 (-.f64 (*.f64 x (log.f64 y)) y) z) (log.f64 t))): 0 points increase in error, 0 points decrease in error
  3. Final simplification0.1

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

Alternatives

Alternative 1
Error0.7
Cost13380
\[\begin{array}{l} t_1 := x \cdot \log y\\ \mathbf{if}\;y \leq 8.8 \cdot 10^{-13}:\\ \;\;\;\;\left(\log t + t_1\right) - z\\ \mathbf{else}:\\ \;\;\;\;t_1 - \left(y + z\right)\\ \end{array} \]
Alternative 2
Error0.1
Cost13376
\[\log t + \left(\left(x \cdot \log y - y\right) - z\right) \]
Alternative 3
Error19.6
Cost7120
\[\begin{array}{l} t_1 := x \cdot \log y\\ t_2 := \left(-y\right) - z\\ \mathbf{if}\;x \leq -8.8 \cdot 10^{+52}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -2.7 \cdot 10^{-156}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -2.7 \cdot 10^{-188}:\\ \;\;\;\;\log t\\ \mathbf{elif}\;x \leq 8 \cdot 10^{+71}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 4
Error19.1
Cost7120
\[\begin{array}{l} t_1 := x \cdot \log y\\ t_2 := \left(-y\right) - z\\ \mathbf{if}\;x \leq -6 \cdot 10^{+52}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -1 \cdot 10^{-155}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -5 \cdot 10^{-190}:\\ \;\;\;\;\log t - y\\ \mathbf{elif}\;x \leq 8 \cdot 10^{+71}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 5
Error0.6
Cost7112
\[\begin{array}{l} t_1 := x \cdot \log y - \left(y + z\right)\\ \mathbf{if}\;x \leq -950000000000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 3.1 \cdot 10^{-12}:\\ \;\;\;\;\log t - \left(y + z\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 6
Error10.8
Cost6984
\[\begin{array}{l} t_1 := x \cdot \log y\\ \mathbf{if}\;x \leq -8.5 \cdot 10^{+52}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 8.5 \cdot 10^{+72}:\\ \;\;\;\;\log t - \left(y + z\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 7
Error6.8
Cost6984
\[\begin{array}{l} t_1 := x \cdot \log y - y\\ \mathbf{if}\;x \leq -5.5 \cdot 10^{+52}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 4.1 \cdot 10^{+60}:\\ \;\;\;\;\log t - \left(y + z\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 8
Error6.5
Cost6984
\[\begin{array}{l} t_1 := x \cdot \log y\\ \mathbf{if}\;x \leq -8.2 \cdot 10^{+14}:\\ \;\;\;\;t_1 - z\\ \mathbf{elif}\;x \leq 4.4 \cdot 10^{+60}:\\ \;\;\;\;\log t - \left(y + z\right)\\ \mathbf{else}:\\ \;\;\;\;t_1 - y\\ \end{array} \]
Alternative 9
Error27.3
Cost6728
\[\begin{array}{l} t_1 := \left(-y\right) - z\\ \mathbf{if}\;x \leq -2.4 \cdot 10^{-156}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -2.7 \cdot 10^{-188}:\\ \;\;\;\;\log t\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 10
Error32.5
Cost260
\[\begin{array}{l} \mathbf{if}\;y \leq 6.2 \cdot 10^{+56}:\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;-y\\ \end{array} \]
Alternative 11
Error26.5
Cost256
\[\left(-y\right) - z \]
Alternative 12
Error44.3
Cost128
\[-y \]

Error

Reproduce

herbie shell --seed 2022329 
(FPCore (x y z t)
  :name "Numeric.SpecFunctions:incompleteGamma from math-functions-0.1.5.2, A"
  :precision binary64
  (+ (- (- (* x (log y)) y) z) (log t)))