Average Error: 0.1 → 0.1
Time: 12.3s
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.1
Cost13376
\[\log t + \left(\left(x \cdot \log y - y\right) - z\right) \]
Alternative 2
Error21.2
Cost7648
\[\begin{array}{l} t_1 := \log t - z\\ t_2 := x \cdot \log y\\ t_3 := \left(-y\right) - z\\ \mathbf{if}\;x \leq -1.3030758989019341 \cdot 10^{+178}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -1.290465894653738:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \leq -3.172781724553245 \cdot 10^{-96}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -9.63219946031011 \cdot 10^{-247}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \leq 2.7298498189146745 \cdot 10^{-273}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 1.63409794258199 \cdot 10^{-174}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \leq 1.428678024673647 \cdot 10^{-36}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 6.098482636525676 \cdot 10^{+163}:\\ \;\;\;\;t_3\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 3
Error7.2
Cost7248
\[\begin{array}{l} t_1 := x \cdot \log y - y\\ t_2 := \log t - \left(y + z\right)\\ \mathbf{if}\;x \leq -1.0255283987012284 \cdot 10^{+22}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 1.12381758745025:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 7.3 \cdot 10^{+71}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 1.8596740072009744 \cdot 10^{+119}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 4
Error7.1
Cost7248
\[\begin{array}{l} t_1 := \log t - \left(y + z\right)\\ t_2 := x \cdot \log y\\ t_3 := t_2 - y\\ \mathbf{if}\;x \leq -8.466218904188016 \cdot 10^{+37}:\\ \;\;\;\;t_2 - z\\ \mathbf{elif}\;x \leq 1.12381758745025:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 7.3 \cdot 10^{+71}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \leq 1.8596740072009744 \cdot 10^{+119}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \]
Alternative 5
Error0.8
Cost7112
\[\begin{array}{l} t_1 := x \cdot \log y - \left(y + z\right)\\ \mathbf{if}\;x \leq -283616246.2478593:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 1.428678024673647 \cdot 10^{-36}:\\ \;\;\;\;\log t - \left(y + z\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 6
Error28.3
Cost6992
\[\begin{array}{l} t_1 := \left(-y\right) - z\\ \mathbf{if}\;z \leq -8.904108583592085 \cdot 10^{-245}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -1.033010105399299 \cdot 10^{-299}:\\ \;\;\;\;\log t\\ \mathbf{elif}\;z \leq 2.3450542354169483 \cdot 10^{-248}:\\ \;\;\;\;-y\\ \mathbf{elif}\;z \leq 6.97 \cdot 10^{-80}:\\ \;\;\;\;\log t\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 7
Error10.8
Cost6984
\[\begin{array}{l} t_1 := x \cdot \log y\\ \mathbf{if}\;x \leq -1.3030758989019341 \cdot 10^{+178}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 6.098482636525676 \cdot 10^{+163}:\\ \;\;\;\;\log t - \left(y + z\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 8
Error18.7
Cost6856
\[\begin{array}{l} t_1 := x \cdot \log y\\ \mathbf{if}\;x \leq -1.3030758989019341 \cdot 10^{+178}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 6.098482636525676 \cdot 10^{+163}:\\ \;\;\;\;\left(-y\right) - z\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 9
Error34.1
Cost656
\[\begin{array}{l} \mathbf{if}\;z \leq -4.9209311232271846 \cdot 10^{+119}:\\ \;\;\;\;-z\\ \mathbf{elif}\;z \leq 9.159553307678012 \cdot 10^{+23}:\\ \;\;\;\;-y\\ \mathbf{elif}\;z \leq 7.596515670464469 \cdot 10^{+143}:\\ \;\;\;\;-z\\ \mathbf{elif}\;z \leq 1.587391782007631 \cdot 10^{+194}:\\ \;\;\;\;-y\\ \mathbf{else}:\\ \;\;\;\;-z\\ \end{array} \]
Alternative 10
Error26.7
Cost256
\[\left(-y\right) - z \]
Alternative 11
Error44.9
Cost128
\[-z \]

Error

Reproduce

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