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

Percentage Accurate: 89.2% → 99.8%
Time: 22.5s
Alternatives: 17
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 17 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.2% 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(z + -1, \mathsf{log1p}\left(-y\right), \mathsf{fma}\left(-1 + x, \log y, -t\right)\right) \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (fma (+ z -1.0) (log1p (- y)) (fma (+ -1.0 x) (log y) (- t))))
double code(double x, double y, double z, double t) {
	return fma((z + -1.0), log1p(-y), fma((-1.0 + x), log(y), -t));
}
function code(x, y, z, t)
	return fma(Float64(z + -1.0), log1p(Float64(-y)), fma(Float64(-1.0 + x), log(y), Float64(-t)))
end
code[x_, y_, z_, t_] := N[(N[(z + -1.0), $MachinePrecision] * N[Log[1 + (-y)], $MachinePrecision] + N[(N[(-1.0 + x), $MachinePrecision] * N[Log[y], $MachinePrecision] + (-t)), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 99.8% accurate, 0.7× speedup?

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

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

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

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

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

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

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

      \[\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-define99.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. Add Preprocessing
  5. Final simplification99.8%

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

Alternative 3: 99.6% accurate, 1.7× speedup?

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

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

    \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
  2. Add Preprocessing
  3. 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(y \cdot \left(y \cdot \left(y \cdot \left(-0.25 \cdot y - 0.3333333333333333\right) - 0.5\right) - 1\right)\right)}\right) - t \]
  4. Final simplification99.5%

    \[\leadsto \left(\left(-1 + x\right) \cdot \log y + \left(z + -1\right) \cdot \left(y \cdot \left(-1 + y \cdot \left(y \cdot \left(y \cdot -0.25 - 0.3333333333333333\right) - 0.5\right)\right)\right)\right) - t \]
  5. Add Preprocessing

Alternative 4: 66.0% accurate, 1.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \log y\\ \mathbf{if}\;x \leq -1.5 \cdot 10^{+134}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq -4.5 \cdot 10^{+97}:\\ \;\;\;\;\left(-t\right) - z \cdot y\\ \mathbf{elif}\;x \leq -5.2 \cdot 10^{+45} \lor \neg \left(x \leq 8 \cdot 10^{+62}\right):\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(1 - z\right) - t\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (log y))))
   (if (<= x -1.5e+134)
     t_1
     (if (<= x -4.5e+97)
       (- (- t) (* z y))
       (if (or (<= x -5.2e+45) (not (<= x 8e+62)))
         t_1
         (- (* y (- 1.0 z)) t))))))
double code(double x, double y, double z, double t) {
	double t_1 = x * log(y);
	double tmp;
	if (x <= -1.5e+134) {
		tmp = t_1;
	} else if (x <= -4.5e+97) {
		tmp = -t - (z * y);
	} else if ((x <= -5.2e+45) || !(x <= 8e+62)) {
		tmp = t_1;
	} else {
		tmp = (y * (1.0 - z)) - 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 <= (-1.5d+134)) then
        tmp = t_1
    else if (x <= (-4.5d+97)) then
        tmp = -t - (z * y)
    else if ((x <= (-5.2d+45)) .or. (.not. (x <= 8d+62))) then
        tmp = t_1
    else
        tmp = (y * (1.0d0 - z)) - 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 <= -1.5e+134) {
		tmp = t_1;
	} else if (x <= -4.5e+97) {
		tmp = -t - (z * y);
	} else if ((x <= -5.2e+45) || !(x <= 8e+62)) {
		tmp = t_1;
	} else {
		tmp = (y * (1.0 - z)) - t;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x * math.log(y)
	tmp = 0
	if x <= -1.5e+134:
		tmp = t_1
	elif x <= -4.5e+97:
		tmp = -t - (z * y)
	elif (x <= -5.2e+45) or not (x <= 8e+62):
		tmp = t_1
	else:
		tmp = (y * (1.0 - z)) - t
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x * log(y))
	tmp = 0.0
	if (x <= -1.5e+134)
		tmp = t_1;
	elseif (x <= -4.5e+97)
		tmp = Float64(Float64(-t) - Float64(z * y));
	elseif ((x <= -5.2e+45) || !(x <= 8e+62))
		tmp = t_1;
	else
		tmp = Float64(Float64(y * Float64(1.0 - z)) - t);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x * log(y);
	tmp = 0.0;
	if (x <= -1.5e+134)
		tmp = t_1;
	elseif (x <= -4.5e+97)
		tmp = -t - (z * y);
	elseif ((x <= -5.2e+45) || ~((x <= 8e+62)))
		tmp = t_1;
	else
		tmp = (y * (1.0 - z)) - 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, -1.5e+134], t$95$1, If[LessEqual[x, -4.5e+97], N[((-t) - N[(z * y), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, -5.2e+45], N[Not[LessEqual[x, 8e+62]], $MachinePrecision]], t$95$1, N[(N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x \cdot \log y\\
\mathbf{if}\;x \leq -1.5 \cdot 10^{+134}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;x \leq -5.2 \cdot 10^{+45} \lor \neg \left(x \leq 8 \cdot 10^{+62}\right):\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.49999999999999998e134 or -4.49999999999999976e97 < x < -5.20000000000000014e45 or 8.00000000000000028e62 < x

    1. Initial program 97.9%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{t \cdot \left(\frac{\log y \cdot \left(x - 1\right)}{t} - 1\right)} \]
    7. Step-by-step derivation
      1. sub-neg65.5%

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

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

        \[\leadsto t \cdot \left(\frac{\log y \cdot \left(x + \color{blue}{-1}\right)}{t} + \left(-1\right)\right) \]
      4. associate-*r/65.5%

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

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

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

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

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

        \[\leadsto \color{blue}{\log y \cdot x} \]
    11. Simplified83.6%

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

    if -1.49999999999999998e134 < x < -4.49999999999999976e97

    1. Initial program 89.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.20000000000000014e45 < x < 8.00000000000000028e62

    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. Add Preprocessing
    3. Taylor expanded in y around 0 98.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.5 \cdot 10^{+134}:\\ \;\;\;\;x \cdot \log y\\ \mathbf{elif}\;x \leq -4.5 \cdot 10^{+97}:\\ \;\;\;\;\left(-t\right) - z \cdot y\\ \mathbf{elif}\;x \leq -5.2 \cdot 10^{+45} \lor \neg \left(x \leq 8 \cdot 10^{+62}\right):\\ \;\;\;\;x \cdot \log y\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(1 - z\right) - t\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 95.4% accurate, 1.7× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 x #s(literal 1 binary64)) < -5e5 or -1 < (-.f64 x #s(literal 1 binary64))

    1. Initial program 96.0%

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

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

    if -5e5 < (-.f64 x #s(literal 1 binary64)) < -1

    1. Initial program 85.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;-1 + x \leq -500000 \lor \neg \left(-1 + x \leq -1\right):\\ \;\;\;\;\left(-1 + x\right) \cdot \log y - t\\ \mathbf{else}:\\ \;\;\;\;\left(y \cdot \left(1 - z\right) - \log y\right) - t\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 99.6% accurate, 1.7× speedup?

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

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

    \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
  2. Add Preprocessing
  3. 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(y \cdot \left(y \cdot \left(-0.3333333333333333 \cdot y - 0.5\right) - 1\right)\right)}\right) - t \]
  4. Final simplification99.4%

    \[\leadsto \left(\left(-1 + x\right) \cdot \log y + \left(z + -1\right) \cdot \left(y \cdot \left(-1 + y \cdot \left(y \cdot -0.3333333333333333 - 0.5\right)\right)\right)\right) - t \]
  5. Add Preprocessing

Alternative 7: 99.4% accurate, 1.8× speedup?

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

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

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

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

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

Alternative 8: 90.1% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -6.5 \cdot 10^{+195}:\\ \;\;\;\;y \cdot \left(z \cdot \left(-1 + y \cdot -0.5\right)\right) - t\\ \mathbf{elif}\;z \leq 3 \cdot 10^{+181}:\\ \;\;\;\;\left(-1 + x\right) \cdot \log y - t\\ \mathbf{else}:\\ \;\;\;\;z \cdot \mathsf{log1p}\left(-y\right) - t\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= z -6.5e+195)
   (- (* y (* z (+ -1.0 (* y -0.5)))) t)
   (if (<= z 3e+181) (- (* (+ -1.0 x) (log y)) t) (- (* z (log1p (- y))) t))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (z <= -6.5e+195) {
		tmp = (y * (z * (-1.0 + (y * -0.5)))) - t;
	} else if (z <= 3e+181) {
		tmp = ((-1.0 + x) * log(y)) - t;
	} else {
		tmp = (z * log1p(-y)) - t;
	}
	return tmp;
}
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (z <= -6.5e+195) {
		tmp = (y * (z * (-1.0 + (y * -0.5)))) - t;
	} else if (z <= 3e+181) {
		tmp = ((-1.0 + x) * Math.log(y)) - t;
	} else {
		tmp = (z * Math.log1p(-y)) - t;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if z <= -6.5e+195:
		tmp = (y * (z * (-1.0 + (y * -0.5)))) - t
	elif z <= 3e+181:
		tmp = ((-1.0 + x) * math.log(y)) - t
	else:
		tmp = (z * math.log1p(-y)) - t
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (z <= -6.5e+195)
		tmp = Float64(Float64(y * Float64(z * Float64(-1.0 + Float64(y * -0.5)))) - t);
	elseif (z <= 3e+181)
		tmp = Float64(Float64(Float64(-1.0 + x) * log(y)) - t);
	else
		tmp = Float64(Float64(z * log1p(Float64(-y))) - t);
	end
	return tmp
end
code[x_, y_, z_, t_] := If[LessEqual[z, -6.5e+195], N[(N[(y * N[(z * N[(-1.0 + N[(y * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[z, 3e+181], N[(N[(N[(-1.0 + x), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(z * N[Log[1 + (-y)], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.5 \cdot 10^{+195}:\\
\;\;\;\;y \cdot \left(z \cdot \left(-1 + y \cdot -0.5\right)\right) - t\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -6.5000000000000003e195

    1. Initial program 52.5%

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

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

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

    if -6.5000000000000003e195 < z < 3.00000000000000012e181

    1. Initial program 96.4%

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

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

    if 3.00000000000000012e181 < z

    1. Initial program 62.7%

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{log1p}\left(-y\right)} \cdot z - t \]
    5. Simplified83.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -6.5 \cdot 10^{+195}:\\ \;\;\;\;y \cdot \left(z \cdot \left(-1 + y \cdot -0.5\right)\right) - t\\ \mathbf{elif}\;z \leq 3 \cdot 10^{+181}:\\ \;\;\;\;\left(-1 + x\right) \cdot \log y - t\\ \mathbf{else}:\\ \;\;\;\;z \cdot \mathsf{log1p}\left(-y\right) - t\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 86.8% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -280 \lor \neg \left(t \leq 2.6 \cdot 10^{-15}\right):\\
\;\;\;\;x \cdot \log y - t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -280 or 2.60000000000000004e-15 < t

    1. Initial program 92.3%

      \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
    2. Add Preprocessing
    3. 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(y \cdot \left(-0.5 \cdot y - 1\right)\right)}\right) - t \]
    4. Taylor expanded in x around inf 91.3%

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

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

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

    if -280 < t < 2.60000000000000004e-15

    1. Initial program 89.2%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{t \cdot \left(\frac{\log y \cdot \left(x - 1\right)}{t} - 1\right)} \]
    7. Step-by-step derivation
      1. sub-neg63.4%

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

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

        \[\leadsto t \cdot \left(\frac{\log y \cdot \left(x + \color{blue}{-1}\right)}{t} + \left(-1\right)\right) \]
      4. associate-*r/63.3%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -280 \lor \neg \left(t \leq 2.6 \cdot 10^{-15}\right):\\ \;\;\;\;x \cdot \log y - t\\ \mathbf{else}:\\ \;\;\;\;\left(-1 + x\right) \cdot \log y\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 78.6% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.8 \cdot 10^{+17}:\\
\;\;\;\;y \cdot \left(z \cdot \left(-1 + y \cdot -0.5\right)\right) - t\\

\mathbf{elif}\;t \leq 3.7 \cdot 10^{+19}:\\
\;\;\;\;\left(-1 + x\right) \cdot \log y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -3.8e17

    1. Initial program 90.7%

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

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

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

    if -3.8e17 < t < 3.7e19

    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. Add Preprocessing
    3. Taylor expanded in t around inf 67.0%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{t \cdot \left(\frac{\log y \cdot \left(x - 1\right)}{t} - 1\right)} \]
    7. Step-by-step derivation
      1. sub-neg66.0%

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

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

        \[\leadsto t \cdot \left(\frac{\log y \cdot \left(x + \color{blue}{-1}\right)}{t} + \left(-1\right)\right) \]
      4. associate-*r/65.9%

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

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

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

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

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

    if 3.7e19 < t

    1. Initial program 92.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -3.8 \cdot 10^{+17}:\\ \;\;\;\;y \cdot \left(z \cdot \left(-1 + y \cdot -0.5\right)\right) - t\\ \mathbf{elif}\;t \leq 3.7 \cdot 10^{+19}:\\ \;\;\;\;\left(-1 + x\right) \cdot \log y\\ \mathbf{else}:\\ \;\;\;\;\left(-t\right) - z \cdot y\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 99.1% accurate, 1.9× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 56.1% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -0.105:\\
\;\;\;\;y \cdot \left(z \cdot \left(-1 + y \cdot -0.5\right)\right) - t\\

\mathbf{elif}\;t \leq 1800:\\
\;\;\;\;-\log y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -0.104999999999999996

    1. Initial program 91.3%

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

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

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

    if -0.104999999999999996 < t < 1800

    1. Initial program 89.4%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{t \cdot \left(\frac{\log y \cdot \left(x - 1\right)}{t} - 1\right)} \]
    7. Step-by-step derivation
      1. sub-neg64.0%

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

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

        \[\leadsto t \cdot \left(\frac{\log y \cdot \left(x + \color{blue}{-1}\right)}{t} + \left(-1\right)\right) \]
      4. associate-*r/63.8%

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

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

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

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

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

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

    if 1800 < t

    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. Add Preprocessing
    3. Taylor expanded in y around 0 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -0.105:\\ \;\;\;\;y \cdot \left(z \cdot \left(-1 + y \cdot -0.5\right)\right) - t\\ \mathbf{elif}\;t \leq 1800:\\ \;\;\;\;-\log y\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(1 - z\right) - t\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 99.0% accurate, 1.9× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 14: 45.8% accurate, 30.7× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{y \cdot \left(1 - z\right)} - t \]
  7. Add Preprocessing

Alternative 15: 45.6% accurate, 35.8× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \left(-t\right) - z \cdot y \]
  10. Add Preprocessing

Alternative 16: 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.8%

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

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

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

    \[\leadsto \color{blue}{-t} \]
  6. Add Preprocessing

Alternative 17: 2.3% accurate, 215.0× speedup?

\[\begin{array}{l} \\ 0 \end{array} \]
(FPCore (x y z t) :precision binary64 0.0)
double code(double x, double y, double z, double t) {
	return 0.0;
}
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 = 0.0d0
end function
public static double code(double x, double y, double z, double t) {
	return 0.0;
}
def code(x, y, z, t):
	return 0.0
function code(x, y, z, t)
	return 0.0
end
function tmp = code(x, y, z, t)
	tmp = 0.0;
end
code[x_, y_, z_, t_] := 0.0
\begin{array}{l}

\\
0
\end{array}
Derivation
  1. Initial program 90.8%

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

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

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

    \[\leadsto \color{blue}{-t} \]
  6. Step-by-step derivation
    1. expm1-log1p-u15.4%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(-t\right)\right)} \]
    2. expm1-undefine15.3%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(-t\right)} - 1} \]
  7. Applied egg-rr15.3%

    \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(-t\right)} - 1} \]
  8. Step-by-step derivation
    1. sub-neg15.3%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(-t\right)} + \left(-1\right)} \]
    2. log1p-undefine15.3%

      \[\leadsto e^{\color{blue}{\log \left(1 + \left(-t\right)\right)}} + \left(-1\right) \]
    3. rem-exp-log36.7%

      \[\leadsto \color{blue}{\left(1 + \left(-t\right)\right)} + \left(-1\right) \]
    4. unsub-neg36.7%

      \[\leadsto \color{blue}{\left(1 - t\right)} + \left(-1\right) \]
    5. metadata-eval36.7%

      \[\leadsto \left(1 - t\right) + \color{blue}{-1} \]
  9. Simplified36.7%

    \[\leadsto \color{blue}{\left(1 - t\right) + -1} \]
  10. Taylor expanded in t around 0 2.4%

    \[\leadsto \color{blue}{1} + -1 \]
  11. Step-by-step derivation
    1. metadata-eval2.4%

      \[\leadsto \color{blue}{0} \]
  12. Applied egg-rr2.4%

    \[\leadsto \color{blue}{0} \]
  13. Add Preprocessing

Reproduce

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