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

Percentage Accurate: 88.8% → 99.8%
Time: 19.8s
Alternatives: 19
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 19 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: 88.8% 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 87.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 99.8% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(z + -1, \mathsf{log1p}\left(-y\right), \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 87.9%

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(z + -1, \log \color{blue}{\left(1 + \left(-y\right)\right)}, \left(x - 1\right) \cdot \log y\right) - t \]
    6. log1p-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: 74.1% accurate, 1.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := z \cdot \left(\frac{y}{z} - y\right) - t\\ t_2 := x \cdot \log y\\ t_3 := \left(-\log y\right) - t\\ \mathbf{if}\;x \leq -1950000000:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;x \leq 3.05 \cdot 10^{-297}:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;x \leq 10^{-187}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 3.6 \cdot 10^{-32}:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;x \leq 1.2 \cdot 10^{+20}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (- (* z (- (/ y z) y)) t))
        (t_2 (* x (log y)))
        (t_3 (- (- (log y)) t)))
   (if (<= x -1950000000.0)
     t_2
     (if (<= x 3.05e-297)
       t_3
       (if (<= x 1e-187)
         t_1
         (if (<= x 3.6e-32) t_3 (if (<= x 1.2e+20) t_1 t_2)))))))
double code(double x, double y, double z, double t) {
	double t_1 = (z * ((y / z) - y)) - t;
	double t_2 = x * log(y);
	double t_3 = -log(y) - t;
	double tmp;
	if (x <= -1950000000.0) {
		tmp = t_2;
	} else if (x <= 3.05e-297) {
		tmp = t_3;
	} else if (x <= 1e-187) {
		tmp = t_1;
	} else if (x <= 3.6e-32) {
		tmp = t_3;
	} else if (x <= 1.2e+20) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: tmp
    t_1 = (z * ((y / z) - y)) - t
    t_2 = x * log(y)
    t_3 = -log(y) - t
    if (x <= (-1950000000.0d0)) then
        tmp = t_2
    else if (x <= 3.05d-297) then
        tmp = t_3
    else if (x <= 1d-187) then
        tmp = t_1
    else if (x <= 3.6d-32) then
        tmp = t_3
    else if (x <= 1.2d+20) then
        tmp = t_1
    else
        tmp = t_2
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = (z * ((y / z) - y)) - t;
	double t_2 = x * Math.log(y);
	double t_3 = -Math.log(y) - t;
	double tmp;
	if (x <= -1950000000.0) {
		tmp = t_2;
	} else if (x <= 3.05e-297) {
		tmp = t_3;
	} else if (x <= 1e-187) {
		tmp = t_1;
	} else if (x <= 3.6e-32) {
		tmp = t_3;
	} else if (x <= 1.2e+20) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = (z * ((y / z) - y)) - t
	t_2 = x * math.log(y)
	t_3 = -math.log(y) - t
	tmp = 0
	if x <= -1950000000.0:
		tmp = t_2
	elif x <= 3.05e-297:
		tmp = t_3
	elif x <= 1e-187:
		tmp = t_1
	elif x <= 3.6e-32:
		tmp = t_3
	elif x <= 1.2e+20:
		tmp = t_1
	else:
		tmp = t_2
	return tmp
function code(x, y, z, t)
	t_1 = Float64(Float64(z * Float64(Float64(y / z) - y)) - t)
	t_2 = Float64(x * log(y))
	t_3 = Float64(Float64(-log(y)) - t)
	tmp = 0.0
	if (x <= -1950000000.0)
		tmp = t_2;
	elseif (x <= 3.05e-297)
		tmp = t_3;
	elseif (x <= 1e-187)
		tmp = t_1;
	elseif (x <= 3.6e-32)
		tmp = t_3;
	elseif (x <= 1.2e+20)
		tmp = t_1;
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = (z * ((y / z) - y)) - t;
	t_2 = x * log(y);
	t_3 = -log(y) - t;
	tmp = 0.0;
	if (x <= -1950000000.0)
		tmp = t_2;
	elseif (x <= 3.05e-297)
		tmp = t_3;
	elseif (x <= 1e-187)
		tmp = t_1;
	elseif (x <= 3.6e-32)
		tmp = t_3;
	elseif (x <= 1.2e+20)
		tmp = t_1;
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z * N[(N[(y / z), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[((-N[Log[y], $MachinePrecision]) - t), $MachinePrecision]}, If[LessEqual[x, -1950000000.0], t$95$2, If[LessEqual[x, 3.05e-297], t$95$3, If[LessEqual[x, 1e-187], t$95$1, If[LessEqual[x, 3.6e-32], t$95$3, If[LessEqual[x, 1.2e+20], t$95$1, t$95$2]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := z \cdot \left(\frac{y}{z} - y\right) - t\\
t_2 := x \cdot \log y\\
t_3 := \left(-\log y\right) - t\\
\mathbf{if}\;x \leq -1950000000:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;x \leq 3.05 \cdot 10^{-297}:\\
\;\;\;\;t\_3\\

\mathbf{elif}\;x \leq 10^{-187}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \leq 3.6 \cdot 10^{-32}:\\
\;\;\;\;t\_3\\

\mathbf{elif}\;x \leq 1.2 \cdot 10^{+20}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.95e9 or 1.2e20 < x

    1. Initial program 92.5%

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

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

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

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

    if -1.95e9 < x < 3.05e-297 or 1e-187 < x < 3.59999999999999993e-32

    1. Initial program 91.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \left(\log y + \color{blue}{\left(-\frac{t + \log y}{x}\right)}\right) \]
      2. distribute-neg-frac268.7%

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

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

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

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

        \[\leadsto \color{blue}{-\left(t + \log y\right)} \]
      2. distribute-neg-in89.8%

        \[\leadsto \color{blue}{\left(-t\right) + \left(-\log y\right)} \]
      3. unsub-neg89.8%

        \[\leadsto \color{blue}{\left(-t\right) - \log y} \]
    11. Simplified89.8%

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

    if 3.05e-297 < x < 1e-187 or 3.59999999999999993e-32 < x < 1.2e20

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1950000000:\\ \;\;\;\;x \cdot \log y\\ \mathbf{elif}\;x \leq 3.05 \cdot 10^{-297}:\\ \;\;\;\;\left(-\log y\right) - t\\ \mathbf{elif}\;x \leq 10^{-187}:\\ \;\;\;\;z \cdot \left(\frac{y}{z} - y\right) - t\\ \mathbf{elif}\;x \leq 3.6 \cdot 10^{-32}:\\ \;\;\;\;\left(-\log y\right) - t\\ \mathbf{elif}\;x \leq 1.2 \cdot 10^{+20}:\\ \;\;\;\;z \cdot \left(\frac{y}{z} - y\right) - t\\ \mathbf{else}:\\ \;\;\;\;x \cdot \log y\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 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 87.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.4%

    \[\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.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 \left(y \cdot -0.25 - 0.3333333333333333\right) - 0.5\right)\right)\right)\right) - t \]
  5. Add Preprocessing

Alternative 5: 97.9% accurate, 1.7× speedup?

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

\\
\begin{array}{l}
t_1 := y \cdot \left(1 - z\right)\\
\mathbf{if}\;-1 + x \leq -2000000000 \lor \neg \left(-1 + x \leq -0.5\right):\\
\;\;\;\;\left(t\_1 + x \cdot \log y\right) - t\\

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


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

    1. Initial program 92.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 83.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 y around 0 98.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 87.4% accurate, 1.7× speedup?

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

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

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


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

    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 y around 0 86.8%

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

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

    1. Initial program 75.3%

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

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{-1 \cdot \left(y \cdot \left(z - 1\right)\right)}\right) - t \]
    4. Step-by-step derivation
      1. 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 \]
      2. distribute-rgt-neg-in100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 98.1% accurate, 1.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -2 \cdot 10^{+14} \lor \neg \left(z \leq 4.2 \cdot 10^{+128}\right):\\
\;\;\;\;z \cdot \left(\log y \cdot \frac{-1 + x}{z} - y\right) - t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -2e14 or 4.1999999999999999e128 < z

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2e14 < z < 4.1999999999999999e128

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

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

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

Alternative 8: 99.5% 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 87.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.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 9: 95.0% accurate, 1.8× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -7.9999999999999994e112 or 1.55e133 < z

    1. Initial program 60.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto z \cdot \left(\color{blue}{x \cdot \frac{\log y}{z}} - y\right) - t \]
    11. Simplified93.6%

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

    if -7.9999999999999994e112 < z < 1.55e133

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

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

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

Alternative 10: 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 87.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.1%

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

    \[\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 11: 89.3% accurate, 1.8× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -5.50000000000000022e242 or 1.6499999999999999e265 < z

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.50000000000000022e242 < z < 1.6499999999999999e265

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

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

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

Alternative 12: 77.6% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.4 \cdot 10^{+27} \lor \neg \left(t \leq 8 \cdot 10^{+46}\right):\\
\;\;\;\;y \cdot \left(-z\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 < -4.3999999999999997e27 or 7.9999999999999999e46 < t

    1. Initial program 93.7%

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

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{-1 \cdot \left(y \cdot \left(z - 1\right)\right)}\right) - t \]
    4. Step-by-step derivation
      1. 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 \]
      2. distribute-rgt-neg-in98.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.3999999999999997e27 < t < 7.9999999999999999e46

    1. Initial program 84.5%

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

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

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

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

Alternative 13: 66.3% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -3300000000 \lor \neg \left(x \leq 5.7 \cdot 10^{+16}\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 -3300000000.0) (not (<= x 5.7e+16)))
   (* x (log y))
   (- (* z (- (/ y z) y)) t)))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((x <= -3300000000.0) || !(x <= 5.7e+16)) {
		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 <= (-3300000000.0d0)) .or. (.not. (x <= 5.7d+16))) 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 <= -3300000000.0) || !(x <= 5.7e+16)) {
		tmp = x * Math.log(y);
	} else {
		tmp = (z * ((y / z) - y)) - t;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (x <= -3300000000.0) or not (x <= 5.7e+16):
		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 <= -3300000000.0) || !(x <= 5.7e+16))
		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 <= -3300000000.0) || ~((x <= 5.7e+16)))
		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, -3300000000.0], N[Not[LessEqual[x, 5.7e+16]], $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 -3300000000 \lor \neg \left(x \leq 5.7 \cdot 10^{+16}\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 < -3.3e9 or 5.7e16 < x

    1. Initial program 92.5%

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

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

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

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

    if -3.3e9 < x < 5.7e16

    1. Initial program 83.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 14: 99.0% 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 87.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.9%

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

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

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

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

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

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

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

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

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

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

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

Alternative 15: 42.7% accurate, 14.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -10500 \lor \neg \left(t \leq 3.5 \cdot 10^{+34}\right):\\
\;\;\;\;-t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -10500 or 3.49999999999999998e34 < t

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

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

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

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

    if -10500 < t < 3.49999999999999998e34

    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. Taylor expanded in y around 0 98.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left({\left(\sqrt[3]{\left(x + \color{blue}{-1}\right) \cdot \log y}\right)}^{3} + y \cdot \left(1 - z\right)\right) - t \]
    7. Applied egg-rr97.4%

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

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

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

Alternative 16: 42.9% accurate, 15.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.2 \cdot 10^{+18} \lor \neg \left(t \leq 34000000000000\right):\\
\;\;\;\;-t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -3.2e18 or 3.4e13 < t

    1. Initial program 94.2%

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

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

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

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

    if -3.2e18 < t < 3.4e13

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

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

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

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

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

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

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

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

Alternative 17: 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 87.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.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 18: 45.7% accurate, 35.8× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 19: 34.9% 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 87.9%

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

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

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

    \[\leadsto \color{blue}{-t} \]
  6. Final simplification29.8%

    \[\leadsto -t \]
  7. Add Preprocessing

Reproduce

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