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

Percentage Accurate: 89.3% → 99.8%
Time: 22.4s
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: 89.3% accurate, 1.0× speedup?

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

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

Alternative 1: 99.8% accurate, 0.7× speedup?

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

\\
\mathsf{fma}\left(z + -1, \mathsf{log1p}\left(-y\right), \log y \cdot \left(-1 + x\right)\right) - t
\end{array}
Derivation
  1. Initial program 89.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. +-commutative89.4%

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

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

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

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

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

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

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

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

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

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

Alternative 2: 99.2% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + y \cdot \left(-1 \cdot \left(z + \color{blue}{-1}\right)\right)\right) - t \]
    6. +-commutative99.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-in99.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-eval99.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-199.0%

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

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

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

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

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

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

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

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

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

Alternative 3: 88.3% accurate, 1.7× speedup?

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

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

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


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

    1. Initial program 89.5%

      \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. flip3--89.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \left(\mathsf{log1p}\left({y}^{3}\right) - \color{blue}{\mathsf{log1p}\left(y \cdot y + 1 \cdot y\right)}\right)\right) - t \]
      16. *-un-lft-identity99.7%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \left(\mathsf{log1p}\left({y}^{3}\right) - \mathsf{log1p}\left(y \cdot y + \color{blue}{y}\right)\right)\right) - t \]
      17. fma-def99.7%

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

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

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

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

    1. Initial program 84.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 98.3% accurate, 1.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;-1 + x \leq -200 \lor \neg \left(-1 + x \leq -0.5\right):\\ \;\;\;\;\left(x \cdot \log y - z \cdot y\right) - t\\ \mathbf{else}:\\ \;\;\;\;\left(y \cdot \left(1 - z\right) - \log y\right) - t\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (or (<= (+ -1.0 x) -200.0) (not (<= (+ -1.0 x) -0.5)))
   (- (- (* x (log y)) (* z 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) <= -200.0) || !((-1.0 + x) <= -0.5)) {
		tmp = ((x * log(y)) - (z * 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) <= (-200.0d0)) .or. (.not. (((-1.0d0) + x) <= (-0.5d0)))) then
        tmp = ((x * log(y)) - (z * 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) <= -200.0) || !((-1.0 + x) <= -0.5)) {
		tmp = ((x * Math.log(y)) - (z * 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) <= -200.0) or not ((-1.0 + x) <= -0.5):
		tmp = ((x * math.log(y)) - (z * 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) <= -200.0) || !(Float64(-1.0 + x) <= -0.5))
		tmp = Float64(Float64(Float64(x * log(y)) - Float64(z * 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) <= -200.0) || ~(((-1.0 + x) <= -0.5)))
		tmp = ((x * log(y)) - (z * 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], -200.0], N[Not[LessEqual[N[(-1.0 + x), $MachinePrecision], -0.5]], $MachinePrecision]], N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - N[(z * 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 -200 \lor \neg \left(-1 + x \leq -0.5\right):\\
\;\;\;\;\left(x \cdot \log y - z \cdot y\right) - t\\

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


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

    1. Initial program 94.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -200 < (-.f64 x 1) < -0.5

    1. Initial program 84.8%

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

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

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

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

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

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

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + y \cdot \left(-1 \cdot \left(z + \color{blue}{-1}\right)\right)\right) - t \]
      6. +-commutative98.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-in98.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-eval98.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-198.8%

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 89.7% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.9 \cdot 10^{+202} \lor \neg \left(z \leq 1.3 \cdot 10^{+186}\right):\\
\;\;\;\;z \cdot \mathsf{log1p}\left(-y\right) - t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -3.89999999999999983e202 or 1.3e186 < z

    1. Initial program 55.3%

      \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative55.3%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(\color{blue}{\frac{\log y \cdot \mathsf{fma}\left(x, x, -1\right)}{1 + x}} + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
    5. Step-by-step derivation
      1. associate-/l*44.3%

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

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

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

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

        \[\leadsto z \cdot \color{blue}{\mathsf{log1p}\left(-y\right)} - t \]
    9. Simplified88.0%

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

    if -3.89999999999999983e202 < z < 1.3e186

    1. Initial program 96.5%

      \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. flip3--96.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \left(\mathsf{log1p}\left({y}^{3}\right) - \color{blue}{\mathsf{log1p}\left(y \cdot y + 1 \cdot y\right)}\right)\right) - t \]
      16. *-un-lft-identity99.7%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \left(\mathsf{log1p}\left({y}^{3}\right) - \mathsf{log1p}\left(y \cdot y + \color{blue}{y}\right)\right)\right) - t \]
      17. fma-def99.7%

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

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

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

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

Alternative 6: 87.5% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -0.52 \lor \neg \left(x \leq 1\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 -0.52) (not (<= x 1.0))) (- (* x (log y)) t) (- (- (log y)) t)))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((x <= -0.52) || !(x <= 1.0)) {
		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 <= (-0.52d0)) .or. (.not. (x <= 1.0d0))) 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 <= -0.52) || !(x <= 1.0)) {
		tmp = (x * Math.log(y)) - t;
	} else {
		tmp = -Math.log(y) - t;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (x <= -0.52) or not (x <= 1.0):
		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 <= -0.52) || !(x <= 1.0))
		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 <= -0.52) || ~((x <= 1.0)))
		tmp = (x * log(y)) - t;
	else
		tmp = -log(y) - t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -0.52], N[Not[LessEqual[x, 1.0]], $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 -0.52 \lor \neg \left(x \leq 1\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 < -0.52000000000000002 or 1 < x

    1. Initial program 94.2%

      \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. flip3--94.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \left(\mathsf{log1p}\left({y}^{3}\right) - \color{blue}{\mathsf{log1p}\left(y \cdot y + 1 \cdot y\right)}\right)\right) - t \]
      16. *-un-lft-identity99.7%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \left(\mathsf{log1p}\left({y}^{3}\right) - \mathsf{log1p}\left(y \cdot y + \color{blue}{y}\right)\right)\right) - t \]
      17. fma-def99.7%

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

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

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

    if -0.52000000000000002 < x < 1

    1. Initial program 85.1%

      \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative85.1%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(\color{blue}{\frac{\log y \cdot \mathsf{fma}\left(x, x, -1\right)}{1 + x}} + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
    5. Step-by-step derivation
      1. associate-/l*85.1%

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

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

      \[\leadsto \color{blue}{\frac{\log y \cdot \left({x}^{2} - 1\right)}{1 + x}} - t \]
    8. Step-by-step derivation
      1. associate-/l*82.6%

        \[\leadsto \color{blue}{\frac{\log y}{\frac{1 + x}{{x}^{2} - 1}}} - t \]
      2. unpow282.6%

        \[\leadsto \frac{\log y}{\frac{1 + x}{\color{blue}{x \cdot x} - 1}} - t \]
      3. fma-neg82.6%

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

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

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

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

        \[\leadsto \color{blue}{\left(-\log y\right)} - t \]
    12. Simplified81.4%

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

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

Alternative 7: 87.6% accurate, 1.9× speedup?

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

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

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


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

    1. Initial program 94.2%

      \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. flip3--94.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \left(\mathsf{log1p}\left({y}^{3}\right) - \color{blue}{\mathsf{log1p}\left(y \cdot y + 1 \cdot y\right)}\right)\right) - t \]
      16. *-un-lft-identity99.7%

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \left(\mathsf{log1p}\left({y}^{3}\right) - \mathsf{log1p}\left(y \cdot y + \color{blue}{y}\right)\right)\right) - t \]
      17. fma-def99.7%

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

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

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

    if -0.52000000000000002 < x < 1

    1. Initial program 85.1%

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

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

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

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

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

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

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + y \cdot \left(-1 \cdot \left(z + \color{blue}{-1}\right)\right)\right) - t \]
      6. +-commutative98.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-in98.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-eval98.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-198.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 59.0% accurate, 1.9× speedup?

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

    1. Initial program 68.6%

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

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

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

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

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

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

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + y \cdot \left(-1 \cdot \left(z + \color{blue}{-1}\right)\right)\right) - t \]
      6. +-commutative97.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-in97.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-eval97.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-197.3%

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

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

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

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

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

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

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

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

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

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

    if -1.2500000000000001e171 < z < 6.5e20

    1. Initial program 99.1%

      \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative99.1%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(\color{blue}{\frac{\log y \cdot \mathsf{fma}\left(x, x, -1\right)}{1 + x}} + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
    5. Step-by-step derivation
      1. associate-/l*75.7%

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

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

      \[\leadsto \color{blue}{\frac{\log y \cdot \left({x}^{2} - 1\right)}{1 + x}} - t \]
    8. Step-by-step derivation
      1. associate-/l*75.2%

        \[\leadsto \color{blue}{\frac{\log y}{\frac{1 + x}{{x}^{2} - 1}}} - t \]
      2. unpow275.2%

        \[\leadsto \frac{\log y}{\frac{1 + x}{\color{blue}{x \cdot x} - 1}} - t \]
      3. fma-neg75.2%

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

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

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

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

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

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

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

Alternative 9: 99.2% 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 89.4%

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

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

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

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

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

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

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + y \cdot \left(-1 \cdot \left(z + \color{blue}{-1}\right)\right)\right) - t \]
    6. +-commutative99.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-in99.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-eval99.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-199.0%

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

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

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

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

Alternative 10: 99.1% accurate, 1.9× speedup?

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

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

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

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

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

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

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

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

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + y \cdot \left(-1 \cdot \left(z + \color{blue}{-1}\right)\right)\right) - t \]
    6. +-commutative99.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-in99.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-eval99.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-199.0%

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

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

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

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

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

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

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

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

Alternative 11: 45.5% 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 89.4%

    \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. *-commutative89.4%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \left(\color{blue}{\frac{\log y \cdot \mathsf{fma}\left(x, x, -1\right)}{1 + x}} + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
  5. Step-by-step derivation
    1. associate-/l*67.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 45.3% 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 89.4%

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

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

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

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

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

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

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + y \cdot \left(-1 \cdot \left(z + \color{blue}{-1}\right)\right)\right) - t \]
    6. +-commutative99.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-in99.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-eval99.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-199.0%

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

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

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

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

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

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

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

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

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

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

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

Alternative 13: 35.1% accurate, 107.5× speedup?

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

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

    \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. flip3--89.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \left(\mathsf{log1p}\left({y}^{3}\right) - \color{blue}{\mathsf{log1p}\left(y \cdot y + 1 \cdot y\right)}\right)\right) - t \]
    16. *-un-lft-identity99.7%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \left(\mathsf{log1p}\left({y}^{3}\right) - \mathsf{log1p}\left(y \cdot y + \color{blue}{y}\right)\right)\right) - t \]
    17. fma-def99.7%

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

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

    \[\leadsto \color{blue}{x \cdot \log y} - t \]
  6. Taylor expanded in x around 0 41.7%

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

      \[\leadsto \color{blue}{-t} \]
  8. Simplified41.7%

    \[\leadsto \color{blue}{-t} \]
  9. Final simplification41.7%

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

Reproduce

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