Average Error: 0.1 → 0.1
Time: 12.2s
Precision: binary64
Cost: 19648
\[\left(\left(x \cdot \log y - y\right) - z\right) + \log t \]
\[\left(\mathsf{fma}\left(x, \log y, \log t\right) - y\right) - z \]
(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(Float64(fma(x, log(y), log(t)) - 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[(N[(x * N[Log[y], $MachinePrecision] + N[Log[t], $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision] - z), $MachinePrecision]
\left(\left(x \cdot \log y - y\right) - z\right) + \log t
\left(\mathsf{fma}\left(x, \log y, \log t\right) - y\right) - z

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}{\left(\mathsf{fma}\left(x, \log y, \log t\right) - y\right) - z} \]
    Proof
    (-.f64 (-.f64 (fma.f64 x (log.f64 y) (log.f64 t)) y) z): 0 points increase in error, 0 points decrease in error
    (-.f64 (-.f64 (Rewrite<= fma-def_binary64 (+.f64 (*.f64 x (log.f64 y)) (log.f64 t))) y) z): 0 points increase in error, 0 points decrease in error
    (-.f64 (-.f64 (Rewrite<= +-commutative_binary64 (+.f64 (log.f64 t) (*.f64 x (log.f64 y)))) y) z): 0 points increase in error, 0 points decrease in error
    (-.f64 (Rewrite<= associate-+r-_binary64 (+.f64 (log.f64 t) (-.f64 (*.f64 x (log.f64 y)) y))) z): 0 points increase in error, 0 points decrease in error
    (-.f64 (Rewrite<= +-rgt-identity_binary64 (+.f64 (+.f64 (log.f64 t) (-.f64 (*.f64 x (log.f64 y)) y)) 0)) z): 0 points increase in error, 0 points decrease in error
    (Rewrite<= associate-+r-_binary64 (+.f64 (+.f64 (log.f64 t) (-.f64 (*.f64 x (log.f64 y)) y)) (-.f64 0 z))): 0 points increase in error, 0 points decrease in error
    (+.f64 (+.f64 (log.f64 t) (-.f64 (*.f64 x (log.f64 y)) y)) (Rewrite<= neg-sub0_binary64 (neg.f64 z))): 0 points increase in error, 0 points decrease in error
    (Rewrite<= associate-+r+_binary64 (+.f64 (log.f64 t) (+.f64 (-.f64 (*.f64 x (log.f64 y)) y) (neg.f64 z)))): 0 points increase in error, 0 points decrease in error
    (+.f64 (log.f64 t) (Rewrite<= sub-neg_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))): 3 points increase in error, 0 points decrease in error
  3. Final simplification0.1

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

Alternatives

Alternative 1
Error0.1
Cost13376
\[\log t + \left(\left(x \cdot \log y - y\right) - z\right) \]
Alternative 2
Error16.2
Cost7776
\[\begin{array}{l} t_1 := \left(-z\right) - y\\ t_2 := x \cdot \log y - z\\ t_3 := \log t - y\\ \mathbf{if}\;x \leq -2.2 \cdot 10^{+60}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -2.95 \cdot 10^{-122}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -2.6 \cdot 10^{-203}:\\ \;\;\;\;\log t - z\\ \mathbf{elif}\;x \leq 1.45 \cdot 10^{-241}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 3 \cdot 10^{-198}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \leq 6 \cdot 10^{-67}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 5.5 \cdot 10^{-15}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \leq 7.6 \cdot 10^{+81}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 3
Error20.2
Cost7648
\[\begin{array}{l} t_1 := \log t - y\\ t_2 := x \cdot \log y\\ t_3 := \left(-z\right) - y\\ \mathbf{if}\;x \leq -6 \cdot 10^{+113}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -2.7 \cdot 10^{-161}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \leq -3.5 \cdot 10^{-204}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 1.85 \cdot 10^{-236}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \leq 5.4 \cdot 10^{-198}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 8.2 \cdot 10^{-70}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \leq 4.8 \cdot 10^{-15}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 3.2 \cdot 10^{+179}:\\ \;\;\;\;t_3\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 4
Error20.5
Cost7648
\[\begin{array}{l} t_1 := x \cdot \log y\\ t_2 := \log t - y\\ t_3 := \left(-z\right) - y\\ \mathbf{if}\;x \leq -3.4 \cdot 10^{+114}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -4.3 \cdot 10^{-125}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \leq -2.4 \cdot 10^{-211}:\\ \;\;\;\;\log t - z\\ \mathbf{elif}\;x \leq 4.3 \cdot 10^{-244}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \leq 7.2 \cdot 10^{-196}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 9 \cdot 10^{-68}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \leq 5.3 \cdot 10^{-15}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 3.1 \cdot 10^{+179}:\\ \;\;\;\;t_3\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 5
Error20.1
Cost7120
\[\begin{array}{l} t_1 := x \cdot \log y\\ t_2 := \left(-z\right) - y\\ \mathbf{if}\;x \leq -2.9 \cdot 10^{+113}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -1.65 \cdot 10^{-161}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -2.7 \cdot 10^{-203}:\\ \;\;\;\;\log t\\ \mathbf{elif}\;x \leq 1.45 \cdot 10^{+183}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 6
Error0.8
Cost7113
\[\begin{array}{l} \mathbf{if}\;x \leq -1.16 \cdot 10^{+29} \lor \neg \left(x \leq 0.62\right):\\ \;\;\;\;\left(x \cdot \log y - y\right) - z\\ \mathbf{else}:\\ \;\;\;\;\left(\log t - y\right) - z\\ \end{array} \]
Alternative 7
Error27.6
Cost6992
\[\begin{array}{l} \mathbf{if}\;y \leq 7.6 \cdot 10^{-243}:\\ \;\;\;\;-z\\ \mathbf{elif}\;y \leq 5.6 \cdot 10^{-207}:\\ \;\;\;\;\log t\\ \mathbf{elif}\;y \leq 1.8 \cdot 10^{-134}:\\ \;\;\;\;-z\\ \mathbf{elif}\;y \leq 9.2 \cdot 10^{-123}:\\ \;\;\;\;\log t\\ \mathbf{else}:\\ \;\;\;\;\left(-z\right) - y\\ \end{array} \]
Alternative 8
Error7.2
Cost6985
\[\begin{array}{l} \mathbf{if}\;x \leq -2.25 \cdot 10^{+62} \lor \neg \left(x \leq 5.8 \cdot 10^{+81}\right):\\ \;\;\;\;x \cdot \log y - z\\ \mathbf{else}:\\ \;\;\;\;\left(\log t - y\right) - z\\ \end{array} \]
Alternative 9
Error33.1
Cost260
\[\begin{array}{l} \mathbf{if}\;y \leq 5.2 \cdot 10^{+53}:\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;-y\\ \end{array} \]
Alternative 10
Error27.2
Cost256
\[\left(-z\right) - y \]
Alternative 11
Error45.2
Cost128
\[-y \]

Error

Reproduce

herbie shell --seed 2022343 
(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)))