?

Average Accuracy: 99.9% → 99.9%
Time: 13.7s
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 99.9%

    \[\left(\left(x \cdot \log y - y\right) - z\right) + \log t \]
  2. Simplified99.9%

    \[\leadsto \color{blue}{\left(x \cdot \log y - y\right) - \left(z - \log t\right)} \]
    Proof

    [Start]99.9

    \[ \left(\left(x \cdot \log y - y\right) - z\right) + \log t \]

    associate-+l- [=>]99.9

    \[ \color{blue}{\left(x \cdot \log y - y\right) - \left(z - \log t\right)} \]
  3. Taylor expanded in x around 0 99.9%

    \[\leadsto \color{blue}{\left(\log y \cdot x + \log t\right) - \left(y + z\right)} \]
  4. Simplified99.9%

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

    [Start]99.9

    \[ \left(\log y \cdot x + \log t\right) - \left(y + z\right) \]

    +-commutative [=>]99.9

    \[ \color{blue}{\left(\log t + \log y \cdot x\right)} - \left(y + z\right) \]

    remove-double-neg [<=]99.9

    \[ \left(\color{blue}{\left(-\left(-\log t\right)\right)} + \log y \cdot x\right) - \left(y + z\right) \]

    neg-mul-1 [=>]99.9

    \[ \left(\color{blue}{-1 \cdot \left(-\log t\right)} + \log y \cdot x\right) - \left(y + z\right) \]

    mul-1-neg [<=]99.9

    \[ \left(-1 \cdot \color{blue}{\left(-1 \cdot \log t\right)} + \log y \cdot x\right) - \left(y + z\right) \]

    associate-*r* [=>]99.9

    \[ \left(\color{blue}{\left(-1 \cdot -1\right) \cdot \log t} + \log y \cdot x\right) - \left(y + z\right) \]

    metadata-eval [=>]99.9

    \[ \left(\color{blue}{1} \cdot \log t + \log y \cdot x\right) - \left(y + z\right) \]

    *-commutative [<=]99.9

    \[ \left(\color{blue}{\log t \cdot 1} + \log y \cdot x\right) - \left(y + z\right) \]

    *-commutative [=>]99.9

    \[ \left(\log t \cdot 1 + \color{blue}{x \cdot \log y}\right) - \left(y + z\right) \]

    associate-+r- [<=]99.9

    \[ \color{blue}{\log t \cdot 1 + \left(x \cdot \log y - \left(y + z\right)\right)} \]

    *-rgt-identity [<=]99.9

    \[ \log t \cdot 1 + \color{blue}{\left(x \cdot \log y - \left(y + z\right)\right) \cdot 1} \]

    distribute-rgt-in [<=]99.9

    \[ \color{blue}{1 \cdot \left(\log t + \left(x \cdot \log y - \left(y + z\right)\right)\right)} \]

    *-lft-identity [=>]99.9

    \[ \color{blue}{\log t + \left(x \cdot \log y - \left(y + z\right)\right)} \]

    +-commutative [=>]99.9

    \[ \color{blue}{\left(x \cdot \log y - \left(y + z\right)\right) + \log t} \]

    associate-+l- [=>]99.9

    \[ \color{blue}{x \cdot \log y - \left(\left(y + z\right) - \log t\right)} \]

    associate-+r- [<=]99.9

    \[ x \cdot \log y - \color{blue}{\left(y + \left(z - \log t\right)\right)} \]

    unsub-neg [<=]99.9

    \[ \color{blue}{x \cdot \log y + \left(-\left(y + \left(z - \log t\right)\right)\right)} \]

    *-commutative [<=]99.9

    \[ \color{blue}{\log y \cdot x} + \left(-\left(y + \left(z - \log t\right)\right)\right) \]

    fma-udef [<=]99.9

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

    distribute-neg-in [=>]99.9

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

    sub-neg [<=]99.9

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

    associate--r- [=>]99.9

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

    +-commutative [=>]99.9

    \[ \mathsf{fma}\left(\log y, x, \color{blue}{\log t + \left(\left(-y\right) - z\right)}\right) \]
  5. Final simplification99.9%

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

Alternatives

Alternative 1
Accuracy99.9%
Cost13376
\[\log t + \left(\left(\log y \cdot x - y\right) - z\right) \]
Alternative 2
Accuracy65.8%
Cost7253
\[\begin{array}{l} t_1 := \log t - z\\ t_2 := \log y \cdot x\\ \mathbf{if}\;y \leq 2.6 \cdot 10^{-197}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 9.5 \cdot 10^{-166}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq 1.7 \cdot 10^{-10}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 2.2 \cdot 10^{+67} \lor \neg \left(y \leq 2.5 \cdot 10^{+107}\right):\\ \;\;\;\;\left(-z\right) - y\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 3
Accuracy98.8%
Cost7113
\[\begin{array}{l} \mathbf{if}\;x \leq -1.9 \cdot 10^{+18} \lor \neg \left(x \leq 1.65 \cdot 10^{-16}\right):\\ \;\;\;\;\left(\log y \cdot x - y\right) - z\\ \mathbf{else}:\\ \;\;\;\;\log t - \left(y + z\right)\\ \end{array} \]
Alternative 4
Accuracy84.7%
Cost6985
\[\begin{array}{l} \mathbf{if}\;x \leq -4.2 \cdot 10^{+141} \lor \neg \left(x \leq 9.5 \cdot 10^{+133}\right):\\ \;\;\;\;\log y \cdot x\\ \mathbf{else}:\\ \;\;\;\;\log t - \left(y + z\right)\\ \end{array} \]
Alternative 5
Accuracy88.7%
Cost6985
\[\begin{array}{l} \mathbf{if}\;x \leq -1.9 \cdot 10^{+141} \lor \neg \left(x \leq 8.5 \cdot 10^{+79}\right):\\ \;\;\;\;\log y \cdot x - y\\ \mathbf{else}:\\ \;\;\;\;\log t - \left(y + z\right)\\ \end{array} \]
Alternative 6
Accuracy89.1%
Cost6985
\[\begin{array}{l} \mathbf{if}\;x \leq -5.7 \cdot 10^{+141} \lor \neg \left(x \leq 1.9 \cdot 10^{+43}\right):\\ \;\;\;\;\log y \cdot x - z\\ \mathbf{else}:\\ \;\;\;\;\log t - \left(y + z\right)\\ \end{array} \]
Alternative 7
Accuracy72.3%
Cost6857
\[\begin{array}{l} \mathbf{if}\;x \leq -4.5 \cdot 10^{+143} \lor \neg \left(x \leq 8.2 \cdot 10^{+132}\right):\\ \;\;\;\;\log y \cdot x\\ \mathbf{else}:\\ \;\;\;\;\left(-z\right) - y\\ \end{array} \]
Alternative 8
Accuracy48.3%
Cost260
\[\begin{array}{l} \mathbf{if}\;y \leq 6.2 \cdot 10^{+58}:\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;-y\\ \end{array} \]
Alternative 9
Accuracy58.3%
Cost256
\[\left(-z\right) - y \]
Alternative 10
Accuracy29.6%
Cost128
\[-y \]

Error

Reproduce?

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