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

    \[\leadsto \color{blue}{\mathsf{fma}\left(\log y, x, \log t - \left(y + z\right)\right)} \]
  4. Final simplification0.1

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

Alternatives

Alternative 1
Error0.5
Cost13576
\[\begin{array}{l} \mathbf{if}\;x \leq -66.77564264476575:\\ \;\;\;\;\mathsf{fma}\left(\log y, x, \left(-y\right) - z\right)\\ \mathbf{elif}\;x \leq 2.345466627684827 \cdot 10^{-16}:\\ \;\;\;\;\log \left(t \cdot {y}^{x}\right) - \left(y + z\right)\\ \mathbf{else}:\\ \;\;\;\;\log y \cdot x - \left(y + z\right)\\ \end{array} \]
Alternative 2
Error0.1
Cost13376
\[\log t + \left(\left(\log y \cdot x - y\right) - z\right) \]
Alternative 3
Error0.9
Cost13316
\[\begin{array}{l} \mathbf{if}\;x \leq -1.506824021241902 \cdot 10^{+25}:\\ \;\;\;\;\mathsf{fma}\left(\log y, x, \left(-y\right) - z\right)\\ \mathbf{elif}\;x \leq 2.345466627684827 \cdot 10^{-16}:\\ \;\;\;\;\log t - \left(y + z\right)\\ \mathbf{else}:\\ \;\;\;\;\log y \cdot x - \left(y + z\right)\\ \end{array} \]
Alternative 4
Error15.6
Cost7512
\[\begin{array}{l} t_1 := \log t - y\\ t_2 := \log y \cdot x\\ t_3 := t_2 - y\\ \mathbf{if}\;z \leq -5.930579428805752 \cdot 10^{+119}:\\ \;\;\;\;t_2 - z\\ \mathbf{elif}\;z \leq -7.807375258801311 \cdot 10^{-106}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;z \leq -4.4645664225227 \cdot 10^{-146}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 6.7904513131785855 \cdot 10^{-254}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;z \leq 2.386451894915776 \cdot 10^{-165}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 4.28888686953458 \cdot 10^{+37}:\\ \;\;\;\;t_3\\ \mathbf{else}:\\ \;\;\;\;\left(-y\right) - z\\ \end{array} \]
Alternative 5
Error16.8
Cost7248
\[\begin{array}{l} t_1 := \left(-y\right) - z\\ t_2 := \log y \cdot x - z\\ \mathbf{if}\;x \leq -1.3043146709148838 \cdot 10^{+151}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -8.709610675452013 \cdot 10^{-32}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -1.9 \cdot 10^{-304}:\\ \;\;\;\;\log t - y\\ \mathbf{elif}\;x \leq 9.64344295068233 \cdot 10^{+49}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 6
Error18.9
Cost7120
\[\begin{array}{l} t_1 := \log y \cdot x\\ t_2 := \left(-y\right) - z\\ \mathbf{if}\;x \leq -1.3043146709148838 \cdot 10^{+151}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -2.8021100975205507 \cdot 10^{-43}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -1.0602102441445996 \cdot 10^{-144}:\\ \;\;\;\;\log t - z\\ \mathbf{elif}\;x \leq 2.4403430877519052 \cdot 10^{+79}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 7
Error19.8
Cost7120
\[\begin{array}{l} t_1 := \log y \cdot x\\ t_2 := \left(-y\right) - z\\ \mathbf{if}\;x \leq -1.3043146709148838 \cdot 10^{+151}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -8.709610675452013 \cdot 10^{-32}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -1.9 \cdot 10^{-304}:\\ \;\;\;\;\log t - y\\ \mathbf{elif}\;x \leq 2.4403430877519052 \cdot 10^{+79}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 8
Error0.9
Cost7112
\[\begin{array}{l} t_1 := \log y \cdot x - \left(y + z\right)\\ \mathbf{if}\;x \leq -1.506824021241902 \cdot 10^{+25}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 2.345466627684827 \cdot 10^{-16}:\\ \;\;\;\;\log t - \left(y + z\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 9
Error6.8
Cost6984
\[\begin{array}{l} t_1 := \log y \cdot x - y\\ \mathbf{if}\;x \leq -4.584775965405014 \cdot 10^{+48}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 6141.117113583173:\\ \;\;\;\;\log t - \left(y + z\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 10
Error26.7
Cost6728
\[\begin{array}{l} t_1 := \left(-y\right) - z\\ \mathbf{if}\;z \leq -3.3015773088059174 \cdot 10^{-118}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -2.2949463250878774 \cdot 10^{-149}:\\ \;\;\;\;\log t\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 11
Error19.2
Cost6724
\[\begin{array}{l} \mathbf{if}\;y \leq 0.00016232600723135973:\\ \;\;\;\;\log t - z\\ \mathbf{else}:\\ \;\;\;\;\left(-y\right) - z\\ \end{array} \]
Alternative 12
Error33.0
Cost260
\[\begin{array}{l} \mathbf{if}\;y \leq 8.388195282196854 \cdot 10^{+55}:\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;-y\\ \end{array} \]
Alternative 13
Error26.5
Cost256
\[\left(-y\right) - z \]
Alternative 14
Error44.4
Cost128
\[-z \]

Error

Reproduce

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