Statistics.Distribution.Beta:$cdensity from math-functions-0.1.5.2

Percentage Accurate: 89.3% → 99.8%
Time: 19.2s
Alternatives: 16
Speedup: 1.9×

Specification

?
\[\begin{array}{l} \\ \left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (- (+ (* (- x 1.0) (log y)) (* (- z 1.0) (log (- 1.0 y)))) t))
double code(double x, double y, double z, double t) {
	return (((x - 1.0) * log(y)) + ((z - 1.0) * log((1.0 - y)))) - t;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = (((x - 1.0d0) * log(y)) + ((z - 1.0d0) * log((1.0d0 - y)))) - t
end function
public static double code(double x, double y, double z, double t) {
	return (((x - 1.0) * Math.log(y)) + ((z - 1.0) * Math.log((1.0 - y)))) - t;
}
def code(x, y, z, t):
	return (((x - 1.0) * math.log(y)) + ((z - 1.0) * math.log((1.0 - y)))) - t
function code(x, y, z, t)
	return Float64(Float64(Float64(Float64(x - 1.0) * log(y)) + Float64(Float64(z - 1.0) * log(Float64(1.0 - y)))) - t)
end
function tmp = code(x, y, z, t)
	tmp = (((x - 1.0) * log(y)) + ((z - 1.0) * log((1.0 - y)))) - t;
end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x - 1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(N[(z - 1.0), $MachinePrecision] * N[Log[N[(1.0 - y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}

\\
\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 16 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 89.3% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (- (+ (* (- x 1.0) (log y)) (* (- z 1.0) (log (- 1.0 y)))) t))
double code(double x, double y, double z, double t) {
	return (((x - 1.0) * log(y)) + ((z - 1.0) * log((1.0 - y)))) - t;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = (((x - 1.0d0) * log(y)) + ((z - 1.0d0) * log((1.0d0 - y)))) - t
end function
public static double code(double x, double y, double z, double t) {
	return (((x - 1.0) * Math.log(y)) + ((z - 1.0) * Math.log((1.0 - y)))) - t;
}
def code(x, y, z, t):
	return (((x - 1.0) * math.log(y)) + ((z - 1.0) * math.log((1.0 - y)))) - t
function code(x, y, z, t)
	return Float64(Float64(Float64(Float64(x - 1.0) * log(y)) + Float64(Float64(z - 1.0) * log(Float64(1.0 - y)))) - t)
end
function tmp = code(x, y, z, t)
	tmp = (((x - 1.0) * log(y)) + ((z - 1.0) * log((1.0 - y)))) - t;
end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x - 1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(N[(z - 1.0), $MachinePrecision] * N[Log[N[(1.0 - y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}

\\
\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t
\end{array}

Alternative 1: 99.8% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(x + -1, \log y, \mathsf{fma}\left(-1 + z, \mathsf{log1p}\left(-y\right), -t\right)\right) \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (fma (+ x -1.0) (log y) (fma (+ -1.0 z) (log1p (- y)) (- t))))
double code(double x, double y, double z, double t) {
	return fma((x + -1.0), log(y), fma((-1.0 + z), log1p(-y), -t));
}
function code(x, y, z, t)
	return fma(Float64(x + -1.0), log(y), fma(Float64(-1.0 + z), log1p(Float64(-y)), Float64(-t)))
end
code[x_, y_, z_, t_] := N[(N[(x + -1.0), $MachinePrecision] * N[Log[y], $MachinePrecision] + N[(N[(-1.0 + z), $MachinePrecision] * N[Log[1 + (-y)], $MachinePrecision] + (-t)), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(x + -1, \log y, \mathsf{fma}\left(-1 + z, \mathsf{log1p}\left(-y\right), -t\right)\right)
\end{array}
Derivation
  1. Initial program 91.1%

    \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
  2. Step-by-step derivation
    1. associate--l+91.1%

      \[\leadsto \color{blue}{\left(x - 1\right) \cdot \log y + \left(\left(z - 1\right) \cdot \log \left(1 - y\right) - t\right)} \]
    2. fma-def91.2%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x - 1, \log y, \left(z - 1\right) \cdot \log \left(1 - y\right) - t\right)} \]
    3. sub-neg91.2%

      \[\leadsto \mathsf{fma}\left(\color{blue}{x + \left(-1\right)}, \log y, \left(z - 1\right) \cdot \log \left(1 - y\right) - t\right) \]
    4. metadata-eval91.2%

      \[\leadsto \mathsf{fma}\left(x + \color{blue}{-1}, \log y, \left(z - 1\right) \cdot \log \left(1 - y\right) - t\right) \]
    5. fma-neg91.2%

      \[\leadsto \mathsf{fma}\left(x + -1, \log y, \color{blue}{\mathsf{fma}\left(z - 1, \log \left(1 - y\right), -t\right)}\right) \]
    6. sub-neg91.2%

      \[\leadsto \mathsf{fma}\left(x + -1, \log y, \mathsf{fma}\left(\color{blue}{z + \left(-1\right)}, \log \left(1 - y\right), -t\right)\right) \]
    7. metadata-eval91.2%

      \[\leadsto \mathsf{fma}\left(x + -1, \log y, \mathsf{fma}\left(z + \color{blue}{-1}, \log \left(1 - y\right), -t\right)\right) \]
    8. sub-neg91.2%

      \[\leadsto \mathsf{fma}\left(x + -1, \log y, \mathsf{fma}\left(z + -1, \log \color{blue}{\left(1 + \left(-y\right)\right)}, -t\right)\right) \]
    9. log1p-def99.8%

      \[\leadsto \mathsf{fma}\left(x + -1, \log y, \mathsf{fma}\left(z + -1, \color{blue}{\mathsf{log1p}\left(-y\right)}, -t\right)\right) \]
  3. Simplified99.8%

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

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

Alternative 2: 99.8% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(-1 + z, \mathsf{log1p}\left(-y\right), \left(x + -1\right) \cdot \log y\right) - t \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (- (fma (+ -1.0 z) (log1p (- y)) (* (+ x -1.0) (log y))) t))
double code(double x, double y, double z, double t) {
	return fma((-1.0 + z), log1p(-y), ((x + -1.0) * log(y))) - t;
}
function code(x, y, z, t)
	return Float64(fma(Float64(-1.0 + z), log1p(Float64(-y)), Float64(Float64(x + -1.0) * log(y))) - t)
end
code[x_, y_, z_, t_] := N[(N[(N[(-1.0 + z), $MachinePrecision] * N[Log[1 + (-y)], $MachinePrecision] + N[(N[(x + -1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(-1 + z, \mathsf{log1p}\left(-y\right), \left(x + -1\right) \cdot \log y\right) - t
\end{array}
Derivation
  1. Initial program 91.1%

    \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
  2. Step-by-step derivation
    1. +-commutative91.1%

      \[\leadsto \color{blue}{\left(\left(z - 1\right) \cdot \log \left(1 - y\right) + \left(x - 1\right) \cdot \log y\right)} - t \]
    2. fma-def91.1%

      \[\leadsto \color{blue}{\mathsf{fma}\left(z - 1, \log \left(1 - y\right), \left(x - 1\right) \cdot \log y\right)} - t \]
    3. sub-neg91.1%

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

      \[\leadsto \mathsf{fma}\left(z + \color{blue}{-1}, \log \left(1 - y\right), \left(x - 1\right) \cdot \log y\right) - t \]
    5. sub-neg91.1%

      \[\leadsto \mathsf{fma}\left(z + -1, \log \color{blue}{\left(1 + \left(-y\right)\right)}, \left(x - 1\right) \cdot \log y\right) - t \]
    6. log1p-def99.8%

      \[\leadsto \mathsf{fma}\left(z + -1, \color{blue}{\mathsf{log1p}\left(-y\right)}, \left(x - 1\right) \cdot \log y\right) - t \]
    7. sub-neg99.8%

      \[\leadsto \mathsf{fma}\left(z + -1, \mathsf{log1p}\left(-y\right), \color{blue}{\left(x + \left(-1\right)\right)} \cdot \log y\right) - t \]
    8. metadata-eval99.8%

      \[\leadsto \mathsf{fma}\left(z + -1, \mathsf{log1p}\left(-y\right), \left(x + \color{blue}{-1}\right) \cdot \log y\right) - t \]
  3. Simplified99.8%

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

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

Alternative 3: 99.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(\mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\left(-1 + z\right) \cdot \left(y \cdot y\right)\right)\right) + \left(x + -1\right) \cdot \log y\right) - t \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (-
  (+
   (fma -1.0 (* y (+ -1.0 z)) (* -0.5 (* (+ -1.0 z) (* y y))))
   (* (+ x -1.0) (log y)))
  t))
double code(double x, double y, double z, double t) {
	return (fma(-1.0, (y * (-1.0 + z)), (-0.5 * ((-1.0 + z) * (y * y)))) + ((x + -1.0) * log(y))) - t;
}
function code(x, y, z, t)
	return Float64(Float64(fma(-1.0, Float64(y * Float64(-1.0 + z)), Float64(-0.5 * Float64(Float64(-1.0 + z) * Float64(y * y)))) + Float64(Float64(x + -1.0) * log(y))) - t)
end
code[x_, y_, z_, t_] := N[(N[(N[(-1.0 * N[(y * N[(-1.0 + z), $MachinePrecision]), $MachinePrecision] + N[(-0.5 * N[(N[(-1.0 + z), $MachinePrecision] * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(x + -1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}

\\
\left(\mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\left(-1 + z\right) \cdot \left(y \cdot y\right)\right)\right) + \left(x + -1\right) \cdot \log y\right) - t
\end{array}
Derivation
  1. Initial program 91.1%

    \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
  2. Taylor expanded in y around 0 98.9%

    \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\left(-1 \cdot \left(y \cdot \left(z - 1\right)\right) + -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)}\right) - t \]
  3. Step-by-step derivation
    1. fma-def98.9%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\mathsf{fma}\left(-1, y \cdot \left(z - 1\right), -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)}\right) - t \]
    2. sub-neg98.9%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \color{blue}{\left(z + \left(-1\right)\right)}, -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)\right) - t \]
    3. metadata-eval98.9%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(z + \color{blue}{-1}\right), -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)\right) - t \]
    4. +-commutative98.9%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \color{blue}{\left(-1 + z\right)}, -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)\right) - t \]
    5. unpow298.9%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\color{blue}{\left(y \cdot y\right)} \cdot \left(z - 1\right)\right)\right)\right) - t \]
    6. sub-neg98.9%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\left(y \cdot y\right) \cdot \color{blue}{\left(z + \left(-1\right)\right)}\right)\right)\right) - t \]
    7. metadata-eval98.9%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\left(y \cdot y\right) \cdot \left(z + \color{blue}{-1}\right)\right)\right)\right) - t \]
    8. +-commutative98.9%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\left(y \cdot y\right) \cdot \color{blue}{\left(-1 + z\right)}\right)\right)\right) - t \]
  4. Simplified98.9%

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

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

Alternative 4: 99.1% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(y, 1 - z, \left(x + -1\right) \cdot \log y\right) - t \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (- (fma y (- 1.0 z) (* (+ x -1.0) (log y))) t))
double code(double x, double y, double z, double t) {
	return fma(y, (1.0 - z), ((x + -1.0) * log(y))) - t;
}
function code(x, y, z, t)
	return Float64(fma(y, Float64(1.0 - z), Float64(Float64(x + -1.0) * log(y))) - t)
end
code[x_, y_, z_, t_] := N[(N[(y * N[(1.0 - z), $MachinePrecision] + N[(N[(x + -1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(y, 1 - z, \left(x + -1\right) \cdot \log y\right) - t
\end{array}
Derivation
  1. Initial program 91.1%

    \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
  2. Taylor expanded in y around 0 98.9%

    \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\left(-1 \cdot \left(y \cdot \left(z - 1\right)\right) + -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)}\right) - t \]
  3. Step-by-step derivation
    1. fma-def98.9%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\mathsf{fma}\left(-1, y \cdot \left(z - 1\right), -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)}\right) - t \]
    2. sub-neg98.9%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \color{blue}{\left(z + \left(-1\right)\right)}, -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)\right) - t \]
    3. metadata-eval98.9%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(z + \color{blue}{-1}\right), -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)\right) - t \]
    4. +-commutative98.9%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \color{blue}{\left(-1 + z\right)}, -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)\right) - t \]
    5. unpow298.9%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\color{blue}{\left(y \cdot y\right)} \cdot \left(z - 1\right)\right)\right)\right) - t \]
    6. sub-neg98.9%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\left(y \cdot y\right) \cdot \color{blue}{\left(z + \left(-1\right)\right)}\right)\right)\right) - t \]
    7. metadata-eval98.9%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\left(y \cdot y\right) \cdot \left(z + \color{blue}{-1}\right)\right)\right)\right) - t \]
    8. +-commutative98.9%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\left(y \cdot y\right) \cdot \color{blue}{\left(-1 + z\right)}\right)\right)\right) - t \]
  4. Simplified98.9%

    \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\left(y \cdot y\right) \cdot \left(-1 + z\right)\right)\right)}\right) - t \]
  5. Taylor expanded in y around 0 98.4%

    \[\leadsto \color{blue}{\left(-1 \cdot \left(y \cdot \left(z - 1\right)\right) + \log y \cdot \left(x - 1\right)\right)} - t \]
  6. Step-by-step derivation
    1. +-commutative98.4%

      \[\leadsto \color{blue}{\left(\log y \cdot \left(x - 1\right) + -1 \cdot \left(y \cdot \left(z - 1\right)\right)\right)} - t \]
    2. sub-neg98.4%

      \[\leadsto \left(\log y \cdot \color{blue}{\left(x + \left(-1\right)\right)} + -1 \cdot \left(y \cdot \left(z - 1\right)\right)\right) - t \]
    3. metadata-eval98.4%

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

      \[\leadsto \left(\log y \cdot \color{blue}{\left(-1 + x\right)} + -1 \cdot \left(y \cdot \left(z - 1\right)\right)\right) - t \]
    5. fma-def98.4%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\log y, -1 + x, -1 \cdot \left(y \cdot \left(z - 1\right)\right)\right)} - t \]
    6. mul-1-neg98.4%

      \[\leadsto \mathsf{fma}\left(\log y, -1 + x, \color{blue}{-y \cdot \left(z - 1\right)}\right) - t \]
    7. sub-neg98.4%

      \[\leadsto \mathsf{fma}\left(\log y, -1 + x, -y \cdot \color{blue}{\left(z + \left(-1\right)\right)}\right) - t \]
    8. metadata-eval98.4%

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

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

      \[\leadsto \color{blue}{\left(\log y \cdot \left(-1 + x\right) - y \cdot \left(-1 + z\right)\right)} - t \]
    11. distribute-rgt-in98.4%

      \[\leadsto \left(\log y \cdot \left(-1 + x\right) - \color{blue}{\left(-1 \cdot y + z \cdot y\right)}\right) - t \]
    12. neg-mul-198.4%

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

      \[\leadsto \left(\log y \cdot \left(-1 + x\right) - \color{blue}{\left(z \cdot y + \left(-y\right)\right)}\right) - t \]
    14. unsub-neg98.4%

      \[\leadsto \left(\log y \cdot \left(-1 + x\right) - \color{blue}{\left(z \cdot y - y\right)}\right) - t \]
    15. *-commutative98.4%

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

    \[\leadsto \color{blue}{\left(\log y \cdot \left(-1 + x\right) - \left(y \cdot z - y\right)\right)} - t \]
  8. Taylor expanded in y around 0 98.4%

    \[\leadsto \color{blue}{\left(y \cdot \left(1 - z\right) + \log y \cdot \left(x - 1\right)\right) - t} \]
  9. Step-by-step derivation
    1. +-commutative98.4%

      \[\leadsto \color{blue}{\left(\log y \cdot \left(x - 1\right) + y \cdot \left(1 - z\right)\right)} - t \]
    2. sub-neg98.4%

      \[\leadsto \left(\log y \cdot \color{blue}{\left(x + \left(-1\right)\right)} + y \cdot \left(1 - z\right)\right) - t \]
    3. metadata-eval98.4%

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

      \[\leadsto \left(\log y \cdot \color{blue}{\left(-1 + x\right)} + y \cdot \left(1 - z\right)\right) - t \]
    5. associate--l+98.4%

      \[\leadsto \color{blue}{\log y \cdot \left(-1 + x\right) + \left(y \cdot \left(1 - z\right) - t\right)} \]
    6. *-lft-identity98.4%

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

      \[\leadsto \left(1 \cdot \log y\right) \cdot \color{blue}{\left(x + -1\right)} + \left(y \cdot \left(1 - z\right) - t\right) \]
    8. metadata-eval98.4%

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

      \[\leadsto \left(1 \cdot \log y\right) \cdot \color{blue}{\left(x - 1\right)} + \left(y \cdot \left(1 - z\right) - t\right) \]
    10. metadata-eval98.4%

      \[\leadsto \left(\color{blue}{\left(-1 \cdot -1\right)} \cdot \log y\right) \cdot \left(x - 1\right) + \left(y \cdot \left(1 - z\right) - t\right) \]
    11. associate-*r*98.4%

      \[\leadsto \color{blue}{\left(-1 \cdot \left(-1 \cdot \log y\right)\right)} \cdot \left(x - 1\right) + \left(y \cdot \left(1 - z\right) - t\right) \]
    12. associate-*r*98.4%

      \[\leadsto \color{blue}{-1 \cdot \left(\left(-1 \cdot \log y\right) \cdot \left(x - 1\right)\right)} + \left(y \cdot \left(1 - z\right) - t\right) \]
    13. mul-1-neg98.4%

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

      \[\leadsto -1 \cdot \left(\color{blue}{\log \left(\frac{1}{y}\right)} \cdot \left(x - 1\right)\right) + \left(y \cdot \left(1 - z\right) - t\right) \]
    15. associate--l+98.4%

      \[\leadsto \color{blue}{\left(-1 \cdot \left(\log \left(\frac{1}{y}\right) \cdot \left(x - 1\right)\right) + y \cdot \left(1 - z\right)\right) - t} \]
    16. +-commutative98.4%

      \[\leadsto \color{blue}{\left(y \cdot \left(1 - z\right) + -1 \cdot \left(\log \left(\frac{1}{y}\right) \cdot \left(x - 1\right)\right)\right)} - t \]
  10. Simplified98.4%

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

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

Alternative 5: 95.6% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x + -1 \leq -4 \cdot 10^{+18}:\\ \;\;\;\;x \cdot \log y - t\\ \mathbf{elif}\;x + -1 \leq -0.999999999:\\ \;\;\;\;\left(\left(y - \log y\right) - y \cdot z\right) - t\\ \mathbf{else}:\\ \;\;\;\;\left(x + -1\right) \cdot \log y - t\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= (+ x -1.0) -4e+18)
   (- (* x (log y)) t)
   (if (<= (+ x -1.0) -0.999999999)
     (- (- (- y (log y)) (* y z)) t)
     (- (* (+ x -1.0) (log y)) t))))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((x + -1.0) <= -4e+18) {
		tmp = (x * log(y)) - t;
	} else if ((x + -1.0) <= -0.999999999) {
		tmp = ((y - log(y)) - (y * z)) - t;
	} else {
		tmp = ((x + -1.0) * log(y)) - t;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if ((x + (-1.0d0)) <= (-4d+18)) then
        tmp = (x * log(y)) - t
    else if ((x + (-1.0d0)) <= (-0.999999999d0)) then
        tmp = ((y - log(y)) - (y * z)) - t
    else
        tmp = ((x + (-1.0d0)) * log(y)) - t
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if ((x + -1.0) <= -4e+18) {
		tmp = (x * Math.log(y)) - t;
	} else if ((x + -1.0) <= -0.999999999) {
		tmp = ((y - Math.log(y)) - (y * z)) - t;
	} else {
		tmp = ((x + -1.0) * Math.log(y)) - t;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (x + -1.0) <= -4e+18:
		tmp = (x * math.log(y)) - t
	elif (x + -1.0) <= -0.999999999:
		tmp = ((y - math.log(y)) - (y * z)) - t
	else:
		tmp = ((x + -1.0) * math.log(y)) - t
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (Float64(x + -1.0) <= -4e+18)
		tmp = Float64(Float64(x * log(y)) - t);
	elseif (Float64(x + -1.0) <= -0.999999999)
		tmp = Float64(Float64(Float64(y - log(y)) - Float64(y * z)) - t);
	else
		tmp = Float64(Float64(Float64(x + -1.0) * log(y)) - t);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if ((x + -1.0) <= -4e+18)
		tmp = (x * log(y)) - t;
	elseif ((x + -1.0) <= -0.999999999)
		tmp = ((y - log(y)) - (y * z)) - t;
	else
		tmp = ((x + -1.0) * log(y)) - t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[N[(x + -1.0), $MachinePrecision], -4e+18], N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[N[(x + -1.0), $MachinePrecision], -0.999999999], N[(N[(N[(y - N[Log[y], $MachinePrecision]), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(N[(x + -1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x + -1 \leq -4 \cdot 10^{+18}:\\
\;\;\;\;x \cdot \log y - t\\

\mathbf{elif}\;x + -1 \leq -0.999999999:\\
\;\;\;\;\left(\left(y - \log y\right) - y \cdot z\right) - t\\

\mathbf{else}:\\
\;\;\;\;\left(x + -1\right) \cdot \log y - t\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (-.f64 x 1) < -4e18

    1. Initial program 96.2%

      \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
    2. Taylor expanded in y around 0 98.7%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\left(-1 \cdot \left(y \cdot \left(z - 1\right)\right) + -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)}\right) - t \]
    3. Step-by-step derivation
      1. fma-def98.7%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\mathsf{fma}\left(-1, y \cdot \left(z - 1\right), -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)}\right) - t \]
      2. sub-neg98.7%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \color{blue}{\left(z + \left(-1\right)\right)}, -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)\right) - t \]
      3. metadata-eval98.7%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(z + \color{blue}{-1}\right), -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)\right) - t \]
      4. +-commutative98.7%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \color{blue}{\left(-1 + z\right)}, -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)\right) - t \]
      5. unpow298.7%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\color{blue}{\left(y \cdot y\right)} \cdot \left(z - 1\right)\right)\right)\right) - t \]
      6. sub-neg98.7%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\left(y \cdot y\right) \cdot \color{blue}{\left(z + \left(-1\right)\right)}\right)\right)\right) - t \]
      7. metadata-eval98.7%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\left(y \cdot y\right) \cdot \left(z + \color{blue}{-1}\right)\right)\right)\right) - t \]
      8. +-commutative98.7%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\left(y \cdot y\right) \cdot \color{blue}{\left(-1 + z\right)}\right)\right)\right) - t \]
    4. Simplified98.7%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\left(y \cdot y\right) \cdot \left(-1 + z\right)\right)\right)}\right) - t \]
    5. Taylor expanded in x around inf 94.3%

      \[\leadsto \color{blue}{x \cdot \log y} - t \]
    6. Step-by-step derivation
      1. *-commutative94.3%

        \[\leadsto \color{blue}{\log y \cdot x} - t \]
    7. Simplified94.3%

      \[\leadsto \color{blue}{\log y \cdot x} - t \]

    if -4e18 < (-.f64 x 1) < -0.999999999000000028

    1. Initial program 85.3%

      \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
    2. Taylor expanded in y around 0 98.5%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\left(-1 \cdot \left(y \cdot \left(z - 1\right)\right) + -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)}\right) - t \]
    3. Step-by-step derivation
      1. fma-def98.5%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\mathsf{fma}\left(-1, y \cdot \left(z - 1\right), -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)}\right) - t \]
      2. sub-neg98.5%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \color{blue}{\left(z + \left(-1\right)\right)}, -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)\right) - t \]
      3. metadata-eval98.5%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(z + \color{blue}{-1}\right), -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)\right) - t \]
      4. +-commutative98.5%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \color{blue}{\left(-1 + z\right)}, -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)\right) - t \]
      5. unpow298.5%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\color{blue}{\left(y \cdot y\right)} \cdot \left(z - 1\right)\right)\right)\right) - t \]
      6. sub-neg98.5%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\left(y \cdot y\right) \cdot \color{blue}{\left(z + \left(-1\right)\right)}\right)\right)\right) - t \]
      7. metadata-eval98.5%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\left(y \cdot y\right) \cdot \left(z + \color{blue}{-1}\right)\right)\right)\right) - t \]
      8. +-commutative98.5%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\left(y \cdot y\right) \cdot \color{blue}{\left(-1 + z\right)}\right)\right)\right) - t \]
    4. Simplified98.5%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\left(y \cdot y\right) \cdot \left(-1 + z\right)\right)\right)}\right) - t \]
    5. Taylor expanded in y around 0 97.5%

      \[\leadsto \color{blue}{\left(-1 \cdot \left(y \cdot \left(z - 1\right)\right) + \log y \cdot \left(x - 1\right)\right)} - t \]
    6. Step-by-step derivation
      1. +-commutative97.5%

        \[\leadsto \color{blue}{\left(\log y \cdot \left(x - 1\right) + -1 \cdot \left(y \cdot \left(z - 1\right)\right)\right)} - t \]
      2. sub-neg97.5%

        \[\leadsto \left(\log y \cdot \color{blue}{\left(x + \left(-1\right)\right)} + -1 \cdot \left(y \cdot \left(z - 1\right)\right)\right) - t \]
      3. metadata-eval97.5%

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

        \[\leadsto \left(\log y \cdot \color{blue}{\left(-1 + x\right)} + -1 \cdot \left(y \cdot \left(z - 1\right)\right)\right) - t \]
      5. fma-def97.5%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\log y, -1 + x, -1 \cdot \left(y \cdot \left(z - 1\right)\right)\right)} - t \]
      6. mul-1-neg97.5%

        \[\leadsto \mathsf{fma}\left(\log y, -1 + x, \color{blue}{-y \cdot \left(z - 1\right)}\right) - t \]
      7. sub-neg97.5%

        \[\leadsto \mathsf{fma}\left(\log y, -1 + x, -y \cdot \color{blue}{\left(z + \left(-1\right)\right)}\right) - t \]
      8. metadata-eval97.5%

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

        \[\leadsto \mathsf{fma}\left(\log y, -1 + x, -y \cdot \color{blue}{\left(-1 + z\right)}\right) - t \]
      10. fma-neg97.5%

        \[\leadsto \color{blue}{\left(\log y \cdot \left(-1 + x\right) - y \cdot \left(-1 + z\right)\right)} - t \]
      11. distribute-rgt-in97.5%

        \[\leadsto \left(\log y \cdot \left(-1 + x\right) - \color{blue}{\left(-1 \cdot y + z \cdot y\right)}\right) - t \]
      12. neg-mul-197.5%

        \[\leadsto \left(\log y \cdot \left(-1 + x\right) - \left(\color{blue}{\left(-y\right)} + z \cdot y\right)\right) - t \]
      13. +-commutative97.5%

        \[\leadsto \left(\log y \cdot \left(-1 + x\right) - \color{blue}{\left(z \cdot y + \left(-y\right)\right)}\right) - t \]
      14. unsub-neg97.5%

        \[\leadsto \left(\log y \cdot \left(-1 + x\right) - \color{blue}{\left(z \cdot y - y\right)}\right) - t \]
      15. *-commutative97.5%

        \[\leadsto \left(\log y \cdot \left(-1 + x\right) - \left(\color{blue}{y \cdot z} - y\right)\right) - t \]
    7. Simplified97.5%

      \[\leadsto \color{blue}{\left(\log y \cdot \left(-1 + x\right) - \left(y \cdot z - y\right)\right)} - t \]
    8. Taylor expanded in x around 0 97.4%

      \[\leadsto \color{blue}{\left(\left(y + -1 \cdot \log y\right) - y \cdot z\right)} - t \]
    9. Step-by-step derivation
      1. mul-1-neg97.4%

        \[\leadsto \left(\left(y + \color{blue}{\left(-\log y\right)}\right) - y \cdot z\right) - t \]
      2. unsub-neg97.4%

        \[\leadsto \left(\color{blue}{\left(y - \log y\right)} - y \cdot z\right) - t \]
    10. Simplified97.4%

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

    if -0.999999999000000028 < (-.f64 x 1)

    1. Initial program 96.7%

      \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
    2. Step-by-step derivation
      1. +-commutative96.7%

        \[\leadsto \color{blue}{\left(\left(z - 1\right) \cdot \log \left(1 - y\right) + \left(x - 1\right) \cdot \log y\right)} - t \]
      2. fma-def96.7%

        \[\leadsto \color{blue}{\mathsf{fma}\left(z - 1, \log \left(1 - y\right), \left(x - 1\right) \cdot \log y\right)} - t \]
      3. sub-neg96.7%

        \[\leadsto \mathsf{fma}\left(\color{blue}{z + \left(-1\right)}, \log \left(1 - y\right), \left(x - 1\right) \cdot \log y\right) - t \]
      4. metadata-eval96.7%

        \[\leadsto \mathsf{fma}\left(z + \color{blue}{-1}, \log \left(1 - y\right), \left(x - 1\right) \cdot \log y\right) - t \]
      5. sub-neg96.7%

        \[\leadsto \mathsf{fma}\left(z + -1, \log \color{blue}{\left(1 + \left(-y\right)\right)}, \left(x - 1\right) \cdot \log y\right) - t \]
      6. log1p-def99.6%

        \[\leadsto \mathsf{fma}\left(z + -1, \color{blue}{\mathsf{log1p}\left(-y\right)}, \left(x - 1\right) \cdot \log y\right) - t \]
      7. sub-neg99.6%

        \[\leadsto \mathsf{fma}\left(z + -1, \mathsf{log1p}\left(-y\right), \color{blue}{\left(x + \left(-1\right)\right)} \cdot \log y\right) - t \]
      8. metadata-eval99.6%

        \[\leadsto \mathsf{fma}\left(z + -1, \mathsf{log1p}\left(-y\right), \left(x + \color{blue}{-1}\right) \cdot \log y\right) - t \]
    3. Simplified99.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(z + -1, \mathsf{log1p}\left(-y\right), \left(x + -1\right) \cdot \log y\right) - t} \]
    4. Taylor expanded in y around 0 96.7%

      \[\leadsto \color{blue}{\log y \cdot \left(x - 1\right) - t} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification96.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x + -1 \leq -4 \cdot 10^{+18}:\\ \;\;\;\;x \cdot \log y - t\\ \mathbf{elif}\;x + -1 \leq -0.999999999:\\ \;\;\;\;\left(\left(y - \log y\right) - y \cdot z\right) - t\\ \mathbf{else}:\\ \;\;\;\;\left(x + -1\right) \cdot \log y - t\\ \end{array} \]

Alternative 6: 99.1% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \left(\left(x + -1\right) \cdot \log y + \left(y - y \cdot z\right)\right) - t \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (- (+ (* (+ x -1.0) (log y)) (- y (* y z))) t))
double code(double x, double y, double z, double t) {
	return (((x + -1.0) * log(y)) + (y - (y * z))) - t;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = (((x + (-1.0d0)) * log(y)) + (y - (y * z))) - t
end function
public static double code(double x, double y, double z, double t) {
	return (((x + -1.0) * Math.log(y)) + (y - (y * z))) - t;
}
def code(x, y, z, t):
	return (((x + -1.0) * math.log(y)) + (y - (y * z))) - t
function code(x, y, z, t)
	return Float64(Float64(Float64(Float64(x + -1.0) * log(y)) + Float64(y - Float64(y * z))) - t)
end
function tmp = code(x, y, z, t)
	tmp = (((x + -1.0) * log(y)) + (y - (y * z))) - t;
end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x + -1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(y - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}

\\
\left(\left(x + -1\right) \cdot \log y + \left(y - y \cdot z\right)\right) - t
\end{array}
Derivation
  1. Initial program 91.1%

    \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
  2. Taylor expanded in y around 0 98.9%

    \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\left(-1 \cdot \left(y \cdot \left(z - 1\right)\right) + -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)}\right) - t \]
  3. Step-by-step derivation
    1. fma-def98.9%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\mathsf{fma}\left(-1, y \cdot \left(z - 1\right), -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)}\right) - t \]
    2. sub-neg98.9%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \color{blue}{\left(z + \left(-1\right)\right)}, -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)\right) - t \]
    3. metadata-eval98.9%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(z + \color{blue}{-1}\right), -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)\right) - t \]
    4. +-commutative98.9%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \color{blue}{\left(-1 + z\right)}, -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)\right) - t \]
    5. unpow298.9%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\color{blue}{\left(y \cdot y\right)} \cdot \left(z - 1\right)\right)\right)\right) - t \]
    6. sub-neg98.9%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\left(y \cdot y\right) \cdot \color{blue}{\left(z + \left(-1\right)\right)}\right)\right)\right) - t \]
    7. metadata-eval98.9%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\left(y \cdot y\right) \cdot \left(z + \color{blue}{-1}\right)\right)\right)\right) - t \]
    8. +-commutative98.9%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\left(y \cdot y\right) \cdot \color{blue}{\left(-1 + z\right)}\right)\right)\right) - t \]
  4. Simplified98.9%

    \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\left(y \cdot y\right) \cdot \left(-1 + z\right)\right)\right)}\right) - t \]
  5. Taylor expanded in y around 0 98.4%

    \[\leadsto \color{blue}{\left(-1 \cdot \left(y \cdot \left(z - 1\right)\right) + \log y \cdot \left(x - 1\right)\right)} - t \]
  6. Step-by-step derivation
    1. +-commutative98.4%

      \[\leadsto \color{blue}{\left(\log y \cdot \left(x - 1\right) + -1 \cdot \left(y \cdot \left(z - 1\right)\right)\right)} - t \]
    2. sub-neg98.4%

      \[\leadsto \left(\log y \cdot \color{blue}{\left(x + \left(-1\right)\right)} + -1 \cdot \left(y \cdot \left(z - 1\right)\right)\right) - t \]
    3. metadata-eval98.4%

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

      \[\leadsto \left(\log y \cdot \color{blue}{\left(-1 + x\right)} + -1 \cdot \left(y \cdot \left(z - 1\right)\right)\right) - t \]
    5. fma-def98.4%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\log y, -1 + x, -1 \cdot \left(y \cdot \left(z - 1\right)\right)\right)} - t \]
    6. mul-1-neg98.4%

      \[\leadsto \mathsf{fma}\left(\log y, -1 + x, \color{blue}{-y \cdot \left(z - 1\right)}\right) - t \]
    7. sub-neg98.4%

      \[\leadsto \mathsf{fma}\left(\log y, -1 + x, -y \cdot \color{blue}{\left(z + \left(-1\right)\right)}\right) - t \]
    8. metadata-eval98.4%

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

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

      \[\leadsto \color{blue}{\left(\log y \cdot \left(-1 + x\right) - y \cdot \left(-1 + z\right)\right)} - t \]
    11. distribute-rgt-in98.4%

      \[\leadsto \left(\log y \cdot \left(-1 + x\right) - \color{blue}{\left(-1 \cdot y + z \cdot y\right)}\right) - t \]
    12. neg-mul-198.4%

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

      \[\leadsto \left(\log y \cdot \left(-1 + x\right) - \color{blue}{\left(z \cdot y + \left(-y\right)\right)}\right) - t \]
    14. unsub-neg98.4%

      \[\leadsto \left(\log y \cdot \left(-1 + x\right) - \color{blue}{\left(z \cdot y - y\right)}\right) - t \]
    15. *-commutative98.4%

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

    \[\leadsto \color{blue}{\left(\log y \cdot \left(-1 + x\right) - \left(y \cdot z - y\right)\right)} - t \]
  8. Final simplification98.4%

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

Alternative 7: 99.0% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \left(\left(x + -1\right) \cdot \log y - y \cdot z\right) - t \end{array} \]
(FPCore (x y z t) :precision binary64 (- (- (* (+ x -1.0) (log y)) (* y z)) t))
double code(double x, double y, double z, double t) {
	return (((x + -1.0) * log(y)) - (y * z)) - t;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = (((x + (-1.0d0)) * log(y)) - (y * z)) - t
end function
public static double code(double x, double y, double z, double t) {
	return (((x + -1.0) * Math.log(y)) - (y * z)) - t;
}
def code(x, y, z, t):
	return (((x + -1.0) * math.log(y)) - (y * z)) - t
function code(x, y, z, t)
	return Float64(Float64(Float64(Float64(x + -1.0) * log(y)) - Float64(y * z)) - t)
end
function tmp = code(x, y, z, t)
	tmp = (((x + -1.0) * log(y)) - (y * z)) - t;
end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x + -1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}

\\
\left(\left(x + -1\right) \cdot \log y - y \cdot z\right) - t
\end{array}
Derivation
  1. Initial program 91.1%

    \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
  2. Taylor expanded in y around 0 98.9%

    \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\left(-1 \cdot \left(y \cdot \left(z - 1\right)\right) + -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)}\right) - t \]
  3. Step-by-step derivation
    1. fma-def98.9%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\mathsf{fma}\left(-1, y \cdot \left(z - 1\right), -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)}\right) - t \]
    2. sub-neg98.9%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \color{blue}{\left(z + \left(-1\right)\right)}, -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)\right) - t \]
    3. metadata-eval98.9%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(z + \color{blue}{-1}\right), -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)\right) - t \]
    4. +-commutative98.9%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \color{blue}{\left(-1 + z\right)}, -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)\right) - t \]
    5. unpow298.9%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\color{blue}{\left(y \cdot y\right)} \cdot \left(z - 1\right)\right)\right)\right) - t \]
    6. sub-neg98.9%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\left(y \cdot y\right) \cdot \color{blue}{\left(z + \left(-1\right)\right)}\right)\right)\right) - t \]
    7. metadata-eval98.9%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\left(y \cdot y\right) \cdot \left(z + \color{blue}{-1}\right)\right)\right)\right) - t \]
    8. +-commutative98.9%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\left(y \cdot y\right) \cdot \color{blue}{\left(-1 + z\right)}\right)\right)\right) - t \]
  4. Simplified98.9%

    \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\left(y \cdot y\right) \cdot \left(-1 + z\right)\right)\right)}\right) - t \]
  5. Taylor expanded in y around 0 98.4%

    \[\leadsto \color{blue}{\left(-1 \cdot \left(y \cdot \left(z - 1\right)\right) + \log y \cdot \left(x - 1\right)\right)} - t \]
  6. Step-by-step derivation
    1. +-commutative98.4%

      \[\leadsto \color{blue}{\left(\log y \cdot \left(x - 1\right) + -1 \cdot \left(y \cdot \left(z - 1\right)\right)\right)} - t \]
    2. sub-neg98.4%

      \[\leadsto \left(\log y \cdot \color{blue}{\left(x + \left(-1\right)\right)} + -1 \cdot \left(y \cdot \left(z - 1\right)\right)\right) - t \]
    3. metadata-eval98.4%

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

      \[\leadsto \left(\log y \cdot \color{blue}{\left(-1 + x\right)} + -1 \cdot \left(y \cdot \left(z - 1\right)\right)\right) - t \]
    5. fma-def98.4%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\log y, -1 + x, -1 \cdot \left(y \cdot \left(z - 1\right)\right)\right)} - t \]
    6. mul-1-neg98.4%

      \[\leadsto \mathsf{fma}\left(\log y, -1 + x, \color{blue}{-y \cdot \left(z - 1\right)}\right) - t \]
    7. sub-neg98.4%

      \[\leadsto \mathsf{fma}\left(\log y, -1 + x, -y \cdot \color{blue}{\left(z + \left(-1\right)\right)}\right) - t \]
    8. metadata-eval98.4%

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

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

      \[\leadsto \color{blue}{\left(\log y \cdot \left(-1 + x\right) - y \cdot \left(-1 + z\right)\right)} - t \]
    11. distribute-rgt-in98.4%

      \[\leadsto \left(\log y \cdot \left(-1 + x\right) - \color{blue}{\left(-1 \cdot y + z \cdot y\right)}\right) - t \]
    12. neg-mul-198.4%

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

      \[\leadsto \left(\log y \cdot \left(-1 + x\right) - \color{blue}{\left(z \cdot y + \left(-y\right)\right)}\right) - t \]
    14. unsub-neg98.4%

      \[\leadsto \left(\log y \cdot \left(-1 + x\right) - \color{blue}{\left(z \cdot y - y\right)}\right) - t \]
    15. *-commutative98.4%

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

    \[\leadsto \color{blue}{\left(\log y \cdot \left(-1 + x\right) - \left(y \cdot z - y\right)\right)} - t \]
  8. Taylor expanded in z around inf 98.3%

    \[\leadsto \left(\log y \cdot \left(-1 + x\right) - \color{blue}{y \cdot z}\right) - t \]
  9. Final simplification98.3%

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

Alternative 8: 87.0% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -7.2 \cdot 10^{+16} \lor \neg \left(x \leq 1\right):\\ \;\;\;\;x \cdot \log y - t\\ \mathbf{else}:\\ \;\;\;\;\left(-t\right) - \log y\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (or (<= x -7.2e+16) (not (<= x 1.0)))
   (- (* x (log y)) t)
   (- (- t) (log y))))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((x <= -7.2e+16) || !(x <= 1.0)) {
		tmp = (x * log(y)) - t;
	} else {
		tmp = -t - log(y);
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if ((x <= (-7.2d+16)) .or. (.not. (x <= 1.0d0))) then
        tmp = (x * log(y)) - t
    else
        tmp = -t - log(y)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if ((x <= -7.2e+16) || !(x <= 1.0)) {
		tmp = (x * Math.log(y)) - t;
	} else {
		tmp = -t - Math.log(y);
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (x <= -7.2e+16) or not (x <= 1.0):
		tmp = (x * math.log(y)) - t
	else:
		tmp = -t - math.log(y)
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if ((x <= -7.2e+16) || !(x <= 1.0))
		tmp = Float64(Float64(x * log(y)) - t);
	else
		tmp = Float64(Float64(-t) - log(y));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if ((x <= -7.2e+16) || ~((x <= 1.0)))
		tmp = (x * log(y)) - t;
	else
		tmp = -t - log(y);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -7.2e+16], N[Not[LessEqual[x, 1.0]], $MachinePrecision]], N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[((-t) - N[Log[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.2 \cdot 10^{+16} \lor \neg \left(x \leq 1\right):\\
\;\;\;\;x \cdot \log y - t\\

\mathbf{else}:\\
\;\;\;\;\left(-t\right) - \log y\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -7.2e16 or 1 < x

    1. Initial program 96.2%

      \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
    2. Taylor expanded in y around 0 99.2%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\left(-1 \cdot \left(y \cdot \left(z - 1\right)\right) + -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)}\right) - t \]
    3. Step-by-step derivation
      1. fma-def99.2%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\mathsf{fma}\left(-1, y \cdot \left(z - 1\right), -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)}\right) - t \]
      2. sub-neg99.2%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \color{blue}{\left(z + \left(-1\right)\right)}, -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)\right) - t \]
      3. metadata-eval99.2%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(z + \color{blue}{-1}\right), -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)\right) - t \]
      4. +-commutative99.2%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \color{blue}{\left(-1 + z\right)}, -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)\right) - t \]
      5. unpow299.2%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\color{blue}{\left(y \cdot y\right)} \cdot \left(z - 1\right)\right)\right)\right) - t \]
      6. sub-neg99.2%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\left(y \cdot y\right) \cdot \color{blue}{\left(z + \left(-1\right)\right)}\right)\right)\right) - t \]
      7. metadata-eval99.2%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\left(y \cdot y\right) \cdot \left(z + \color{blue}{-1}\right)\right)\right)\right) - t \]
      8. +-commutative99.2%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\left(y \cdot y\right) \cdot \color{blue}{\left(-1 + z\right)}\right)\right)\right) - t \]
    4. Simplified99.2%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\left(y \cdot y\right) \cdot \left(-1 + z\right)\right)\right)}\right) - t \]
    5. Taylor expanded in x around inf 94.2%

      \[\leadsto \color{blue}{x \cdot \log y} - t \]
    6. Step-by-step derivation
      1. *-commutative94.2%

        \[\leadsto \color{blue}{\log y \cdot x} - t \]
    7. Simplified94.2%

      \[\leadsto \color{blue}{\log y \cdot x} - t \]

    if -7.2e16 < x < 1

    1. Initial program 86.3%

      \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
    2. Step-by-step derivation
      1. +-commutative86.3%

        \[\leadsto \color{blue}{\left(\left(z - 1\right) \cdot \log \left(1 - y\right) + \left(x - 1\right) \cdot \log y\right)} - t \]
      2. fma-def86.3%

        \[\leadsto \color{blue}{\mathsf{fma}\left(z - 1, \log \left(1 - y\right), \left(x - 1\right) \cdot \log y\right)} - t \]
      3. sub-neg86.3%

        \[\leadsto \mathsf{fma}\left(\color{blue}{z + \left(-1\right)}, \log \left(1 - y\right), \left(x - 1\right) \cdot \log y\right) - t \]
      4. metadata-eval86.3%

        \[\leadsto \mathsf{fma}\left(z + \color{blue}{-1}, \log \left(1 - y\right), \left(x - 1\right) \cdot \log y\right) - t \]
      5. sub-neg86.3%

        \[\leadsto \mathsf{fma}\left(z + -1, \log \color{blue}{\left(1 + \left(-y\right)\right)}, \left(x - 1\right) \cdot \log y\right) - t \]
      6. log1p-def100.0%

        \[\leadsto \mathsf{fma}\left(z + -1, \color{blue}{\mathsf{log1p}\left(-y\right)}, \left(x - 1\right) \cdot \log y\right) - t \]
      7. sub-neg100.0%

        \[\leadsto \mathsf{fma}\left(z + -1, \mathsf{log1p}\left(-y\right), \color{blue}{\left(x + \left(-1\right)\right)} \cdot \log y\right) - t \]
      8. metadata-eval100.0%

        \[\leadsto \mathsf{fma}\left(z + -1, \mathsf{log1p}\left(-y\right), \left(x + \color{blue}{-1}\right) \cdot \log y\right) - t \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(z + -1, \mathsf{log1p}\left(-y\right), \left(x + -1\right) \cdot \log y\right) - t} \]
    4. Taylor expanded in y around 0 83.3%

      \[\leadsto \color{blue}{\log y \cdot \left(x - 1\right) - t} \]
    5. Step-by-step derivation
      1. fma-neg83.3%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\log y, x - 1, -t\right)} \]
      2. sub-neg83.3%

        \[\leadsto \mathsf{fma}\left(\log y, \color{blue}{x + \left(-1\right)}, -t\right) \]
      3. metadata-eval83.3%

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

        \[\leadsto \mathsf{fma}\left(\log y, \color{blue}{-1 + x}, -t\right) \]
    6. Simplified83.3%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\log y, -1 + x, -t\right)} \]
    7. Taylor expanded in x around 0 81.5%

      \[\leadsto \color{blue}{-1 \cdot \log y - t} \]
    8. Step-by-step derivation
      1. neg-mul-181.5%

        \[\leadsto \color{blue}{\left(-\log y\right)} - t \]
    9. Simplified81.5%

      \[\leadsto \color{blue}{\left(-\log y\right) - t} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification87.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -7.2 \cdot 10^{+16} \lor \neg \left(x \leq 1\right):\\ \;\;\;\;x \cdot \log y - t\\ \mathbf{else}:\\ \;\;\;\;\left(-t\right) - \log y\\ \end{array} \]

Alternative 9: 87.2% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -7.2 \cdot 10^{+16} \lor \neg \left(x \leq 1\right):\\ \;\;\;\;x \cdot \log y - t\\ \mathbf{else}:\\ \;\;\;\;\left(y - \log y\right) - t\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (or (<= x -7.2e+16) (not (<= x 1.0)))
   (- (* x (log y)) t)
   (- (- y (log y)) t)))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((x <= -7.2e+16) || !(x <= 1.0)) {
		tmp = (x * log(y)) - t;
	} else {
		tmp = (y - log(y)) - t;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if ((x <= (-7.2d+16)) .or. (.not. (x <= 1.0d0))) then
        tmp = (x * log(y)) - t
    else
        tmp = (y - log(y)) - t
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if ((x <= -7.2e+16) || !(x <= 1.0)) {
		tmp = (x * Math.log(y)) - t;
	} else {
		tmp = (y - Math.log(y)) - t;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (x <= -7.2e+16) or not (x <= 1.0):
		tmp = (x * math.log(y)) - t
	else:
		tmp = (y - math.log(y)) - t
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if ((x <= -7.2e+16) || !(x <= 1.0))
		tmp = Float64(Float64(x * log(y)) - t);
	else
		tmp = Float64(Float64(y - log(y)) - t);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if ((x <= -7.2e+16) || ~((x <= 1.0)))
		tmp = (x * log(y)) - t;
	else
		tmp = (y - log(y)) - t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -7.2e+16], N[Not[LessEqual[x, 1.0]], $MachinePrecision]], N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(y - N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.2 \cdot 10^{+16} \lor \neg \left(x \leq 1\right):\\
\;\;\;\;x \cdot \log y - t\\

\mathbf{else}:\\
\;\;\;\;\left(y - \log y\right) - t\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -7.2e16 or 1 < x

    1. Initial program 96.2%

      \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
    2. Taylor expanded in y around 0 99.2%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\left(-1 \cdot \left(y \cdot \left(z - 1\right)\right) + -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)}\right) - t \]
    3. Step-by-step derivation
      1. fma-def99.2%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\mathsf{fma}\left(-1, y \cdot \left(z - 1\right), -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)}\right) - t \]
      2. sub-neg99.2%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \color{blue}{\left(z + \left(-1\right)\right)}, -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)\right) - t \]
      3. metadata-eval99.2%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(z + \color{blue}{-1}\right), -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)\right) - t \]
      4. +-commutative99.2%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \color{blue}{\left(-1 + z\right)}, -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)\right) - t \]
      5. unpow299.2%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\color{blue}{\left(y \cdot y\right)} \cdot \left(z - 1\right)\right)\right)\right) - t \]
      6. sub-neg99.2%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\left(y \cdot y\right) \cdot \color{blue}{\left(z + \left(-1\right)\right)}\right)\right)\right) - t \]
      7. metadata-eval99.2%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\left(y \cdot y\right) \cdot \left(z + \color{blue}{-1}\right)\right)\right)\right) - t \]
      8. +-commutative99.2%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\left(y \cdot y\right) \cdot \color{blue}{\left(-1 + z\right)}\right)\right)\right) - t \]
    4. Simplified99.2%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\left(y \cdot y\right) \cdot \left(-1 + z\right)\right)\right)}\right) - t \]
    5. Taylor expanded in x around inf 94.2%

      \[\leadsto \color{blue}{x \cdot \log y} - t \]
    6. Step-by-step derivation
      1. *-commutative94.2%

        \[\leadsto \color{blue}{\log y \cdot x} - t \]
    7. Simplified94.2%

      \[\leadsto \color{blue}{\log y \cdot x} - t \]

    if -7.2e16 < x < 1

    1. Initial program 86.3%

      \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
    2. Taylor expanded in y around 0 98.6%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\left(-1 \cdot \left(y \cdot \left(z - 1\right)\right) + -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)}\right) - t \]
    3. Step-by-step derivation
      1. fma-def98.6%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\mathsf{fma}\left(-1, y \cdot \left(z - 1\right), -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)}\right) - t \]
      2. sub-neg98.6%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \color{blue}{\left(z + \left(-1\right)\right)}, -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)\right) - t \]
      3. metadata-eval98.6%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(z + \color{blue}{-1}\right), -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)\right) - t \]
      4. +-commutative98.6%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \color{blue}{\left(-1 + z\right)}, -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)\right) - t \]
      5. unpow298.6%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\color{blue}{\left(y \cdot y\right)} \cdot \left(z - 1\right)\right)\right)\right) - t \]
      6. sub-neg98.6%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\left(y \cdot y\right) \cdot \color{blue}{\left(z + \left(-1\right)\right)}\right)\right)\right) - t \]
      7. metadata-eval98.6%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\left(y \cdot y\right) \cdot \left(z + \color{blue}{-1}\right)\right)\right)\right) - t \]
      8. +-commutative98.6%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\left(y \cdot y\right) \cdot \color{blue}{\left(-1 + z\right)}\right)\right)\right) - t \]
    4. Simplified98.6%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\left(y \cdot y\right) \cdot \left(-1 + z\right)\right)\right)}\right) - t \]
    5. Taylor expanded in y around 0 97.7%

      \[\leadsto \color{blue}{\left(-1 \cdot \left(y \cdot \left(z - 1\right)\right) + \log y \cdot \left(x - 1\right)\right)} - t \]
    6. Step-by-step derivation
      1. +-commutative97.7%

        \[\leadsto \color{blue}{\left(\log y \cdot \left(x - 1\right) + -1 \cdot \left(y \cdot \left(z - 1\right)\right)\right)} - t \]
      2. sub-neg97.7%

        \[\leadsto \left(\log y \cdot \color{blue}{\left(x + \left(-1\right)\right)} + -1 \cdot \left(y \cdot \left(z - 1\right)\right)\right) - t \]
      3. metadata-eval97.7%

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

        \[\leadsto \left(\log y \cdot \color{blue}{\left(-1 + x\right)} + -1 \cdot \left(y \cdot \left(z - 1\right)\right)\right) - t \]
      5. fma-def97.7%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\log y, -1 + x, -1 \cdot \left(y \cdot \left(z - 1\right)\right)\right)} - t \]
      6. mul-1-neg97.7%

        \[\leadsto \mathsf{fma}\left(\log y, -1 + x, \color{blue}{-y \cdot \left(z - 1\right)}\right) - t \]
      7. sub-neg97.7%

        \[\leadsto \mathsf{fma}\left(\log y, -1 + x, -y \cdot \color{blue}{\left(z + \left(-1\right)\right)}\right) - t \]
      8. metadata-eval97.7%

        \[\leadsto \mathsf{fma}\left(\log y, -1 + x, -y \cdot \left(z + \color{blue}{-1}\right)\right) - t \]
      9. +-commutative97.7%

        \[\leadsto \mathsf{fma}\left(\log y, -1 + x, -y \cdot \color{blue}{\left(-1 + z\right)}\right) - t \]
      10. fma-neg97.7%

        \[\leadsto \color{blue}{\left(\log y \cdot \left(-1 + x\right) - y \cdot \left(-1 + z\right)\right)} - t \]
      11. distribute-rgt-in97.7%

        \[\leadsto \left(\log y \cdot \left(-1 + x\right) - \color{blue}{\left(-1 \cdot y + z \cdot y\right)}\right) - t \]
      12. neg-mul-197.7%

        \[\leadsto \left(\log y \cdot \left(-1 + x\right) - \left(\color{blue}{\left(-y\right)} + z \cdot y\right)\right) - t \]
      13. +-commutative97.7%

        \[\leadsto \left(\log y \cdot \left(-1 + x\right) - \color{blue}{\left(z \cdot y + \left(-y\right)\right)}\right) - t \]
      14. unsub-neg97.7%

        \[\leadsto \left(\log y \cdot \left(-1 + x\right) - \color{blue}{\left(z \cdot y - y\right)}\right) - t \]
      15. *-commutative97.7%

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

      \[\leadsto \color{blue}{\left(\log y \cdot \left(-1 + x\right) - \left(y \cdot z - y\right)\right)} - t \]
    8. Taylor expanded in x around 0 95.8%

      \[\leadsto \color{blue}{\left(\left(y + -1 \cdot \log y\right) - y \cdot z\right)} - t \]
    9. Step-by-step derivation
      1. mul-1-neg95.8%

        \[\leadsto \left(\left(y + \color{blue}{\left(-\log y\right)}\right) - y \cdot z\right) - t \]
      2. unsub-neg95.8%

        \[\leadsto \left(\color{blue}{\left(y - \log y\right)} - y \cdot z\right) - t \]
    10. Simplified95.8%

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

      \[\leadsto \color{blue}{\left(y - \log y\right)} - t \]
  3. Recombined 2 regimes into one program.
  4. Final simplification87.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -7.2 \cdot 10^{+16} \lor \neg \left(x \leq 1\right):\\ \;\;\;\;x \cdot \log y - t\\ \mathbf{else}:\\ \;\;\;\;\left(y - \log y\right) - t\\ \end{array} \]

Alternative 10: 88.6% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq 2.1 \cdot 10^{+159}:\\ \;\;\;\;\left(x + -1\right) \cdot \log y - t\\ \mathbf{else}:\\ \;\;\;\;\left(-t\right) - z \cdot \left(y + \left(y \cdot y\right) \cdot 0.5\right)\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= z 2.1e+159)
   (- (* (+ x -1.0) (log y)) t)
   (- (- t) (* z (+ y (* (* y y) 0.5))))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (z <= 2.1e+159) {
		tmp = ((x + -1.0) * log(y)) - t;
	} else {
		tmp = -t - (z * (y + ((y * y) * 0.5)));
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if (z <= 2.1d+159) then
        tmp = ((x + (-1.0d0)) * log(y)) - t
    else
        tmp = -t - (z * (y + ((y * y) * 0.5d0)))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (z <= 2.1e+159) {
		tmp = ((x + -1.0) * Math.log(y)) - t;
	} else {
		tmp = -t - (z * (y + ((y * y) * 0.5)));
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if z <= 2.1e+159:
		tmp = ((x + -1.0) * math.log(y)) - t
	else:
		tmp = -t - (z * (y + ((y * y) * 0.5)))
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (z <= 2.1e+159)
		tmp = Float64(Float64(Float64(x + -1.0) * log(y)) - t);
	else
		tmp = Float64(Float64(-t) - Float64(z * Float64(y + Float64(Float64(y * y) * 0.5))));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (z <= 2.1e+159)
		tmp = ((x + -1.0) * log(y)) - t;
	else
		tmp = -t - (z * (y + ((y * y) * 0.5)));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[z, 2.1e+159], N[(N[(N[(x + -1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[((-t) - N[(z * N[(y + N[(N[(y * y), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq 2.1 \cdot 10^{+159}:\\
\;\;\;\;\left(x + -1\right) \cdot \log y - t\\

\mathbf{else}:\\
\;\;\;\;\left(-t\right) - z \cdot \left(y + \left(y \cdot y\right) \cdot 0.5\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 2.09999999999999989e159

    1. Initial program 95.4%

      \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
    2. Step-by-step derivation
      1. +-commutative95.4%

        \[\leadsto \color{blue}{\left(\left(z - 1\right) \cdot \log \left(1 - y\right) + \left(x - 1\right) \cdot \log y\right)} - t \]
      2. fma-def95.4%

        \[\leadsto \color{blue}{\mathsf{fma}\left(z - 1, \log \left(1 - y\right), \left(x - 1\right) \cdot \log y\right)} - t \]
      3. sub-neg95.4%

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

        \[\leadsto \mathsf{fma}\left(z + \color{blue}{-1}, \log \left(1 - y\right), \left(x - 1\right) \cdot \log y\right) - t \]
      5. sub-neg95.4%

        \[\leadsto \mathsf{fma}\left(z + -1, \log \color{blue}{\left(1 + \left(-y\right)\right)}, \left(x - 1\right) \cdot \log y\right) - t \]
      6. log1p-def99.8%

        \[\leadsto \mathsf{fma}\left(z + -1, \color{blue}{\mathsf{log1p}\left(-y\right)}, \left(x - 1\right) \cdot \log y\right) - t \]
      7. sub-neg99.8%

        \[\leadsto \mathsf{fma}\left(z + -1, \mathsf{log1p}\left(-y\right), \color{blue}{\left(x + \left(-1\right)\right)} \cdot \log y\right) - t \]
      8. metadata-eval99.8%

        \[\leadsto \mathsf{fma}\left(z + -1, \mathsf{log1p}\left(-y\right), \left(x + \color{blue}{-1}\right) \cdot \log y\right) - t \]
    3. Simplified99.8%

      \[\leadsto \color{blue}{\mathsf{fma}\left(z + -1, \mathsf{log1p}\left(-y\right), \left(x + -1\right) \cdot \log y\right) - t} \]
    4. Taylor expanded in y around 0 94.1%

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

    if 2.09999999999999989e159 < z

    1. Initial program 64.2%

      \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
    2. Taylor expanded in y around 0 97.9%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\left(-1 \cdot \left(y \cdot \left(z - 1\right)\right) + -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)}\right) - t \]
    3. Step-by-step derivation
      1. fma-def97.9%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\mathsf{fma}\left(-1, y \cdot \left(z - 1\right), -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)}\right) - t \]
      2. sub-neg97.9%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \color{blue}{\left(z + \left(-1\right)\right)}, -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)\right) - t \]
      3. metadata-eval97.9%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(z + \color{blue}{-1}\right), -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)\right) - t \]
      4. +-commutative97.9%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \color{blue}{\left(-1 + z\right)}, -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)\right) - t \]
      5. unpow297.9%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\color{blue}{\left(y \cdot y\right)} \cdot \left(z - 1\right)\right)\right)\right) - t \]
      6. sub-neg97.9%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\left(y \cdot y\right) \cdot \color{blue}{\left(z + \left(-1\right)\right)}\right)\right)\right) - t \]
      7. metadata-eval97.9%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\left(y \cdot y\right) \cdot \left(z + \color{blue}{-1}\right)\right)\right)\right) - t \]
      8. +-commutative97.9%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\left(y \cdot y\right) \cdot \color{blue}{\left(-1 + z\right)}\right)\right)\right) - t \]
    4. Simplified97.9%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\left(y \cdot y\right) \cdot \left(-1 + z\right)\right)\right)}\right) - t \]
    5. Taylor expanded in z around -inf 73.6%

      \[\leadsto \color{blue}{-1 \cdot \left(z \cdot \left(y + 0.5 \cdot {y}^{2}\right)\right)} - t \]
    6. Step-by-step derivation
      1. mul-1-neg73.6%

        \[\leadsto \color{blue}{\left(-z \cdot \left(y + 0.5 \cdot {y}^{2}\right)\right)} - t \]
      2. unpow273.6%

        \[\leadsto \left(-z \cdot \left(y + 0.5 \cdot \color{blue}{\left(y \cdot y\right)}\right)\right) - t \]
    7. Simplified73.6%

      \[\leadsto \color{blue}{\left(-z \cdot \left(y + 0.5 \cdot \left(y \cdot y\right)\right)\right)} - t \]
  3. Recombined 2 regimes into one program.
  4. Final simplification91.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 2.1 \cdot 10^{+159}:\\ \;\;\;\;\left(x + -1\right) \cdot \log y - t\\ \mathbf{else}:\\ \;\;\;\;\left(-t\right) - z \cdot \left(y + \left(y \cdot y\right) \cdot 0.5\right)\\ \end{array} \]

Alternative 11: 59.6% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -6 \cdot 10^{+125} \lor \neg \left(z \leq 1.65 \cdot 10^{+16}\right):\\ \;\;\;\;\left(-t\right) - z \cdot \left(y + \left(y \cdot y\right) \cdot 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;\left(-t\right) - \log y\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (or (<= z -6e+125) (not (<= z 1.65e+16)))
   (- (- t) (* z (+ y (* (* y y) 0.5))))
   (- (- t) (log y))))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((z <= -6e+125) || !(z <= 1.65e+16)) {
		tmp = -t - (z * (y + ((y * y) * 0.5)));
	} else {
		tmp = -t - log(y);
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if ((z <= (-6d+125)) .or. (.not. (z <= 1.65d+16))) then
        tmp = -t - (z * (y + ((y * y) * 0.5d0)))
    else
        tmp = -t - log(y)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if ((z <= -6e+125) || !(z <= 1.65e+16)) {
		tmp = -t - (z * (y + ((y * y) * 0.5)));
	} else {
		tmp = -t - Math.log(y);
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (z <= -6e+125) or not (z <= 1.65e+16):
		tmp = -t - (z * (y + ((y * y) * 0.5)))
	else:
		tmp = -t - math.log(y)
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if ((z <= -6e+125) || !(z <= 1.65e+16))
		tmp = Float64(Float64(-t) - Float64(z * Float64(y + Float64(Float64(y * y) * 0.5))));
	else
		tmp = Float64(Float64(-t) - log(y));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if ((z <= -6e+125) || ~((z <= 1.65e+16)))
		tmp = -t - (z * (y + ((y * y) * 0.5)));
	else
		tmp = -t - log(y);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -6e+125], N[Not[LessEqual[z, 1.65e+16]], $MachinePrecision]], N[((-t) - N[(z * N[(y + N[(N[(y * y), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-t) - N[Log[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -6 \cdot 10^{+125} \lor \neg \left(z \leq 1.65 \cdot 10^{+16}\right):\\
\;\;\;\;\left(-t\right) - z \cdot \left(y + \left(y \cdot y\right) \cdot 0.5\right)\\

\mathbf{else}:\\
\;\;\;\;\left(-t\right) - \log y\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -6.0000000000000003e125 or 1.65e16 < z

    1. Initial program 77.5%

      \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
    2. Taylor expanded in y around 0 98.0%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\left(-1 \cdot \left(y \cdot \left(z - 1\right)\right) + -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)}\right) - t \]
    3. Step-by-step derivation
      1. fma-def98.0%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\mathsf{fma}\left(-1, y \cdot \left(z - 1\right), -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)}\right) - t \]
      2. sub-neg98.0%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \color{blue}{\left(z + \left(-1\right)\right)}, -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)\right) - t \]
      3. metadata-eval98.0%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(z + \color{blue}{-1}\right), -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)\right) - t \]
      4. +-commutative98.0%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \color{blue}{\left(-1 + z\right)}, -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)\right) - t \]
      5. unpow298.0%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\color{blue}{\left(y \cdot y\right)} \cdot \left(z - 1\right)\right)\right)\right) - t \]
      6. sub-neg98.0%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\left(y \cdot y\right) \cdot \color{blue}{\left(z + \left(-1\right)\right)}\right)\right)\right) - t \]
      7. metadata-eval98.0%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\left(y \cdot y\right) \cdot \left(z + \color{blue}{-1}\right)\right)\right)\right) - t \]
      8. +-commutative98.0%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\left(y \cdot y\right) \cdot \color{blue}{\left(-1 + z\right)}\right)\right)\right) - t \]
    4. Simplified98.0%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\left(y \cdot y\right) \cdot \left(-1 + z\right)\right)\right)}\right) - t \]
    5. Taylor expanded in z around -inf 58.6%

      \[\leadsto \color{blue}{-1 \cdot \left(z \cdot \left(y + 0.5 \cdot {y}^{2}\right)\right)} - t \]
    6. Step-by-step derivation
      1. mul-1-neg58.6%

        \[\leadsto \color{blue}{\left(-z \cdot \left(y + 0.5 \cdot {y}^{2}\right)\right)} - t \]
      2. unpow258.6%

        \[\leadsto \left(-z \cdot \left(y + 0.5 \cdot \color{blue}{\left(y \cdot y\right)}\right)\right) - t \]
    7. Simplified58.6%

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

    if -6.0000000000000003e125 < z < 1.65e16

    1. Initial program 99.0%

      \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
    2. Step-by-step derivation
      1. +-commutative99.0%

        \[\leadsto \color{blue}{\left(\left(z - 1\right) \cdot \log \left(1 - y\right) + \left(x - 1\right) \cdot \log y\right)} - t \]
      2. fma-def99.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(z - 1, \log \left(1 - y\right), \left(x - 1\right) \cdot \log y\right)} - t \]
      3. sub-neg99.0%

        \[\leadsto \mathsf{fma}\left(\color{blue}{z + \left(-1\right)}, \log \left(1 - y\right), \left(x - 1\right) \cdot \log y\right) - t \]
      4. metadata-eval99.0%

        \[\leadsto \mathsf{fma}\left(z + \color{blue}{-1}, \log \left(1 - y\right), \left(x - 1\right) \cdot \log y\right) - t \]
      5. sub-neg99.0%

        \[\leadsto \mathsf{fma}\left(z + -1, \log \color{blue}{\left(1 + \left(-y\right)\right)}, \left(x - 1\right) \cdot \log y\right) - t \]
      6. log1p-def99.8%

        \[\leadsto \mathsf{fma}\left(z + -1, \color{blue}{\mathsf{log1p}\left(-y\right)}, \left(x - 1\right) \cdot \log y\right) - t \]
      7. sub-neg99.8%

        \[\leadsto \mathsf{fma}\left(z + -1, \mathsf{log1p}\left(-y\right), \color{blue}{\left(x + \left(-1\right)\right)} \cdot \log y\right) - t \]
      8. metadata-eval99.8%

        \[\leadsto \mathsf{fma}\left(z + -1, \mathsf{log1p}\left(-y\right), \left(x + \color{blue}{-1}\right) \cdot \log y\right) - t \]
    3. Simplified99.8%

      \[\leadsto \color{blue}{\mathsf{fma}\left(z + -1, \mathsf{log1p}\left(-y\right), \left(x + -1\right) \cdot \log y\right) - t} \]
    4. Taylor expanded in y around 0 98.3%

      \[\leadsto \color{blue}{\log y \cdot \left(x - 1\right) - t} \]
    5. Step-by-step derivation
      1. fma-neg98.3%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\log y, x - 1, -t\right)} \]
      2. sub-neg98.3%

        \[\leadsto \mathsf{fma}\left(\log y, \color{blue}{x + \left(-1\right)}, -t\right) \]
      3. metadata-eval98.3%

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

        \[\leadsto \mathsf{fma}\left(\log y, \color{blue}{-1 + x}, -t\right) \]
    6. Simplified98.3%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\log y, -1 + x, -t\right)} \]
    7. Taylor expanded in x around 0 61.1%

      \[\leadsto \color{blue}{-1 \cdot \log y - t} \]
    8. Step-by-step derivation
      1. neg-mul-161.1%

        \[\leadsto \color{blue}{\left(-\log y\right)} - t \]
    9. Simplified61.1%

      \[\leadsto \color{blue}{\left(-\log y\right) - t} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification60.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -6 \cdot 10^{+125} \lor \neg \left(z \leq 1.65 \cdot 10^{+16}\right):\\ \;\;\;\;\left(-t\right) - z \cdot \left(y + \left(y \cdot y\right) \cdot 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;\left(-t\right) - \log y\\ \end{array} \]

Alternative 12: 45.5% accurate, 17.9× speedup?

\[\begin{array}{l} \\ \left(-t\right) - z \cdot \left(y + \left(y \cdot y\right) \cdot 0.5\right) \end{array} \]
(FPCore (x y z t) :precision binary64 (- (- t) (* z (+ y (* (* y y) 0.5)))))
double code(double x, double y, double z, double t) {
	return -t - (z * (y + ((y * y) * 0.5)));
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = -t - (z * (y + ((y * y) * 0.5d0)))
end function
public static double code(double x, double y, double z, double t) {
	return -t - (z * (y + ((y * y) * 0.5)));
}
def code(x, y, z, t):
	return -t - (z * (y + ((y * y) * 0.5)))
function code(x, y, z, t)
	return Float64(Float64(-t) - Float64(z * Float64(y + Float64(Float64(y * y) * 0.5))))
end
function tmp = code(x, y, z, t)
	tmp = -t - (z * (y + ((y * y) * 0.5)));
end
code[x_, y_, z_, t_] := N[((-t) - N[(z * N[(y + N[(N[(y * y), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(-t\right) - z \cdot \left(y + \left(y \cdot y\right) \cdot 0.5\right)
\end{array}
Derivation
  1. Initial program 91.1%

    \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
  2. Taylor expanded in y around 0 98.9%

    \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\left(-1 \cdot \left(y \cdot \left(z - 1\right)\right) + -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)}\right) - t \]
  3. Step-by-step derivation
    1. fma-def98.9%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\mathsf{fma}\left(-1, y \cdot \left(z - 1\right), -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)}\right) - t \]
    2. sub-neg98.9%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \color{blue}{\left(z + \left(-1\right)\right)}, -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)\right) - t \]
    3. metadata-eval98.9%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(z + \color{blue}{-1}\right), -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)\right) - t \]
    4. +-commutative98.9%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \color{blue}{\left(-1 + z\right)}, -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)\right) - t \]
    5. unpow298.9%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\color{blue}{\left(y \cdot y\right)} \cdot \left(z - 1\right)\right)\right)\right) - t \]
    6. sub-neg98.9%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\left(y \cdot y\right) \cdot \color{blue}{\left(z + \left(-1\right)\right)}\right)\right)\right) - t \]
    7. metadata-eval98.9%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\left(y \cdot y\right) \cdot \left(z + \color{blue}{-1}\right)\right)\right)\right) - t \]
    8. +-commutative98.9%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\left(y \cdot y\right) \cdot \color{blue}{\left(-1 + z\right)}\right)\right)\right) - t \]
  4. Simplified98.9%

    \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\left(y \cdot y\right) \cdot \left(-1 + z\right)\right)\right)}\right) - t \]
  5. Taylor expanded in z around -inf 48.2%

    \[\leadsto \color{blue}{-1 \cdot \left(z \cdot \left(y + 0.5 \cdot {y}^{2}\right)\right)} - t \]
  6. Step-by-step derivation
    1. mul-1-neg48.2%

      \[\leadsto \color{blue}{\left(-z \cdot \left(y + 0.5 \cdot {y}^{2}\right)\right)} - t \]
    2. unpow248.2%

      \[\leadsto \left(-z \cdot \left(y + 0.5 \cdot \color{blue}{\left(y \cdot y\right)}\right)\right) - t \]
  7. Simplified48.2%

    \[\leadsto \color{blue}{\left(-z \cdot \left(y + 0.5 \cdot \left(y \cdot y\right)\right)\right)} - t \]
  8. Final simplification48.2%

    \[\leadsto \left(-t\right) - z \cdot \left(y + \left(y \cdot y\right) \cdot 0.5\right) \]

Alternative 13: 42.4% accurate, 23.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq -80:\\ \;\;\;\;-t\\ \mathbf{elif}\;t \leq 48000:\\ \;\;\;\;y \cdot \left(1 - z\right)\\ \mathbf{else}:\\ \;\;\;\;-t\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= t -80.0) (- t) (if (<= t 48000.0) (* y (- 1.0 z)) (- t))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (t <= -80.0) {
		tmp = -t;
	} else if (t <= 48000.0) {
		tmp = y * (1.0 - z);
	} else {
		tmp = -t;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if (t <= (-80.0d0)) then
        tmp = -t
    else if (t <= 48000.0d0) then
        tmp = y * (1.0d0 - z)
    else
        tmp = -t
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (t <= -80.0) {
		tmp = -t;
	} else if (t <= 48000.0) {
		tmp = y * (1.0 - z);
	} else {
		tmp = -t;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if t <= -80.0:
		tmp = -t
	elif t <= 48000.0:
		tmp = y * (1.0 - z)
	else:
		tmp = -t
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (t <= -80.0)
		tmp = Float64(-t);
	elseif (t <= 48000.0)
		tmp = Float64(y * Float64(1.0 - z));
	else
		tmp = Float64(-t);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (t <= -80.0)
		tmp = -t;
	elseif (t <= 48000.0)
		tmp = y * (1.0 - z);
	else
		tmp = -t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[t, -80.0], (-t), If[LessEqual[t, 48000.0], N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision], (-t)]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;t \leq -80:\\
\;\;\;\;-t\\

\mathbf{elif}\;t \leq 48000:\\
\;\;\;\;y \cdot \left(1 - z\right)\\

\mathbf{else}:\\
\;\;\;\;-t\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -80 or 48000 < t

    1. Initial program 96.9%

      \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
    2. Step-by-step derivation
      1. +-commutative96.9%

        \[\leadsto \color{blue}{\left(\left(z - 1\right) \cdot \log \left(1 - y\right) + \left(x - 1\right) \cdot \log y\right)} - t \]
      2. fma-def96.9%

        \[\leadsto \color{blue}{\mathsf{fma}\left(z - 1, \log \left(1 - y\right), \left(x - 1\right) \cdot \log y\right)} - t \]
      3. sub-neg96.9%

        \[\leadsto \mathsf{fma}\left(\color{blue}{z + \left(-1\right)}, \log \left(1 - y\right), \left(x - 1\right) \cdot \log y\right) - t \]
      4. metadata-eval96.9%

        \[\leadsto \mathsf{fma}\left(z + \color{blue}{-1}, \log \left(1 - y\right), \left(x - 1\right) \cdot \log y\right) - t \]
      5. sub-neg96.9%

        \[\leadsto \mathsf{fma}\left(z + -1, \log \color{blue}{\left(1 + \left(-y\right)\right)}, \left(x - 1\right) \cdot \log y\right) - t \]
      6. log1p-def99.9%

        \[\leadsto \mathsf{fma}\left(z + -1, \color{blue}{\mathsf{log1p}\left(-y\right)}, \left(x - 1\right) \cdot \log y\right) - t \]
      7. sub-neg99.9%

        \[\leadsto \mathsf{fma}\left(z + -1, \mathsf{log1p}\left(-y\right), \color{blue}{\left(x + \left(-1\right)\right)} \cdot \log y\right) - t \]
      8. metadata-eval99.9%

        \[\leadsto \mathsf{fma}\left(z + -1, \mathsf{log1p}\left(-y\right), \left(x + \color{blue}{-1}\right) \cdot \log y\right) - t \]
    3. Simplified99.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(z + -1, \mathsf{log1p}\left(-y\right), \left(x + -1\right) \cdot \log y\right) - t} \]
    4. Taylor expanded in t around inf 74.7%

      \[\leadsto \color{blue}{-1 \cdot t} \]
    5. Step-by-step derivation
      1. mul-1-neg74.7%

        \[\leadsto \color{blue}{-t} \]
    6. Simplified74.7%

      \[\leadsto \color{blue}{-t} \]

    if -80 < t < 48000

    1. Initial program 85.2%

      \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
    2. Taylor expanded in y around 0 99.2%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\left(-1 \cdot \left(y \cdot \left(z - 1\right)\right) + -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)}\right) - t \]
    3. Step-by-step derivation
      1. fma-def99.2%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\mathsf{fma}\left(-1, y \cdot \left(z - 1\right), -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)}\right) - t \]
      2. sub-neg99.2%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \color{blue}{\left(z + \left(-1\right)\right)}, -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)\right) - t \]
      3. metadata-eval99.2%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(z + \color{blue}{-1}\right), -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)\right) - t \]
      4. +-commutative99.2%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \color{blue}{\left(-1 + z\right)}, -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)\right) - t \]
      5. unpow299.2%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\color{blue}{\left(y \cdot y\right)} \cdot \left(z - 1\right)\right)\right)\right) - t \]
      6. sub-neg99.2%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\left(y \cdot y\right) \cdot \color{blue}{\left(z + \left(-1\right)\right)}\right)\right)\right) - t \]
      7. metadata-eval99.2%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\left(y \cdot y\right) \cdot \left(z + \color{blue}{-1}\right)\right)\right)\right) - t \]
      8. +-commutative99.2%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\left(y \cdot y\right) \cdot \color{blue}{\left(-1 + z\right)}\right)\right)\right) - t \]
    4. Simplified99.2%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\left(y \cdot y\right) \cdot \left(-1 + z\right)\right)\right)}\right) - t \]
    5. Taylor expanded in y around 0 98.4%

      \[\leadsto \color{blue}{\left(-1 \cdot \left(y \cdot \left(z - 1\right)\right) + \log y \cdot \left(x - 1\right)\right)} - t \]
    6. Step-by-step derivation
      1. +-commutative98.4%

        \[\leadsto \color{blue}{\left(\log y \cdot \left(x - 1\right) + -1 \cdot \left(y \cdot \left(z - 1\right)\right)\right)} - t \]
      2. sub-neg98.4%

        \[\leadsto \left(\log y \cdot \color{blue}{\left(x + \left(-1\right)\right)} + -1 \cdot \left(y \cdot \left(z - 1\right)\right)\right) - t \]
      3. metadata-eval98.4%

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

        \[\leadsto \left(\log y \cdot \color{blue}{\left(-1 + x\right)} + -1 \cdot \left(y \cdot \left(z - 1\right)\right)\right) - t \]
      5. fma-def98.4%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\log y, -1 + x, -1 \cdot \left(y \cdot \left(z - 1\right)\right)\right)} - t \]
      6. mul-1-neg98.4%

        \[\leadsto \mathsf{fma}\left(\log y, -1 + x, \color{blue}{-y \cdot \left(z - 1\right)}\right) - t \]
      7. sub-neg98.4%

        \[\leadsto \mathsf{fma}\left(\log y, -1 + x, -y \cdot \color{blue}{\left(z + \left(-1\right)\right)}\right) - t \]
      8. metadata-eval98.4%

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

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

        \[\leadsto \color{blue}{\left(\log y \cdot \left(-1 + x\right) - y \cdot \left(-1 + z\right)\right)} - t \]
      11. distribute-rgt-in98.4%

        \[\leadsto \left(\log y \cdot \left(-1 + x\right) - \color{blue}{\left(-1 \cdot y + z \cdot y\right)}\right) - t \]
      12. neg-mul-198.4%

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

        \[\leadsto \left(\log y \cdot \left(-1 + x\right) - \color{blue}{\left(z \cdot y + \left(-y\right)\right)}\right) - t \]
      14. unsub-neg98.4%

        \[\leadsto \left(\log y \cdot \left(-1 + x\right) - \color{blue}{\left(z \cdot y - y\right)}\right) - t \]
      15. *-commutative98.4%

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

      \[\leadsto \color{blue}{\left(\log y \cdot \left(-1 + x\right) - \left(y \cdot z - y\right)\right)} - t \]
    8. Taylor expanded in y around inf 16.9%

      \[\leadsto \color{blue}{y \cdot \left(1 - z\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification46.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -80:\\ \;\;\;\;-t\\ \mathbf{elif}\;t \leq 48000:\\ \;\;\;\;y \cdot \left(1 - z\right)\\ \mathbf{else}:\\ \;\;\;\;-t\\ \end{array} \]

Alternative 14: 42.2% accurate, 26.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq -80:\\ \;\;\;\;-t\\ \mathbf{elif}\;t \leq 5500:\\ \;\;\;\;y \cdot \left(-z\right)\\ \mathbf{else}:\\ \;\;\;\;-t\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= t -80.0) (- t) (if (<= t 5500.0) (* y (- z)) (- t))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (t <= -80.0) {
		tmp = -t;
	} else if (t <= 5500.0) {
		tmp = y * -z;
	} else {
		tmp = -t;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if (t <= (-80.0d0)) then
        tmp = -t
    else if (t <= 5500.0d0) then
        tmp = y * -z
    else
        tmp = -t
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (t <= -80.0) {
		tmp = -t;
	} else if (t <= 5500.0) {
		tmp = y * -z;
	} else {
		tmp = -t;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if t <= -80.0:
		tmp = -t
	elif t <= 5500.0:
		tmp = y * -z
	else:
		tmp = -t
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (t <= -80.0)
		tmp = Float64(-t);
	elseif (t <= 5500.0)
		tmp = Float64(y * Float64(-z));
	else
		tmp = Float64(-t);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (t <= -80.0)
		tmp = -t;
	elseif (t <= 5500.0)
		tmp = y * -z;
	else
		tmp = -t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[t, -80.0], (-t), If[LessEqual[t, 5500.0], N[(y * (-z)), $MachinePrecision], (-t)]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;t \leq -80:\\
\;\;\;\;-t\\

\mathbf{elif}\;t \leq 5500:\\
\;\;\;\;y \cdot \left(-z\right)\\

\mathbf{else}:\\
\;\;\;\;-t\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -80 or 5500 < t

    1. Initial program 96.9%

      \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
    2. Step-by-step derivation
      1. +-commutative96.9%

        \[\leadsto \color{blue}{\left(\left(z - 1\right) \cdot \log \left(1 - y\right) + \left(x - 1\right) \cdot \log y\right)} - t \]
      2. fma-def96.9%

        \[\leadsto \color{blue}{\mathsf{fma}\left(z - 1, \log \left(1 - y\right), \left(x - 1\right) \cdot \log y\right)} - t \]
      3. sub-neg96.9%

        \[\leadsto \mathsf{fma}\left(\color{blue}{z + \left(-1\right)}, \log \left(1 - y\right), \left(x - 1\right) \cdot \log y\right) - t \]
      4. metadata-eval96.9%

        \[\leadsto \mathsf{fma}\left(z + \color{blue}{-1}, \log \left(1 - y\right), \left(x - 1\right) \cdot \log y\right) - t \]
      5. sub-neg96.9%

        \[\leadsto \mathsf{fma}\left(z + -1, \log \color{blue}{\left(1 + \left(-y\right)\right)}, \left(x - 1\right) \cdot \log y\right) - t \]
      6. log1p-def99.9%

        \[\leadsto \mathsf{fma}\left(z + -1, \color{blue}{\mathsf{log1p}\left(-y\right)}, \left(x - 1\right) \cdot \log y\right) - t \]
      7. sub-neg99.9%

        \[\leadsto \mathsf{fma}\left(z + -1, \mathsf{log1p}\left(-y\right), \color{blue}{\left(x + \left(-1\right)\right)} \cdot \log y\right) - t \]
      8. metadata-eval99.9%

        \[\leadsto \mathsf{fma}\left(z + -1, \mathsf{log1p}\left(-y\right), \left(x + \color{blue}{-1}\right) \cdot \log y\right) - t \]
    3. Simplified99.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(z + -1, \mathsf{log1p}\left(-y\right), \left(x + -1\right) \cdot \log y\right) - t} \]
    4. Taylor expanded in t around inf 74.7%

      \[\leadsto \color{blue}{-1 \cdot t} \]
    5. Step-by-step derivation
      1. mul-1-neg74.7%

        \[\leadsto \color{blue}{-t} \]
    6. Simplified74.7%

      \[\leadsto \color{blue}{-t} \]

    if -80 < t < 5500

    1. Initial program 85.2%

      \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
    2. Taylor expanded in y around 0 99.2%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\left(-1 \cdot \left(y \cdot \left(z - 1\right)\right) + -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)}\right) - t \]
    3. Step-by-step derivation
      1. fma-def99.2%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\mathsf{fma}\left(-1, y \cdot \left(z - 1\right), -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)}\right) - t \]
      2. sub-neg99.2%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \color{blue}{\left(z + \left(-1\right)\right)}, -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)\right) - t \]
      3. metadata-eval99.2%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(z + \color{blue}{-1}\right), -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)\right) - t \]
      4. +-commutative99.2%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \color{blue}{\left(-1 + z\right)}, -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)\right) - t \]
      5. unpow299.2%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\color{blue}{\left(y \cdot y\right)} \cdot \left(z - 1\right)\right)\right)\right) - t \]
      6. sub-neg99.2%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\left(y \cdot y\right) \cdot \color{blue}{\left(z + \left(-1\right)\right)}\right)\right)\right) - t \]
      7. metadata-eval99.2%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\left(y \cdot y\right) \cdot \left(z + \color{blue}{-1}\right)\right)\right)\right) - t \]
      8. +-commutative99.2%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\left(y \cdot y\right) \cdot \color{blue}{\left(-1 + z\right)}\right)\right)\right) - t \]
    4. Simplified99.2%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\left(y \cdot y\right) \cdot \left(-1 + z\right)\right)\right)}\right) - t \]
    5. Taylor expanded in y around 0 98.4%

      \[\leadsto \color{blue}{\left(-1 \cdot \left(y \cdot \left(z - 1\right)\right) + \log y \cdot \left(x - 1\right)\right)} - t \]
    6. Step-by-step derivation
      1. +-commutative98.4%

        \[\leadsto \color{blue}{\left(\log y \cdot \left(x - 1\right) + -1 \cdot \left(y \cdot \left(z - 1\right)\right)\right)} - t \]
      2. sub-neg98.4%

        \[\leadsto \left(\log y \cdot \color{blue}{\left(x + \left(-1\right)\right)} + -1 \cdot \left(y \cdot \left(z - 1\right)\right)\right) - t \]
      3. metadata-eval98.4%

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

        \[\leadsto \left(\log y \cdot \color{blue}{\left(-1 + x\right)} + -1 \cdot \left(y \cdot \left(z - 1\right)\right)\right) - t \]
      5. fma-def98.4%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\log y, -1 + x, -1 \cdot \left(y \cdot \left(z - 1\right)\right)\right)} - t \]
      6. mul-1-neg98.4%

        \[\leadsto \mathsf{fma}\left(\log y, -1 + x, \color{blue}{-y \cdot \left(z - 1\right)}\right) - t \]
      7. sub-neg98.4%

        \[\leadsto \mathsf{fma}\left(\log y, -1 + x, -y \cdot \color{blue}{\left(z + \left(-1\right)\right)}\right) - t \]
      8. metadata-eval98.4%

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

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

        \[\leadsto \color{blue}{\left(\log y \cdot \left(-1 + x\right) - y \cdot \left(-1 + z\right)\right)} - t \]
      11. distribute-rgt-in98.4%

        \[\leadsto \left(\log y \cdot \left(-1 + x\right) - \color{blue}{\left(-1 \cdot y + z \cdot y\right)}\right) - t \]
      12. neg-mul-198.4%

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

        \[\leadsto \left(\log y \cdot \left(-1 + x\right) - \color{blue}{\left(z \cdot y + \left(-y\right)\right)}\right) - t \]
      14. unsub-neg98.4%

        \[\leadsto \left(\log y \cdot \left(-1 + x\right) - \color{blue}{\left(z \cdot y - y\right)}\right) - t \]
      15. *-commutative98.4%

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

      \[\leadsto \color{blue}{\left(\log y \cdot \left(-1 + x\right) - \left(y \cdot z - y\right)\right)} - t \]
    8. Taylor expanded in z around inf 16.5%

      \[\leadsto \color{blue}{-1 \cdot \left(y \cdot z\right)} \]
    9. Step-by-step derivation
      1. mul-1-neg16.5%

        \[\leadsto \color{blue}{-y \cdot z} \]
      2. distribute-rgt-neg-in16.5%

        \[\leadsto \color{blue}{y \cdot \left(-z\right)} \]
    10. Simplified16.5%

      \[\leadsto \color{blue}{y \cdot \left(-z\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification46.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -80:\\ \;\;\;\;-t\\ \mathbf{elif}\;t \leq 5500:\\ \;\;\;\;y \cdot \left(-z\right)\\ \mathbf{else}:\\ \;\;\;\;-t\\ \end{array} \]

Alternative 15: 45.5% accurate, 30.7× speedup?

\[\begin{array}{l} \\ \left(y - y \cdot z\right) - t \end{array} \]
(FPCore (x y z t) :precision binary64 (- (- y (* y z)) t))
double code(double x, double y, double z, double t) {
	return (y - (y * z)) - t;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = (y - (y * z)) - t
end function
public static double code(double x, double y, double z, double t) {
	return (y - (y * z)) - t;
}
def code(x, y, z, t):
	return (y - (y * z)) - t
function code(x, y, z, t)
	return Float64(Float64(y - Float64(y * z)) - t)
end
function tmp = code(x, y, z, t)
	tmp = (y - (y * z)) - t;
end
code[x_, y_, z_, t_] := N[(N[(y - N[(y * z), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}

\\
\left(y - y \cdot z\right) - t
\end{array}
Derivation
  1. Initial program 91.1%

    \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
  2. Taylor expanded in y around 0 98.9%

    \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\left(-1 \cdot \left(y \cdot \left(z - 1\right)\right) + -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)}\right) - t \]
  3. Step-by-step derivation
    1. fma-def98.9%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\mathsf{fma}\left(-1, y \cdot \left(z - 1\right), -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)}\right) - t \]
    2. sub-neg98.9%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \color{blue}{\left(z + \left(-1\right)\right)}, -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)\right) - t \]
    3. metadata-eval98.9%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(z + \color{blue}{-1}\right), -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)\right) - t \]
    4. +-commutative98.9%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \color{blue}{\left(-1 + z\right)}, -0.5 \cdot \left({y}^{2} \cdot \left(z - 1\right)\right)\right)\right) - t \]
    5. unpow298.9%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\color{blue}{\left(y \cdot y\right)} \cdot \left(z - 1\right)\right)\right)\right) - t \]
    6. sub-neg98.9%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\left(y \cdot y\right) \cdot \color{blue}{\left(z + \left(-1\right)\right)}\right)\right)\right) - t \]
    7. metadata-eval98.9%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\left(y \cdot y\right) \cdot \left(z + \color{blue}{-1}\right)\right)\right)\right) - t \]
    8. +-commutative98.9%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\left(y \cdot y\right) \cdot \color{blue}{\left(-1 + z\right)}\right)\right)\right) - t \]
  4. Simplified98.9%

    \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\left(y \cdot y\right) \cdot \left(-1 + z\right)\right)\right)}\right) - t \]
  5. Taylor expanded in y around 0 98.4%

    \[\leadsto \color{blue}{\left(-1 \cdot \left(y \cdot \left(z - 1\right)\right) + \log y \cdot \left(x - 1\right)\right)} - t \]
  6. Step-by-step derivation
    1. +-commutative98.4%

      \[\leadsto \color{blue}{\left(\log y \cdot \left(x - 1\right) + -1 \cdot \left(y \cdot \left(z - 1\right)\right)\right)} - t \]
    2. sub-neg98.4%

      \[\leadsto \left(\log y \cdot \color{blue}{\left(x + \left(-1\right)\right)} + -1 \cdot \left(y \cdot \left(z - 1\right)\right)\right) - t \]
    3. metadata-eval98.4%

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

      \[\leadsto \left(\log y \cdot \color{blue}{\left(-1 + x\right)} + -1 \cdot \left(y \cdot \left(z - 1\right)\right)\right) - t \]
    5. fma-def98.4%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\log y, -1 + x, -1 \cdot \left(y \cdot \left(z - 1\right)\right)\right)} - t \]
    6. mul-1-neg98.4%

      \[\leadsto \mathsf{fma}\left(\log y, -1 + x, \color{blue}{-y \cdot \left(z - 1\right)}\right) - t \]
    7. sub-neg98.4%

      \[\leadsto \mathsf{fma}\left(\log y, -1 + x, -y \cdot \color{blue}{\left(z + \left(-1\right)\right)}\right) - t \]
    8. metadata-eval98.4%

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

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

      \[\leadsto \color{blue}{\left(\log y \cdot \left(-1 + x\right) - y \cdot \left(-1 + z\right)\right)} - t \]
    11. distribute-rgt-in98.4%

      \[\leadsto \left(\log y \cdot \left(-1 + x\right) - \color{blue}{\left(-1 \cdot y + z \cdot y\right)}\right) - t \]
    12. neg-mul-198.4%

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

      \[\leadsto \left(\log y \cdot \left(-1 + x\right) - \color{blue}{\left(z \cdot y + \left(-y\right)\right)}\right) - t \]
    14. unsub-neg98.4%

      \[\leadsto \left(\log y \cdot \left(-1 + x\right) - \color{blue}{\left(z \cdot y - y\right)}\right) - t \]
    15. *-commutative98.4%

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

    \[\leadsto \color{blue}{\left(\log y \cdot \left(-1 + x\right) - \left(y \cdot z - y\right)\right)} - t \]
  8. Taylor expanded in x around 0 62.7%

    \[\leadsto \color{blue}{\left(\left(y + -1 \cdot \log y\right) - y \cdot z\right)} - t \]
  9. Step-by-step derivation
    1. mul-1-neg62.7%

      \[\leadsto \left(\left(y + \color{blue}{\left(-\log y\right)}\right) - y \cdot z\right) - t \]
    2. unsub-neg62.7%

      \[\leadsto \left(\color{blue}{\left(y - \log y\right)} - y \cdot z\right) - t \]
  10. Simplified62.7%

    \[\leadsto \color{blue}{\left(\left(y - \log y\right) - y \cdot z\right)} - t \]
  11. Taylor expanded in y around inf 47.8%

    \[\leadsto \left(\color{blue}{y} - y \cdot z\right) - t \]
  12. Final simplification47.8%

    \[\leadsto \left(y - y \cdot z\right) - t \]

Alternative 16: 35.1% accurate, 107.5× speedup?

\[\begin{array}{l} \\ -t \end{array} \]
(FPCore (x y z t) :precision binary64 (- t))
double code(double x, double y, double z, double t) {
	return -t;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = -t
end function
public static double code(double x, double y, double z, double t) {
	return -t;
}
def code(x, y, z, t):
	return -t
function code(x, y, z, t)
	return Float64(-t)
end
function tmp = code(x, y, z, t)
	tmp = -t;
end
code[x_, y_, z_, t_] := (-t)
\begin{array}{l}

\\
-t
\end{array}
Derivation
  1. Initial program 91.1%

    \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
  2. Step-by-step derivation
    1. +-commutative91.1%

      \[\leadsto \color{blue}{\left(\left(z - 1\right) \cdot \log \left(1 - y\right) + \left(x - 1\right) \cdot \log y\right)} - t \]
    2. fma-def91.1%

      \[\leadsto \color{blue}{\mathsf{fma}\left(z - 1, \log \left(1 - y\right), \left(x - 1\right) \cdot \log y\right)} - t \]
    3. sub-neg91.1%

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

      \[\leadsto \mathsf{fma}\left(z + \color{blue}{-1}, \log \left(1 - y\right), \left(x - 1\right) \cdot \log y\right) - t \]
    5. sub-neg91.1%

      \[\leadsto \mathsf{fma}\left(z + -1, \log \color{blue}{\left(1 + \left(-y\right)\right)}, \left(x - 1\right) \cdot \log y\right) - t \]
    6. log1p-def99.8%

      \[\leadsto \mathsf{fma}\left(z + -1, \color{blue}{\mathsf{log1p}\left(-y\right)}, \left(x - 1\right) \cdot \log y\right) - t \]
    7. sub-neg99.8%

      \[\leadsto \mathsf{fma}\left(z + -1, \mathsf{log1p}\left(-y\right), \color{blue}{\left(x + \left(-1\right)\right)} \cdot \log y\right) - t \]
    8. metadata-eval99.8%

      \[\leadsto \mathsf{fma}\left(z + -1, \mathsf{log1p}\left(-y\right), \left(x + \color{blue}{-1}\right) \cdot \log y\right) - t \]
  3. Simplified99.8%

    \[\leadsto \color{blue}{\mathsf{fma}\left(z + -1, \mathsf{log1p}\left(-y\right), \left(x + -1\right) \cdot \log y\right) - t} \]
  4. Taylor expanded in t around inf 39.3%

    \[\leadsto \color{blue}{-1 \cdot t} \]
  5. Step-by-step derivation
    1. mul-1-neg39.3%

      \[\leadsto \color{blue}{-t} \]
  6. Simplified39.3%

    \[\leadsto \color{blue}{-t} \]
  7. Final simplification39.3%

    \[\leadsto -t \]

Reproduce

?
herbie shell --seed 2023279 
(FPCore (x y z t)
  :name "Statistics.Distribution.Beta:$cdensity from math-functions-0.1.5.2"
  :precision binary64
  (- (+ (* (- x 1.0) (log y)) (* (- z 1.0) (log (- 1.0 y)))) t))