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

Percentage Accurate: 88.7% → 99.3%
Time: 13.8s
Alternatives: 13
Speedup: 1.9×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 13 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 88.7% 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.3% accurate, 1.8× speedup?

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

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

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

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

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

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

Alternative 2: 97.9% accurate, 1.7× speedup?

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

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

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


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

    1. Initial program 92.9%

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

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

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

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

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

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

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

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

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

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

    1. Initial program 82.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 93.7% accurate, 1.8× speedup?

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

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

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


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

    1. Initial program 95.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. +-commutative95.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-define95.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-neg95.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-eval95.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-neg95.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-define99.7%

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

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

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

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

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

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

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

    1. Initial program 80.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 73.2% accurate, 1.8× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -6.5e170 or 4.19999999999999997e75 < x

    1. Initial program 96.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\log y \cdot x} \]
    10. Simplified80.3%

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

    if -6.5e170 < x < -0.00110000000000000007

    1. Initial program 80.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. add-cbrt-cube79.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -0.00110000000000000007 < x < 4.19999999999999997e75

    1. Initial program 84.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 86.9% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -230000 \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 -230000.0) (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 <= -230000.0) || !(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 <= (-230000.0d0)) .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 <= -230000.0) || !(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 <= -230000.0) 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 <= -230000.0) || !(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 <= -230000.0) || ~((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, -230000.0], 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 -230000 \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 < -2.3e5 or 1 < x

    1. Initial program 92.8%

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.3e5 < x < 1

    1. Initial program 82.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. +-commutative82.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-define82.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-neg82.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-eval82.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-neg82.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-define100.0%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -230000 \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 6: 78.0% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -6.1 \cdot 10^{+26} \lor \neg \left(t \leq 1.45 \cdot 10^{+48}\right):\\
\;\;\;\;y \cdot \left(z \cdot \left(y \cdot -0.5 + -1\right)\right) - t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -6.1000000000000003e26 or 1.4499999999999999e48 < t

    1. Initial program 97.6%

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

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

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

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

    if -6.1000000000000003e26 < t < 1.4499999999999999e48

    1. Initial program 79.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 64.1% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -8.2 \cdot 10^{+170} \lor \neg \left(x \leq 3.2 \cdot 10^{+77}\right):\\
\;\;\;\;x \cdot \log y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -8.2000000000000001e170 or 3.2000000000000002e77 < x

    1. Initial program 96.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\log y \cdot x} \]
    10. Simplified80.3%

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

    if -8.2000000000000001e170 < x < 3.2000000000000002e77

    1. Initial program 83.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. add-cbrt-cube83.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 86.3% accurate, 1.9× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 8.2000000000000005e-28

    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. Step-by-step derivation
      1. +-commutative89.5%

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

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

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

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

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

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

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

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

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

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

    if 8.2000000000000005e-28 < y

    1. Initial program 71.2%

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(z + -1, \log \color{blue}{\left(1 + \left(-y\right)\right)}, \left(x - 1\right) \cdot \log y\right) - t \]
      6. log1p-define99.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. Taylor expanded in z around inf 57.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 99.0% accurate, 1.9× speedup?

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

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

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

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

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

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

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

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

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

Alternative 10: 46.3% accurate, 26.9× speedup?

\[\begin{array}{l} \\ y \cdot \left(\left(--1\right) - 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(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(\left(--1\right) - z\right) - t
\end{array}
Derivation
  1. Initial program 87.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. Step-by-step derivation
    1. add-cbrt-cube87.3%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(-y\right)} \cdot \left(z - 1\right) - t \]
    3. *-commutative48.9%

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

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

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

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

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

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

Alternative 11: 46.1% accurate, 35.8× speedup?

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

\\
\left(-t\right) - y \cdot z
\end{array}
Derivation
  1. Initial program 87.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. Step-by-step derivation
    1. add-cbrt-cube87.3%

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 35.4% accurate, 107.5× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-t} \]
  7. Simplified37.2%

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

Alternative 13: 2.3% accurate, 215.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-t} \]
  7. Simplified37.2%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0} \]
  14. Applied egg-rr2.3%

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

Reproduce

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