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

Percentage Accurate: 89.6% → 99.8%
Time: 22.8s
Alternatives: 20
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 20 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.6% 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 91.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(z + -1, \log \color{blue}{\left(1 + \left(-y\right)\right)}, \left(x - 1\right) \cdot \log y\right) - t \]
    6. log1p-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), \log y \cdot \left(-1 + x\right)\right) - t \]
  6. Add Preprocessing

Alternative 3: 99.6% accurate, 1.7× speedup?

\[\begin{array}{l} \\ \left(\log y \cdot \left(-1 + x\right) + \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
 (-
  (+
   (* (log y) (+ -1.0 x))
   (*
    (+ 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 ((log(y) * (-1.0 + x)) + ((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 = ((log(y) * ((-1.0d0) + x)) + ((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 ((Math.log(y) * (-1.0 + x)) + ((z + -1.0) * (y * (-1.0 + (y * ((y * ((y * -0.25) - 0.3333333333333333)) - 0.5)))))) - t;
}
def code(x, y, z, t):
	return ((math.log(y) * (-1.0 + x)) + ((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(log(y) * Float64(-1.0 + x)) + 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 = ((log(y) * (-1.0 + x)) + ((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[Log[y], $MachinePrecision] * N[(-1.0 + x), $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(\log y \cdot \left(-1 + x\right) + \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 91.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 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(\log y \cdot \left(-1 + x\right) + \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: 98.1% accurate, 1.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.8 \cdot 10^{+136} \lor \neg \left(z \leq 1.12 \cdot 10^{+55}\right):\\
\;\;\;\;z \cdot \left(\log y \cdot \frac{-1 + x}{z} - y\right) - t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -2.8000000000000002e136 or 1.12000000000000006e55 < z

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

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

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

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

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

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

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

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

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

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

    if -2.8000000000000002e136 < z < 1.12000000000000006e55

    1. Initial program 99.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 \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.5%

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

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

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

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

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

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

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

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

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

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

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

      \[\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 0 99.5%

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

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

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

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

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

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

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

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

Alternative 5: 95.0% accurate, 1.7× speedup?

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

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

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

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


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

    1. Initial program 99.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.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. +-commutative99.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-neg99.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-eval99.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. *-commutative99.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-neg99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\log y \cdot x} - t \]
    11. Simplified99.8%

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

    if -1.9999999999999999e31 < (-.f64 x #s(literal 1 binary64)) < -1

    1. Initial program 83.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. Step-by-step derivation
      1. flip--83.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 99.6% accurate, 1.7× speedup?

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

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

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

Alternative 8: 87.0% accurate, 1.9× speedup?

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\log y \cdot x} - t \]
    11. Simplified98.9%

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

    if -2.4e21 < x < 1

    1. Initial program 83.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. Step-by-step derivation
      1. flip--83.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 77.9% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.6 \cdot 10^{+87} \lor \neg \left(t \leq 310\right):\\
\;\;\;\;z \cdot \left(\frac{y}{z} - y\right) - t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.6e87 or 310 < t

    1. Initial program 94.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.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. +-commutative99.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-neg99.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-eval99.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. *-commutative99.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-neg99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(z \cdot y\right)} \cdot \left(\frac{1}{z} - 1\right) - t \]
      3. associate-*l*75.0%

        \[\leadsto \color{blue}{z \cdot \left(y \cdot \left(\frac{1}{z} - 1\right)\right)} - t \]
      4. sub-neg75.0%

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

        \[\leadsto z \cdot \left(y \cdot \left(\frac{1}{z} + \color{blue}{-1}\right)\right) - t \]
      6. distribute-rgt-in75.0%

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

        \[\leadsto z \cdot \left(\color{blue}{\frac{1 \cdot y}{z}} + -1 \cdot y\right) - t \]
      8. *-lft-identity75.0%

        \[\leadsto z \cdot \left(\frac{\color{blue}{y}}{z} + -1 \cdot y\right) - t \]
      9. neg-mul-175.0%

        \[\leadsto z \cdot \left(\frac{y}{z} + \color{blue}{\left(-y\right)}\right) - t \]
      10. sub-neg75.0%

        \[\leadsto z \cdot \color{blue}{\left(\frac{y}{z} - y\right)} - t \]
    11. Simplified75.0%

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

    if -1.6e87 < t < 310

    1. Initial program 88.1%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{t \cdot \left(\left(\log y \cdot \frac{-1 + x}{t} + \log \left(1 - y\right) \cdot \frac{-1 + z}{t}\right) + -1\right)} \]
    6. Taylor expanded in y around 0 68.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-neg68.4%

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

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

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

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

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

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

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

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

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

Alternative 10: 76.3% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1.35 \cdot 10^{+65} \lor \neg \left(x \leq 6.6 \cdot 10^{+21}\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 -1.35e+65) (not (<= x 6.6e+21)))
   (* x (log y))
   (- (- t) (log y))))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((x <= -1.35e+65) || !(x <= 6.6e+21)) {
		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 <= (-1.35d+65)) .or. (.not. (x <= 6.6d+21))) 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 <= -1.35e+65) || !(x <= 6.6e+21)) {
		tmp = x * Math.log(y);
	} else {
		tmp = -t - Math.log(y);
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (x <= -1.35e+65) or not (x <= 6.6e+21):
		tmp = x * math.log(y)
	else:
		tmp = -t - math.log(y)
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if ((x <= -1.35e+65) || !(x <= 6.6e+21))
		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 <= -1.35e+65) || ~((x <= 6.6e+21)))
		tmp = x * log(y);
	else
		tmp = -t - log(y);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.35e+65], N[Not[LessEqual[x, 6.6e+21]], $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 -1.35 \cdot 10^{+65} \lor \neg \left(x \leq 6.6 \cdot 10^{+21}\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 < -1.35000000000000009e65 or 6.6e21 < x

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

      \[\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. Taylor expanded in x around inf 77.6%

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

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

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

    if -1.35000000000000009e65 < x < 6.6e21

    1. Initial program 84.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. Step-by-step derivation
      1. flip--84.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 89.4% accurate, 1.9× speedup?

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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 0 91.9%

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

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

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

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

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

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

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

    if 5.8999999999999997e237 < z

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(z \cdot y\right)} \cdot \left(\frac{1}{z} - 1\right) - t \]
      3. associate-*l*100.0%

        \[\leadsto \color{blue}{z \cdot \left(y \cdot \left(\frac{1}{z} - 1\right)\right)} - t \]
      4. sub-neg100.0%

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

        \[\leadsto z \cdot \left(y \cdot \left(\frac{1}{z} + \color{blue}{-1}\right)\right) - t \]
      6. distribute-rgt-in100.0%

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

        \[\leadsto z \cdot \left(\color{blue}{\frac{1 \cdot y}{z}} + -1 \cdot y\right) - t \]
      8. *-lft-identity100.0%

        \[\leadsto z \cdot \left(\frac{\color{blue}{y}}{z} + -1 \cdot y\right) - t \]
      9. neg-mul-1100.0%

        \[\leadsto z \cdot \left(\frac{y}{z} + \color{blue}{\left(-y\right)}\right) - t \]
      10. sub-neg100.0%

        \[\leadsto z \cdot \color{blue}{\left(\frac{y}{z} - y\right)} - t \]
    11. Simplified100.0%

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

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

Alternative 12: 66.5% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.35 \cdot 10^{+65} \lor \neg \left(x \leq 1.22 \cdot 10^{+23}\right):\\
\;\;\;\;x \cdot \log y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.35000000000000009e65 or 1.22e23 < x

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

      \[\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. Taylor expanded in x around inf 77.6%

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

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

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

    if -1.35000000000000009e65 < x < 1.22e23

    1. Initial program 84.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 99.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. +-commutative99.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-neg99.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-eval99.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. *-commutative99.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-neg99.0%

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

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

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

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

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

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

        \[\leadsto \left(\log y \cdot \left(-1 + x\right) - y \cdot \color{blue}{\left(-1 + z\right)}\right) - t \]
    5. Simplified99.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 97.6%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(z \cdot y\right)} \cdot \left(\frac{1}{z} - 1\right) - t \]
      3. associate-*l*57.9%

        \[\leadsto \color{blue}{z \cdot \left(y \cdot \left(\frac{1}{z} - 1\right)\right)} - t \]
      4. sub-neg57.9%

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

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

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

        \[\leadsto z \cdot \left(\color{blue}{\frac{1 \cdot y}{z}} + -1 \cdot y\right) - t \]
      8. *-lft-identity57.9%

        \[\leadsto z \cdot \left(\frac{\color{blue}{y}}{z} + -1 \cdot y\right) - t \]
      9. neg-mul-157.9%

        \[\leadsto z \cdot \left(\frac{y}{z} + \color{blue}{\left(-y\right)}\right) - t \]
      10. sub-neg57.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.35 \cdot 10^{+65} \lor \neg \left(x \leq 1.22 \cdot 10^{+23}\right):\\ \;\;\;\;x \cdot \log y\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(\frac{y}{z} - y\right) - t\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 99.1% accurate, 1.9× speedup?

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

\\
\left(\log y \cdot \left(-1 + x\right) + y \cdot \left(1 - z\right)\right) - t
\end{array}
Derivation
  1. Initial program 91.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 99.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 14: 89.2% accurate, 1.9× speedup?

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

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

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


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

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

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

    if 1.60000000000000009e233 < z

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(z \cdot y\right)} \cdot \left(\frac{1}{z} - 1\right) - t \]
      3. associate-*l*100.0%

        \[\leadsto \color{blue}{z \cdot \left(y \cdot \left(\frac{1}{z} - 1\right)\right)} - t \]
      4. sub-neg100.0%

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

        \[\leadsto z \cdot \left(y \cdot \left(\frac{1}{z} + \color{blue}{-1}\right)\right) - t \]
      6. distribute-rgt-in100.0%

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

        \[\leadsto z \cdot \left(\color{blue}{\frac{1 \cdot y}{z}} + -1 \cdot y\right) - t \]
      8. *-lft-identity100.0%

        \[\leadsto z \cdot \left(\frac{\color{blue}{y}}{z} + -1 \cdot y\right) - t \]
      9. neg-mul-1100.0%

        \[\leadsto z \cdot \left(\frac{y}{z} + \color{blue}{\left(-y\right)}\right) - t \]
      10. sub-neg100.0%

        \[\leadsto z \cdot \color{blue}{\left(\frac{y}{z} - y\right)} - t \]
    11. Simplified100.0%

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

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

Alternative 15: 42.6% accurate, 14.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.6 \cdot 10^{-14} \lor \neg \left(t \leq 8.5 \cdot 10^{+29}\right):\\
\;\;\;\;-t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -4.59999999999999996e-14 or 8.5000000000000006e29 < t

    1. Initial program 96.1%

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

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

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

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

    if -4.59999999999999996e-14 < t < 8.5000000000000006e29

    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. 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 17.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -4.6 \cdot 10^{-14} \lor \neg \left(t \leq 8.5 \cdot 10^{+29}\right):\\ \;\;\;\;-t\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(1 - z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 16: 42.6% accurate, 14.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.2 \cdot 10^{-14}:\\
\;\;\;\;-1 + \left(1 - t\right)\\

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.19999999999999993e-14 < t < 8.5000000000000006e29

    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. 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 17.1%

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

    if 8.5000000000000006e29 < t

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

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

        \[\leadsto \color{blue}{-t} \]
    5. Simplified72.0%

      \[\leadsto \color{blue}{-t} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification40.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -5.2 \cdot 10^{-14}:\\ \;\;\;\;-1 + \left(1 - t\right)\\ \mathbf{elif}\;t \leq 8.5 \cdot 10^{+29}:\\ \;\;\;\;y \cdot \left(1 - z\right)\\ \mathbf{else}:\\ \;\;\;\;-t\\ \end{array} \]
  5. Add Preprocessing

Alternative 17: 42.2% accurate, 15.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.1 \cdot 10^{-14} \lor \neg \left(t \leq 8.5 \cdot 10^{+29}\right):\\
\;\;\;\;-t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.1e-14 or 8.5000000000000006e29 < t

    1. Initial program 96.1%

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

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

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

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

    if -1.1e-14 < t < 8.5000000000000006e29

    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. 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 z around inf 16.4%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1.1 \cdot 10^{-14} \lor \neg \left(t \leq 8.5 \cdot 10^{+29}\right):\\ \;\;\;\;-t\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(-y\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 18: 45.9% accurate, 23.9× speedup?

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

\\
z \cdot \left(\frac{y}{z} - y\right) - t
\end{array}
Derivation
  1. Initial program 91.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 99.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(z \cdot y\right)} \cdot \left(\frac{1}{z} - 1\right) - t \]
    3. associate-*l*43.1%

      \[\leadsto \color{blue}{z \cdot \left(y \cdot \left(\frac{1}{z} - 1\right)\right)} - t \]
    4. sub-neg43.1%

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

      \[\leadsto z \cdot \left(y \cdot \left(\frac{1}{z} + \color{blue}{-1}\right)\right) - t \]
    6. distribute-rgt-in43.1%

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

      \[\leadsto z \cdot \left(\color{blue}{\frac{1 \cdot y}{z}} + -1 \cdot y\right) - t \]
    8. *-lft-identity43.1%

      \[\leadsto z \cdot \left(\frac{\color{blue}{y}}{z} + -1 \cdot y\right) - t \]
    9. neg-mul-143.1%

      \[\leadsto z \cdot \left(\frac{y}{z} + \color{blue}{\left(-y\right)}\right) - t \]
    10. sub-neg43.1%

      \[\leadsto z \cdot \color{blue}{\left(\frac{y}{z} - y\right)} - t \]
  11. Simplified43.1%

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

Alternative 19: 35.7% 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.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 34.0%

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

      \[\leadsto \color{blue}{-t} \]
  5. Simplified34.0%

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

Alternative 20: 2.9% accurate, 215.0× speedup?

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

\\
y
\end{array}
Derivation
  1. Initial program 91.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 99.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{y \cdot \left(1 - z\right)} \]
  7. Taylor expanded in z around 0 2.9%

    \[\leadsto \color{blue}{y} \]
  8. Add Preprocessing

Reproduce

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