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

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

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 19 alternatives:

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

Initial Program: 89.0% accurate, 1.0× speedup?

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

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

Alternative 1: 99.6% accurate, 1.5× speedup?

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

\\
\left(\left(z + -1\right) \cdot \left(y \cdot \mathsf{fma}\left(y, \mathsf{fma}\left(y, \mathsf{fma}\left(y, -0.25, -0.3333333333333333\right), -0.5\right), -1\right)\right) + \log y \cdot \left(x + -1\right)\right) - t
\end{array}
Derivation
  1. Initial program 87.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 \left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \color{blue}{\left(y \cdot \left(y \cdot \left(y \cdot \left(\frac{-1}{4} \cdot y - \frac{1}{3}\right) - \frac{1}{2}\right) - 1\right)\right)}\right) - t \]
  4. Step-by-step derivation
    1. *-lowering-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 86.5% accurate, 0.3× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (+.f64 (*.f64 (-.f64 x #s(literal 1 binary64)) (log.f64 y)) (*.f64 (-.f64 z #s(literal 1 binary64)) (log.f64 (-.f64 #s(literal 1 binary64) y)))) < -5e14 or 2e10 < (+.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 94.5%

      \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
    2. Add Preprocessing
    3. Taylor expanded in 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. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{\log y \cdot x} - t \]
      3. log-lowering-log.f6493.0

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

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

    if -5e14 < (+.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)))) < 200

    1. Initial program 63.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(y \cdot \left(-1 \cdot \left(z - 1\right) + \frac{-1}{2} \cdot \left(y \cdot \left(z - 1\right)\right)\right) + \log y \cdot \left(x - 1\right)\right)} - t \]
    4. Step-by-step derivation
      1. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, \frac{-1}{2}, -1\right)} \cdot \left(y \cdot z\right) - t \]
      8. *-lowering-*.f6479.6

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

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

    if 200 < (+.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)))) < 2e10

    1. Initial program 83.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}{\log y \cdot \left(x - 1\right)} - t \]
    4. Step-by-step derivation
      1. *-lowering-*.f64N/A

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \log y - t} \]
    7. Step-by-step derivation
      1. --lowering--.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. neg-sub0N/A

        \[\leadsto \color{blue}{\left(0 - \log y\right)} - t \]
      4. --lowering--.f64N/A

        \[\leadsto \color{blue}{\left(0 - \log y\right)} - t \]
      5. log-lowering-log.f6483.3

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

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

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

Alternative 3: 75.0% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \log y \cdot \left(x + -1\right)\\ t_2 := t\_1 + \left(z + -1\right) \cdot \log \left(1 - y\right)\\ \mathbf{if}\;t\_2 \leq -5 \cdot 10^{+14}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 \leq 200:\\ \;\;\;\;\mathsf{fma}\left(y, -0.5, -1\right) \cdot \left(y \cdot z\right) - t\\ \mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+44}:\\ \;\;\;\;\left(0 - 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 -1.0)))
        (t_2 (+ t_1 (* (+ z -1.0) (log (- 1.0 y))))))
   (if (<= t_2 -5e+14)
     t_1
     (if (<= t_2 200.0)
       (- (* (fma y -0.5 -1.0) (* y z)) t)
       (if (<= t_2 2e+44) (- (- 0.0 t) (log y)) t_1)))))
double code(double x, double y, double z, double t) {
	double t_1 = log(y) * (x + -1.0);
	double t_2 = t_1 + ((z + -1.0) * log((1.0 - y)));
	double tmp;
	if (t_2 <= -5e+14) {
		tmp = t_1;
	} else if (t_2 <= 200.0) {
		tmp = (fma(y, -0.5, -1.0) * (y * z)) - t;
	} else if (t_2 <= 2e+44) {
		tmp = (0.0 - t) - log(y);
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(x, y, z, t)
	t_1 = Float64(log(y) * Float64(x + -1.0))
	t_2 = Float64(t_1 + Float64(Float64(z + -1.0) * log(Float64(1.0 - y))))
	tmp = 0.0
	if (t_2 <= -5e+14)
		tmp = t_1;
	elseif (t_2 <= 200.0)
		tmp = Float64(Float64(fma(y, -0.5, -1.0) * Float64(y * z)) - t);
	elseif (t_2 <= 2e+44)
		tmp = Float64(Float64(0.0 - t) - log(y));
	else
		tmp = t_1;
	end
	return tmp
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Log[y], $MachinePrecision] * N[(x + -1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 + N[(N[(z + -1.0), $MachinePrecision] * N[Log[N[(1.0 - y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+14], t$95$1, If[LessEqual[t$95$2, 200.0], N[(N[(N[(y * -0.5 + -1.0), $MachinePrecision] * N[(y * z), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[t$95$2, 2e+44], N[(N[(0.0 - t), $MachinePrecision] - N[Log[y], $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+44}:\\
\;\;\;\;\left(0 - t\right) - \log y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (+.f64 (*.f64 (-.f64 x #s(literal 1 binary64)) (log.f64 y)) (*.f64 (-.f64 z #s(literal 1 binary64)) (log.f64 (-.f64 #s(literal 1 binary64) y)))) < -5e14 or 2.0000000000000002e44 < (+.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 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. *-lowering-*.f64N/A

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

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

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

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

        \[\leadsto \log y \cdot \color{blue}{\left(-1 + x\right)} - t \]
      6. +-lowering-+.f6493.6

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

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

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

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

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

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

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

        \[\leadsto \log y \cdot \color{blue}{\left(-1 + x\right)} \]
      6. +-lowering-+.f6476.7

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

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

    if -5e14 < (+.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)))) < 200

    1. Initial program 63.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(y \cdot \left(-1 \cdot \left(z - 1\right) + \frac{-1}{2} \cdot \left(y \cdot \left(z - 1\right)\right)\right) + \log y \cdot \left(x - 1\right)\right)} - t \]
    4. Step-by-step derivation
      1. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, \frac{-1}{2}, -1\right)} \cdot \left(y \cdot z\right) - t \]
      8. *-lowering-*.f6479.6

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

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

    if 200 < (+.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)))) < 2.0000000000000002e44

    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}{\log y \cdot \left(x - 1\right)} - t \]
    4. Step-by-step derivation
      1. *-lowering-*.f64N/A

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

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

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

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

        \[\leadsto \log y \cdot \color{blue}{\left(-1 + x\right)} - t \]
      6. +-lowering-+.f6484.4

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

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

      \[\leadsto \color{blue}{-1 \cdot \log y - t} \]
    7. Step-by-step derivation
      1. --lowering--.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. neg-sub0N/A

        \[\leadsto \color{blue}{\left(0 - \log y\right)} - t \]
      4. --lowering--.f64N/A

        \[\leadsto \color{blue}{\left(0 - \log y\right)} - t \]
      5. log-lowering-log.f6481.0

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

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

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

Alternative 4: 75.4% accurate, 0.3× speedup?

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

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

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

\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+44}:\\
\;\;\;\;\left(0 - t\right) - \log y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (+.f64 (*.f64 (-.f64 x #s(literal 1 binary64)) (log.f64 y)) (*.f64 (-.f64 z #s(literal 1 binary64)) (log.f64 (-.f64 #s(literal 1 binary64) y)))) < -1e47 or 2.0000000000000002e44 < (+.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 95.2%

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

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

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

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

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

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

    if -1e47 < (+.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)))) < 200

    1. Initial program 65.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(y \cdot \left(-1 \cdot \left(z - 1\right) + \frac{-1}{2} \cdot \left(y \cdot \left(z - 1\right)\right)\right) + \log y \cdot \left(x - 1\right)\right)} - t \]
    4. Step-by-step derivation
      1. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, \frac{-1}{2}, -1\right)} \cdot \left(y \cdot z\right) - t \]
      8. *-lowering-*.f6476.4

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

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

    if 200 < (+.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)))) < 2.0000000000000002e44

    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}{\log y \cdot \left(x - 1\right)} - t \]
    4. Step-by-step derivation
      1. *-lowering-*.f64N/A

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

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

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

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

        \[\leadsto \log y \cdot \color{blue}{\left(-1 + x\right)} - t \]
      6. +-lowering-+.f6484.4

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

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

      \[\leadsto \color{blue}{-1 \cdot \log y - t} \]
    7. Step-by-step derivation
      1. --lowering--.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. neg-sub0N/A

        \[\leadsto \color{blue}{\left(0 - \log y\right)} - t \]
      4. --lowering--.f64N/A

        \[\leadsto \color{blue}{\left(0 - \log y\right)} - t \]
      5. log-lowering-log.f6481.0

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

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

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

Alternative 5: 57.3% accurate, 0.4× speedup?

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

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

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

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


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

    1. Initial program 89.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(y \cdot \left(-1 \cdot \left(z - 1\right) + \frac{-1}{2} \cdot \left(y \cdot \left(z - 1\right)\right)\right) + \log y \cdot \left(x - 1\right)\right)} - t \]
    4. Step-by-step derivation
      1. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, \frac{-1}{2}, -1\right)} \cdot \left(y \cdot z\right) - t \]
      8. *-lowering-*.f6444.4

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

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

    if 150 < (-.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 80.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{0 - \log y} \]
      3. --lowering--.f64N/A

        \[\leadsto \color{blue}{0 - \log y} \]
      4. log-lowering-log.f6479.2

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

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

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

Alternative 6: 99.5% accurate, 1.6× speedup?

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

\\
\left(\left(z + -1\right) \cdot \left(y \cdot \mathsf{fma}\left(y, \mathsf{fma}\left(y, -0.3333333333333333, -0.5\right), -1\right)\right) + \log y \cdot \left(x + -1\right)\right) - t
\end{array}
Derivation
  1. Initial program 87.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 \left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \color{blue}{\left(y \cdot \left(y \cdot \left(\frac{-1}{3} \cdot y - \frac{1}{2}\right) - 1\right)\right)}\right) - t \]
  4. Step-by-step derivation
    1. *-lowering-*.f64N/A

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

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

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

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

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

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

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

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

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

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

Alternative 7: 99.4% accurate, 1.7× speedup?

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

\\
\mathsf{fma}\left(z + -1, y \cdot \mathsf{fma}\left(y, -0.5, -1\right), \log y \cdot \left(x + -1\right)\right) - t
\end{array}
Derivation
  1. Initial program 87.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(y \cdot \left(-1 \cdot \left(z - 1\right) + \frac{-1}{2} \cdot \left(y \cdot \left(z - 1\right)\right)\right) + \log y \cdot \left(x - 1\right)\right)} - t \]
  4. Step-by-step derivation
    1. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 95.1% accurate, 1.7× speedup?

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

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

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

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


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

    1. Initial program 95.0%

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

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

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

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

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

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

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

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

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

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

    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. Step-by-step derivation
      1. associate--l+N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(x + -1, \log y, 0 - \mathsf{fma}\left(y, \color{blue}{-1 + z}, t\right)\right) \]
      10. +-lowering-+.f6499.3

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

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

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

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

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

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

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

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

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

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

    1. Initial program 95.5%

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

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

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

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

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

        \[\leadsto \log y \cdot \color{blue}{\left(-1 + x\right)} - t \]
      6. +-lowering-+.f6495.5

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

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

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

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

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

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

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

        \[\leadsto \left(x - 1\right) \cdot \log y + \color{blue}{\left(0 - t\right)} \]
      7. accelerator-lowering-fma.f64N/A

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

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

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

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

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

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

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

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

Alternative 9: 95.1% accurate, 1.7× speedup?

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

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

\mathbf{elif}\;x + -1 \leq 10000000000:\\
\;\;\;\;\left(y - \mathsf{fma}\left(y, z, t\right)\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)) < -1e10 or 1e10 < (-.f64 x #s(literal 1 binary64))

    1. Initial program 95.3%

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

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

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

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

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

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

        \[\leadsto \log y \cdot \color{blue}{\left(-1 + x\right)} - t \]
      6. +-lowering-+.f6494.6

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

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

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

    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. Step-by-step derivation
      1. associate--l+N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(x + -1, \log y, 0 - \mathsf{fma}\left(y, \color{blue}{-1 + z}, t\right)\right) \]
      10. +-lowering-+.f6499.3

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

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

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

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

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

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

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

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

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

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

Alternative 10: 92.1% accurate, 1.7× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;x \cdot \log y - t\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -2.5999999999999999e94

    1. Initial program 97.5%

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

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

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

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

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

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

        \[\leadsto \log y \cdot \color{blue}{\left(-1 + x\right)} - t \]
      6. +-lowering-+.f6497.5

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

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

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

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

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

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

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

        \[\leadsto \left(x - 1\right) \cdot \log y + \color{blue}{\left(0 - t\right)} \]
      7. accelerator-lowering-fma.f64N/A

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

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

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

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

        \[\leadsto \mathsf{fma}\left(x + -1, \color{blue}{\log y}, 0 - t\right) \]
      12. --lowering--.f6497.6

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

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

    if -2.5999999999999999e94 < t < 1.79999999999999998e58

    1. Initial program 81.4%

      \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate--l+N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(x + -1, \log y, \mathsf{fma}\left(z + -1, \log \left(1 - y\right), \color{blue}{0 - t}\right)\right) \]
      15. --lowering--.f6481.4

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(x + -1, \log y, \color{blue}{0 - y \cdot z}\right) \]
      4. *-lowering-*.f6495.1

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

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

    if 1.79999999999999998e58 < t

    1. Initial program 98.8%

      \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
    2. Add Preprocessing
    3. Taylor expanded in x around 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. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{\log y \cdot x} - t \]
      3. log-lowering-log.f6497.5

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

      \[\leadsto \color{blue}{\log y \cdot x} - t \]
  3. Recombined 3 regimes into one program.
  4. Final simplification96.0%

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

Alternative 11: 89.1% accurate, 1.7× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 z #s(literal 1 binary64)) < -1.00000000000000004e264 or 1.99999999999999989e194 < (-.f64 z #s(literal 1 binary64))

    1. Initial program 37.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(y \cdot \left(-1 \cdot \left(z - 1\right) + \frac{-1}{2} \cdot \left(y \cdot \left(z - 1\right)\right)\right) + \log y \cdot \left(x - 1\right)\right)} - t \]
    4. Step-by-step derivation
      1. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, \frac{-1}{2}, -1\right)} \cdot \left(y \cdot z\right) - t \]
      8. *-lowering-*.f6470.7

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

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

    if -1.00000000000000004e264 < (-.f64 z #s(literal 1 binary64)) < 1.99999999999999989e194

    1. Initial program 94.5%

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

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

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

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

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

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

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

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

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

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

Alternative 12: 92.1% accurate, 1.8× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;x \cdot \log y - t\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -2.5999999999999999e94

    1. Initial program 97.5%

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

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

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

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

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

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

        \[\leadsto \log y \cdot \color{blue}{\left(-1 + x\right)} - t \]
      6. +-lowering-+.f6497.5

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

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

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

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

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

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

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

        \[\leadsto \left(x - 1\right) \cdot \log y + \color{blue}{\left(0 - t\right)} \]
      7. accelerator-lowering-fma.f64N/A

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

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

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

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

        \[\leadsto \mathsf{fma}\left(x + -1, \color{blue}{\log y}, 0 - t\right) \]
      12. --lowering--.f6497.6

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

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

    if -2.5999999999999999e94 < t < 3.39999999999999992e57

    1. Initial program 81.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. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.39999999999999992e57 < t

    1. Initial program 98.8%

      \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
    2. Add Preprocessing
    3. Taylor expanded in x around 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. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{\log y \cdot x} - t \]
      3. log-lowering-log.f6497.5

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

      \[\leadsto \color{blue}{\log y \cdot x} - t \]
  3. Recombined 3 regimes into one program.
  4. Final simplification96.0%

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

Alternative 13: 66.1% accurate, 1.8× speedup?

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

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

\mathbf{elif}\;x + -1 \leq 2 \cdot 10^{+33}:\\
\;\;\;\;\mathsf{fma}\left(y, -0.5, -1\right) \cdot \left(y \cdot z\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.0000000000000001e50 or 1.9999999999999999e33 < (-.f64 x #s(literal 1 binary64))

    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 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. *-lowering-*.f64N/A

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

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

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

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

    1. Initial program 79.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(y \cdot \left(-1 \cdot \left(z - 1\right) + \frac{-1}{2} \cdot \left(y \cdot \left(z - 1\right)\right)\right) + \log y \cdot \left(x - 1\right)\right)} - t \]
    4. Step-by-step derivation
      1. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, \frac{-1}{2}, -1\right)} \cdot \left(y \cdot z\right) - t \]
      8. *-lowering-*.f6458.9

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

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

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

Alternative 14: 99.1% accurate, 1.9× speedup?

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

\\
\mathsf{fma}\left(x + -1, \log y, 0 - \mathsf{fma}\left(y, z + -1, t\right)\right)
\end{array}
Derivation
  1. Initial program 87.4%

    \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. associate--l+N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(x + -1, \log y, \mathsf{fma}\left(z + -1, \log \left(1 - y\right), \color{blue}{0 - t}\right)\right) \]
    15. --lowering--.f6487.4

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(x + -1, \log y, 0 - \mathsf{fma}\left(y, \color{blue}{-1 + z}, t\right)\right) \]
    10. +-lowering-+.f6499.3

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

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

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

Alternative 15: 99.1% accurate, 1.9× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 16: 41.4% accurate, 7.1× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -3.1000000000000002e37 or 3.39999999999999992e57 < 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}{\left(y \cdot \left(-1 \cdot \left(z - 1\right) + \frac{-1}{2} \cdot \left(y \cdot \left(z - 1\right)\right)\right) + \log y \cdot \left(x - 1\right)\right)} - t \]
    4. Step-by-step derivation
      1. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.1000000000000002e37 < t < 3.39999999999999992e57

    1. Initial program 81.6%

      \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate--l+N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(x + -1, \log y, \mathsf{fma}\left(z + -1, \log \left(1 - y\right), \color{blue}{0 - t}\right)\right) \]
      15. --lowering--.f6481.6

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto y \cdot \left(-1 \cdot \color{blue}{\left(z + -1\right)}\right) \]
      6. metadata-evalN/A

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

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

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

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

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

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

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

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

        \[\leadsto y \cdot \color{blue}{\left(\left(0 - -1\right) - z\right)} \]
      15. metadata-evalN/A

        \[\leadsto y \cdot \left(\color{blue}{1} - z\right) \]
      16. --lowering--.f6420.5

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

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

Alternative 17: 41.3% accurate, 10.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.1 \cdot 10^{+37}:\\
\;\;\;\;0 - t\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -3.1000000000000002e37 or 3.39999999999999992e57 < 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 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. neg-sub0N/A

        \[\leadsto \color{blue}{0 - t} \]
      3. --lowering--.f6464.5

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

      \[\leadsto \color{blue}{0 - t} \]
    6. Step-by-step derivation
      1. sub0-negN/A

        \[\leadsto \color{blue}{\mathsf{neg}\left(t\right)} \]
      2. neg-lowering-neg.f6464.5

        \[\leadsto \color{blue}{-t} \]
    7. Applied egg-rr64.5%

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

    if -3.1000000000000002e37 < t < 3.39999999999999992e57

    1. Initial program 81.6%

      \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate--l+N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(x + -1, \log y, \mathsf{fma}\left(z + -1, \log \left(1 - y\right), \color{blue}{0 - t}\right)\right) \]
      15. --lowering--.f6481.6

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto y \cdot \left(-1 \cdot \color{blue}{\left(z + -1\right)}\right) \]
      6. metadata-evalN/A

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

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

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

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

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

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

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

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

        \[\leadsto y \cdot \color{blue}{\left(\left(0 - -1\right) - z\right)} \]
      15. metadata-evalN/A

        \[\leadsto y \cdot \left(\color{blue}{1} - z\right) \]
      16. --lowering--.f6420.5

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

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

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

Alternative 18: 45.8% accurate, 11.3× speedup?

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

\\
\mathsf{fma}\left(y, -0.5, -1\right) \cdot \left(y \cdot z\right) - t
\end{array}
Derivation
  1. Initial program 87.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(y \cdot \left(-1 \cdot \left(z - 1\right) + \frac{-1}{2} \cdot \left(y \cdot \left(z - 1\right)\right)\right) + \log y \cdot \left(x - 1\right)\right)} - t \]
  4. Step-by-step derivation
    1. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, \frac{-1}{2}, -1\right)} \cdot \left(y \cdot z\right) - t \]
    8. *-lowering-*.f6439.9

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

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

Alternative 19: 35.0% accurate, 56.5× speedup?

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

\\
0 - t
\end{array}
Derivation
  1. Initial program 87.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. neg-sub0N/A

      \[\leadsto \color{blue}{0 - t} \]
    3. --lowering--.f6427.6

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

    \[\leadsto \color{blue}{0 - t} \]
  6. Step-by-step derivation
    1. sub0-negN/A

      \[\leadsto \color{blue}{\mathsf{neg}\left(t\right)} \]
    2. neg-lowering-neg.f6427.6

      \[\leadsto \color{blue}{-t} \]
  7. Applied egg-rr27.6%

    \[\leadsto \color{blue}{-t} \]
  8. Final simplification27.6%

    \[\leadsto 0 - t \]
  9. Add Preprocessing

Reproduce

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