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

Percentage Accurate: 89.0% → 99.6%
Time: 16.1s
Alternatives: 19
Speedup: 1.9×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 19 alternatives:

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

Initial Program: 89.0% 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.9× speedup?

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

\\
\frac{1}{\frac{1}{\mathsf{fma}\left(x + -1, \log y, \mathsf{fma}\left(-1 + z, \mathsf{log1p}\left(-y\right), -t\right)\right)}}
\end{array}
Derivation
  1. Initial program 89.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. lift--.f64N/A

      \[\leadsto \left(\color{blue}{\left(x - 1\right)} \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
    2. lift-log.f64N/A

      \[\leadsto \left(\left(x - 1\right) \cdot \color{blue}{\log y} + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
    3. lift-*.f64N/A

      \[\leadsto \left(\color{blue}{\left(x - 1\right) \cdot \log y} + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
    4. lift--.f64N/A

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\left(z - 1\right)} \cdot \log \left(1 - y\right)\right) - t \]
    5. lift--.f64N/A

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \color{blue}{\left(1 - y\right)}\right) - t \]
    6. lift-log.f64N/A

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \color{blue}{\log \left(1 - y\right)}\right) - t \]
    7. lift-*.f64N/A

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\left(z - 1\right) \cdot \log \left(1 - y\right)}\right) - t \]
    8. lift-+.f64N/A

      \[\leadsto \color{blue}{\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right)} - t \]
    9. flip--N/A

      \[\leadsto \color{blue}{\frac{\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) \cdot \left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \cdot t}{\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) + t}} \]
    10. clear-numN/A

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

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

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

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

Alternative 2: 86.6% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \log y \cdot \left(x + -1\right) + \left(-1 + z\right) \cdot \log \left(1 - y\right)\\ \mathbf{if}\;t\_1 \leq -10000000000:\\ \;\;\;\;x \cdot \log y - t\\ \mathbf{elif}\;t\_1 \leq 138:\\ \;\;\;\;z \cdot \mathsf{log1p}\left(-y\right) - t\\ \mathbf{elif}\;t\_1 \leq 1000:\\ \;\;\;\;\left(-t\right) - \log y\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\log y, x, -t\right)\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (+ (* (log y) (+ x -1.0)) (* (+ -1.0 z) (log (- 1.0 y))))))
   (if (<= t_1 -10000000000.0)
     (- (* x (log y)) t)
     (if (<= t_1 138.0)
       (- (* z (log1p (- y))) t)
       (if (<= t_1 1000.0) (- (- t) (log y)) (fma (log y) x (- t)))))))
double code(double x, double y, double z, double t) {
	double t_1 = (log(y) * (x + -1.0)) + ((-1.0 + z) * log((1.0 - y)));
	double tmp;
	if (t_1 <= -10000000000.0) {
		tmp = (x * log(y)) - t;
	} else if (t_1 <= 138.0) {
		tmp = (z * log1p(-y)) - t;
	} else if (t_1 <= 1000.0) {
		tmp = -t - log(y);
	} else {
		tmp = fma(log(y), x, -t);
	}
	return tmp;
}
function code(x, y, z, t)
	t_1 = Float64(Float64(log(y) * Float64(x + -1.0)) + Float64(Float64(-1.0 + z) * log(Float64(1.0 - y))))
	tmp = 0.0
	if (t_1 <= -10000000000.0)
		tmp = Float64(Float64(x * log(y)) - t);
	elseif (t_1 <= 138.0)
		tmp = Float64(Float64(z * log1p(Float64(-y))) - t);
	elseif (t_1 <= 1000.0)
		tmp = Float64(Float64(-t) - log(y));
	else
		tmp = fma(log(y), x, Float64(-t));
	end
	return tmp
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[Log[y], $MachinePrecision] * N[(x + -1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(-1.0 + z), $MachinePrecision] * N[Log[N[(1.0 - y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -10000000000.0], N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[t$95$1, 138.0], N[(N[(z * N[Log[1 + (-y)], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[t$95$1, 1000.0], N[((-t) - N[Log[y], $MachinePrecision]), $MachinePrecision], N[(N[Log[y], $MachinePrecision] * x + (-t)), $MachinePrecision]]]]]
\begin{array}{l}

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

\mathbf{elif}\;t\_1 \leq 138:\\
\;\;\;\;z \cdot \mathsf{log1p}\left(-y\right) - t\\

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\log y, x, -t\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (+.f64 (*.f64 (-.f64 x #s(literal 1 binary64)) (log.f64 y)) (*.f64 (-.f64 z #s(literal 1 binary64)) (log.f64 (-.f64 #s(literal 1 binary64) y)))) < -1e10

    1. Initial program 97.5%

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

      \[\leadsto \color{blue}{x \cdot \log y} - t \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{\log y \cdot x} - t \]
      2. lower-*.f64N/A

        \[\leadsto \color{blue}{\log y \cdot x} - t \]
      3. lower-log.f6496.7

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

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

    if -1e10 < (+.f64 (*.f64 (-.f64 x #s(literal 1 binary64)) (log.f64 y)) (*.f64 (-.f64 z #s(literal 1 binary64)) (log.f64 (-.f64 #s(literal 1 binary64) y)))) < 138

    1. Initial program 67.8%

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

      \[\leadsto \color{blue}{z \cdot \log \left(1 - y\right)} - t \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{\log \left(1 - y\right) \cdot z} - t \]
      2. lower-*.f64N/A

        \[\leadsto \color{blue}{\log \left(1 - y\right) \cdot z} - t \]
      3. sub-negN/A

        \[\leadsto \log \color{blue}{\left(1 + \left(\mathsf{neg}\left(y\right)\right)\right)} \cdot z - t \]
      4. lower-log1p.f64N/A

        \[\leadsto \color{blue}{\mathsf{log1p}\left(\mathsf{neg}\left(y\right)\right)} \cdot z - t \]
      5. lower-neg.f6476.1

        \[\leadsto \mathsf{log1p}\left(\color{blue}{-y}\right) \cdot z - t \]
    5. Simplified76.1%

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

    if 138 < (+.f64 (*.f64 (-.f64 x #s(literal 1 binary64)) (log.f64 y)) (*.f64 (-.f64 z #s(literal 1 binary64)) (log.f64 (-.f64 #s(literal 1 binary64) y)))) < 1e3

    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. Add Preprocessing
    3. Taylor expanded in y around 0

      \[\leadsto \color{blue}{\log y \cdot \left(x - 1\right) - t} \]
    4. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \color{blue}{\log y \cdot \left(x - 1\right) + \left(\mathsf{neg}\left(t\right)\right)} \]
      2. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\log y, x - 1, \mathsf{neg}\left(t\right)\right)} \]
      3. lower-log.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\log y}, x - 1, \mathsf{neg}\left(t\right)\right) \]
      4. sub-negN/A

        \[\leadsto \mathsf{fma}\left(\log y, \color{blue}{x + \left(\mathsf{neg}\left(1\right)\right)}, \mathsf{neg}\left(t\right)\right) \]
      5. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(\log y, x + \color{blue}{-1}, \mathsf{neg}\left(t\right)\right) \]
      6. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\log y, \color{blue}{-1 + x}, \mathsf{neg}\left(t\right)\right) \]
      7. lower-+.f64N/A

        \[\leadsto \mathsf{fma}\left(\log y, \color{blue}{-1 + x}, \mathsf{neg}\left(t\right)\right) \]
      8. lower-neg.f6486.0

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

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

      \[\leadsto \color{blue}{-1 \cdot \log y - t} \]
    7. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\log y\right)\right)} - t \]
      2. log-recN/A

        \[\leadsto \color{blue}{\log \left(\frac{1}{y}\right)} - t \]
      3. lower--.f64N/A

        \[\leadsto \color{blue}{\log \left(\frac{1}{y}\right) - t} \]
      4. log-recN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\log y\right)\right)} - t \]
      5. lower-neg.f64N/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\log y\right)\right)} - t \]
      6. lower-log.f6485.3

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

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

    if 1e3 < (+.f64 (*.f64 (-.f64 x #s(literal 1 binary64)) (log.f64 y)) (*.f64 (-.f64 z #s(literal 1 binary64)) (log.f64 (-.f64 #s(literal 1 binary64) y))))

    1. Initial program 97.2%

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

      \[\leadsto \color{blue}{x \cdot \log y} - t \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{\log y \cdot x} - t \]
      2. lower-*.f64N/A

        \[\leadsto \color{blue}{\log y \cdot x} - t \]
      3. lower-log.f6496.7

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

      \[\leadsto \color{blue}{\log y \cdot x} - t \]
    6. Step-by-step derivation
      1. lift-log.f64N/A

        \[\leadsto \color{blue}{\log y} \cdot x - t \]
      2. lift-*.f64N/A

        \[\leadsto \color{blue}{\log y \cdot x} - t \]
      3. sub-negN/A

        \[\leadsto \color{blue}{\log y \cdot x + \left(\mathsf{neg}\left(t\right)\right)} \]
      4. lift-*.f64N/A

        \[\leadsto \color{blue}{\log y \cdot x} + \left(\mathsf{neg}\left(t\right)\right) \]
      5. lift-neg.f64N/A

        \[\leadsto \log y \cdot x + \color{blue}{\left(\mathsf{neg}\left(t\right)\right)} \]
      6. lower-fma.f6496.7

        \[\leadsto \color{blue}{\mathsf{fma}\left(\log y, x, -t\right)} \]
    7. Applied egg-rr96.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\log y \cdot \left(x + -1\right) + \left(-1 + z\right) \cdot \log \left(1 - y\right) \leq -10000000000:\\ \;\;\;\;x \cdot \log y - t\\ \mathbf{elif}\;\log y \cdot \left(x + -1\right) + \left(-1 + z\right) \cdot \log \left(1 - y\right) \leq 138:\\ \;\;\;\;z \cdot \mathsf{log1p}\left(-y\right) - t\\ \mathbf{elif}\;\log y \cdot \left(x + -1\right) + \left(-1 + z\right) \cdot \log \left(1 - y\right) \leq 1000:\\ \;\;\;\;\left(-t\right) - \log y\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\log y, x, -t\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 86.6% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \log y \cdot \left(x + -1\right) + \left(-1 + z\right) \cdot \log \left(1 - y\right)\\ \mathbf{if}\;t\_1 \leq -10000000000:\\ \;\;\;\;x \cdot \log y - t\\ \mathbf{elif}\;t\_1 \leq 138:\\ \;\;\;\;y \cdot \left(z \cdot \mathsf{fma}\left(y, -0.5, -1\right)\right) - t\\ \mathbf{elif}\;t\_1 \leq 1000:\\ \;\;\;\;\left(-t\right) - \log y\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\log y, x, -t\right)\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (+ (* (log y) (+ x -1.0)) (* (+ -1.0 z) (log (- 1.0 y))))))
   (if (<= t_1 -10000000000.0)
     (- (* x (log y)) t)
     (if (<= t_1 138.0)
       (- (* y (* z (fma y -0.5 -1.0))) t)
       (if (<= t_1 1000.0) (- (- t) (log y)) (fma (log y) x (- t)))))))
double code(double x, double y, double z, double t) {
	double t_1 = (log(y) * (x + -1.0)) + ((-1.0 + z) * log((1.0 - y)));
	double tmp;
	if (t_1 <= -10000000000.0) {
		tmp = (x * log(y)) - t;
	} else if (t_1 <= 138.0) {
		tmp = (y * (z * fma(y, -0.5, -1.0))) - t;
	} else if (t_1 <= 1000.0) {
		tmp = -t - log(y);
	} else {
		tmp = fma(log(y), x, -t);
	}
	return tmp;
}
function code(x, y, z, t)
	t_1 = Float64(Float64(log(y) * Float64(x + -1.0)) + Float64(Float64(-1.0 + z) * log(Float64(1.0 - y))))
	tmp = 0.0
	if (t_1 <= -10000000000.0)
		tmp = Float64(Float64(x * log(y)) - t);
	elseif (t_1 <= 138.0)
		tmp = Float64(Float64(y * Float64(z * fma(y, -0.5, -1.0))) - t);
	elseif (t_1 <= 1000.0)
		tmp = Float64(Float64(-t) - log(y));
	else
		tmp = fma(log(y), x, Float64(-t));
	end
	return tmp
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[Log[y], $MachinePrecision] * N[(x + -1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(-1.0 + z), $MachinePrecision] * N[Log[N[(1.0 - y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -10000000000.0], N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[t$95$1, 138.0], N[(N[(y * N[(z * N[(y * -0.5 + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[t$95$1, 1000.0], N[((-t) - N[Log[y], $MachinePrecision]), $MachinePrecision], N[(N[Log[y], $MachinePrecision] * x + (-t)), $MachinePrecision]]]]]
\begin{array}{l}

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

\mathbf{elif}\;t\_1 \leq 138:\\
\;\;\;\;y \cdot \left(z \cdot \mathsf{fma}\left(y, -0.5, -1\right)\right) - t\\

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\log y, x, -t\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (+.f64 (*.f64 (-.f64 x #s(literal 1 binary64)) (log.f64 y)) (*.f64 (-.f64 z #s(literal 1 binary64)) (log.f64 (-.f64 #s(literal 1 binary64) y)))) < -1e10

    1. Initial program 97.5%

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

      \[\leadsto \color{blue}{x \cdot \log y} - t \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{\log y \cdot x} - t \]
      2. lower-*.f64N/A

        \[\leadsto \color{blue}{\log y \cdot x} - t \]
      3. lower-log.f6496.7

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

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

    if -1e10 < (+.f64 (*.f64 (-.f64 x #s(literal 1 binary64)) (log.f64 y)) (*.f64 (-.f64 z #s(literal 1 binary64)) (log.f64 (-.f64 #s(literal 1 binary64) y)))) < 138

    1. Initial program 67.8%

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

      \[\leadsto \color{blue}{\left(-1 \cdot \log y + \log \left(1 - y\right) \cdot \left(z - 1\right)\right)} - t \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{\left(\log \left(1 - y\right) \cdot \left(z - 1\right) + -1 \cdot \log y\right)} - t \]
      2. mul-1-negN/A

        \[\leadsto \left(\log \left(1 - y\right) \cdot \left(z - 1\right) + \color{blue}{\left(\mathsf{neg}\left(\log y\right)\right)}\right) - t \]
      3. unsub-negN/A

        \[\leadsto \color{blue}{\left(\log \left(1 - y\right) \cdot \left(z - 1\right) - \log y\right)} - t \]
      4. lower--.f64N/A

        \[\leadsto \color{blue}{\left(\log \left(1 - y\right) \cdot \left(z - 1\right) - \log y\right)} - t \]
      5. lower-*.f64N/A

        \[\leadsto \left(\color{blue}{\log \left(1 - y\right) \cdot \left(z - 1\right)} - \log y\right) - t \]
      6. sub-negN/A

        \[\leadsto \left(\log \color{blue}{\left(1 + \left(\mathsf{neg}\left(y\right)\right)\right)} \cdot \left(z - 1\right) - \log y\right) - t \]
      7. lower-log1p.f64N/A

        \[\leadsto \left(\color{blue}{\mathsf{log1p}\left(\mathsf{neg}\left(y\right)\right)} \cdot \left(z - 1\right) - \log y\right) - t \]
      8. lower-neg.f64N/A

        \[\leadsto \left(\mathsf{log1p}\left(\color{blue}{\mathsf{neg}\left(y\right)}\right) \cdot \left(z - 1\right) - \log y\right) - t \]
      9. sub-negN/A

        \[\leadsto \left(\mathsf{log1p}\left(\mathsf{neg}\left(y\right)\right) \cdot \color{blue}{\left(z + \left(\mathsf{neg}\left(1\right)\right)\right)} - \log y\right) - t \]
      10. metadata-evalN/A

        \[\leadsto \left(\mathsf{log1p}\left(\mathsf{neg}\left(y\right)\right) \cdot \left(z + \color{blue}{-1}\right) - \log y\right) - t \]
      11. +-commutativeN/A

        \[\leadsto \left(\mathsf{log1p}\left(\mathsf{neg}\left(y\right)\right) \cdot \color{blue}{\left(-1 + z\right)} - \log y\right) - t \]
      12. lower-+.f64N/A

        \[\leadsto \left(\mathsf{log1p}\left(\mathsf{neg}\left(y\right)\right) \cdot \color{blue}{\left(-1 + z\right)} - \log y\right) - t \]
      13. lower-log.f6498.5

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

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

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

        \[\leadsto \color{blue}{\left(y \cdot \left(-1 \cdot \left(z - 1\right) + \frac{-1}{2} \cdot \left(y \cdot \left(z - 1\right)\right)\right) + \left(\mathsf{neg}\left(\log y\right)\right)\right)} - t \]
      2. *-commutativeN/A

        \[\leadsto \left(y \cdot \left(-1 \cdot \left(z - 1\right) + \frac{-1}{2} \cdot \color{blue}{\left(\left(z - 1\right) \cdot y\right)}\right) + \left(\mathsf{neg}\left(\log y\right)\right)\right) - t \]
      3. associate-*r*N/A

        \[\leadsto \left(y \cdot \left(-1 \cdot \left(z - 1\right) + \color{blue}{\left(\frac{-1}{2} \cdot \left(z - 1\right)\right) \cdot y}\right) + \left(\mathsf{neg}\left(\log y\right)\right)\right) - t \]
      4. log-recN/A

        \[\leadsto \left(y \cdot \left(-1 \cdot \left(z - 1\right) + \left(\frac{-1}{2} \cdot \left(z - 1\right)\right) \cdot y\right) + \color{blue}{\log \left(\frac{1}{y}\right)}\right) - t \]
      5. lower-fma.f64N/A

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

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

      \[\leadsto \color{blue}{y \cdot \left(z \cdot \left(\frac{-1}{2} \cdot y - 1\right)\right)} - t \]
    10. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \color{blue}{y \cdot \left(z \cdot \left(\frac{-1}{2} \cdot y - 1\right)\right)} - t \]
      2. lower-*.f64N/A

        \[\leadsto y \cdot \color{blue}{\left(z \cdot \left(\frac{-1}{2} \cdot y - 1\right)\right)} - t \]
      3. sub-negN/A

        \[\leadsto y \cdot \left(z \cdot \color{blue}{\left(\frac{-1}{2} \cdot y + \left(\mathsf{neg}\left(1\right)\right)\right)}\right) - t \]
      4. *-commutativeN/A

        \[\leadsto y \cdot \left(z \cdot \left(\color{blue}{y \cdot \frac{-1}{2}} + \left(\mathsf{neg}\left(1\right)\right)\right)\right) - t \]
      5. metadata-evalN/A

        \[\leadsto y \cdot \left(z \cdot \left(y \cdot \frac{-1}{2} + \color{blue}{-1}\right)\right) - t \]
      6. lower-fma.f6476.1

        \[\leadsto y \cdot \left(z \cdot \color{blue}{\mathsf{fma}\left(y, -0.5, -1\right)}\right) - t \]
    11. Simplified76.1%

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

    if 138 < (+.f64 (*.f64 (-.f64 x #s(literal 1 binary64)) (log.f64 y)) (*.f64 (-.f64 z #s(literal 1 binary64)) (log.f64 (-.f64 #s(literal 1 binary64) y)))) < 1e3

    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. Add Preprocessing
    3. Taylor expanded in y around 0

      \[\leadsto \color{blue}{\log y \cdot \left(x - 1\right) - t} \]
    4. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \color{blue}{\log y \cdot \left(x - 1\right) + \left(\mathsf{neg}\left(t\right)\right)} \]
      2. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\log y, x - 1, \mathsf{neg}\left(t\right)\right)} \]
      3. lower-log.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\log y}, x - 1, \mathsf{neg}\left(t\right)\right) \]
      4. sub-negN/A

        \[\leadsto \mathsf{fma}\left(\log y, \color{blue}{x + \left(\mathsf{neg}\left(1\right)\right)}, \mathsf{neg}\left(t\right)\right) \]
      5. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(\log y, x + \color{blue}{-1}, \mathsf{neg}\left(t\right)\right) \]
      6. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\log y, \color{blue}{-1 + x}, \mathsf{neg}\left(t\right)\right) \]
      7. lower-+.f64N/A

        \[\leadsto \mathsf{fma}\left(\log y, \color{blue}{-1 + x}, \mathsf{neg}\left(t\right)\right) \]
      8. lower-neg.f6486.0

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

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

      \[\leadsto \color{blue}{-1 \cdot \log y - t} \]
    7. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\log y\right)\right)} - t \]
      2. log-recN/A

        \[\leadsto \color{blue}{\log \left(\frac{1}{y}\right)} - t \]
      3. lower--.f64N/A

        \[\leadsto \color{blue}{\log \left(\frac{1}{y}\right) - t} \]
      4. log-recN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\log y\right)\right)} - t \]
      5. lower-neg.f64N/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\log y\right)\right)} - t \]
      6. lower-log.f6485.3

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

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

    if 1e3 < (+.f64 (*.f64 (-.f64 x #s(literal 1 binary64)) (log.f64 y)) (*.f64 (-.f64 z #s(literal 1 binary64)) (log.f64 (-.f64 #s(literal 1 binary64) y))))

    1. Initial program 97.2%

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

      \[\leadsto \color{blue}{x \cdot \log y} - t \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{\log y \cdot x} - t \]
      2. lower-*.f64N/A

        \[\leadsto \color{blue}{\log y \cdot x} - t \]
      3. lower-log.f6496.7

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

      \[\leadsto \color{blue}{\log y \cdot x} - t \]
    6. Step-by-step derivation
      1. lift-log.f64N/A

        \[\leadsto \color{blue}{\log y} \cdot x - t \]
      2. lift-*.f64N/A

        \[\leadsto \color{blue}{\log y \cdot x} - t \]
      3. sub-negN/A

        \[\leadsto \color{blue}{\log y \cdot x + \left(\mathsf{neg}\left(t\right)\right)} \]
      4. lift-*.f64N/A

        \[\leadsto \color{blue}{\log y \cdot x} + \left(\mathsf{neg}\left(t\right)\right) \]
      5. lift-neg.f64N/A

        \[\leadsto \log y \cdot x + \color{blue}{\left(\mathsf{neg}\left(t\right)\right)} \]
      6. lower-fma.f6496.7

        \[\leadsto \color{blue}{\mathsf{fma}\left(\log y, x, -t\right)} \]
    7. Applied egg-rr96.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\log y \cdot \left(x + -1\right) + \left(-1 + z\right) \cdot \log \left(1 - y\right) \leq -10000000000:\\ \;\;\;\;x \cdot \log y - t\\ \mathbf{elif}\;\log y \cdot \left(x + -1\right) + \left(-1 + z\right) \cdot \log \left(1 - y\right) \leq 138:\\ \;\;\;\;y \cdot \left(z \cdot \mathsf{fma}\left(y, -0.5, -1\right)\right) - t\\ \mathbf{elif}\;\log y \cdot \left(x + -1\right) + \left(-1 + z\right) \cdot \log \left(1 - y\right) \leq 1000:\\ \;\;\;\;\left(-t\right) - \log y\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\log y, x, -t\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 86.6% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \log y - t\\ t_2 := \log y \cdot \left(x + -1\right) + \left(-1 + z\right) \cdot \log \left(1 - y\right)\\ \mathbf{if}\;t\_2 \leq -10000000000:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 \leq 138:\\ \;\;\;\;y \cdot \left(z \cdot \mathsf{fma}\left(y, -0.5, -1\right)\right) - t\\ \mathbf{elif}\;t\_2 \leq 1000:\\ \;\;\;\;\left(-t\right) - \log y\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (- (* x (log y)) t))
        (t_2 (+ (* (log y) (+ x -1.0)) (* (+ -1.0 z) (log (- 1.0 y))))))
   (if (<= t_2 -10000000000.0)
     t_1
     (if (<= t_2 138.0)
       (- (* y (* z (fma y -0.5 -1.0))) t)
       (if (<= t_2 1000.0) (- (- t) (log y)) t_1)))))
double code(double x, double y, double z, double t) {
	double t_1 = (x * log(y)) - t;
	double t_2 = (log(y) * (x + -1.0)) + ((-1.0 + z) * log((1.0 - y)));
	double tmp;
	if (t_2 <= -10000000000.0) {
		tmp = t_1;
	} else if (t_2 <= 138.0) {
		tmp = (y * (z * fma(y, -0.5, -1.0))) - t;
	} else if (t_2 <= 1000.0) {
		tmp = -t - log(y);
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(x, y, z, t)
	t_1 = Float64(Float64(x * log(y)) - t)
	t_2 = Float64(Float64(log(y) * Float64(x + -1.0)) + Float64(Float64(-1.0 + z) * log(Float64(1.0 - y))))
	tmp = 0.0
	if (t_2 <= -10000000000.0)
		tmp = t_1;
	elseif (t_2 <= 138.0)
		tmp = Float64(Float64(y * Float64(z * fma(y, -0.5, -1.0))) - t);
	elseif (t_2 <= 1000.0)
		tmp = Float64(Float64(-t) - log(y));
	else
		tmp = t_1;
	end
	return tmp
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Log[y], $MachinePrecision] * N[(x + -1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(-1.0 + z), $MachinePrecision] * N[Log[N[(1.0 - y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -10000000000.0], t$95$1, If[LessEqual[t$95$2, 138.0], N[(N[(y * N[(z * N[(y * -0.5 + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[t$95$2, 1000.0], N[((-t) - N[Log[y], $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x \cdot \log y - t\\
t_2 := \log y \cdot \left(x + -1\right) + \left(-1 + z\right) \cdot \log \left(1 - y\right)\\
\mathbf{if}\;t\_2 \leq -10000000000:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_2 \leq 138:\\
\;\;\;\;y \cdot \left(z \cdot \mathsf{fma}\left(y, -0.5, -1\right)\right) - t\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (+.f64 (*.f64 (-.f64 x #s(literal 1 binary64)) (log.f64 y)) (*.f64 (-.f64 z #s(literal 1 binary64)) (log.f64 (-.f64 #s(literal 1 binary64) y)))) < -1e10 or 1e3 < (+.f64 (*.f64 (-.f64 x #s(literal 1 binary64)) (log.f64 y)) (*.f64 (-.f64 z #s(literal 1 binary64)) (log.f64 (-.f64 #s(literal 1 binary64) y))))

    1. Initial program 97.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 x around inf

      \[\leadsto \color{blue}{x \cdot \log y} - t \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{\log y \cdot x} - t \]
      2. lower-*.f64N/A

        \[\leadsto \color{blue}{\log y \cdot x} - t \]
      3. lower-log.f6496.7

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

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

    if -1e10 < (+.f64 (*.f64 (-.f64 x #s(literal 1 binary64)) (log.f64 y)) (*.f64 (-.f64 z #s(literal 1 binary64)) (log.f64 (-.f64 #s(literal 1 binary64) y)))) < 138

    1. Initial program 67.8%

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

      \[\leadsto \color{blue}{\left(-1 \cdot \log y + \log \left(1 - y\right) \cdot \left(z - 1\right)\right)} - t \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{\left(\log \left(1 - y\right) \cdot \left(z - 1\right) + -1 \cdot \log y\right)} - t \]
      2. mul-1-negN/A

        \[\leadsto \left(\log \left(1 - y\right) \cdot \left(z - 1\right) + \color{blue}{\left(\mathsf{neg}\left(\log y\right)\right)}\right) - t \]
      3. unsub-negN/A

        \[\leadsto \color{blue}{\left(\log \left(1 - y\right) \cdot \left(z - 1\right) - \log y\right)} - t \]
      4. lower--.f64N/A

        \[\leadsto \color{blue}{\left(\log \left(1 - y\right) \cdot \left(z - 1\right) - \log y\right)} - t \]
      5. lower-*.f64N/A

        \[\leadsto \left(\color{blue}{\log \left(1 - y\right) \cdot \left(z - 1\right)} - \log y\right) - t \]
      6. sub-negN/A

        \[\leadsto \left(\log \color{blue}{\left(1 + \left(\mathsf{neg}\left(y\right)\right)\right)} \cdot \left(z - 1\right) - \log y\right) - t \]
      7. lower-log1p.f64N/A

        \[\leadsto \left(\color{blue}{\mathsf{log1p}\left(\mathsf{neg}\left(y\right)\right)} \cdot \left(z - 1\right) - \log y\right) - t \]
      8. lower-neg.f64N/A

        \[\leadsto \left(\mathsf{log1p}\left(\color{blue}{\mathsf{neg}\left(y\right)}\right) \cdot \left(z - 1\right) - \log y\right) - t \]
      9. sub-negN/A

        \[\leadsto \left(\mathsf{log1p}\left(\mathsf{neg}\left(y\right)\right) \cdot \color{blue}{\left(z + \left(\mathsf{neg}\left(1\right)\right)\right)} - \log y\right) - t \]
      10. metadata-evalN/A

        \[\leadsto \left(\mathsf{log1p}\left(\mathsf{neg}\left(y\right)\right) \cdot \left(z + \color{blue}{-1}\right) - \log y\right) - t \]
      11. +-commutativeN/A

        \[\leadsto \left(\mathsf{log1p}\left(\mathsf{neg}\left(y\right)\right) \cdot \color{blue}{\left(-1 + z\right)} - \log y\right) - t \]
      12. lower-+.f64N/A

        \[\leadsto \left(\mathsf{log1p}\left(\mathsf{neg}\left(y\right)\right) \cdot \color{blue}{\left(-1 + z\right)} - \log y\right) - t \]
      13. lower-log.f6498.5

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

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

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

        \[\leadsto \color{blue}{\left(y \cdot \left(-1 \cdot \left(z - 1\right) + \frac{-1}{2} \cdot \left(y \cdot \left(z - 1\right)\right)\right) + \left(\mathsf{neg}\left(\log y\right)\right)\right)} - t \]
      2. *-commutativeN/A

        \[\leadsto \left(y \cdot \left(-1 \cdot \left(z - 1\right) + \frac{-1}{2} \cdot \color{blue}{\left(\left(z - 1\right) \cdot y\right)}\right) + \left(\mathsf{neg}\left(\log y\right)\right)\right) - t \]
      3. associate-*r*N/A

        \[\leadsto \left(y \cdot \left(-1 \cdot \left(z - 1\right) + \color{blue}{\left(\frac{-1}{2} \cdot \left(z - 1\right)\right) \cdot y}\right) + \left(\mathsf{neg}\left(\log y\right)\right)\right) - t \]
      4. log-recN/A

        \[\leadsto \left(y \cdot \left(-1 \cdot \left(z - 1\right) + \left(\frac{-1}{2} \cdot \left(z - 1\right)\right) \cdot y\right) + \color{blue}{\log \left(\frac{1}{y}\right)}\right) - t \]
      5. lower-fma.f64N/A

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

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

      \[\leadsto \color{blue}{y \cdot \left(z \cdot \left(\frac{-1}{2} \cdot y - 1\right)\right)} - t \]
    10. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \color{blue}{y \cdot \left(z \cdot \left(\frac{-1}{2} \cdot y - 1\right)\right)} - t \]
      2. lower-*.f64N/A

        \[\leadsto y \cdot \color{blue}{\left(z \cdot \left(\frac{-1}{2} \cdot y - 1\right)\right)} - t \]
      3. sub-negN/A

        \[\leadsto y \cdot \left(z \cdot \color{blue}{\left(\frac{-1}{2} \cdot y + \left(\mathsf{neg}\left(1\right)\right)\right)}\right) - t \]
      4. *-commutativeN/A

        \[\leadsto y \cdot \left(z \cdot \left(\color{blue}{y \cdot \frac{-1}{2}} + \left(\mathsf{neg}\left(1\right)\right)\right)\right) - t \]
      5. metadata-evalN/A

        \[\leadsto y \cdot \left(z \cdot \left(y \cdot \frac{-1}{2} + \color{blue}{-1}\right)\right) - t \]
      6. lower-fma.f6476.1

        \[\leadsto y \cdot \left(z \cdot \color{blue}{\mathsf{fma}\left(y, -0.5, -1\right)}\right) - t \]
    11. Simplified76.1%

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

    if 138 < (+.f64 (*.f64 (-.f64 x #s(literal 1 binary64)) (log.f64 y)) (*.f64 (-.f64 z #s(literal 1 binary64)) (log.f64 (-.f64 #s(literal 1 binary64) y)))) < 1e3

    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. Add Preprocessing
    3. Taylor expanded in y around 0

      \[\leadsto \color{blue}{\log y \cdot \left(x - 1\right) - t} \]
    4. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \color{blue}{\log y \cdot \left(x - 1\right) + \left(\mathsf{neg}\left(t\right)\right)} \]
      2. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\log y, x - 1, \mathsf{neg}\left(t\right)\right)} \]
      3. lower-log.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\log y}, x - 1, \mathsf{neg}\left(t\right)\right) \]
      4. sub-negN/A

        \[\leadsto \mathsf{fma}\left(\log y, \color{blue}{x + \left(\mathsf{neg}\left(1\right)\right)}, \mathsf{neg}\left(t\right)\right) \]
      5. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(\log y, x + \color{blue}{-1}, \mathsf{neg}\left(t\right)\right) \]
      6. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\log y, \color{blue}{-1 + x}, \mathsf{neg}\left(t\right)\right) \]
      7. lower-+.f64N/A

        \[\leadsto \mathsf{fma}\left(\log y, \color{blue}{-1 + x}, \mathsf{neg}\left(t\right)\right) \]
      8. lower-neg.f6486.0

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

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

      \[\leadsto \color{blue}{-1 \cdot \log y - t} \]
    7. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\log y\right)\right)} - t \]
      2. log-recN/A

        \[\leadsto \color{blue}{\log \left(\frac{1}{y}\right)} - t \]
      3. lower--.f64N/A

        \[\leadsto \color{blue}{\log \left(\frac{1}{y}\right) - t} \]
      4. log-recN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\log y\right)\right)} - t \]
      5. lower-neg.f64N/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\log y\right)\right)} - t \]
      6. lower-log.f6485.3

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\log y \cdot \left(x + -1\right) + \left(-1 + z\right) \cdot \log \left(1 - y\right) \leq -10000000000:\\ \;\;\;\;x \cdot \log y - t\\ \mathbf{elif}\;\log y \cdot \left(x + -1\right) + \left(-1 + z\right) \cdot \log \left(1 - y\right) \leq 138:\\ \;\;\;\;y \cdot \left(z \cdot \mathsf{fma}\left(y, -0.5, -1\right)\right) - t\\ \mathbf{elif}\;\log y \cdot \left(x + -1\right) + \left(-1 + z\right) \cdot \log \left(1 - y\right) \leq 1000:\\ \;\;\;\;\left(-t\right) - \log y\\ \mathbf{else}:\\ \;\;\;\;x \cdot \log y - t\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 64.8% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \log y\\ t_2 := \log y \cdot \left(x + -1\right) + \left(-1 + z\right) \cdot \log \left(1 - y\right)\\ \mathbf{if}\;t\_2 \leq -10000000000:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 \leq 582:\\ \;\;\;\;y \cdot \left(z \cdot \mathsf{fma}\left(y, -0.5, -1\right)\right) - t\\ \mathbf{elif}\;t\_2 \leq 1000:\\ \;\;\;\;-\log y\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (log y)))
        (t_2 (+ (* (log y) (+ x -1.0)) (* (+ -1.0 z) (log (- 1.0 y))))))
   (if (<= t_2 -10000000000.0)
     t_1
     (if (<= t_2 582.0)
       (- (* y (* z (fma y -0.5 -1.0))) t)
       (if (<= t_2 1000.0) (- (log y)) t_1)))))
double code(double x, double y, double z, double t) {
	double t_1 = x * log(y);
	double t_2 = (log(y) * (x + -1.0)) + ((-1.0 + z) * log((1.0 - y)));
	double tmp;
	if (t_2 <= -10000000000.0) {
		tmp = t_1;
	} else if (t_2 <= 582.0) {
		tmp = (y * (z * fma(y, -0.5, -1.0))) - t;
	} else if (t_2 <= 1000.0) {
		tmp = -log(y);
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(x, y, z, t)
	t_1 = Float64(x * log(y))
	t_2 = Float64(Float64(log(y) * Float64(x + -1.0)) + Float64(Float64(-1.0 + z) * log(Float64(1.0 - y))))
	tmp = 0.0
	if (t_2 <= -10000000000.0)
		tmp = t_1;
	elseif (t_2 <= 582.0)
		tmp = Float64(Float64(y * Float64(z * fma(y, -0.5, -1.0))) - t);
	elseif (t_2 <= 1000.0)
		tmp = Float64(-log(y));
	else
		tmp = t_1;
	end
	return tmp
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Log[y], $MachinePrecision] * N[(x + -1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(-1.0 + z), $MachinePrecision] * N[Log[N[(1.0 - y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -10000000000.0], t$95$1, If[LessEqual[t$95$2, 582.0], N[(N[(y * N[(z * N[(y * -0.5 + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[t$95$2, 1000.0], (-N[Log[y], $MachinePrecision]), t$95$1]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x \cdot \log y\\
t_2 := \log y \cdot \left(x + -1\right) + \left(-1 + z\right) \cdot \log \left(1 - y\right)\\
\mathbf{if}\;t\_2 \leq -10000000000:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_2 \leq 582:\\
\;\;\;\;y \cdot \left(z \cdot \mathsf{fma}\left(y, -0.5, -1\right)\right) - t\\

\mathbf{elif}\;t\_2 \leq 1000:\\
\;\;\;\;-\log y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (+.f64 (*.f64 (-.f64 x #s(literal 1 binary64)) (log.f64 y)) (*.f64 (-.f64 z #s(literal 1 binary64)) (log.f64 (-.f64 #s(literal 1 binary64) y)))) < -1e10 or 1e3 < (+.f64 (*.f64 (-.f64 x #s(literal 1 binary64)) (log.f64 y)) (*.f64 (-.f64 z #s(literal 1 binary64)) (log.f64 (-.f64 #s(literal 1 binary64) y))))

    1. Initial program 97.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 x around inf

      \[\leadsto \color{blue}{x \cdot \log y} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{\log y \cdot x} \]
      2. lower-*.f64N/A

        \[\leadsto \color{blue}{\log y \cdot x} \]
      3. lower-log.f6478.4

        \[\leadsto \color{blue}{\log y} \cdot x \]
    5. Simplified78.4%

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

    if -1e10 < (+.f64 (*.f64 (-.f64 x #s(literal 1 binary64)) (log.f64 y)) (*.f64 (-.f64 z #s(literal 1 binary64)) (log.f64 (-.f64 #s(literal 1 binary64) y)))) < 582

    1. Initial program 79.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 x around 0

      \[\leadsto \color{blue}{\left(-1 \cdot \log y + \log \left(1 - y\right) \cdot \left(z - 1\right)\right)} - t \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{\left(\log \left(1 - y\right) \cdot \left(z - 1\right) + -1 \cdot \log y\right)} - t \]
      2. mul-1-negN/A

        \[\leadsto \left(\log \left(1 - y\right) \cdot \left(z - 1\right) + \color{blue}{\left(\mathsf{neg}\left(\log y\right)\right)}\right) - t \]
      3. unsub-negN/A

        \[\leadsto \color{blue}{\left(\log \left(1 - y\right) \cdot \left(z - 1\right) - \log y\right)} - t \]
      4. lower--.f64N/A

        \[\leadsto \color{blue}{\left(\log \left(1 - y\right) \cdot \left(z - 1\right) - \log y\right)} - t \]
      5. lower-*.f64N/A

        \[\leadsto \left(\color{blue}{\log \left(1 - y\right) \cdot \left(z - 1\right)} - \log y\right) - t \]
      6. sub-negN/A

        \[\leadsto \left(\log \color{blue}{\left(1 + \left(\mathsf{neg}\left(y\right)\right)\right)} \cdot \left(z - 1\right) - \log y\right) - t \]
      7. lower-log1p.f64N/A

        \[\leadsto \left(\color{blue}{\mathsf{log1p}\left(\mathsf{neg}\left(y\right)\right)} \cdot \left(z - 1\right) - \log y\right) - t \]
      8. lower-neg.f64N/A

        \[\leadsto \left(\mathsf{log1p}\left(\color{blue}{\mathsf{neg}\left(y\right)}\right) \cdot \left(z - 1\right) - \log y\right) - t \]
      9. sub-negN/A

        \[\leadsto \left(\mathsf{log1p}\left(\mathsf{neg}\left(y\right)\right) \cdot \color{blue}{\left(z + \left(\mathsf{neg}\left(1\right)\right)\right)} - \log y\right) - t \]
      10. metadata-evalN/A

        \[\leadsto \left(\mathsf{log1p}\left(\mathsf{neg}\left(y\right)\right) \cdot \left(z + \color{blue}{-1}\right) - \log y\right) - t \]
      11. +-commutativeN/A

        \[\leadsto \left(\mathsf{log1p}\left(\mathsf{neg}\left(y\right)\right) \cdot \color{blue}{\left(-1 + z\right)} - \log y\right) - t \]
      12. lower-+.f64N/A

        \[\leadsto \left(\mathsf{log1p}\left(\mathsf{neg}\left(y\right)\right) \cdot \color{blue}{\left(-1 + z\right)} - \log y\right) - t \]
      13. lower-log.f6498.9

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

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

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

        \[\leadsto \color{blue}{\left(y \cdot \left(-1 \cdot \left(z - 1\right) + \frac{-1}{2} \cdot \left(y \cdot \left(z - 1\right)\right)\right) + \left(\mathsf{neg}\left(\log y\right)\right)\right)} - t \]
      2. *-commutativeN/A

        \[\leadsto \left(y \cdot \left(-1 \cdot \left(z - 1\right) + \frac{-1}{2} \cdot \color{blue}{\left(\left(z - 1\right) \cdot y\right)}\right) + \left(\mathsf{neg}\left(\log y\right)\right)\right) - t \]
      3. associate-*r*N/A

        \[\leadsto \left(y \cdot \left(-1 \cdot \left(z - 1\right) + \color{blue}{\left(\frac{-1}{2} \cdot \left(z - 1\right)\right) \cdot y}\right) + \left(\mathsf{neg}\left(\log y\right)\right)\right) - t \]
      4. log-recN/A

        \[\leadsto \left(y \cdot \left(-1 \cdot \left(z - 1\right) + \left(\frac{-1}{2} \cdot \left(z - 1\right)\right) \cdot y\right) + \color{blue}{\log \left(\frac{1}{y}\right)}\right) - t \]
      5. lower-fma.f64N/A

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

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

      \[\leadsto \color{blue}{y \cdot \left(z \cdot \left(\frac{-1}{2} \cdot y - 1\right)\right)} - t \]
    10. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \color{blue}{y \cdot \left(z \cdot \left(\frac{-1}{2} \cdot y - 1\right)\right)} - t \]
      2. lower-*.f64N/A

        \[\leadsto y \cdot \color{blue}{\left(z \cdot \left(\frac{-1}{2} \cdot y - 1\right)\right)} - t \]
      3. sub-negN/A

        \[\leadsto y \cdot \left(z \cdot \color{blue}{\left(\frac{-1}{2} \cdot y + \left(\mathsf{neg}\left(1\right)\right)\right)}\right) - t \]
      4. *-commutativeN/A

        \[\leadsto y \cdot \left(z \cdot \left(\color{blue}{y \cdot \frac{-1}{2}} + \left(\mathsf{neg}\left(1\right)\right)\right)\right) - t \]
      5. metadata-evalN/A

        \[\leadsto y \cdot \left(z \cdot \left(y \cdot \frac{-1}{2} + \color{blue}{-1}\right)\right) - t \]
      6. lower-fma.f6465.6

        \[\leadsto y \cdot \left(z \cdot \color{blue}{\mathsf{fma}\left(y, -0.5, -1\right)}\right) - t \]
    11. Simplified65.6%

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

    if 582 < (+.f64 (*.f64 (-.f64 x #s(literal 1 binary64)) (log.f64 y)) (*.f64 (-.f64 z #s(literal 1 binary64)) (log.f64 (-.f64 #s(literal 1 binary64) y)))) < 1e3

    1. Initial program 93.4%

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

      \[\leadsto \color{blue}{\log y \cdot \left(x - 1\right) - t} \]
    4. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \color{blue}{\log y \cdot \left(x - 1\right) + \left(\mathsf{neg}\left(t\right)\right)} \]
      2. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\log y, x - 1, \mathsf{neg}\left(t\right)\right)} \]
      3. lower-log.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\log y}, x - 1, \mathsf{neg}\left(t\right)\right) \]
      4. sub-negN/A

        \[\leadsto \mathsf{fma}\left(\log y, \color{blue}{x + \left(\mathsf{neg}\left(1\right)\right)}, \mathsf{neg}\left(t\right)\right) \]
      5. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(\log y, x + \color{blue}{-1}, \mathsf{neg}\left(t\right)\right) \]
      6. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\log y, \color{blue}{-1 + x}, \mathsf{neg}\left(t\right)\right) \]
      7. lower-+.f64N/A

        \[\leadsto \mathsf{fma}\left(\log y, \color{blue}{-1 + x}, \mathsf{neg}\left(t\right)\right) \]
      8. lower-neg.f6493.4

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

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

      \[\leadsto \color{blue}{\log y \cdot \left(x - 1\right)} \]
    7. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \color{blue}{\log y \cdot \left(x - 1\right)} \]
      2. lower-log.f64N/A

        \[\leadsto \color{blue}{\log y} \cdot \left(x - 1\right) \]
      3. sub-negN/A

        \[\leadsto \log y \cdot \color{blue}{\left(x + \left(\mathsf{neg}\left(1\right)\right)\right)} \]
      4. metadata-evalN/A

        \[\leadsto \log y \cdot \left(x + \color{blue}{-1}\right) \]
      5. +-commutativeN/A

        \[\leadsto \log y \cdot \color{blue}{\left(-1 + x\right)} \]
      6. lower-+.f6461.0

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

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

      \[\leadsto \color{blue}{-1 \cdot \log y} \]
    10. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \color{blue}{\mathsf{neg}\left(\log y\right)} \]
      2. lower-neg.f64N/A

        \[\leadsto \color{blue}{\mathsf{neg}\left(\log y\right)} \]
      3. lower-log.f6461.0

        \[\leadsto -\color{blue}{\log y} \]
    11. Simplified61.0%

      \[\leadsto \color{blue}{-\log y} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification71.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\log y \cdot \left(x + -1\right) + \left(-1 + z\right) \cdot \log \left(1 - y\right) \leq -10000000000:\\ \;\;\;\;x \cdot \log y\\ \mathbf{elif}\;\log y \cdot \left(x + -1\right) + \left(-1 + z\right) \cdot \log \left(1 - y\right) \leq 582:\\ \;\;\;\;y \cdot \left(z \cdot \mathsf{fma}\left(y, -0.5, -1\right)\right) - t\\ \mathbf{elif}\;\log y \cdot \left(x + -1\right) + \left(-1 + z\right) \cdot \log \left(1 - y\right) \leq 1000:\\ \;\;\;\;-\log y\\ \mathbf{else}:\\ \;\;\;\;x \cdot \log y\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 57.1% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(\log y \cdot \left(x + -1\right) + \left(-1 + z\right) \cdot \log \left(1 - y\right)\right) - t\\ t_2 := y \cdot \left(z \cdot \mathsf{fma}\left(y, -0.5, -1\right)\right) - t\\ \mathbf{if}\;t\_1 \leq 120:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t\_1 \leq 1000:\\ \;\;\;\;-\log y\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (- (+ (* (log y) (+ x -1.0)) (* (+ -1.0 z) (log (- 1.0 y)))) t))
        (t_2 (- (* y (* z (fma y -0.5 -1.0))) t)))
   (if (<= t_1 120.0) t_2 (if (<= t_1 1000.0) (- (log y)) t_2))))
double code(double x, double y, double z, double t) {
	double t_1 = ((log(y) * (x + -1.0)) + ((-1.0 + z) * log((1.0 - y)))) - t;
	double t_2 = (y * (z * fma(y, -0.5, -1.0))) - t;
	double tmp;
	if (t_1 <= 120.0) {
		tmp = t_2;
	} else if (t_1 <= 1000.0) {
		tmp = -log(y);
	} else {
		tmp = t_2;
	}
	return tmp;
}
function code(x, y, z, t)
	t_1 = Float64(Float64(Float64(log(y) * Float64(x + -1.0)) + Float64(Float64(-1.0 + z) * log(Float64(1.0 - y)))) - t)
	t_2 = Float64(Float64(y * Float64(z * fma(y, -0.5, -1.0))) - t)
	tmp = 0.0
	if (t_1 <= 120.0)
		tmp = t_2;
	elseif (t_1 <= 1000.0)
		tmp = Float64(-log(y));
	else
		tmp = t_2;
	end
	return tmp
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(N[Log[y], $MachinePrecision] * N[(x + -1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(-1.0 + z), $MachinePrecision] * N[Log[N[(1.0 - y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y * N[(z * N[(y * -0.5 + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]}, If[LessEqual[t$95$1, 120.0], t$95$2, If[LessEqual[t$95$1, 1000.0], (-N[Log[y], $MachinePrecision]), t$95$2]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \left(\log y \cdot \left(x + -1\right) + \left(-1 + z\right) \cdot \log \left(1 - y\right)\right) - t\\
t_2 := y \cdot \left(z \cdot \mathsf{fma}\left(y, -0.5, -1\right)\right) - t\\
\mathbf{if}\;t\_1 \leq 120:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;t\_1 \leq 1000:\\
\;\;\;\;-\log y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 (+.f64 (*.f64 (-.f64 x #s(literal 1 binary64)) (log.f64 y)) (*.f64 (-.f64 z #s(literal 1 binary64)) (log.f64 (-.f64 #s(literal 1 binary64) y)))) t) < 120 or 1e3 < (-.f64 (+.f64 (*.f64 (-.f64 x #s(literal 1 binary64)) (log.f64 y)) (*.f64 (-.f64 z #s(literal 1 binary64)) (log.f64 (-.f64 #s(literal 1 binary64) y)))) t)

    1. Initial program 93.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 x around 0

      \[\leadsto \color{blue}{\left(-1 \cdot \log y + \log \left(1 - y\right) \cdot \left(z - 1\right)\right)} - t \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{\left(\log \left(1 - y\right) \cdot \left(z - 1\right) + -1 \cdot \log y\right)} - t \]
      2. mul-1-negN/A

        \[\leadsto \left(\log \left(1 - y\right) \cdot \left(z - 1\right) + \color{blue}{\left(\mathsf{neg}\left(\log y\right)\right)}\right) - t \]
      3. unsub-negN/A

        \[\leadsto \color{blue}{\left(\log \left(1 - y\right) \cdot \left(z - 1\right) - \log y\right)} - t \]
      4. lower--.f64N/A

        \[\leadsto \color{blue}{\left(\log \left(1 - y\right) \cdot \left(z - 1\right) - \log y\right)} - t \]
      5. lower-*.f64N/A

        \[\leadsto \left(\color{blue}{\log \left(1 - y\right) \cdot \left(z - 1\right)} - \log y\right) - t \]
      6. sub-negN/A

        \[\leadsto \left(\log \color{blue}{\left(1 + \left(\mathsf{neg}\left(y\right)\right)\right)} \cdot \left(z - 1\right) - \log y\right) - t \]
      7. lower-log1p.f64N/A

        \[\leadsto \left(\color{blue}{\mathsf{log1p}\left(\mathsf{neg}\left(y\right)\right)} \cdot \left(z - 1\right) - \log y\right) - t \]
      8. lower-neg.f64N/A

        \[\leadsto \left(\mathsf{log1p}\left(\color{blue}{\mathsf{neg}\left(y\right)}\right) \cdot \left(z - 1\right) - \log y\right) - t \]
      9. sub-negN/A

        \[\leadsto \left(\mathsf{log1p}\left(\mathsf{neg}\left(y\right)\right) \cdot \color{blue}{\left(z + \left(\mathsf{neg}\left(1\right)\right)\right)} - \log y\right) - t \]
      10. metadata-evalN/A

        \[\leadsto \left(\mathsf{log1p}\left(\mathsf{neg}\left(y\right)\right) \cdot \left(z + \color{blue}{-1}\right) - \log y\right) - t \]
      11. +-commutativeN/A

        \[\leadsto \left(\mathsf{log1p}\left(\mathsf{neg}\left(y\right)\right) \cdot \color{blue}{\left(-1 + z\right)} - \log y\right) - t \]
      12. lower-+.f64N/A

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

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

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

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

        \[\leadsto \color{blue}{\left(y \cdot \left(-1 \cdot \left(z - 1\right) + \frac{-1}{2} \cdot \left(y \cdot \left(z - 1\right)\right)\right) + \left(\mathsf{neg}\left(\log y\right)\right)\right)} - t \]
      2. *-commutativeN/A

        \[\leadsto \left(y \cdot \left(-1 \cdot \left(z - 1\right) + \frac{-1}{2} \cdot \color{blue}{\left(\left(z - 1\right) \cdot y\right)}\right) + \left(\mathsf{neg}\left(\log y\right)\right)\right) - t \]
      3. associate-*r*N/A

        \[\leadsto \left(y \cdot \left(-1 \cdot \left(z - 1\right) + \color{blue}{\left(\frac{-1}{2} \cdot \left(z - 1\right)\right) \cdot y}\right) + \left(\mathsf{neg}\left(\log y\right)\right)\right) - t \]
      4. log-recN/A

        \[\leadsto \left(y \cdot \left(-1 \cdot \left(z - 1\right) + \left(\frac{-1}{2} \cdot \left(z - 1\right)\right) \cdot y\right) + \color{blue}{\log \left(\frac{1}{y}\right)}\right) - t \]
      5. lower-fma.f64N/A

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

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

      \[\leadsto \color{blue}{y \cdot \left(z \cdot \left(\frac{-1}{2} \cdot y - 1\right)\right)} - t \]
    10. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \color{blue}{y \cdot \left(z \cdot \left(\frac{-1}{2} \cdot y - 1\right)\right)} - t \]
      2. lower-*.f64N/A

        \[\leadsto y \cdot \color{blue}{\left(z \cdot \left(\frac{-1}{2} \cdot y - 1\right)\right)} - t \]
      3. sub-negN/A

        \[\leadsto y \cdot \left(z \cdot \color{blue}{\left(\frac{-1}{2} \cdot y + \left(\mathsf{neg}\left(1\right)\right)\right)}\right) - t \]
      4. *-commutativeN/A

        \[\leadsto y \cdot \left(z \cdot \left(\color{blue}{y \cdot \frac{-1}{2}} + \left(\mathsf{neg}\left(1\right)\right)\right)\right) - t \]
      5. metadata-evalN/A

        \[\leadsto y \cdot \left(z \cdot \left(y \cdot \frac{-1}{2} + \color{blue}{-1}\right)\right) - t \]
      6. lower-fma.f6447.6

        \[\leadsto y \cdot \left(z \cdot \color{blue}{\mathsf{fma}\left(y, -0.5, -1\right)}\right) - t \]
    11. Simplified47.6%

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

    if 120 < (-.f64 (+.f64 (*.f64 (-.f64 x #s(literal 1 binary64)) (log.f64 y)) (*.f64 (-.f64 z #s(literal 1 binary64)) (log.f64 (-.f64 #s(literal 1 binary64) y)))) t) < 1e3

    1. Initial program 76.4%

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

      \[\leadsto \color{blue}{\log y \cdot \left(x - 1\right) - t} \]
    4. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \color{blue}{\log y \cdot \left(x - 1\right) + \left(\mathsf{neg}\left(t\right)\right)} \]
      2. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\log y, x - 1, \mathsf{neg}\left(t\right)\right)} \]
      3. lower-log.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\log y}, x - 1, \mathsf{neg}\left(t\right)\right) \]
      4. sub-negN/A

        \[\leadsto \mathsf{fma}\left(\log y, \color{blue}{x + \left(\mathsf{neg}\left(1\right)\right)}, \mathsf{neg}\left(t\right)\right) \]
      5. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(\log y, x + \color{blue}{-1}, \mathsf{neg}\left(t\right)\right) \]
      6. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\log y, \color{blue}{-1 + x}, \mathsf{neg}\left(t\right)\right) \]
      7. lower-+.f64N/A

        \[\leadsto \mathsf{fma}\left(\log y, \color{blue}{-1 + x}, \mathsf{neg}\left(t\right)\right) \]
      8. lower-neg.f6476.4

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

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

      \[\leadsto \color{blue}{\log y \cdot \left(x - 1\right)} \]
    7. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \color{blue}{\log y \cdot \left(x - 1\right)} \]
      2. lower-log.f64N/A

        \[\leadsto \color{blue}{\log y} \cdot \left(x - 1\right) \]
      3. sub-negN/A

        \[\leadsto \log y \cdot \color{blue}{\left(x + \left(\mathsf{neg}\left(1\right)\right)\right)} \]
      4. metadata-evalN/A

        \[\leadsto \log y \cdot \left(x + \color{blue}{-1}\right) \]
      5. +-commutativeN/A

        \[\leadsto \log y \cdot \color{blue}{\left(-1 + x\right)} \]
      6. lower-+.f6473.8

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

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

      \[\leadsto \color{blue}{-1 \cdot \log y} \]
    10. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \color{blue}{\mathsf{neg}\left(\log y\right)} \]
      2. lower-neg.f64N/A

        \[\leadsto \color{blue}{\mathsf{neg}\left(\log y\right)} \]
      3. lower-log.f6472.4

        \[\leadsto -\color{blue}{\log y} \]
    11. Simplified72.4%

      \[\leadsto \color{blue}{-\log y} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification53.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(\log y \cdot \left(x + -1\right) + \left(-1 + z\right) \cdot \log \left(1 - y\right)\right) - t \leq 120:\\ \;\;\;\;y \cdot \left(z \cdot \mathsf{fma}\left(y, -0.5, -1\right)\right) - t\\ \mathbf{elif}\;\left(\log y \cdot \left(x + -1\right) + \left(-1 + z\right) \cdot \log \left(1 - y\right)\right) - t \leq 1000:\\ \;\;\;\;-\log y\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(z \cdot \mathsf{fma}\left(y, -0.5, -1\right)\right) - t\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 99.7% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \left(\log y \cdot \left(x + -1\right) + \left(-1 + z\right) \cdot \left(y \cdot \mathsf{fma}\left(y, \mathsf{fma}\left(y, \mathsf{fma}\left(y, -0.25, -0.3333333333333333\right), -0.5\right), -1\right)\right)\right) - t \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (-
  (+
   (* (log y) (+ x -1.0))
   (*
    (+ -1.0 z)
    (* y (fma y (fma y (fma y -0.25 -0.3333333333333333) -0.5) -1.0))))
  t))
double code(double x, double y, double z, double t) {
	return ((log(y) * (x + -1.0)) + ((-1.0 + z) * (y * fma(y, fma(y, fma(y, -0.25, -0.3333333333333333), -0.5), -1.0)))) - t;
}
function code(x, y, z, t)
	return Float64(Float64(Float64(log(y) * Float64(x + -1.0)) + Float64(Float64(-1.0 + z) * Float64(y * fma(y, fma(y, fma(y, -0.25, -0.3333333333333333), -0.5), -1.0)))) - 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[(y * N[(y * N[(y * -0.25 + -0.3333333333333333), $MachinePrecision] + -0.5), $MachinePrecision] + -1.0), $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 \mathsf{fma}\left(y, \mathsf{fma}\left(y, \mathsf{fma}\left(y, -0.25, -0.3333333333333333\right), -0.5\right), -1\right)\right)\right) - t
\end{array}
Derivation
  1. Initial program 89.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

    \[\leadsto \left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \color{blue}{\left(y \cdot \left(y \cdot \left(y \cdot \left(\frac{-1}{4} \cdot y - \frac{1}{3}\right) - \frac{1}{2}\right) - 1\right)\right)}\right) - t \]
  4. Step-by-step derivation
    1. lower-*.f64N/A

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \color{blue}{\left(y \cdot \left(y \cdot \left(y \cdot \left(\frac{-1}{4} \cdot y - \frac{1}{3}\right) - \frac{1}{2}\right) - 1\right)\right)}\right) - t \]
    2. sub-negN/A

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \left(y \cdot \color{blue}{\left(y \cdot \left(y \cdot \left(\frac{-1}{4} \cdot y - \frac{1}{3}\right) - \frac{1}{2}\right) + \left(\mathsf{neg}\left(1\right)\right)\right)}\right)\right) - t \]
    3. metadata-evalN/A

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \left(y \cdot \left(y \cdot \left(y \cdot \left(\frac{-1}{4} \cdot y - \frac{1}{3}\right) - \frac{1}{2}\right) + \color{blue}{-1}\right)\right)\right) - t \]
    4. lower-fma.f64N/A

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \left(y \cdot \color{blue}{\mathsf{fma}\left(y, y \cdot \left(\frac{-1}{4} \cdot y - \frac{1}{3}\right) - \frac{1}{2}, -1\right)}\right)\right) - t \]
    5. sub-negN/A

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \left(y \cdot \mathsf{fma}\left(y, \color{blue}{y \cdot \left(\frac{-1}{4} \cdot y - \frac{1}{3}\right) + \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}, -1\right)\right)\right) - t \]
    6. metadata-evalN/A

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \left(y \cdot \mathsf{fma}\left(y, y \cdot \left(\frac{-1}{4} \cdot y - \frac{1}{3}\right) + \color{blue}{\frac{-1}{2}}, -1\right)\right)\right) - t \]
    7. lower-fma.f64N/A

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \left(y \cdot \mathsf{fma}\left(y, \color{blue}{\mathsf{fma}\left(y, \frac{-1}{4} \cdot y - \frac{1}{3}, \frac{-1}{2}\right)}, -1\right)\right)\right) - t \]
    8. sub-negN/A

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \left(y \cdot \mathsf{fma}\left(y, \mathsf{fma}\left(y, \color{blue}{\frac{-1}{4} \cdot y + \left(\mathsf{neg}\left(\frac{1}{3}\right)\right)}, \frac{-1}{2}\right), -1\right)\right)\right) - t \]
    9. *-commutativeN/A

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \left(y \cdot \mathsf{fma}\left(y, \mathsf{fma}\left(y, \color{blue}{y \cdot \frac{-1}{4}} + \left(\mathsf{neg}\left(\frac{1}{3}\right)\right), \frac{-1}{2}\right), -1\right)\right)\right) - t \]
    10. metadata-evalN/A

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

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

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

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

Alternative 8: 99.6% accurate, 1.6× speedup?

\[\begin{array}{l} \\ \left(\log y \cdot \left(x + -1\right) + \left(-1 + z\right) \cdot \left(y \cdot \mathsf{fma}\left(y, \mathsf{fma}\left(y, -0.3333333333333333, -0.5\right), -1\right)\right)\right) - t \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (-
  (+
   (* (log y) (+ x -1.0))
   (* (+ -1.0 z) (* y (fma y (fma y -0.3333333333333333 -0.5) -1.0))))
  t))
double code(double x, double y, double z, double t) {
	return ((log(y) * (x + -1.0)) + ((-1.0 + z) * (y * fma(y, fma(y, -0.3333333333333333, -0.5), -1.0)))) - t;
}
function code(x, y, z, t)
	return Float64(Float64(Float64(log(y) * Float64(x + -1.0)) + Float64(Float64(-1.0 + z) * Float64(y * fma(y, fma(y, -0.3333333333333333, -0.5), -1.0)))) - 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[(y * N[(y * -0.3333333333333333 + -0.5), $MachinePrecision] + -1.0), $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 \mathsf{fma}\left(y, \mathsf{fma}\left(y, -0.3333333333333333, -0.5\right), -1\right)\right)\right) - t
\end{array}
Derivation
  1. Initial program 89.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

    \[\leadsto \left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \color{blue}{\left(y \cdot \left(y \cdot \left(\frac{-1}{3} \cdot y - \frac{1}{2}\right) - 1\right)\right)}\right) - t \]
  4. Step-by-step derivation
    1. lower-*.f64N/A

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

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \left(y \cdot \color{blue}{\left(y \cdot \left(\frac{-1}{3} \cdot y - \frac{1}{2}\right) + \left(\mathsf{neg}\left(1\right)\right)\right)}\right)\right) - t \]
    3. metadata-evalN/A

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \left(y \cdot \left(y \cdot \left(\frac{-1}{3} \cdot y - \frac{1}{2}\right) + \color{blue}{-1}\right)\right)\right) - t \]
    4. lower-fma.f64N/A

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

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \left(y \cdot \mathsf{fma}\left(y, \color{blue}{\frac{-1}{3} \cdot y + \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}, -1\right)\right)\right) - t \]
    6. *-commutativeN/A

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \left(y \cdot \mathsf{fma}\left(y, \color{blue}{y \cdot \frac{-1}{3}} + \left(\mathsf{neg}\left(\frac{1}{2}\right)\right), -1\right)\right)\right) - t \]
    7. metadata-evalN/A

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

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

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

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

Alternative 9: 95.2% accurate, 1.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x + -1 \leq -2 \cdot 10^{+25}:\\ \;\;\;\;\mathsf{fma}\left(\log y, x, -t\right)\\ \mathbf{elif}\;x + -1 \leq 4:\\ \;\;\;\;\left(-t\right) - \mathsf{fma}\left(y, -1 + z, \log y\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\log y, x + -1, -t\right)\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= (+ x -1.0) -2e+25)
   (fma (log y) x (- t))
   (if (<= (+ x -1.0) 4.0)
     (- (- t) (fma y (+ -1.0 z) (log y)))
     (fma (log y) (+ x -1.0) (- t)))))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((x + -1.0) <= -2e+25) {
		tmp = fma(log(y), x, -t);
	} else if ((x + -1.0) <= 4.0) {
		tmp = -t - fma(y, (-1.0 + z), log(y));
	} else {
		tmp = fma(log(y), (x + -1.0), -t);
	}
	return tmp;
}
function code(x, y, z, t)
	tmp = 0.0
	if (Float64(x + -1.0) <= -2e+25)
		tmp = fma(log(y), x, Float64(-t));
	elseif (Float64(x + -1.0) <= 4.0)
		tmp = Float64(Float64(-t) - fma(y, Float64(-1.0 + z), log(y)));
	else
		tmp = fma(log(y), Float64(x + -1.0), Float64(-t));
	end
	return tmp
end
code[x_, y_, z_, t_] := If[LessEqual[N[(x + -1.0), $MachinePrecision], -2e+25], N[(N[Log[y], $MachinePrecision] * x + (-t)), $MachinePrecision], If[LessEqual[N[(x + -1.0), $MachinePrecision], 4.0], N[((-t) - N[(y * N[(-1.0 + z), $MachinePrecision] + N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Log[y], $MachinePrecision] * N[(x + -1.0), $MachinePrecision] + (-t)), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x + -1 \leq -2 \cdot 10^{+25}:\\
\;\;\;\;\mathsf{fma}\left(\log y, x, -t\right)\\

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

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


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

    1. Initial program 98.1%

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

      \[\leadsto \color{blue}{x \cdot \log y} - t \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{\log y \cdot x} - t \]
      2. lower-*.f64N/A

        \[\leadsto \color{blue}{\log y \cdot x} - t \]
      3. lower-log.f6498.1

        \[\leadsto \color{blue}{\log y} \cdot x - t \]
    5. Simplified98.1%

      \[\leadsto \color{blue}{\log y \cdot x} - t \]
    6. Step-by-step derivation
      1. lift-log.f64N/A

        \[\leadsto \color{blue}{\log y} \cdot x - t \]
      2. lift-*.f64N/A

        \[\leadsto \color{blue}{\log y \cdot x} - t \]
      3. sub-negN/A

        \[\leadsto \color{blue}{\log y \cdot x + \left(\mathsf{neg}\left(t\right)\right)} \]
      4. lift-*.f64N/A

        \[\leadsto \color{blue}{\log y \cdot x} + \left(\mathsf{neg}\left(t\right)\right) \]
      5. lift-neg.f64N/A

        \[\leadsto \log y \cdot x + \color{blue}{\left(\mathsf{neg}\left(t\right)\right)} \]
      6. lower-fma.f6498.1

        \[\leadsto \color{blue}{\mathsf{fma}\left(\log y, x, -t\right)} \]
    7. Applied egg-rr98.1%

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

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

    1. Initial program 82.7%

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

      \[\leadsto \color{blue}{\left(-1 \cdot \log y + \log \left(1 - y\right) \cdot \left(z - 1\right)\right)} - t \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{\left(\log \left(1 - y\right) \cdot \left(z - 1\right) + -1 \cdot \log y\right)} - t \]
      2. mul-1-negN/A

        \[\leadsto \left(\log \left(1 - y\right) \cdot \left(z - 1\right) + \color{blue}{\left(\mathsf{neg}\left(\log y\right)\right)}\right) - t \]
      3. unsub-negN/A

        \[\leadsto \color{blue}{\left(\log \left(1 - y\right) \cdot \left(z - 1\right) - \log y\right)} - t \]
      4. lower--.f64N/A

        \[\leadsto \color{blue}{\left(\log \left(1 - y\right) \cdot \left(z - 1\right) - \log y\right)} - t \]
      5. lower-*.f64N/A

        \[\leadsto \left(\color{blue}{\log \left(1 - y\right) \cdot \left(z - 1\right)} - \log y\right) - t \]
      6. sub-negN/A

        \[\leadsto \left(\log \color{blue}{\left(1 + \left(\mathsf{neg}\left(y\right)\right)\right)} \cdot \left(z - 1\right) - \log y\right) - t \]
      7. lower-log1p.f64N/A

        \[\leadsto \left(\color{blue}{\mathsf{log1p}\left(\mathsf{neg}\left(y\right)\right)} \cdot \left(z - 1\right) - \log y\right) - t \]
      8. lower-neg.f64N/A

        \[\leadsto \left(\mathsf{log1p}\left(\color{blue}{\mathsf{neg}\left(y\right)}\right) \cdot \left(z - 1\right) - \log y\right) - t \]
      9. sub-negN/A

        \[\leadsto \left(\mathsf{log1p}\left(\mathsf{neg}\left(y\right)\right) \cdot \color{blue}{\left(z + \left(\mathsf{neg}\left(1\right)\right)\right)} - \log y\right) - t \]
      10. metadata-evalN/A

        \[\leadsto \left(\mathsf{log1p}\left(\mathsf{neg}\left(y\right)\right) \cdot \left(z + \color{blue}{-1}\right) - \log y\right) - t \]
      11. +-commutativeN/A

        \[\leadsto \left(\mathsf{log1p}\left(\mathsf{neg}\left(y\right)\right) \cdot \color{blue}{\left(-1 + z\right)} - \log y\right) - t \]
      12. lower-+.f64N/A

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

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

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

      \[\leadsto \color{blue}{\left(-1 \cdot \left(y \cdot \left(z - 1\right)\right) - \log y\right)} - t \]
    7. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \color{blue}{\left(-1 \cdot \left(y \cdot \left(z - 1\right)\right) + \left(\mathsf{neg}\left(\log y\right)\right)\right)} - t \]
      2. mul-1-negN/A

        \[\leadsto \left(\color{blue}{\left(\mathsf{neg}\left(y \cdot \left(z - 1\right)\right)\right)} + \left(\mathsf{neg}\left(\log y\right)\right)\right) - t \]
      3. distribute-neg-outN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(y \cdot \left(z - 1\right) + \log y\right)\right)\right)} - t \]
      4. lower-neg.f64N/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(y \cdot \left(z - 1\right) + \log y\right)\right)\right)} - t \]
      5. lower-fma.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\mathsf{fma}\left(y, z - 1, \log y\right)}\right)\right) - t \]
      6. sub-negN/A

        \[\leadsto \left(\mathsf{neg}\left(\mathsf{fma}\left(y, \color{blue}{z + \left(\mathsf{neg}\left(1\right)\right)}, \log y\right)\right)\right) - t \]
      7. metadata-evalN/A

        \[\leadsto \left(\mathsf{neg}\left(\mathsf{fma}\left(y, z + \color{blue}{-1}, \log y\right)\right)\right) - t \]
      8. +-commutativeN/A

        \[\leadsto \left(\mathsf{neg}\left(\mathsf{fma}\left(y, \color{blue}{-1 + z}, \log y\right)\right)\right) - t \]
      9. lower-+.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(\mathsf{fma}\left(y, \color{blue}{-1 + z}, \log y\right)\right)\right) - t \]
      10. lower-log.f6498.1

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

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

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

    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. Add Preprocessing
    3. Taylor expanded in y around 0

      \[\leadsto \color{blue}{\log y \cdot \left(x - 1\right) - t} \]
    4. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \color{blue}{\log y \cdot \left(x - 1\right) + \left(\mathsf{neg}\left(t\right)\right)} \]
      2. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\log y, x - 1, \mathsf{neg}\left(t\right)\right)} \]
      3. lower-log.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\log y}, x - 1, \mathsf{neg}\left(t\right)\right) \]
      4. sub-negN/A

        \[\leadsto \mathsf{fma}\left(\log y, \color{blue}{x + \left(\mathsf{neg}\left(1\right)\right)}, \mathsf{neg}\left(t\right)\right) \]
      5. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(\log y, x + \color{blue}{-1}, \mathsf{neg}\left(t\right)\right) \]
      6. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\log y, \color{blue}{-1 + x}, \mathsf{neg}\left(t\right)\right) \]
      7. lower-+.f64N/A

        \[\leadsto \mathsf{fma}\left(\log y, \color{blue}{-1 + x}, \mathsf{neg}\left(t\right)\right) \]
      8. lower-neg.f6495.7

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

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

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

Alternative 10: 99.5% accurate, 1.7× speedup?

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

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

    \[\leadsto \color{blue}{\left(y \cdot \left(-1 \cdot \left(z - 1\right) + \frac{-1}{2} \cdot \left(y \cdot \left(z - 1\right)\right)\right) + \log y \cdot \left(x - 1\right)\right)} - t \]
  4. Step-by-step derivation
    1. *-commutativeN/A

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

      \[\leadsto \left(y \cdot \left(-1 \cdot \left(z - 1\right) + \color{blue}{y \cdot \left(\left(z - 1\right) \cdot \frac{-1}{2}\right)}\right) + \log y \cdot \left(x - 1\right)\right) - t \]
    3. *-commutativeN/A

      \[\leadsto \left(y \cdot \left(-1 \cdot \left(z - 1\right) + y \cdot \color{blue}{\left(\frac{-1}{2} \cdot \left(z - 1\right)\right)}\right) + \log y \cdot \left(x - 1\right)\right) - t \]
    4. lower-fma.f64N/A

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

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

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

Alternative 11: 76.3% accurate, 1.8× speedup?

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

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

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

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


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

    1. Initial program 97.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 x around inf

      \[\leadsto \color{blue}{x \cdot \log y} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{\log y \cdot x} \]
      2. lower-*.f64N/A

        \[\leadsto \color{blue}{\log y \cdot x} \]
      3. lower-log.f6479.1

        \[\leadsto \color{blue}{\log y} \cdot x \]
    5. Simplified79.1%

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

    if -2.00000000000000018e25 < (-.f64 x #s(literal 1 binary64)) < 2e5

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

      \[\leadsto \color{blue}{\log y \cdot \left(x - 1\right) - t} \]
    4. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \color{blue}{\log y \cdot \left(x - 1\right) + \left(\mathsf{neg}\left(t\right)\right)} \]
      2. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\log y, x - 1, \mathsf{neg}\left(t\right)\right)} \]
      3. lower-log.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\log y}, x - 1, \mathsf{neg}\left(t\right)\right) \]
      4. sub-negN/A

        \[\leadsto \mathsf{fma}\left(\log y, \color{blue}{x + \left(\mathsf{neg}\left(1\right)\right)}, \mathsf{neg}\left(t\right)\right) \]
      5. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(\log y, x + \color{blue}{-1}, \mathsf{neg}\left(t\right)\right) \]
      6. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\log y, \color{blue}{-1 + x}, \mathsf{neg}\left(t\right)\right) \]
      7. lower-+.f64N/A

        \[\leadsto \mathsf{fma}\left(\log y, \color{blue}{-1 + x}, \mathsf{neg}\left(t\right)\right) \]
      8. lower-neg.f6481.6

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

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

      \[\leadsto \color{blue}{-1 \cdot \log y - t} \]
    7. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\log y\right)\right)} - t \]
      2. log-recN/A

        \[\leadsto \color{blue}{\log \left(\frac{1}{y}\right)} - t \]
      3. lower--.f64N/A

        \[\leadsto \color{blue}{\log \left(\frac{1}{y}\right) - t} \]
      4. log-recN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\log y\right)\right)} - t \]
      5. lower-neg.f64N/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\log y\right)\right)} - t \]
      6. lower-log.f6480.8

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

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

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

Alternative 12: 88.9% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;-1 + z \leq 4.5 \cdot 10^{+263}:\\
\;\;\;\;\mathsf{fma}\left(\log y, x + -1, y - t\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 z #s(literal 1 binary64)) < 4.50000000000000014e263

    1. Initial program 92.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. lift--.f64N/A

        \[\leadsto \left(\color{blue}{\left(x - 1\right)} \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
      2. lift-log.f64N/A

        \[\leadsto \left(\left(x - 1\right) \cdot \color{blue}{\log y} + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
      3. lift-*.f64N/A

        \[\leadsto \left(\color{blue}{\left(x - 1\right) \cdot \log y} + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
      4. lift--.f64N/A

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\left(z - 1\right)} \cdot \log \left(1 - y\right)\right) - t \]
      5. lift--.f64N/A

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \color{blue}{\left(1 - y\right)}\right) - t \]
      6. lift-log.f64N/A

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \color{blue}{\log \left(1 - y\right)}\right) - t \]
      7. lift-*.f64N/A

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\left(z - 1\right) \cdot \log \left(1 - y\right)}\right) - t \]
      8. lift-+.f64N/A

        \[\leadsto \color{blue}{\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right)} - t \]
      9. flip--N/A

        \[\leadsto \color{blue}{\frac{\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) \cdot \left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \cdot t}{\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) + t}} \]
      10. clear-numN/A

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

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

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

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

        \[\leadsto \color{blue}{\left(\log y \cdot \left(x - 1\right) + -1 \cdot \left(y \cdot \left(z - 1\right)\right)\right)} - t \]
      2. associate--l+N/A

        \[\leadsto \color{blue}{\log y \cdot \left(x - 1\right) + \left(-1 \cdot \left(y \cdot \left(z - 1\right)\right) - t\right)} \]
      3. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\log y, x - 1, -1 \cdot \left(y \cdot \left(z - 1\right)\right) - t\right)} \]
      4. lower-log.f64N/A

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

        \[\leadsto \mathsf{fma}\left(\log y, \color{blue}{x + \left(\mathsf{neg}\left(1\right)\right)}, -1 \cdot \left(y \cdot \left(z - 1\right)\right) - t\right) \]
      6. metadata-evalN/A

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

        \[\leadsto \mathsf{fma}\left(\log y, \color{blue}{-1 + x}, -1 \cdot \left(y \cdot \left(z - 1\right)\right) - t\right) \]
      8. lower-+.f64N/A

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

        \[\leadsto \mathsf{fma}\left(\log y, -1 + x, \color{blue}{-1 \cdot \left(y \cdot \left(z - 1\right)\right) + \left(\mathsf{neg}\left(t\right)\right)}\right) \]
      10. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(\log y, -1 + x, \color{blue}{\left(\mathsf{neg}\left(y \cdot \left(z - 1\right)\right)\right)} + \left(\mathsf{neg}\left(t\right)\right)\right) \]
      11. distribute-neg-outN/A

        \[\leadsto \mathsf{fma}\left(\log y, -1 + x, \color{blue}{\mathsf{neg}\left(\left(y \cdot \left(z - 1\right) + t\right)\right)}\right) \]
      12. lower-neg.f64N/A

        \[\leadsto \mathsf{fma}\left(\log y, -1 + x, \color{blue}{\mathsf{neg}\left(\left(y \cdot \left(z - 1\right) + t\right)\right)}\right) \]
      13. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\log y, -1 + x, \mathsf{neg}\left(\color{blue}{\mathsf{fma}\left(y, z - 1, t\right)}\right)\right) \]
      14. sub-negN/A

        \[\leadsto \mathsf{fma}\left(\log y, -1 + x, \mathsf{neg}\left(\mathsf{fma}\left(y, \color{blue}{z + \left(\mathsf{neg}\left(1\right)\right)}, t\right)\right)\right) \]
      15. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(\log y, -1 + x, \mathsf{neg}\left(\mathsf{fma}\left(y, z + \color{blue}{-1}, t\right)\right)\right) \]
      16. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\log y, -1 + x, \mathsf{neg}\left(\mathsf{fma}\left(y, \color{blue}{-1 + z}, t\right)\right)\right) \]
      17. lower-+.f6499.1

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

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

      \[\leadsto \mathsf{fma}\left(\log y, -1 + x, \color{blue}{-1 \cdot \left(t + -1 \cdot y\right)}\right) \]
    9. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(\log y, -1 + x, \color{blue}{\mathsf{neg}\left(\left(t + -1 \cdot y\right)\right)}\right) \]
      2. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\log y, -1 + x, \mathsf{neg}\left(\color{blue}{\left(-1 \cdot y + t\right)}\right)\right) \]
      3. distribute-neg-inN/A

        \[\leadsto \mathsf{fma}\left(\log y, -1 + x, \color{blue}{\left(\mathsf{neg}\left(-1 \cdot y\right)\right) + \left(\mathsf{neg}\left(t\right)\right)}\right) \]
      4. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(\log y, -1 + x, \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(y\right)\right)}\right)\right) + \left(\mathsf{neg}\left(t\right)\right)\right) \]
      5. remove-double-negN/A

        \[\leadsto \mathsf{fma}\left(\log y, -1 + x, \color{blue}{y} + \left(\mathsf{neg}\left(t\right)\right)\right) \]
      6. unsub-negN/A

        \[\leadsto \mathsf{fma}\left(\log y, -1 + x, \color{blue}{y - t}\right) \]
      7. lower--.f6491.6

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

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

    if 4.50000000000000014e263 < (-.f64 z #s(literal 1 binary64))

    1. Initial program 47.4%

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

      \[\leadsto \color{blue}{z \cdot \log \left(1 - y\right)} - t \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{\log \left(1 - y\right) \cdot z} - t \]
      2. lower-*.f64N/A

        \[\leadsto \color{blue}{\log \left(1 - y\right) \cdot z} - t \]
      3. sub-negN/A

        \[\leadsto \log \color{blue}{\left(1 + \left(\mathsf{neg}\left(y\right)\right)\right)} \cdot z - t \]
      4. lower-log1p.f64N/A

        \[\leadsto \color{blue}{\mathsf{log1p}\left(\mathsf{neg}\left(y\right)\right)} \cdot z - t \]
      5. lower-neg.f6477.4

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

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

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

Alternative 13: 78.2% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := y \cdot \left(z \cdot \mathsf{fma}\left(y, -0.5, -1\right)\right) - t\\ \mathbf{if}\;t \leq -2.8 \cdot 10^{+19}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t \leq 3.4 \cdot 10^{+14}:\\ \;\;\;\;\log y \cdot \left(x + -1\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (- (* y (* z (fma y -0.5 -1.0))) t)))
   (if (<= t -2.8e+19) t_1 (if (<= t 3.4e+14) (* (log y) (+ x -1.0)) t_1))))
double code(double x, double y, double z, double t) {
	double t_1 = (y * (z * fma(y, -0.5, -1.0))) - t;
	double tmp;
	if (t <= -2.8e+19) {
		tmp = t_1;
	} else if (t <= 3.4e+14) {
		tmp = log(y) * (x + -1.0);
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(x, y, z, t)
	t_1 = Float64(Float64(y * Float64(z * fma(y, -0.5, -1.0))) - t)
	tmp = 0.0
	if (t <= -2.8e+19)
		tmp = t_1;
	elseif (t <= 3.4e+14)
		tmp = Float64(log(y) * Float64(x + -1.0));
	else
		tmp = t_1;
	end
	return tmp
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y * N[(z * N[(y * -0.5 + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]}, If[LessEqual[t, -2.8e+19], t$95$1, If[LessEqual[t, 3.4e+14], N[(N[Log[y], $MachinePrecision] * N[(x + -1.0), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := y \cdot \left(z \cdot \mathsf{fma}\left(y, -0.5, -1\right)\right) - t\\
\mathbf{if}\;t \leq -2.8 \cdot 10^{+19}:\\
\;\;\;\;t\_1\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -2.8e19 or 3.4e14 < t

    1. Initial program 94.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 x around 0

      \[\leadsto \color{blue}{\left(-1 \cdot \log y + \log \left(1 - y\right) \cdot \left(z - 1\right)\right)} - t \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{\left(\log \left(1 - y\right) \cdot \left(z - 1\right) + -1 \cdot \log y\right)} - t \]
      2. mul-1-negN/A

        \[\leadsto \left(\log \left(1 - y\right) \cdot \left(z - 1\right) + \color{blue}{\left(\mathsf{neg}\left(\log y\right)\right)}\right) - t \]
      3. unsub-negN/A

        \[\leadsto \color{blue}{\left(\log \left(1 - y\right) \cdot \left(z - 1\right) - \log y\right)} - t \]
      4. lower--.f64N/A

        \[\leadsto \color{blue}{\left(\log \left(1 - y\right) \cdot \left(z - 1\right) - \log y\right)} - t \]
      5. lower-*.f64N/A

        \[\leadsto \left(\color{blue}{\log \left(1 - y\right) \cdot \left(z - 1\right)} - \log y\right) - t \]
      6. sub-negN/A

        \[\leadsto \left(\log \color{blue}{\left(1 + \left(\mathsf{neg}\left(y\right)\right)\right)} \cdot \left(z - 1\right) - \log y\right) - t \]
      7. lower-log1p.f64N/A

        \[\leadsto \left(\color{blue}{\mathsf{log1p}\left(\mathsf{neg}\left(y\right)\right)} \cdot \left(z - 1\right) - \log y\right) - t \]
      8. lower-neg.f64N/A

        \[\leadsto \left(\mathsf{log1p}\left(\color{blue}{\mathsf{neg}\left(y\right)}\right) \cdot \left(z - 1\right) - \log y\right) - t \]
      9. sub-negN/A

        \[\leadsto \left(\mathsf{log1p}\left(\mathsf{neg}\left(y\right)\right) \cdot \color{blue}{\left(z + \left(\mathsf{neg}\left(1\right)\right)\right)} - \log y\right) - t \]
      10. metadata-evalN/A

        \[\leadsto \left(\mathsf{log1p}\left(\mathsf{neg}\left(y\right)\right) \cdot \left(z + \color{blue}{-1}\right) - \log y\right) - t \]
      11. +-commutativeN/A

        \[\leadsto \left(\mathsf{log1p}\left(\mathsf{neg}\left(y\right)\right) \cdot \color{blue}{\left(-1 + z\right)} - \log y\right) - t \]
      12. lower-+.f64N/A

        \[\leadsto \left(\mathsf{log1p}\left(\mathsf{neg}\left(y\right)\right) \cdot \color{blue}{\left(-1 + z\right)} - \log y\right) - t \]
      13. lower-log.f6480.9

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

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

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

        \[\leadsto \color{blue}{\left(y \cdot \left(-1 \cdot \left(z - 1\right) + \frac{-1}{2} \cdot \left(y \cdot \left(z - 1\right)\right)\right) + \left(\mathsf{neg}\left(\log y\right)\right)\right)} - t \]
      2. *-commutativeN/A

        \[\leadsto \left(y \cdot \left(-1 \cdot \left(z - 1\right) + \frac{-1}{2} \cdot \color{blue}{\left(\left(z - 1\right) \cdot y\right)}\right) + \left(\mathsf{neg}\left(\log y\right)\right)\right) - t \]
      3. associate-*r*N/A

        \[\leadsto \left(y \cdot \left(-1 \cdot \left(z - 1\right) + \color{blue}{\left(\frac{-1}{2} \cdot \left(z - 1\right)\right) \cdot y}\right) + \left(\mathsf{neg}\left(\log y\right)\right)\right) - t \]
      4. log-recN/A

        \[\leadsto \left(y \cdot \left(-1 \cdot \left(z - 1\right) + \left(\frac{-1}{2} \cdot \left(z - 1\right)\right) \cdot y\right) + \color{blue}{\log \left(\frac{1}{y}\right)}\right) - t \]
      5. lower-fma.f64N/A

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

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

      \[\leadsto \color{blue}{y \cdot \left(z \cdot \left(\frac{-1}{2} \cdot y - 1\right)\right)} - t \]
    10. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \color{blue}{y \cdot \left(z \cdot \left(\frac{-1}{2} \cdot y - 1\right)\right)} - t \]
      2. lower-*.f64N/A

        \[\leadsto y \cdot \color{blue}{\left(z \cdot \left(\frac{-1}{2} \cdot y - 1\right)\right)} - t \]
      3. sub-negN/A

        \[\leadsto y \cdot \left(z \cdot \color{blue}{\left(\frac{-1}{2} \cdot y + \left(\mathsf{neg}\left(1\right)\right)\right)}\right) - t \]
      4. *-commutativeN/A

        \[\leadsto y \cdot \left(z \cdot \left(\color{blue}{y \cdot \frac{-1}{2}} + \left(\mathsf{neg}\left(1\right)\right)\right)\right) - t \]
      5. metadata-evalN/A

        \[\leadsto y \cdot \left(z \cdot \left(y \cdot \frac{-1}{2} + \color{blue}{-1}\right)\right) - t \]
      6. lower-fma.f6480.9

        \[\leadsto y \cdot \left(z \cdot \color{blue}{\mathsf{fma}\left(y, -0.5, -1\right)}\right) - t \]
    11. Simplified80.9%

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

    if -2.8e19 < t < 3.4e14

    1. Initial program 86.4%

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

      \[\leadsto \color{blue}{\log y \cdot \left(x - 1\right) - t} \]
    4. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \color{blue}{\log y \cdot \left(x - 1\right) + \left(\mathsf{neg}\left(t\right)\right)} \]
      2. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\log y, x - 1, \mathsf{neg}\left(t\right)\right)} \]
      3. lower-log.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\log y}, x - 1, \mathsf{neg}\left(t\right)\right) \]
      4. sub-negN/A

        \[\leadsto \mathsf{fma}\left(\log y, \color{blue}{x + \left(\mathsf{neg}\left(1\right)\right)}, \mathsf{neg}\left(t\right)\right) \]
      5. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(\log y, x + \color{blue}{-1}, \mathsf{neg}\left(t\right)\right) \]
      6. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\log y, \color{blue}{-1 + x}, \mathsf{neg}\left(t\right)\right) \]
      7. lower-+.f64N/A

        \[\leadsto \mathsf{fma}\left(\log y, \color{blue}{-1 + x}, \mathsf{neg}\left(t\right)\right) \]
      8. lower-neg.f6485.2

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

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

      \[\leadsto \color{blue}{\log y \cdot \left(x - 1\right)} \]
    7. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \color{blue}{\log y \cdot \left(x - 1\right)} \]
      2. lower-log.f64N/A

        \[\leadsto \color{blue}{\log y} \cdot \left(x - 1\right) \]
      3. sub-negN/A

        \[\leadsto \log y \cdot \color{blue}{\left(x + \left(\mathsf{neg}\left(1\right)\right)\right)} \]
      4. metadata-evalN/A

        \[\leadsto \log y \cdot \left(x + \color{blue}{-1}\right) \]
      5. +-commutativeN/A

        \[\leadsto \log y \cdot \color{blue}{\left(-1 + x\right)} \]
      6. lower-+.f6482.3

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -2.8 \cdot 10^{+19}:\\ \;\;\;\;y \cdot \left(z \cdot \mathsf{fma}\left(y, -0.5, -1\right)\right) - t\\ \mathbf{elif}\;t \leq 3.4 \cdot 10^{+14}:\\ \;\;\;\;\log y \cdot \left(x + -1\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(z \cdot \mathsf{fma}\left(y, -0.5, -1\right)\right) - t\\ \end{array} \]
  5. Add Preprocessing

Alternative 14: 88.8% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;-1 + z \leq 4.5 \cdot 10^{+263}:\\
\;\;\;\;\mathsf{fma}\left(\log y, x + -1, -t\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 z #s(literal 1 binary64)) < 4.50000000000000014e263

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

      \[\leadsto \color{blue}{\log y \cdot \left(x - 1\right) - t} \]
    4. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \color{blue}{\log y \cdot \left(x - 1\right) + \left(\mathsf{neg}\left(t\right)\right)} \]
      2. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\log y, x - 1, \mathsf{neg}\left(t\right)\right)} \]
      3. lower-log.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\log y}, x - 1, \mathsf{neg}\left(t\right)\right) \]
      4. sub-negN/A

        \[\leadsto \mathsf{fma}\left(\log y, \color{blue}{x + \left(\mathsf{neg}\left(1\right)\right)}, \mathsf{neg}\left(t\right)\right) \]
      5. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(\log y, x + \color{blue}{-1}, \mathsf{neg}\left(t\right)\right) \]
      6. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\log y, \color{blue}{-1 + x}, \mathsf{neg}\left(t\right)\right) \]
      7. lower-+.f64N/A

        \[\leadsto \mathsf{fma}\left(\log y, \color{blue}{-1 + x}, \mathsf{neg}\left(t\right)\right) \]
      8. lower-neg.f6491.4

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

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

    if 4.50000000000000014e263 < (-.f64 z #s(literal 1 binary64))

    1. Initial program 47.4%

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

      \[\leadsto \color{blue}{z \cdot \log \left(1 - y\right)} - t \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{\log \left(1 - y\right) \cdot z} - t \]
      2. lower-*.f64N/A

        \[\leadsto \color{blue}{\log \left(1 - y\right) \cdot z} - t \]
      3. sub-negN/A

        \[\leadsto \log \color{blue}{\left(1 + \left(\mathsf{neg}\left(y\right)\right)\right)} \cdot z - t \]
      4. lower-log1p.f64N/A

        \[\leadsto \color{blue}{\mathsf{log1p}\left(\mathsf{neg}\left(y\right)\right)} \cdot z - t \]
      5. lower-neg.f6477.4

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

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

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

Alternative 15: 99.1% accurate, 1.9× speedup?

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

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

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

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

      \[\leadsto \left(\color{blue}{y \cdot \left(\mathsf{neg}\left(\left(z - 1\right)\right)\right)} + \log y \cdot \left(x - 1\right)\right) - t \]
    3. mul-1-negN/A

      \[\leadsto \left(y \cdot \color{blue}{\left(-1 \cdot \left(z - 1\right)\right)} + \log y \cdot \left(x - 1\right)\right) - t \]
    4. lower-fma.f64N/A

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, -1 \cdot \left(z - 1\right), \log y \cdot \left(x - 1\right)\right)} - t \]
    5. mul-1-negN/A

      \[\leadsto \mathsf{fma}\left(y, \color{blue}{\mathsf{neg}\left(\left(z - 1\right)\right)}, \log y \cdot \left(x - 1\right)\right) - t \]
    6. neg-sub0N/A

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

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

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

      \[\leadsto \mathsf{fma}\left(y, 0 - \color{blue}{\left(-1 + z\right)}, \log y \cdot \left(x - 1\right)\right) - t \]
    10. associate--r+N/A

      \[\leadsto \mathsf{fma}\left(y, \color{blue}{\left(0 - -1\right) - z}, \log y \cdot \left(x - 1\right)\right) - t \]
    11. metadata-evalN/A

      \[\leadsto \mathsf{fma}\left(y, \color{blue}{1} - z, \log y \cdot \left(x - 1\right)\right) - t \]
    12. lower--.f64N/A

      \[\leadsto \mathsf{fma}\left(y, \color{blue}{1 - z}, \log y \cdot \left(x - 1\right)\right) - t \]
    13. lower-*.f64N/A

      \[\leadsto \mathsf{fma}\left(y, 1 - z, \color{blue}{\log y \cdot \left(x - 1\right)}\right) - t \]
    14. lower-log.f64N/A

      \[\leadsto \mathsf{fma}\left(y, 1 - z, \color{blue}{\log y} \cdot \left(x - 1\right)\right) - t \]
    15. sub-negN/A

      \[\leadsto \mathsf{fma}\left(y, 1 - z, \log y \cdot \color{blue}{\left(x + \left(\mathsf{neg}\left(1\right)\right)\right)}\right) - t \]
    16. metadata-evalN/A

      \[\leadsto \mathsf{fma}\left(y, 1 - z, \log y \cdot \left(x + \color{blue}{-1}\right)\right) - t \]
    17. +-commutativeN/A

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

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

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

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

Alternative 16: 43.0% accurate, 10.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.4 \cdot 10^{-9}:\\
\;\;\;\;-t\\

\mathbf{elif}\;t \leq 1.2 \cdot 10^{+17}:\\
\;\;\;\;y - y \cdot z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.39999999999999992e-9 or 1.2e17 < t

    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. Add Preprocessing
    3. Taylor expanded in t around inf

      \[\leadsto \color{blue}{-1 \cdot t} \]
    4. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \color{blue}{\mathsf{neg}\left(t\right)} \]
      2. lower-neg.f6471.8

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

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

    if -1.39999999999999992e-9 < t < 1.2e17

    1. Initial program 85.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. lift--.f64N/A

        \[\leadsto \left(\color{blue}{\left(x - 1\right)} \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
      2. lift-log.f64N/A

        \[\leadsto \left(\left(x - 1\right) \cdot \color{blue}{\log y} + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
      3. lift-*.f64N/A

        \[\leadsto \left(\color{blue}{\left(x - 1\right) \cdot \log y} + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
      4. lift--.f64N/A

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\left(z - 1\right)} \cdot \log \left(1 - y\right)\right) - t \]
      5. lift--.f64N/A

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \color{blue}{\left(1 - y\right)}\right) - t \]
      6. lift-log.f64N/A

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \color{blue}{\log \left(1 - y\right)}\right) - t \]
      7. lift-*.f64N/A

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\left(z - 1\right) \cdot \log \left(1 - y\right)}\right) - t \]
      8. lift-+.f64N/A

        \[\leadsto \color{blue}{\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right)} - t \]
      9. flip--N/A

        \[\leadsto \color{blue}{\frac{\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) \cdot \left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \cdot t}{\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) + t}} \]
      10. clear-numN/A

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

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

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

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

        \[\leadsto \color{blue}{\left(\log y \cdot \left(x - 1\right) + -1 \cdot \left(y \cdot \left(z - 1\right)\right)\right)} - t \]
      2. associate--l+N/A

        \[\leadsto \color{blue}{\log y \cdot \left(x - 1\right) + \left(-1 \cdot \left(y \cdot \left(z - 1\right)\right) - t\right)} \]
      3. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\log y, x - 1, -1 \cdot \left(y \cdot \left(z - 1\right)\right) - t\right)} \]
      4. lower-log.f64N/A

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

        \[\leadsto \mathsf{fma}\left(\log y, \color{blue}{x + \left(\mathsf{neg}\left(1\right)\right)}, -1 \cdot \left(y \cdot \left(z - 1\right)\right) - t\right) \]
      6. metadata-evalN/A

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

        \[\leadsto \mathsf{fma}\left(\log y, \color{blue}{-1 + x}, -1 \cdot \left(y \cdot \left(z - 1\right)\right) - t\right) \]
      8. lower-+.f64N/A

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

        \[\leadsto \mathsf{fma}\left(\log y, -1 + x, \color{blue}{-1 \cdot \left(y \cdot \left(z - 1\right)\right) + \left(\mathsf{neg}\left(t\right)\right)}\right) \]
      10. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(\log y, -1 + x, \color{blue}{\left(\mathsf{neg}\left(y \cdot \left(z - 1\right)\right)\right)} + \left(\mathsf{neg}\left(t\right)\right)\right) \]
      11. distribute-neg-outN/A

        \[\leadsto \mathsf{fma}\left(\log y, -1 + x, \color{blue}{\mathsf{neg}\left(\left(y \cdot \left(z - 1\right) + t\right)\right)}\right) \]
      12. lower-neg.f64N/A

        \[\leadsto \mathsf{fma}\left(\log y, -1 + x, \color{blue}{\mathsf{neg}\left(\left(y \cdot \left(z - 1\right) + t\right)\right)}\right) \]
      13. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\log y, -1 + x, \mathsf{neg}\left(\color{blue}{\mathsf{fma}\left(y, z - 1, t\right)}\right)\right) \]
      14. sub-negN/A

        \[\leadsto \mathsf{fma}\left(\log y, -1 + x, \mathsf{neg}\left(\mathsf{fma}\left(y, \color{blue}{z + \left(\mathsf{neg}\left(1\right)\right)}, t\right)\right)\right) \]
      15. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(\log y, -1 + x, \mathsf{neg}\left(\mathsf{fma}\left(y, z + \color{blue}{-1}, t\right)\right)\right) \]
      16. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\log y, -1 + x, \mathsf{neg}\left(\mathsf{fma}\left(y, \color{blue}{-1 + z}, t\right)\right)\right) \]
      17. lower-+.f6498.7

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

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

      \[\leadsto \color{blue}{y \cdot \left(1 - z\right)} \]
    9. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto y \cdot \color{blue}{\left(1 + \left(\mathsf{neg}\left(z\right)\right)\right)} \]
      2. distribute-rgt-inN/A

        \[\leadsto \color{blue}{1 \cdot y + \left(\mathsf{neg}\left(z\right)\right) \cdot y} \]
      3. *-lft-identityN/A

        \[\leadsto \color{blue}{y} + \left(\mathsf{neg}\left(z\right)\right) \cdot y \]
      4. distribute-lft-neg-inN/A

        \[\leadsto y + \color{blue}{\left(\mathsf{neg}\left(z \cdot y\right)\right)} \]
      5. *-commutativeN/A

        \[\leadsto y + \left(\mathsf{neg}\left(\color{blue}{y \cdot z}\right)\right) \]
      6. unsub-negN/A

        \[\leadsto \color{blue}{y - y \cdot z} \]
      7. lower--.f64N/A

        \[\leadsto \color{blue}{y - y \cdot z} \]
      8. lower-*.f6417.0

        \[\leadsto y - \color{blue}{y \cdot z} \]
    10. Simplified17.0%

      \[\leadsto \color{blue}{y - y \cdot z} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 17: 42.7% accurate, 11.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.4 \cdot 10^{-9}:\\
\;\;\;\;-t\\

\mathbf{elif}\;t \leq 1.2 \cdot 10^{+17}:\\
\;\;\;\;z \cdot \left(-y\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.39999999999999992e-9 or 1.2e17 < t

    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. Add Preprocessing
    3. Taylor expanded in t around inf

      \[\leadsto \color{blue}{-1 \cdot t} \]
    4. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \color{blue}{\mathsf{neg}\left(t\right)} \]
      2. lower-neg.f6471.8

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

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

    if -1.39999999999999992e-9 < t < 1.2e17

    1. Initial program 85.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. lift--.f64N/A

        \[\leadsto \left(\color{blue}{\left(x - 1\right)} \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
      2. lift-log.f64N/A

        \[\leadsto \left(\left(x - 1\right) \cdot \color{blue}{\log y} + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
      3. lift-*.f64N/A

        \[\leadsto \left(\color{blue}{\left(x - 1\right) \cdot \log y} + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
      4. lift--.f64N/A

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\left(z - 1\right)} \cdot \log \left(1 - y\right)\right) - t \]
      5. lift--.f64N/A

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \color{blue}{\left(1 - y\right)}\right) - t \]
      6. lift-log.f64N/A

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \color{blue}{\log \left(1 - y\right)}\right) - t \]
      7. lift-*.f64N/A

        \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\left(z - 1\right) \cdot \log \left(1 - y\right)}\right) - t \]
      8. lift-+.f64N/A

        \[\leadsto \color{blue}{\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right)} - t \]
      9. flip--N/A

        \[\leadsto \color{blue}{\frac{\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) \cdot \left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \cdot t}{\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) + t}} \]
      10. clear-numN/A

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

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

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

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

        \[\leadsto \color{blue}{\left(\log y \cdot \left(x - 1\right) + -1 \cdot \left(y \cdot \left(z - 1\right)\right)\right)} - t \]
      2. associate--l+N/A

        \[\leadsto \color{blue}{\log y \cdot \left(x - 1\right) + \left(-1 \cdot \left(y \cdot \left(z - 1\right)\right) - t\right)} \]
      3. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\log y, x - 1, -1 \cdot \left(y \cdot \left(z - 1\right)\right) - t\right)} \]
      4. lower-log.f64N/A

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

        \[\leadsto \mathsf{fma}\left(\log y, \color{blue}{x + \left(\mathsf{neg}\left(1\right)\right)}, -1 \cdot \left(y \cdot \left(z - 1\right)\right) - t\right) \]
      6. metadata-evalN/A

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

        \[\leadsto \mathsf{fma}\left(\log y, \color{blue}{-1 + x}, -1 \cdot \left(y \cdot \left(z - 1\right)\right) - t\right) \]
      8. lower-+.f64N/A

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

        \[\leadsto \mathsf{fma}\left(\log y, -1 + x, \color{blue}{-1 \cdot \left(y \cdot \left(z - 1\right)\right) + \left(\mathsf{neg}\left(t\right)\right)}\right) \]
      10. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(\log y, -1 + x, \color{blue}{\left(\mathsf{neg}\left(y \cdot \left(z - 1\right)\right)\right)} + \left(\mathsf{neg}\left(t\right)\right)\right) \]
      11. distribute-neg-outN/A

        \[\leadsto \mathsf{fma}\left(\log y, -1 + x, \color{blue}{\mathsf{neg}\left(\left(y \cdot \left(z - 1\right) + t\right)\right)}\right) \]
      12. lower-neg.f64N/A

        \[\leadsto \mathsf{fma}\left(\log y, -1 + x, \color{blue}{\mathsf{neg}\left(\left(y \cdot \left(z - 1\right) + t\right)\right)}\right) \]
      13. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\log y, -1 + x, \mathsf{neg}\left(\color{blue}{\mathsf{fma}\left(y, z - 1, t\right)}\right)\right) \]
      14. sub-negN/A

        \[\leadsto \mathsf{fma}\left(\log y, -1 + x, \mathsf{neg}\left(\mathsf{fma}\left(y, \color{blue}{z + \left(\mathsf{neg}\left(1\right)\right)}, t\right)\right)\right) \]
      15. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(\log y, -1 + x, \mathsf{neg}\left(\mathsf{fma}\left(y, z + \color{blue}{-1}, t\right)\right)\right) \]
      16. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\log y, -1 + x, \mathsf{neg}\left(\mathsf{fma}\left(y, \color{blue}{-1 + z}, t\right)\right)\right) \]
      17. lower-+.f6498.7

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

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

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

        \[\leadsto \color{blue}{\mathsf{neg}\left(y \cdot z\right)} \]
      2. distribute-rgt-neg-inN/A

        \[\leadsto \color{blue}{y \cdot \left(\mathsf{neg}\left(z\right)\right)} \]
      3. lower-*.f64N/A

        \[\leadsto \color{blue}{y \cdot \left(\mathsf{neg}\left(z\right)\right)} \]
      4. lower-neg.f6416.4

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

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

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

Alternative 18: 46.2% accurate, 11.3× speedup?

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

\\
y \cdot \left(z \cdot \mathsf{fma}\left(y, -0.5, -1\right)\right) - t
\end{array}
Derivation
  1. Initial program 89.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 x around 0

    \[\leadsto \color{blue}{\left(-1 \cdot \log y + \log \left(1 - y\right) \cdot \left(z - 1\right)\right)} - t \]
  4. Step-by-step derivation
    1. +-commutativeN/A

      \[\leadsto \color{blue}{\left(\log \left(1 - y\right) \cdot \left(z - 1\right) + -1 \cdot \log y\right)} - t \]
    2. mul-1-negN/A

      \[\leadsto \left(\log \left(1 - y\right) \cdot \left(z - 1\right) + \color{blue}{\left(\mathsf{neg}\left(\log y\right)\right)}\right) - t \]
    3. unsub-negN/A

      \[\leadsto \color{blue}{\left(\log \left(1 - y\right) \cdot \left(z - 1\right) - \log y\right)} - t \]
    4. lower--.f64N/A

      \[\leadsto \color{blue}{\left(\log \left(1 - y\right) \cdot \left(z - 1\right) - \log y\right)} - t \]
    5. lower-*.f64N/A

      \[\leadsto \left(\color{blue}{\log \left(1 - y\right) \cdot \left(z - 1\right)} - \log y\right) - t \]
    6. sub-negN/A

      \[\leadsto \left(\log \color{blue}{\left(1 + \left(\mathsf{neg}\left(y\right)\right)\right)} \cdot \left(z - 1\right) - \log y\right) - t \]
    7. lower-log1p.f64N/A

      \[\leadsto \left(\color{blue}{\mathsf{log1p}\left(\mathsf{neg}\left(y\right)\right)} \cdot \left(z - 1\right) - \log y\right) - t \]
    8. lower-neg.f64N/A

      \[\leadsto \left(\mathsf{log1p}\left(\color{blue}{\mathsf{neg}\left(y\right)}\right) \cdot \left(z - 1\right) - \log y\right) - t \]
    9. sub-negN/A

      \[\leadsto \left(\mathsf{log1p}\left(\mathsf{neg}\left(y\right)\right) \cdot \color{blue}{\left(z + \left(\mathsf{neg}\left(1\right)\right)\right)} - \log y\right) - t \]
    10. metadata-evalN/A

      \[\leadsto \left(\mathsf{log1p}\left(\mathsf{neg}\left(y\right)\right) \cdot \left(z + \color{blue}{-1}\right) - \log y\right) - t \]
    11. +-commutativeN/A

      \[\leadsto \left(\mathsf{log1p}\left(\mathsf{neg}\left(y\right)\right) \cdot \color{blue}{\left(-1 + z\right)} - \log y\right) - t \]
    12. lower-+.f64N/A

      \[\leadsto \left(\mathsf{log1p}\left(\mathsf{neg}\left(y\right)\right) \cdot \color{blue}{\left(-1 + z\right)} - \log y\right) - t \]
    13. lower-log.f6462.8

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

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

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

      \[\leadsto \color{blue}{\left(y \cdot \left(-1 \cdot \left(z - 1\right) + \frac{-1}{2} \cdot \left(y \cdot \left(z - 1\right)\right)\right) + \left(\mathsf{neg}\left(\log y\right)\right)\right)} - t \]
    2. *-commutativeN/A

      \[\leadsto \left(y \cdot \left(-1 \cdot \left(z - 1\right) + \frac{-1}{2} \cdot \color{blue}{\left(\left(z - 1\right) \cdot y\right)}\right) + \left(\mathsf{neg}\left(\log y\right)\right)\right) - t \]
    3. associate-*r*N/A

      \[\leadsto \left(y \cdot \left(-1 \cdot \left(z - 1\right) + \color{blue}{\left(\frac{-1}{2} \cdot \left(z - 1\right)\right) \cdot y}\right) + \left(\mathsf{neg}\left(\log y\right)\right)\right) - t \]
    4. log-recN/A

      \[\leadsto \left(y \cdot \left(-1 \cdot \left(z - 1\right) + \left(\frac{-1}{2} \cdot \left(z - 1\right)\right) \cdot y\right) + \color{blue}{\log \left(\frac{1}{y}\right)}\right) - t \]
    5. lower-fma.f64N/A

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

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

    \[\leadsto \color{blue}{y \cdot \left(z \cdot \left(\frac{-1}{2} \cdot y - 1\right)\right)} - t \]
  10. Step-by-step derivation
    1. lower-*.f64N/A

      \[\leadsto \color{blue}{y \cdot \left(z \cdot \left(\frac{-1}{2} \cdot y - 1\right)\right)} - t \]
    2. lower-*.f64N/A

      \[\leadsto y \cdot \color{blue}{\left(z \cdot \left(\frac{-1}{2} \cdot y - 1\right)\right)} - t \]
    3. sub-negN/A

      \[\leadsto y \cdot \left(z \cdot \color{blue}{\left(\frac{-1}{2} \cdot y + \left(\mathsf{neg}\left(1\right)\right)\right)}\right) - t \]
    4. *-commutativeN/A

      \[\leadsto y \cdot \left(z \cdot \left(\color{blue}{y \cdot \frac{-1}{2}} + \left(\mathsf{neg}\left(1\right)\right)\right)\right) - t \]
    5. metadata-evalN/A

      \[\leadsto y \cdot \left(z \cdot \left(y \cdot \frac{-1}{2} + \color{blue}{-1}\right)\right) - t \]
    6. lower-fma.f6442.1

      \[\leadsto y \cdot \left(z \cdot \color{blue}{\mathsf{fma}\left(y, -0.5, -1\right)}\right) - t \]
  11. Simplified42.1%

    \[\leadsto \color{blue}{y \cdot \left(z \cdot \mathsf{fma}\left(y, -0.5, -1\right)\right)} - t \]
  12. Add Preprocessing

Alternative 19: 35.5% accurate, 75.3× speedup?

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

\\
-t
\end{array}
Derivation
  1. Initial program 89.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 t around inf

    \[\leadsto \color{blue}{-1 \cdot t} \]
  4. Step-by-step derivation
    1. mul-1-negN/A

      \[\leadsto \color{blue}{\mathsf{neg}\left(t\right)} \]
    2. lower-neg.f6432.3

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

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

Reproduce

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