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

Percentage Accurate: 89.5% → 99.2%
Time: 14.8s
Alternatives: 14
Speedup: 1.9×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 14 alternatives:

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

Initial Program: 89.5% 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.2% accurate, 1.9× speedup?

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

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

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

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

Alternative 2: 64.6% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \log y \cdot x\\ t_2 := \log y \cdot \left(-1 + x\right) + \left(z + -1\right) \cdot \log \left(1 - y\right)\\ t_3 := \mathsf{fma}\left(y, -z, y\right) - t\\ \mathbf{if}\;t\_2 \leq -1.5 \cdot 10^{+60}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 \leq 590:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;t\_2 \leq 695.6:\\ \;\;\;\;-\log y\\ \mathbf{elif}\;t\_2 \leq 10^{+135}:\\ \;\;\;\;t\_3\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* (log y) x))
        (t_2 (+ (* (log y) (+ -1.0 x)) (* (+ z -1.0) (log (- 1.0 y)))))
        (t_3 (- (fma y (- z) y) t)))
   (if (<= t_2 -1.5e+60)
     t_1
     (if (<= t_2 590.0)
       t_3
       (if (<= t_2 695.6) (- (log y)) (if (<= t_2 1e+135) t_3 t_1))))))
double code(double x, double y, double z, double t) {
	double t_1 = log(y) * x;
	double t_2 = (log(y) * (-1.0 + x)) + ((z + -1.0) * log((1.0 - y)));
	double t_3 = fma(y, -z, y) - t;
	double tmp;
	if (t_2 <= -1.5e+60) {
		tmp = t_1;
	} else if (t_2 <= 590.0) {
		tmp = t_3;
	} else if (t_2 <= 695.6) {
		tmp = -log(y);
	} else if (t_2 <= 1e+135) {
		tmp = t_3;
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(x, y, z, t)
	t_1 = Float64(log(y) * x)
	t_2 = Float64(Float64(log(y) * Float64(-1.0 + x)) + Float64(Float64(z + -1.0) * log(Float64(1.0 - y))))
	t_3 = Float64(fma(y, Float64(-z), y) - t)
	tmp = 0.0
	if (t_2 <= -1.5e+60)
		tmp = t_1;
	elseif (t_2 <= 590.0)
		tmp = t_3;
	elseif (t_2 <= 695.6)
		tmp = Float64(-log(y));
	elseif (t_2 <= 1e+135)
		tmp = t_3;
	else
		tmp = t_1;
	end
	return tmp
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision] + N[(N[(z + -1.0), $MachinePrecision] * N[Log[N[(1.0 - y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(y * (-z) + y), $MachinePrecision] - t), $MachinePrecision]}, If[LessEqual[t$95$2, -1.5e+60], t$95$1, If[LessEqual[t$95$2, 590.0], t$95$3, If[LessEqual[t$95$2, 695.6], (-N[Log[y], $MachinePrecision]), If[LessEqual[t$95$2, 1e+135], t$95$3, t$95$1]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;t\_2 \leq 590:\\
\;\;\;\;t\_3\\

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

\mathbf{elif}\;t\_2 \leq 10^{+135}:\\
\;\;\;\;t\_3\\

\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)))) < -1.4999999999999999e60 or 9.99999999999999962e134 < (+.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.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 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.f6486.3

        \[\leadsto \color{blue}{\log y} \cdot x \]
    5. Simplified86.3%

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

    if -1.4999999999999999e60 < (+.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)))) < 590 or 695.600000000000023 < (+.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)))) < 9.99999999999999962e134

    1. Initial program 85.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}{\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-+.f64100.0

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, \mathsf{neg}\left(z\right), y\right)} - t \]
      6. lower-neg.f6464.0

        \[\leadsto \mathsf{fma}\left(y, \color{blue}{-z}, y\right) - t \]
    8. Simplified64.0%

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

    if 590 < (+.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)))) < 695.600000000000023

    1. Initial program 95.8%

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

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

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

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

      \[\leadsto \color{blue}{\log y \cdot \left(x - 1\right) - t} \]
    7. 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. lower-+.f64N/A

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

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

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \log y} \]
    13. 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.f6476.5

        \[\leadsto -\color{blue}{\log y} \]
    14. Simplified76.5%

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

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

Alternative 3: 58.3% accurate, 0.4× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 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) < 110

    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 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.8

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

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

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

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

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

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

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

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

    if 110 < (-.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 78.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}{\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.9

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

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

      \[\leadsto \color{blue}{\log y \cdot \left(x - 1\right) - t} \]
    7. 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. lower-+.f64N/A

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

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

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

      \[\leadsto \color{blue}{\log y \cdot \left(x - 1\right)} \]
    10. 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. lower-+.f6475.1

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

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

      \[\leadsto \color{blue}{-1 \cdot \log y} \]
    13. 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.f6474.7

        \[\leadsto -\color{blue}{\log y} \]
    14. Simplified74.7%

      \[\leadsto \color{blue}{-\log y} \]

    if 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 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 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.6

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, \mathsf{neg}\left(z\right), y\right)} - t \]
      6. lower-neg.f6451.7

        \[\leadsto \mathsf{fma}\left(y, \color{blue}{-z}, y\right) - t \]
    8. Simplified51.7%

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

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

Alternative 4: 96.1% accurate, 1.7× speedup?

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

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

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

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


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

    1. Initial program 94.7%

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

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

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

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

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

    1. Initial program 85.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. 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. *-commutativeN/A

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

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

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

        \[\leadsto \left(\log y \cdot \color{blue}{\frac{1}{\frac{x \cdot x + \left(1 \cdot 1 + x \cdot 1\right)}{{x}^{3} - {1}^{3}}}} + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
      7. un-div-invN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\frac{\log y}{\frac{1}{x + -1}} + y \cdot \left(\color{blue}{1} - z\right)\right) - t \]
      12. lower--.f64100.0

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(y - \color{blue}{\mathsf{fma}\left(y, z, \log y\right)}\right) - t \]
      10. lower-log.f64100.0

        \[\leadsto \left(y - \mathsf{fma}\left(y, z, \color{blue}{\log y}\right)\right) - t \]
    10. Simplified100.0%

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

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

Alternative 5: 96.1% accurate, 1.7× speedup?

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

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

\mathbf{elif}\;t \leq 2.2 \cdot 10^{-6}:\\
\;\;\;\;\mathsf{fma}\left(\log y, -1 + x, y\right) - y \cdot z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -3.70000000000000004e-7 or 2.2000000000000001e-6 < t

    1. Initial program 96.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.f6496.0

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

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

    if -3.70000000000000004e-7 < t < 2.2000000000000001e-6

    1. Initial program 84.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}{\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.8

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(y \cdot 1 + \color{blue}{-1 \cdot \left(y \cdot z\right)}\right) + \log y \cdot \left(x - 1\right) \]
      17. *-rgt-identityN/A

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

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

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

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

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

Alternative 6: 76.9% accurate, 1.8× speedup?

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

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

\mathbf{elif}\;-1 + x \leq 5 \cdot 10^{+57}:\\
\;\;\;\;\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.0000000000000001e57 or 4.99999999999999972e57 < (-.f64 x #s(literal 1 binary64))

    1. Initial program 95.4%

      \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
    2. 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.8

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

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

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

    1. Initial program 86.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-+.f64100.0

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

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

      \[\leadsto \color{blue}{\log y \cdot \left(x - 1\right) - t} \]
    7. 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. lower-+.f64N/A

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

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

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

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

        \[\leadsto \color{blue}{-1 \cdot \log y - t} \]
      2. mul-1-negN/A

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

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

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

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

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

Alternative 7: 87.1% accurate, 1.9× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2.35e21 or 2.90000000000000019e-15 < x

    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 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.f6492.6

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

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

    if -2.35e21 < x < 2.90000000000000019e-15

    1. Initial program 86.1%

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

      \[\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-+.f64100.0

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

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

      \[\leadsto \color{blue}{\log y \cdot \left(x - 1\right) - t} \]
    7. 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. lower-+.f64N/A

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

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

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

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

        \[\leadsto \color{blue}{-1 \cdot \log y - t} \]
      2. mul-1-negN/A

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

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

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

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

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

Alternative 8: 78.1% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
t_1 := \left(-t\right) - y \cdot z\\
\mathbf{if}\;t \leq -8.5 \cdot 10^{+44}:\\
\;\;\;\;t\_1\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -8.5e44 or 3.7000000000000001e43 < t

    1. Initial program 96.6%

      \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
    2. 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.7

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

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

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

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

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

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

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

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

    if -8.5e44 < t < 3.7000000000000001e43

    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}{\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.8

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

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

      \[\leadsto \color{blue}{\log y \cdot \left(x - 1\right) - t} \]
    7. 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. lower-+.f64N/A

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

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

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

      \[\leadsto \color{blue}{\log y \cdot \left(x - 1\right)} \]
    10. 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. lower-+.f6481.1

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

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

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

Alternative 9: 89.2% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z + -1 \leq -5 \cdot 10^{+197}:\\
\;\;\;\;z \cdot \mathsf{log1p}\left(-y\right) - t\\

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


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

    1. Initial program 49.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 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.f6469.2

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

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

    if -5.00000000000000009e197 < (-.f64 z #s(literal 1 binary64))

    1. Initial program 93.7%

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

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

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

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

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

Alternative 10: 43.5% accurate, 10.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -1950:\\
\;\;\;\;-t\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1950 or 0.050000000000000003 < t

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

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

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

    if -1950 < t < 0.050000000000000003

    1. Initial program 84.5%

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, \mathsf{neg}\left(z\right), y\right)} \]
      6. lower-neg.f6417.0

        \[\leadsto \mathsf{fma}\left(y, \color{blue}{-z}, y\right) \]
    8. Simplified17.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, -z, y\right)} \]
    9. Step-by-step derivation
      1. lift-neg.f64N/A

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(1 - z\right)} \cdot y \]
      8. lower-*.f6417.0

        \[\leadsto \color{blue}{\left(1 - z\right) \cdot y} \]
    10. Applied egg-rr17.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1950:\\ \;\;\;\;-t\\ \mathbf{elif}\;t \leq 0.05:\\ \;\;\;\;y \cdot \left(1 - z\right)\\ \mathbf{else}:\\ \;\;\;\;-t\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 43.2% accurate, 11.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq -160000:\\ \;\;\;\;-t\\ \mathbf{elif}\;t \leq 0.05:\\ \;\;\;\;-y \cdot z\\ \mathbf{else}:\\ \;\;\;\;-t\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= t -160000.0) (- t) (if (<= t 0.05) (- (* y z)) (- t))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (t <= -160000.0) {
		tmp = -t;
	} else if (t <= 0.05) {
		tmp = -(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 <= (-160000.0d0)) then
        tmp = -t
    else if (t <= 0.05d0) then
        tmp = -(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 <= -160000.0) {
		tmp = -t;
	} else if (t <= 0.05) {
		tmp = -(y * z);
	} else {
		tmp = -t;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if t <= -160000.0:
		tmp = -t
	elif t <= 0.05:
		tmp = -(y * z)
	else:
		tmp = -t
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (t <= -160000.0)
		tmp = Float64(-t);
	elseif (t <= 0.05)
		tmp = Float64(-Float64(y * z));
	else
		tmp = Float64(-t);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (t <= -160000.0)
		tmp = -t;
	elseif (t <= 0.05)
		tmp = -(y * z);
	else
		tmp = -t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[t, -160000.0], (-t), If[LessEqual[t, 0.05], (-N[(y * z), $MachinePrecision]), (-t)]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;t \leq -160000:\\
\;\;\;\;-t\\

\mathbf{elif}\;t \leq 0.05:\\
\;\;\;\;-y \cdot z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.6e5 or 0.050000000000000003 < t

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

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

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

    if -1.6e5 < t < 0.050000000000000003

    1. Initial program 84.5%

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(y \cdot z\right)} \]
    7. 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.6

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -160000:\\ \;\;\;\;-t\\ \mathbf{elif}\;t \leq 0.05:\\ \;\;\;\;-y \cdot z\\ \mathbf{else}:\\ \;\;\;\;-t\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 46.3% accurate, 18.8× speedup?

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, \mathsf{neg}\left(z\right), y\right)} - t \]
    6. lower-neg.f6444.5

      \[\leadsto \mathsf{fma}\left(y, \color{blue}{-z}, y\right) - t \]
  8. Simplified44.5%

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

Alternative 13: 46.1% accurate, 20.5× speedup?

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

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

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

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

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

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

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

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

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

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

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

Alternative 14: 36.1% 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 90.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 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.f6435.6

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

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

Reproduce

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