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

Percentage Accurate: 89.5% → 99.8%
Time: 18.0s
Alternatives: 18
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 18 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.5% 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.7× speedup?

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

\\
\mathsf{fma}\left(z + -1, \mathsf{log1p}\left(-y\right), \left(x + -1\right) \cdot \log y - t\right)
\end{array}
Derivation
  1. Initial program 90.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. +-commutative90.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. associate--l+90.0%

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

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

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

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

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

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

Alternative 2: 99.8% accurate, 0.7× speedup?

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

\\
\mathsf{log1p}\left(-y\right) \cdot \left(z + -1\right) - \mathsf{fma}\left(\log y, 1 - x, t\right)
\end{array}
Derivation
  1. Initial program 90.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. associate--l+90.0%

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

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

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

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

      \[\leadsto \color{blue}{\left(z - 1\right) \cdot \log \left(1 - y\right)} - \left(t - \left(x - 1\right) \cdot \log y\right) \]
    6. sub-neg90.0%

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

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

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

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

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

      \[\leadsto \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \color{blue}{\left(\left(-\left(x - 1\right) \cdot \log y\right) + t\right)} \]
    12. *-commutative99.8%

      \[\leadsto \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \left(\left(-\color{blue}{\log y \cdot \left(x - 1\right)}\right) + t\right) \]
    13. distribute-rgt-neg-in99.8%

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

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

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

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

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

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

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

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

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

Alternative 3: 99.5% accurate, 1.7× speedup?

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

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

    \[\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.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(\left(\log y \cdot \left(-1 + x\right) + \left(y \cdot y\right) \cdot \left(\color{blue}{0.5} + -0.5 \cdot z\right)\right) - y \cdot \left(-1 + z\right)\right) - t \]
  6. Applied egg-rr99.5%

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

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

Alternative 4: 99.5% accurate, 1.8× speedup?

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

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

    \[\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.4%

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

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

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

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

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

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

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

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

Alternative 5: 95.5% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x + -1 \leq -1 \cdot 10^{+21}:\\ \;\;\;\;x \cdot \log y - t\\ \mathbf{elif}\;x + -1 \leq 0.5:\\ \;\;\;\;\left(y \cdot \left(\left(-z\right) - -1\right) - \log y\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) -1e+21)
   (- (* x (log y)) t)
   (if (<= (+ x -1.0) 0.5)
     (- (- (* y (- (- z) -1.0)) (log y)) t)
     (- (* (+ x -1.0) (log y)) t))))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((x + -1.0) <= -1e+21) {
		tmp = (x * log(y)) - t;
	} else if ((x + -1.0) <= 0.5) {
		tmp = ((y * (-z - -1.0)) - log(y)) - 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)) <= (-1d+21)) then
        tmp = (x * log(y)) - t
    else if ((x + (-1.0d0)) <= 0.5d0) then
        tmp = ((y * (-z - (-1.0d0))) - log(y)) - 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) <= -1e+21) {
		tmp = (x * Math.log(y)) - t;
	} else if ((x + -1.0) <= 0.5) {
		tmp = ((y * (-z - -1.0)) - Math.log(y)) - t;
	} else {
		tmp = ((x + -1.0) * Math.log(y)) - t;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (x + -1.0) <= -1e+21:
		tmp = (x * math.log(y)) - t
	elif (x + -1.0) <= 0.5:
		tmp = ((y * (-z - -1.0)) - math.log(y)) - 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) <= -1e+21)
		tmp = Float64(Float64(x * log(y)) - t);
	elseif (Float64(x + -1.0) <= 0.5)
		tmp = Float64(Float64(Float64(y * Float64(Float64(-z) - -1.0)) - log(y)) - 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) <= -1e+21)
		tmp = (x * log(y)) - t;
	elseif ((x + -1.0) <= 0.5)
		tmp = ((y * (-z - -1.0)) - log(y)) - 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], -1e+21], N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[N[(x + -1.0), $MachinePrecision], 0.5], N[(N[(N[(y * N[((-z) - -1.0), $MachinePrecision]), $MachinePrecision] - N[Log[y], $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 -1 \cdot 10^{+21}:\\
\;\;\;\;x \cdot \log y - t\\

\mathbf{elif}\;x + -1 \leq 0.5:\\
\;\;\;\;\left(y \cdot \left(\left(-z\right) - -1\right) - \log y\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) < -1e21

    1. Initial program 92.4%

      \[\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.5%

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

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

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

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

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

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

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

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

    if -1e21 < (-.f64 x 1) < 0.5

    1. Initial program 87.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.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 0.5 < (-.f64 x 1)

    1. Initial program 94.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 93.6%

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

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

Alternative 6: 74.6% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \log y\\ \mathbf{if}\;x \leq -6.8 \cdot 10^{+108}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -2.75 \cdot 10^{-30}:\\ \;\;\;\;\left(z + -1\right) \cdot \left(y \cdot \left(-1 + y \cdot -0.5\right)\right) - t\\ \mathbf{elif}\;x \leq 1.46:\\ \;\;\;\;\left(-\log y\right) - t\\ \mathbf{elif}\;x \leq 4.4 \cdot 10^{+77} \lor \neg \left(x \leq 8 \cdot 10^{+146}\right):\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(-y\right) - t\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (log y))))
   (if (<= x -6.8e+108)
     t_1
     (if (<= x -2.75e-30)
       (- (* (+ z -1.0) (* y (+ -1.0 (* y -0.5)))) t)
       (if (<= x 1.46)
         (- (- (log y)) t)
         (if (or (<= x 4.4e+77) (not (<= x 8e+146)))
           t_1
           (- (* z (- y)) t)))))))
double code(double x, double y, double z, double t) {
	double t_1 = x * log(y);
	double tmp;
	if (x <= -6.8e+108) {
		tmp = t_1;
	} else if (x <= -2.75e-30) {
		tmp = ((z + -1.0) * (y * (-1.0 + (y * -0.5)))) - t;
	} else if (x <= 1.46) {
		tmp = -log(y) - t;
	} else if ((x <= 4.4e+77) || !(x <= 8e+146)) {
		tmp = t_1;
	} else {
		tmp = (z * -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) :: t_1
    real(8) :: tmp
    t_1 = x * log(y)
    if (x <= (-6.8d+108)) then
        tmp = t_1
    else if (x <= (-2.75d-30)) then
        tmp = ((z + (-1.0d0)) * (y * ((-1.0d0) + (y * (-0.5d0))))) - t
    else if (x <= 1.46d0) then
        tmp = -log(y) - t
    else if ((x <= 4.4d+77) .or. (.not. (x <= 8d+146))) then
        tmp = t_1
    else
        tmp = (z * -y) - t
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = x * Math.log(y);
	double tmp;
	if (x <= -6.8e+108) {
		tmp = t_1;
	} else if (x <= -2.75e-30) {
		tmp = ((z + -1.0) * (y * (-1.0 + (y * -0.5)))) - t;
	} else if (x <= 1.46) {
		tmp = -Math.log(y) - t;
	} else if ((x <= 4.4e+77) || !(x <= 8e+146)) {
		tmp = t_1;
	} else {
		tmp = (z * -y) - t;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x * math.log(y)
	tmp = 0
	if x <= -6.8e+108:
		tmp = t_1
	elif x <= -2.75e-30:
		tmp = ((z + -1.0) * (y * (-1.0 + (y * -0.5)))) - t
	elif x <= 1.46:
		tmp = -math.log(y) - t
	elif (x <= 4.4e+77) or not (x <= 8e+146):
		tmp = t_1
	else:
		tmp = (z * -y) - t
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x * log(y))
	tmp = 0.0
	if (x <= -6.8e+108)
		tmp = t_1;
	elseif (x <= -2.75e-30)
		tmp = Float64(Float64(Float64(z + -1.0) * Float64(y * Float64(-1.0 + Float64(y * -0.5)))) - t);
	elseif (x <= 1.46)
		tmp = Float64(Float64(-log(y)) - t);
	elseif ((x <= 4.4e+77) || !(x <= 8e+146))
		tmp = t_1;
	else
		tmp = Float64(Float64(z * Float64(-y)) - t);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x * log(y);
	tmp = 0.0;
	if (x <= -6.8e+108)
		tmp = t_1;
	elseif (x <= -2.75e-30)
		tmp = ((z + -1.0) * (y * (-1.0 + (y * -0.5)))) - t;
	elseif (x <= 1.46)
		tmp = -log(y) - t;
	elseif ((x <= 4.4e+77) || ~((x <= 8e+146)))
		tmp = t_1;
	else
		tmp = (z * -y) - t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -6.8e+108], t$95$1, If[LessEqual[x, -2.75e-30], N[(N[(N[(z + -1.0), $MachinePrecision] * N[(y * N[(-1.0 + N[(y * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[x, 1.46], N[((-N[Log[y], $MachinePrecision]) - t), $MachinePrecision], If[Or[LessEqual[x, 4.4e+77], N[Not[LessEqual[x, 8e+146]], $MachinePrecision]], t$95$1, N[(N[(z * (-y)), $MachinePrecision] - t), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x \cdot \log y\\
\mathbf{if}\;x \leq -6.8 \cdot 10^{+108}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \leq -2.75 \cdot 10^{-30}:\\
\;\;\;\;\left(z + -1\right) \cdot \left(y \cdot \left(-1 + y \cdot -0.5\right)\right) - t\\

\mathbf{elif}\;x \leq 1.46:\\
\;\;\;\;\left(-\log y\right) - t\\

\mathbf{elif}\;x \leq 4.4 \cdot 10^{+77} \lor \neg \left(x \leq 8 \cdot 10^{+146}\right):\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -6.79999999999999992e108 or 1.46 < x < 4.4000000000000001e77 or 7.99999999999999947e146 < x

    1. Initial program 95.2%

      \[\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+95.2%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \left(\left(-\color{blue}{\log y \cdot \left(x - 1\right)}\right) + t\right) \]
      13. distribute-rgt-neg-in99.6%

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

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

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

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

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

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

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

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

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

    if -6.79999999999999992e108 < x < -2.74999999999999988e-30

    1. Initial program 73.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.7%

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(-0.5 \cdot \left(\left(z - 1\right) \cdot {y}^{2}\right) + \color{blue}{\left(-\left(z - 1\right) \cdot y\right)}\right) - t \]
      3. sub-neg69.9%

        \[\leadsto \left(-0.5 \cdot \left(\left(z - 1\right) \cdot {y}^{2}\right) + \left(-\color{blue}{\left(z + \left(-1\right)\right)} \cdot y\right)\right) - t \]
      4. metadata-eval69.9%

        \[\leadsto \left(-0.5 \cdot \left(\left(z - 1\right) \cdot {y}^{2}\right) + \left(-\left(z + \color{blue}{-1}\right) \cdot y\right)\right) - t \]
      5. *-commutative69.9%

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

        \[\leadsto \left(-0.5 \cdot \left(\color{blue}{\left(z + \left(-1\right)\right)} \cdot {y}^{2}\right) + \left(-y \cdot \left(z + -1\right)\right)\right) - t \]
      7. metadata-eval69.9%

        \[\leadsto \left(-0.5 \cdot \left(\left(z + \color{blue}{-1}\right) \cdot {y}^{2}\right) + \left(-y \cdot \left(z + -1\right)\right)\right) - t \]
      8. *-commutative69.9%

        \[\leadsto \left(-0.5 \cdot \color{blue}{\left({y}^{2} \cdot \left(z + -1\right)\right)} + \left(-y \cdot \left(z + -1\right)\right)\right) - t \]
      9. associate-*r*69.9%

        \[\leadsto \left(\color{blue}{\left(-0.5 \cdot {y}^{2}\right) \cdot \left(z + -1\right)} + \left(-y \cdot \left(z + -1\right)\right)\right) - t \]
      10. distribute-lft-neg-in69.9%

        \[\leadsto \left(\left(-0.5 \cdot {y}^{2}\right) \cdot \left(z + -1\right) + \color{blue}{\left(-y\right) \cdot \left(z + -1\right)}\right) - t \]
      11. distribute-rgt-in69.9%

        \[\leadsto \color{blue}{\left(z + -1\right) \cdot \left(-0.5 \cdot {y}^{2} + \left(-y\right)\right)} - t \]
      12. *-commutative69.9%

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

        \[\leadsto \left(z + -1\right) \cdot \left(\color{blue}{\left(y \cdot y\right)} \cdot -0.5 + \left(-y\right)\right) - t \]
      14. sub-neg69.9%

        \[\leadsto \left(z + -1\right) \cdot \color{blue}{\left(\left(y \cdot y\right) \cdot -0.5 - y\right)} - t \]
      15. *-commutative69.9%

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

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

    if -2.74999999999999988e-30 < x < 1.46

    1. Initial program 90.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 88.9%

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

      \[\leadsto \color{blue}{-1 \cdot \log y} - t \]
    4. Step-by-step derivation
      1. mul-1-neg87.9%

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

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

    if 4.4000000000000001e77 < x < 7.99999999999999947e146

    1. Initial program 92.9%

      \[\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.7%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(y \cdot z\right)} - t \]
    6. Step-by-step derivation
      1. neg-mul-169.2%

        \[\leadsto \color{blue}{\left(-y \cdot z\right)} - t \]
      2. *-commutative69.2%

        \[\leadsto \left(-\color{blue}{z \cdot y}\right) - t \]
      3. distribute-rgt-neg-in69.2%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -6.8 \cdot 10^{+108}:\\ \;\;\;\;x \cdot \log y\\ \mathbf{elif}\;x \leq -2.75 \cdot 10^{-30}:\\ \;\;\;\;\left(z + -1\right) \cdot \left(y \cdot \left(-1 + y \cdot -0.5\right)\right) - t\\ \mathbf{elif}\;x \leq 1.46:\\ \;\;\;\;\left(-\log y\right) - t\\ \mathbf{elif}\;x \leq 4.4 \cdot 10^{+77} \lor \neg \left(x \leq 8 \cdot 10^{+146}\right):\\ \;\;\;\;x \cdot \log y\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(-y\right) - t\\ \end{array} \]

Alternative 7: 99.1% accurate, 1.9× speedup?

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

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

    \[\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 \color{blue}{\left(-1 \cdot \left(\left(z - 1\right) \cdot y\right) + \left(x - 1\right) \cdot \log y\right)} - t \]
  3. Step-by-step derivation
    1. +-commutative99.2%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 99.0% accurate, 1.9× speedup?

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

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

    \[\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 \color{blue}{\left(-1 \cdot \left(\left(z - 1\right) \cdot y\right) + \left(x - 1\right) \cdot \log y\right)} - t \]
  3. Step-by-step derivation
    1. +-commutative99.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 87.6% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -700 \lor \neg \left(x \leq 1\right):\\ \;\;\;\;x \cdot \log y - t\\ \mathbf{else}:\\ \;\;\;\;\left(-\log y\right) - t\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (or (<= x -700.0) (not (<= x 1.0)))
   (- (* x (log y)) t)
   (- (- (log y)) t)))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((x <= -700.0) || !(x <= 1.0)) {
		tmp = (x * log(y)) - t;
	} else {
		tmp = -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 <= (-700.0d0)) .or. (.not. (x <= 1.0d0))) then
        tmp = (x * log(y)) - t
    else
        tmp = -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 <= -700.0) || !(x <= 1.0)) {
		tmp = (x * Math.log(y)) - t;
	} else {
		tmp = -Math.log(y) - t;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (x <= -700.0) or not (x <= 1.0):
		tmp = (x * math.log(y)) - t
	else:
		tmp = -math.log(y) - t
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if ((x <= -700.0) || !(x <= 1.0))
		tmp = Float64(Float64(x * log(y)) - t);
	else
		tmp = Float64(Float64(-log(y)) - t);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if ((x <= -700.0) || ~((x <= 1.0)))
		tmp = (x * log(y)) - t;
	else
		tmp = -log(y) - t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -700.0], N[Not[LessEqual[x, 1.0]], $MachinePrecision]], N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[((-N[Log[y], $MachinePrecision]) - t), $MachinePrecision]]
\begin{array}{l}

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

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


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

    1. Initial program 91.9%

      \[\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.6%

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

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

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

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

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

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

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

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

    if -700 < x < 1

    1. Initial program 88.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 86.8%

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

      \[\leadsto \color{blue}{-1 \cdot \log y} - t \]
    4. Step-by-step derivation
      1. mul-1-neg85.3%

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

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

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

Alternative 10: 87.7% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -700 \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 -700.0) (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 <= -700.0) || !(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 <= (-700.0d0)) .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 <= -700.0) || !(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 <= -700.0) 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 <= -700.0) || !(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 <= -700.0) || ~((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, -700.0], 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 -700 \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 < -700 or 1 < x

    1. Initial program 91.9%

      \[\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.6%

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

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

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

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

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

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

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

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

    if -700 < x < 1

    1. Initial program 88.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 99.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -1 \cdot \color{blue}{\left(\left(-y\right) + \log y\right)} - t \]
      3. distribute-lft-in85.7%

        \[\leadsto \color{blue}{\left(-1 \cdot \left(-y\right) + -1 \cdot \log y\right)} - t \]
      4. neg-mul-185.7%

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

        \[\leadsto \color{blue}{\left(-1 \cdot \left(-y\right) - \log y\right)} - t \]
      6. neg-mul-185.7%

        \[\leadsto \left(\color{blue}{\left(-\left(-y\right)\right)} - \log y\right) - t \]
      7. remove-double-neg85.7%

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

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

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

Alternative 11: 88.5% accurate, 2.0× speedup?

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

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

    \[\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 \color{blue}{\left(-1 \cdot \left(\left(z - 1\right) \cdot y\right) + \left(x - 1\right) \cdot \log y\right)} - t \]
  3. Step-by-step derivation
    1. +-commutative99.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(-1 \cdot t + \left(x - 1\right) \cdot \log y\right) + \left(--1\right) \cdot y} \]
    6. metadata-eval89.1%

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

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

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

      \[\leadsto \color{blue}{\left(\left(x - 1\right) \cdot \log y + \left(-t\right)\right)} + y \cdot 1 \]
    10. sub-neg89.1%

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

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

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

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

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

      \[\leadsto \color{blue}{\left(\left(-1 + x\right) \cdot \log y - t\right)} + y \cdot 1 \]
    16. *-commutative89.1%

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

      \[\leadsto \left(\log y \cdot \color{blue}{\left(x + -1\right)} - t\right) + y \cdot 1 \]
    18. *-rgt-identity89.1%

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

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

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

Alternative 12: 65.1% accurate, 2.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.5 \cdot 10^{+108} \lor \neg \left(x \leq 4.2 \cdot 10^{+148}\right):\\
\;\;\;\;x \cdot \log y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -4.5e108 or 4.19999999999999998e148 < x

    1. Initial program 97.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. associate--l+97.3%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \left(\left(-\color{blue}{\log y \cdot \left(x - 1\right)}\right) + t\right) \]
      13. distribute-rgt-neg-in99.5%

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

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

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

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

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

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

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

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

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

    if -4.5e108 < x < 4.19999999999999998e148

    1. Initial program 87.0%

      \[\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.4%

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(-0.5 \cdot \left(\left(z - 1\right) \cdot {y}^{2}\right) + \color{blue}{\left(-\left(z - 1\right) \cdot y\right)}\right) - t \]
      3. sub-neg60.4%

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

        \[\leadsto \left(-0.5 \cdot \left(\left(z - 1\right) \cdot {y}^{2}\right) + \left(-\left(z + \color{blue}{-1}\right) \cdot y\right)\right) - t \]
      5. *-commutative60.4%

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

        \[\leadsto \left(-0.5 \cdot \left(\color{blue}{\left(z + \left(-1\right)\right)} \cdot {y}^{2}\right) + \left(-y \cdot \left(z + -1\right)\right)\right) - t \]
      7. metadata-eval60.4%

        \[\leadsto \left(-0.5 \cdot \left(\left(z + \color{blue}{-1}\right) \cdot {y}^{2}\right) + \left(-y \cdot \left(z + -1\right)\right)\right) - t \]
      8. *-commutative60.4%

        \[\leadsto \left(-0.5 \cdot \color{blue}{\left({y}^{2} \cdot \left(z + -1\right)\right)} + \left(-y \cdot \left(z + -1\right)\right)\right) - t \]
      9. associate-*r*60.4%

        \[\leadsto \left(\color{blue}{\left(-0.5 \cdot {y}^{2}\right) \cdot \left(z + -1\right)} + \left(-y \cdot \left(z + -1\right)\right)\right) - t \]
      10. distribute-lft-neg-in60.4%

        \[\leadsto \left(\left(-0.5 \cdot {y}^{2}\right) \cdot \left(z + -1\right) + \color{blue}{\left(-y\right) \cdot \left(z + -1\right)}\right) - t \]
      11. distribute-rgt-in60.4%

        \[\leadsto \color{blue}{\left(z + -1\right) \cdot \left(-0.5 \cdot {y}^{2} + \left(-y\right)\right)} - t \]
      12. *-commutative60.4%

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

        \[\leadsto \left(z + -1\right) \cdot \left(\color{blue}{\left(y \cdot y\right)} \cdot -0.5 + \left(-y\right)\right) - t \]
      14. sub-neg60.4%

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

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

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

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

Alternative 13: 88.4% accurate, 2.0× speedup?

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

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

    \[\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 88.9%

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

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

Alternative 14: 45.9% accurate, 16.5× speedup?

\[\begin{array}{l} \\ \left(z + -1\right) \cdot \left(y \cdot \left(-1 + y \cdot -0.5\right)\right) - t \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (- (* (+ z -1.0) (* y (+ -1.0 (* y -0.5)))) t))
double code(double x, double y, double z, double t) {
	return ((z + -1.0) * (y * (-1.0 + (y * -0.5)))) - 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 = ((z + (-1.0d0)) * (y * ((-1.0d0) + (y * (-0.5d0))))) - t
end function
public static double code(double x, double y, double z, double t) {
	return ((z + -1.0) * (y * (-1.0 + (y * -0.5)))) - t;
}
def code(x, y, z, t):
	return ((z + -1.0) * (y * (-1.0 + (y * -0.5)))) - t
function code(x, y, z, t)
	return Float64(Float64(Float64(z + -1.0) * Float64(y * Float64(-1.0 + Float64(y * -0.5)))) - t)
end
function tmp = code(x, y, z, t)
	tmp = ((z + -1.0) * (y * (-1.0 + (y * -0.5)))) - t;
end
code[x_, y_, z_, t_] := N[(N[(N[(z + -1.0), $MachinePrecision] * N[(y * N[(-1.0 + N[(y * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}

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

    \[\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.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(-0.5 \cdot \color{blue}{\left({y}^{2} \cdot \left(z + -1\right)\right)} + \left(-y \cdot \left(z + -1\right)\right)\right) - t \]
    9. associate-*r*46.1%

      \[\leadsto \left(\color{blue}{\left(-0.5 \cdot {y}^{2}\right) \cdot \left(z + -1\right)} + \left(-y \cdot \left(z + -1\right)\right)\right) - t \]
    10. distribute-lft-neg-in46.1%

      \[\leadsto \left(\left(-0.5 \cdot {y}^{2}\right) \cdot \left(z + -1\right) + \color{blue}{\left(-y\right) \cdot \left(z + -1\right)}\right) - t \]
    11. distribute-rgt-in46.1%

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

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

      \[\leadsto \left(z + -1\right) \cdot \left(\color{blue}{\left(y \cdot y\right)} \cdot -0.5 + \left(-y\right)\right) - t \]
    14. sub-neg46.1%

      \[\leadsto \left(z + -1\right) \cdot \color{blue}{\left(\left(y \cdot y\right) \cdot -0.5 - y\right)} - t \]
    15. *-commutative46.1%

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

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

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

Alternative 15: 42.4% accurate, 26.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq -3.4 \cdot 10^{+21}:\\ \;\;\;\;-t\\ \mathbf{elif}\;t \leq 3.75 \cdot 10^{+14}:\\ \;\;\;\;z \cdot \left(-y\right)\\ \mathbf{else}:\\ \;\;\;\;-t\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= t -3.4e+21) (- t) (if (<= t 3.75e+14) (* z (- y)) (- t))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (t <= -3.4e+21) {
		tmp = -t;
	} else if (t <= 3.75e+14) {
		tmp = z * -y;
	} 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 <= (-3.4d+21)) then
        tmp = -t
    else if (t <= 3.75d+14) then
        tmp = z * -y
    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 <= -3.4e+21) {
		tmp = -t;
	} else if (t <= 3.75e+14) {
		tmp = z * -y;
	} else {
		tmp = -t;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if t <= -3.4e+21:
		tmp = -t
	elif t <= 3.75e+14:
		tmp = z * -y
	else:
		tmp = -t
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (t <= -3.4e+21)
		tmp = Float64(-t);
	elseif (t <= 3.75e+14)
		tmp = Float64(z * Float64(-y));
	else
		tmp = Float64(-t);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (t <= -3.4e+21)
		tmp = -t;
	elseif (t <= 3.75e+14)
		tmp = z * -y;
	else
		tmp = -t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[t, -3.4e+21], (-t), If[LessEqual[t, 3.75e+14], N[(z * (-y)), $MachinePrecision], (-t)]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.4 \cdot 10^{+21}:\\
\;\;\;\;-t\\

\mathbf{elif}\;t \leq 3.75 \cdot 10^{+14}:\\
\;\;\;\;z \cdot \left(-y\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -3.4e21 or 3.75e14 < t

    1. Initial program 93.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. associate--l+93.9%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \color{blue}{\left(\left(-\left(x - 1\right) \cdot \log y\right) + t\right)} \]
      12. *-commutative99.9%

        \[\leadsto \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \left(\left(-\color{blue}{\log y \cdot \left(x - 1\right)}\right) + t\right) \]
      13. distribute-rgt-neg-in99.9%

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

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

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

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

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

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

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

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

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

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

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

    if -3.4e21 < t < 3.75e14

    1. Initial program 86.6%

      \[\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 \color{blue}{\left(-1 \cdot \left(\left(z - 1\right) \cdot y\right) + \left(x - 1\right) \cdot \log y\right)} - t \]
    3. Step-by-step derivation
      1. +-commutative98.6%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(y \cdot z\right)} - t \]
    6. Step-by-step derivation
      1. neg-mul-115.7%

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

        \[\leadsto \left(-\color{blue}{z \cdot y}\right) - t \]
      3. distribute-rgt-neg-in15.7%

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(y \cdot z\right)} \]
    9. Step-by-step derivation
      1. associate-*r*14.4%

        \[\leadsto \color{blue}{\left(-1 \cdot y\right) \cdot z} \]
      2. neg-mul-114.4%

        \[\leadsto \color{blue}{\left(-y\right)} \cdot z \]
      3. *-commutative14.4%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -3.4 \cdot 10^{+21}:\\ \;\;\;\;-t\\ \mathbf{elif}\;t \leq 3.75 \cdot 10^{+14}:\\ \;\;\;\;z \cdot \left(-y\right)\\ \mathbf{else}:\\ \;\;\;\;-t\\ \end{array} \]

Alternative 16: 45.6% accurate, 30.7× speedup?

\[\begin{array}{l} \\ \left(y - z \cdot y\right) - t \end{array} \]
(FPCore (x y z t) :precision binary64 (- (- y (* z y)) t))
double code(double x, double y, double z, double t) {
	return (y - (z * 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 = (y - (z * y)) - t
end function
public static double code(double x, double y, double z, double t) {
	return (y - (z * y)) - t;
}
def code(x, y, z, t):
	return (y - (z * y)) - t
function code(x, y, z, t)
	return Float64(Float64(y - Float64(z * y)) - t)
end
function tmp = code(x, y, z, t)
	tmp = (y - (z * y)) - t;
end
code[x_, y_, z_, t_] := N[(N[(y - N[(z * y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}

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

    \[\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 \color{blue}{\left(-1 \cdot \left(\left(z - 1\right) \cdot y\right) + \left(x - 1\right) \cdot \log y\right)} - t \]
  3. Step-by-step derivation
    1. +-commutative99.2%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{y \cdot \left(1 - z\right)} - t \]
  6. Step-by-step derivation
    1. distribute-lft-out--45.9%

      \[\leadsto \color{blue}{\left(y \cdot 1 - y \cdot z\right)} - t \]
    2. *-rgt-identity45.9%

      \[\leadsto \left(\color{blue}{y} - y \cdot z\right) - t \]
    3. *-commutative45.9%

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

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

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

Alternative 17: 45.4% accurate, 35.8× speedup?

\[\begin{array}{l} \\ z \cdot \left(-y\right) - t \end{array} \]
(FPCore (x y z t) :precision binary64 (- (* z (- y)) t))
double code(double x, double y, double z, double t) {
	return (z * -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 = (z * -y) - t
end function
public static double code(double x, double y, double z, double t) {
	return (z * -y) - t;
}
def code(x, y, z, t):
	return (z * -y) - t
function code(x, y, z, t)
	return Float64(Float64(z * Float64(-y)) - t)
end
function tmp = code(x, y, z, t)
	tmp = (z * -y) - t;
end
code[x_, y_, z_, t_] := N[(N[(z * (-y)), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}

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

    \[\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 \color{blue}{\left(-1 \cdot \left(\left(z - 1\right) \cdot y\right) + \left(x - 1\right) \cdot \log y\right)} - t \]
  3. Step-by-step derivation
    1. +-commutative99.2%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{-1 \cdot \left(y \cdot z\right)} - t \]
  6. Step-by-step derivation
    1. neg-mul-145.7%

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

      \[\leadsto \left(-\color{blue}{z \cdot y}\right) - t \]
    3. distribute-rgt-neg-in45.7%

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

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

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

Alternative 18: 35.3% 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 90.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. associate--l+90.0%

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

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

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

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

      \[\leadsto \color{blue}{\left(z - 1\right) \cdot \log \left(1 - y\right)} - \left(t - \left(x - 1\right) \cdot \log y\right) \]
    6. sub-neg90.0%

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

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

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

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

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

      \[\leadsto \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \color{blue}{\left(\left(-\left(x - 1\right) \cdot \log y\right) + t\right)} \]
    12. *-commutative99.8%

      \[\leadsto \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \left(\left(-\color{blue}{\log y \cdot \left(x - 1\right)}\right) + t\right) \]
    13. distribute-rgt-neg-in99.8%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto -t \]

Reproduce

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