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

Percentage Accurate: 89.3% → 99.8%
Time: 20.2s
Alternatives: 14
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 14 alternatives:

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

Initial Program: 89.3% accurate, 1.0× speedup?

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

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

Alternative 1: 99.8% accurate, 0.5× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 99.8% accurate, 0.7× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 99.6% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(z, \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 (log1p (- y)) (- (* (+ x -1.0) (log y)) t)))
double code(double x, double y, double z, double t) {
	return fma(z, log1p(-y), (((x + -1.0) * log(y)) - t));
}
function code(x, y, z, t)
	return fma(z, log1p(Float64(-y)), Float64(Float64(Float64(x + -1.0) * log(y)) - t))
end
code[x_, y_, z_, t_] := N[(z * 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, \mathsf{log1p}\left(-y\right), \left(x + -1\right) \cdot \log y - t\right)
\end{array}
Derivation
  1. Initial program 91.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 99.6% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 99.4% accurate, 1.7× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 99.3% accurate, 1.8× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 99.1% accurate, 1.9× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 99.0% accurate, 1.9× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 75.6% accurate, 2.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.9 \cdot 10^{+18} \lor \neg \left(x \leq 3.7 \cdot 10^{+87}\right):\\
\;\;\;\;x \cdot \log y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2.9e18 or 3.70000000000000003e87 < x

    1. Initial program 96.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 z around inf 96.5%

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

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

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

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

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

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

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

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

    if -2.9e18 < x < 3.70000000000000003e87

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \log y - t} \]
    6. Step-by-step derivation
      1. mul-1-neg77.7%

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

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

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

Alternative 10: 57.6% accurate, 2.0× speedup?

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

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

\mathbf{elif}\;t \leq 1.22 \cdot 10^{+23}:\\
\;\;\;\;x \cdot \log y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.9999999999999999e31 or 1.22e23 < t

    1. Initial program 97.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 t around inf 80.4%

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

        \[\leadsto \color{blue}{-t} \]
    4. Simplified80.4%

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

    if -1.9999999999999999e31 < t < 1.22e23

    1. Initial program 85.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 z around inf 85.4%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\log y \cdot x} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification65.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -2 \cdot 10^{+31}:\\ \;\;\;\;-t\\ \mathbf{elif}\;t \leq 1.22 \cdot 10^{+23}:\\ \;\;\;\;x \cdot \log y\\ \mathbf{else}:\\ \;\;\;\;-t\\ \end{array} \]

Alternative 11: 88.2% 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 91.1%

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

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

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

Alternative 12: 42.3% accurate, 16.4× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -44 or 3.7e5 < t

    1. Initial program 96.9%

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

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

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

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

    if -44 < t < 3.7e5

    1. Initial program 85.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto z \cdot \left(\color{blue}{\left(y \cdot y\right)} \cdot -0.5 - y\right) \]
      4. associate-*l*17.2%

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

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

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

Alternative 13: 42.2% accurate, 26.5× speedup?

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

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

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

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


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

    1. Initial program 96.9%

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

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

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

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

    if -80 < t < 3.2e5

    1. Initial program 85.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 14: 35.1% accurate, 107.5× speedup?

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

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

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

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

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

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

    \[\leadsto -t \]

Reproduce

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