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

Percentage Accurate: 88.6% → 99.6%
Time: 14.1s
Alternatives: 14
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 14 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.6% accurate, 1.0× speedup?

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

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

Alternative 1: 99.6% accurate, 0.7× speedup?

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 97.5% accurate, 1.7× speedup?

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

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

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


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

    1. Initial program 94.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. fma-define94.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 86.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 95.1% accurate, 1.8× speedup?

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

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

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

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


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

    1. Initial program 93.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. fma-define93.2%

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 85.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 95.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. fma-define95.6%

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

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

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

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

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

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

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

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

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

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

Alternative 4: 99.4% accurate, 1.8× speedup?

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

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

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

Alternative 5: 85.4% accurate, 1.8× speedup?

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

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

\mathbf{elif}\;x \leq -2.3 \cdot 10^{-66}:\\
\;\;\;\;z \cdot \left(-y\right) - t\\

\mathbf{elif}\;x \leq 0.00166:\\
\;\;\;\;\left(-\log y\right) - t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -9.2000000000000004e29 or 0.00166 < x

    1. Initial program 94.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. fma-define94.4%

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

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

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

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

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

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

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

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

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

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

    if -9.2000000000000004e29 < x < -2.29999999999999992e-66

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.29999999999999992e-66 < x < 0.00166

    1. Initial program 88.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 74.4% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \log y\\ \mathbf{if}\;x \leq -4.55 \cdot 10^{+108}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq -2.75 \cdot 10^{-66}:\\ \;\;\;\;y \cdot \left(1 - z\right) - t\\ \mathbf{elif}\;x \leq 140:\\ \;\;\;\;\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 -4.55e+108)
     t_1
     (if (<= x -2.75e-66)
       (- (* y (- 1.0 z)) t)
       (if (<= x 140.0) (- (- (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 <= -4.55e+108) {
		tmp = t_1;
	} else if (x <= -2.75e-66) {
		tmp = (y * (1.0 - z)) - t;
	} else if (x <= 140.0) {
		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 <= (-4.55d+108)) then
        tmp = t_1
    else if (x <= (-2.75d-66)) then
        tmp = (y * (1.0d0 - z)) - t
    else if (x <= 140.0d0) 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 <= -4.55e+108) {
		tmp = t_1;
	} else if (x <= -2.75e-66) {
		tmp = (y * (1.0 - z)) - t;
	} else if (x <= 140.0) {
		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 <= -4.55e+108:
		tmp = t_1
	elif x <= -2.75e-66:
		tmp = (y * (1.0 - z)) - t
	elif x <= 140.0:
		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 <= -4.55e+108)
		tmp = t_1;
	elseif (x <= -2.75e-66)
		tmp = Float64(Float64(y * Float64(1.0 - z)) - t);
	elseif (x <= 140.0)
		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 <= -4.55e+108)
		tmp = t_1;
	elseif (x <= -2.75e-66)
		tmp = (y * (1.0 - z)) - t;
	elseif (x <= 140.0)
		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, -4.55e+108], t$95$1, If[LessEqual[x, -2.75e-66], N[(N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[x, 140.0], 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 -4.55 \cdot 10^{+108}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \leq -2.75 \cdot 10^{-66}:\\
\;\;\;\;y \cdot \left(1 - z\right) - t\\

\mathbf{elif}\;x \leq 140:\\
\;\;\;\;\left(-\log y\right) - t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -4.5499999999999999e108 or 140 < x

    1. Initial program 95.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. fma-define95.5%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\log y \cdot x} \]
    8. Simplified73.4%

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

    if -4.5499999999999999e108 < x < -2.75000000000000026e-66

    1. Initial program 75.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. flip--75.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.75000000000000026e-66 < x < 140

    1. Initial program 89.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 99.4% accurate, 1.8× speedup?

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

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

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

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

Alternative 8: 66.3% accurate, 1.9× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -9.99999999999999982e108 or 1.28e14 < x

    1. Initial program 96.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. fma-define96.3%

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.99999999999999982e108 < x < 1.28e14

    1. Initial program 85.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. flip--85.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 85.7% accurate, 1.9× speedup?

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

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

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


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

    1. Initial program 92.2%

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

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

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

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

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

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

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

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

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

    if 8.9999999999999996e-28 < y

    1. Initial program 63.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 98.9% accurate, 1.9× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 46.0% 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 90.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. flip--69.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 45.8% 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 90.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. flip--69.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 13: 34.9% accurate, 107.5× speedup?

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

\\
-t
\end{array}
Derivation
  1. Initial program 90.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. fma-define90.3%

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

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

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

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

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

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

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

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

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

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

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

Alternative 14: 2.3% accurate, 215.0× 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 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 90.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. fma-define90.3%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{-t} \]
  8. Step-by-step derivation
    1. neg-sub037.0%

      \[\leadsto \color{blue}{0 - t} \]
    2. sub-neg37.0%

      \[\leadsto \color{blue}{0 + \left(-t\right)} \]
    3. add-sqr-sqrt18.6%

      \[\leadsto 0 + \color{blue}{\sqrt{-t} \cdot \sqrt{-t}} \]
    4. sqrt-unprod10.8%

      \[\leadsto 0 + \color{blue}{\sqrt{\left(-t\right) \cdot \left(-t\right)}} \]
    5. sqr-neg10.8%

      \[\leadsto 0 + \sqrt{\color{blue}{t \cdot t}} \]
    6. sqrt-unprod1.2%

      \[\leadsto 0 + \color{blue}{\sqrt{t} \cdot \sqrt{t}} \]
    7. add-sqr-sqrt2.2%

      \[\leadsto 0 + \color{blue}{t} \]
  9. Applied egg-rr2.2%

    \[\leadsto \color{blue}{0 + t} \]
  10. Step-by-step derivation
    1. +-lft-identity2.2%

      \[\leadsto \color{blue}{t} \]
  11. Simplified2.2%

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

Reproduce

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