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

Percentage Accurate: 88.9% → 99.8%
Time: 15.6s
Alternatives: 13
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 13 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.9% accurate, 1.0× speedup?

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

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

Alternative 1: 99.8% accurate, 0.7× speedup?

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

\\
\mathsf{fma}\left(z + -1, \mathsf{log1p}\left(-y\right), \log y \cdot \left(-1 + x\right) - t\right)
\end{array}
Derivation
  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. Step-by-step derivation
    1. sub-neg91.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 98.1% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := y \cdot \left(1 - z\right)\\ \mathbf{if}\;-1 + x \leq -50 \lor \neg \left(-1 + x \leq -1\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) -50.0) (not (<= (+ -1.0 x) -1.0)))
     (- (+ 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) <= -50.0) || !((-1.0 + x) <= -1.0)) {
		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) <= (-50.0d0)) .or. (.not. (((-1.0d0) + x) <= (-1.0d0)))) 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) <= -50.0) || !((-1.0 + x) <= -1.0)) {
		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) <= -50.0) or not ((-1.0 + x) <= -1.0):
		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) <= -50.0) || !(Float64(-1.0 + x) <= -1.0))
		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) <= -50.0) || ~(((-1.0 + x) <= -1.0)))
		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], -50.0], N[Not[LessEqual[N[(-1.0 + x), $MachinePrecision], -1.0]], $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 -50 \lor \neg \left(-1 + x \leq -1\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 1) < -50 or -1 < (-.f64 x 1)

    1. Initial program 95.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -50 < (-.f64 x 1) < -1

    1. Initial program 87.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;-1 + x \leq -50 \lor \neg \left(-1 + x \leq -1\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} \]

Alternative 3: 95.1% accurate, 1.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 x 1) < -5e15 or 2e11 < (-.f64 x 1)

    1. Initial program 95.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5e15 < (-.f64 x 1) < 2e11

    1. Initial program 86.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 95.1% accurate, 1.8× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;\frac{\log y}{\frac{1}{-1 + x}} - t\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (-.f64 x 1) < -5e15

    1. Initial program 97.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\log y \cdot x} - t \]
    7. Simplified97.7%

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

    if -5e15 < (-.f64 x 1) < 2e11

    1. Initial program 86.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2e11 < (-.f64 x 1)

    1. Initial program 93.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\log y}{\frac{1}{x - 1}}} - t \]
      9. sub-neg92.1%

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

        \[\leadsto \frac{\log y}{\frac{1}{x + \color{blue}{-1}}} - t \]
    6. Applied egg-rr92.1%

      \[\leadsto \color{blue}{\frac{\log y}{\frac{1}{x + -1}}} - t \]
  3. Recombined 3 regimes into one program.
  4. Final simplification96.9%

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

Alternative 5: 99.1% accurate, 1.9× speedup?

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

\\
\left(y \cdot \left(1 - z\right) + \log y \cdot \left(-1 + x\right)\right) - t
\end{array}
Derivation
  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. Taylor expanded in y around 0 99.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 89.2% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.02 \cdot 10^{+239}:\\
\;\;\;\;z \cdot \left(-y\right) - t\\

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

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


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

    1. Initial program 35.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.02e239 < z < 2.7999999999999999e243

    1. Initial program 95.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.7999999999999999e243 < z

    1. Initial program 57.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 86.5% accurate, 2.0× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.85e10 or 7.6e-19 < x

    1. Initial program 95.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.85e10 < x < 7.6e-19

    1. Initial program 86.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 59.5% accurate, 2.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.5 \cdot 10^{+170} \lor \neg \left(z \leq 2.05 \cdot 10^{+36}\right):\\
\;\;\;\;z \cdot \left(-y\right) - t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -4.50000000000000022e170 or 2.05000000000000006e36 < z

    1. Initial program 74.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.50000000000000022e170 < z < 2.05000000000000006e36

    1. Initial program 99.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -4.5 \cdot 10^{+170} \lor \neg \left(z \leq 2.05 \cdot 10^{+36}\right):\\ \;\;\;\;z \cdot \left(-y\right) - t\\ \mathbf{else}:\\ \;\;\;\;\left(-\log y\right) - t\\ \end{array} \]

Alternative 9: 41.4% accurate, 26.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -7.3 \cdot 10^{-59} \lor \neg \left(t \leq 1.4 \cdot 10^{-22}\right):\\
\;\;\;\;-t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -7.3000000000000004e-59 or 1.39999999999999997e-22 < t

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -7.3000000000000004e-59 < t < 1.39999999999999997e-22

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-y \cdot z} \]
      2. distribute-rgt-neg-in18.4%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -7.3 \cdot 10^{-59} \lor \neg \left(t \leq 1.4 \cdot 10^{-22}\right):\\ \;\;\;\;-t\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(-y\right)\\ \end{array} \]

Alternative 10: 41.3% accurate, 26.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -7 \cdot 10^{-59}:\\
\;\;\;\;z \cdot y - t\\

\mathbf{elif}\;t \leq 1.02 \cdot 10^{-22}:\\
\;\;\;\;z \cdot \left(-y\right)\\

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


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

    1. Initial program 99.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{y \cdot \left(-z\right)} - t \]
    8. Step-by-step derivation
      1. sub-neg73.3%

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

        \[\leadsto \color{blue}{\left(-z\right) \cdot y} + \left(-t\right) \]
      3. add-sqr-sqrt34.1%

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

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

        \[\leadsto \sqrt{\color{blue}{z \cdot z}} \cdot y + \left(-t\right) \]
      6. sqrt-unprod38.3%

        \[\leadsto \color{blue}{\left(\sqrt{z} \cdot \sqrt{z}\right)} \cdot y + \left(-t\right) \]
      7. add-sqr-sqrt72.4%

        \[\leadsto \color{blue}{z} \cdot y + \left(-t\right) \]
    9. Applied egg-rr72.4%

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

    if -7.0000000000000002e-59 < t < 1.02000000000000002e-22

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-y \cdot z} \]
      2. distribute-rgt-neg-in18.4%

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

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

    if 1.02000000000000002e-22 < t

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -7 \cdot 10^{-59}:\\ \;\;\;\;z \cdot y - t\\ \mathbf{elif}\;t \leq 1.02 \cdot 10^{-22}:\\ \;\;\;\;z \cdot \left(-y\right)\\ \mathbf{else}:\\ \;\;\;\;-t\\ \end{array} \]

Alternative 11: 45.7% accurate, 30.7× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 45.5% accurate, 35.8× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 13: 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 91.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{-t} \]
  7. Final simplification37.5%

    \[\leadsto -t \]

Reproduce

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