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

Percentage Accurate: 89.0% → 99.6%
Time: 14.4s
Alternatives: 13
Speedup: 1.9×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 13 alternatives:

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

Initial Program: 89.0% accurate, 1.0× speedup?

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

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

Alternative 1: 99.6% accurate, 0.9× speedup?

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

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

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

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

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

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

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

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

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

Alternative 2: 97.9% accurate, 1.7× speedup?

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

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

\mathbf{elif}\;x - 1 \leq -0.98:\\
\;\;\;\;\mathsf{fma}\left(1 - z, y, -\log y\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)) < -2e16 or -0.97999999999999998 < (-.f64 x #s(literal 1 binary64))

    1. Initial program 95.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(1 - z, y, x \cdot \log y\right) - t \]
    7. Step-by-step derivation
      1. Applied rewrites99.4%

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

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

      1. Initial program 84.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(1 - z, y, -1 \cdot \log y\right) - t \]
      7. Step-by-step derivation
        1. Applied rewrites98.1%

          \[\leadsto \mathsf{fma}\left(1 - z, y, -\log y\right) - t \]
      8. Recombined 2 regimes into one program.
      9. Final simplification98.6%

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

      Alternative 3: 95.5% accurate, 1.7× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x - 1 \leq -1.0000002:\\ \;\;\;\;\left(x - 1\right) \cdot \log y - t\\ \mathbf{elif}\;x - 1 \leq -0.999999999995:\\ \;\;\;\;\mathsf{fma}\left(1 - z, y, -\log y\right) - t\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\log y, x - 1, y\right) - t\\ \end{array} \end{array} \]
      (FPCore (x y z t)
       :precision binary64
       (if (<= (- x 1.0) -1.0000002)
         (- (* (- x 1.0) (log y)) t)
         (if (<= (- x 1.0) -0.999999999995)
           (- (fma (- 1.0 z) y (- (log y))) t)
           (- (fma (log y) (- x 1.0) y) t))))
      double code(double x, double y, double z, double t) {
      	double tmp;
      	if ((x - 1.0) <= -1.0000002) {
      		tmp = ((x - 1.0) * log(y)) - t;
      	} else if ((x - 1.0) <= -0.999999999995) {
      		tmp = fma((1.0 - z), y, -log(y)) - t;
      	} else {
      		tmp = fma(log(y), (x - 1.0), y) - t;
      	}
      	return tmp;
      }
      
      function code(x, y, z, t)
      	tmp = 0.0
      	if (Float64(x - 1.0) <= -1.0000002)
      		tmp = Float64(Float64(Float64(x - 1.0) * log(y)) - t);
      	elseif (Float64(x - 1.0) <= -0.999999999995)
      		tmp = Float64(fma(Float64(1.0 - z), y, Float64(-log(y))) - t);
      	else
      		tmp = Float64(fma(log(y), Float64(x - 1.0), y) - t);
      	end
      	return tmp
      end
      
      code[x_, y_, z_, t_] := If[LessEqual[N[(x - 1.0), $MachinePrecision], -1.0000002], N[(N[(N[(x - 1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[N[(x - 1.0), $MachinePrecision], -0.999999999995], N[(N[(N[(1.0 - z), $MachinePrecision] * y + (-N[Log[y], $MachinePrecision])), $MachinePrecision] - t), $MachinePrecision], N[(N[(N[Log[y], $MachinePrecision] * N[(x - 1.0), $MachinePrecision] + y), $MachinePrecision] - t), $MachinePrecision]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;x - 1 \leq -1.0000002:\\
      \;\;\;\;\left(x - 1\right) \cdot \log y - t\\
      
      \mathbf{elif}\;x - 1 \leq -0.999999999995:\\
      \;\;\;\;\mathsf{fma}\left(1 - z, y, -\log y\right) - t\\
      
      \mathbf{else}:\\
      \;\;\;\;\mathsf{fma}\left(\log y, x - 1, y\right) - t\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if (-.f64 x #s(literal 1 binary64)) < -1.00000019999999989

        1. Initial program 97.4%

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

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

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

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

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

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

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

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

        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}{\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 \left(-1 \cdot \color{blue}{\left(\left(z - 1\right) \cdot y\right)} + \log y \cdot \left(x - 1\right)\right) - t \]
          2. associate-*r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(1 - z, y, -1 \cdot \log y\right) - t \]
        7. Step-by-step derivation
          1. Applied rewrites99.4%

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

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

          1. Initial program 94.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \mathsf{fma}\left(\log y, \color{blue}{x - 1}, y\right) - t \]
          8. Recombined 3 regimes into one program.
          9. Add Preprocessing

          Alternative 4: 76.9% accurate, 1.8× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \log y - t\\ \mathbf{if}\;x - 1 \leq -1.0000002:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x - 1 \leq -0.5:\\ \;\;\;\;z \cdot \mathsf{log1p}\left(-y\right) - t\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
          (FPCore (x y z t)
           :precision binary64
           (let* ((t_1 (- (* x (log y)) t)))
             (if (<= (- x 1.0) -1.0000002)
               t_1
               (if (<= (- x 1.0) -0.5) (- (* z (log1p (- y))) t) t_1))))
          double code(double x, double y, double z, double t) {
          	double t_1 = (x * log(y)) - t;
          	double tmp;
          	if ((x - 1.0) <= -1.0000002) {
          		tmp = t_1;
          	} else if ((x - 1.0) <= -0.5) {
          		tmp = (z * log1p(-y)) - t;
          	} else {
          		tmp = t_1;
          	}
          	return tmp;
          }
          
          public static double code(double x, double y, double z, double t) {
          	double t_1 = (x * Math.log(y)) - t;
          	double tmp;
          	if ((x - 1.0) <= -1.0000002) {
          		tmp = t_1;
          	} else if ((x - 1.0) <= -0.5) {
          		tmp = (z * Math.log1p(-y)) - t;
          	} else {
          		tmp = t_1;
          	}
          	return tmp;
          }
          
          def code(x, y, z, t):
          	t_1 = (x * math.log(y)) - t
          	tmp = 0
          	if (x - 1.0) <= -1.0000002:
          		tmp = t_1
          	elif (x - 1.0) <= -0.5:
          		tmp = (z * math.log1p(-y)) - t
          	else:
          		tmp = t_1
          	return tmp
          
          function code(x, y, z, t)
          	t_1 = Float64(Float64(x * log(y)) - t)
          	tmp = 0.0
          	if (Float64(x - 1.0) <= -1.0000002)
          		tmp = t_1;
          	elseif (Float64(x - 1.0) <= -0.5)
          		tmp = Float64(Float64(z * log1p(Float64(-y))) - t);
          	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]}, If[LessEqual[N[(x - 1.0), $MachinePrecision], -1.0000002], t$95$1, If[LessEqual[N[(x - 1.0), $MachinePrecision], -0.5], N[(N[(z * N[Log[1 + (-y)], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], t$95$1]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          t_1 := x \cdot \log y - t\\
          \mathbf{if}\;x - 1 \leq -1.0000002:\\
          \;\;\;\;t\_1\\
          
          \mathbf{elif}\;x - 1 \leq -0.5:\\
          \;\;\;\;z \cdot \mathsf{log1p}\left(-y\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.00000019999999989 or -0.5 < (-.f64 x #s(literal 1 binary64))

            1. Initial program 96.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. lower-*.f64N/A

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

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

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

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

            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 z around inf

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

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

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

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

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

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

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

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

          Alternative 5: 89.3% accurate, 1.9× speedup?

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

            1. Initial program 92.8%

              \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
            2. 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 \left(-1 \cdot \color{blue}{\left(\left(z - 1\right) \cdot y\right)} + \log y \cdot \left(x - 1\right)\right) - t \]
              2. associate-*r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              if 4.9999999999999995e211 < (-.f64 z #s(literal 1 binary64))

              1. Initial program 49.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 z around inf

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

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

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

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

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

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

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

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

            Alternative 6: 76.7% accurate, 1.9× speedup?

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

              1. Initial program 96.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. lower-*.f64N/A

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

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

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

              if -2.1500000000000001e-7 < x < 9.5

              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}{\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 \left(-1 \cdot \color{blue}{\left(\left(z - 1\right) \cdot y\right)} + \log y \cdot \left(x - 1\right)\right) - t \]
                2. associate-*r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              Alternative 7: 89.2% accurate, 1.9× speedup?

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

                1. Initial program 92.8%

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

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

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

                    \[\leadsto \color{blue}{\left(x - 1\right)} \cdot \log y - t \]
                  4. lower-log.f6492.3

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

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

                if 4.9999999999999995e211 < (-.f64 z #s(literal 1 binary64))

                1. Initial program 49.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 z around inf

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

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

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

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

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

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

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

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

              Alternative 8: 99.1% accurate, 1.9× speedup?

              \[\begin{array}{l} \\ \mathsf{fma}\left(1 - z, y, \left(x - 1\right) \cdot \log y\right) - t \end{array} \]
              (FPCore (x y z t)
               :precision binary64
               (- (fma (- 1.0 z) y (* (- x 1.0) (log y))) t))
              double code(double x, double y, double z, double t) {
              	return fma((1.0 - z), y, ((x - 1.0) * log(y))) - t;
              }
              
              function code(x, y, z, t)
              	return Float64(fma(Float64(1.0 - z), y, Float64(Float64(x - 1.0) * log(y))) - t)
              end
              
              code[x_, y_, z_, t_] := N[(N[(N[(1.0 - z), $MachinePrecision] * y + N[(N[(x - 1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
              
              \begin{array}{l}
              
              \\
              \mathsf{fma}\left(1 - z, y, \left(x - 1\right) \cdot \log y\right) - t
              \end{array}
              
              Derivation
              1. Initial program 89.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}{\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 \left(-1 \cdot \color{blue}{\left(\left(z - 1\right) \cdot y\right)} + \log y \cdot \left(x - 1\right)\right) - t \]
                2. associate-*r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              Alternative 9: 65.7% accurate, 1.9× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \log y\\ \mathbf{if}\;x \leq -1.6 \cdot 10^{+16}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 4.9 \cdot 10^{+30}:\\ \;\;\;\;\left(1 - z\right) \cdot y - 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.6e+16) t_1 (if (<= x 4.9e+30) (- (* (- 1.0 z) y) t) t_1))))
              double code(double x, double y, double z, double t) {
              	double t_1 = x * log(y);
              	double tmp;
              	if (x <= -1.6e+16) {
              		tmp = t_1;
              	} else if (x <= 4.9e+30) {
              		tmp = ((1.0 - z) * y) - t;
              	} else {
              		tmp = t_1;
              	}
              	return tmp;
              }
              
              real(8) function code(x, y, z, t)
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  real(8), intent (in) :: z
                  real(8), intent (in) :: t
                  real(8) :: t_1
                  real(8) :: tmp
                  t_1 = x * log(y)
                  if (x <= (-1.6d+16)) then
                      tmp = t_1
                  else if (x <= 4.9d+30) then
                      tmp = ((1.0d0 - z) * y) - t
                  else
                      tmp = t_1
                  end if
                  code = tmp
              end function
              
              public static double code(double x, double y, double z, double t) {
              	double t_1 = x * Math.log(y);
              	double tmp;
              	if (x <= -1.6e+16) {
              		tmp = t_1;
              	} else if (x <= 4.9e+30) {
              		tmp = ((1.0 - z) * y) - t;
              	} else {
              		tmp = t_1;
              	}
              	return tmp;
              }
              
              def code(x, y, z, t):
              	t_1 = x * math.log(y)
              	tmp = 0
              	if x <= -1.6e+16:
              		tmp = t_1
              	elif x <= 4.9e+30:
              		tmp = ((1.0 - z) * y) - t
              	else:
              		tmp = t_1
              	return tmp
              
              function code(x, y, z, t)
              	t_1 = Float64(x * log(y))
              	tmp = 0.0
              	if (x <= -1.6e+16)
              		tmp = t_1;
              	elseif (x <= 4.9e+30)
              		tmp = Float64(Float64(Float64(1.0 - z) * y) - t);
              	else
              		tmp = t_1;
              	end
              	return tmp
              end
              
              function tmp_2 = code(x, y, z, t)
              	t_1 = x * log(y);
              	tmp = 0.0;
              	if (x <= -1.6e+16)
              		tmp = t_1;
              	elseif (x <= 4.9e+30)
              		tmp = ((1.0 - z) * y) - t;
              	else
              		tmp = t_1;
              	end
              	tmp_2 = tmp;
              end
              
              code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.6e+16], t$95$1, If[LessEqual[x, 4.9e+30], N[(N[(N[(1.0 - z), $MachinePrecision] * y), $MachinePrecision] - t), $MachinePrecision], t$95$1]]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              t_1 := x \cdot \log y\\
              \mathbf{if}\;x \leq -1.6 \cdot 10^{+16}:\\
              \;\;\;\;t\_1\\
              
              \mathbf{elif}\;x \leq 4.9 \cdot 10^{+30}:\\
              \;\;\;\;\left(1 - z\right) \cdot y - t\\
              
              \mathbf{else}:\\
              \;\;\;\;t\_1\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if x < -1.6e16 or 4.89999999999999984e30 < x

                1. Initial program 98.4%

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

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

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

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

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

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

                if -1.6e16 < x < 4.89999999999999984e30

                1. Initial program 83.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}{\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 \left(-1 \cdot \color{blue}{\left(\left(z - 1\right) \cdot y\right)} + \log y \cdot \left(x - 1\right)\right) - t \]
                  2. associate-*r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                Alternative 10: 42.5% accurate, 11.3× speedup?

                \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq -1.06 \cdot 10^{-36}:\\ \;\;\;\;-t\\ \mathbf{elif}\;t \leq 0.145:\\ \;\;\;\;\left(-y\right) \cdot z\\ \mathbf{else}:\\ \;\;\;\;-t\\ \end{array} \end{array} \]
                (FPCore (x y z t)
                 :precision binary64
                 (if (<= t -1.06e-36) (- t) (if (<= t 0.145) (* (- y) z) (- t))))
                double code(double x, double y, double z, double t) {
                	double tmp;
                	if (t <= -1.06e-36) {
                		tmp = -t;
                	} else if (t <= 0.145) {
                		tmp = -y * z;
                	} else {
                		tmp = -t;
                	}
                	return tmp;
                }
                
                real(8) function code(x, y, z, t)
                    real(8), intent (in) :: x
                    real(8), intent (in) :: y
                    real(8), intent (in) :: z
                    real(8), intent (in) :: t
                    real(8) :: tmp
                    if (t <= (-1.06d-36)) then
                        tmp = -t
                    else if (t <= 0.145d0) then
                        tmp = -y * z
                    else
                        tmp = -t
                    end if
                    code = tmp
                end function
                
                public static double code(double x, double y, double z, double t) {
                	double tmp;
                	if (t <= -1.06e-36) {
                		tmp = -t;
                	} else if (t <= 0.145) {
                		tmp = -y * z;
                	} else {
                		tmp = -t;
                	}
                	return tmp;
                }
                
                def code(x, y, z, t):
                	tmp = 0
                	if t <= -1.06e-36:
                		tmp = -t
                	elif t <= 0.145:
                		tmp = -y * z
                	else:
                		tmp = -t
                	return tmp
                
                function code(x, y, z, t)
                	tmp = 0.0
                	if (t <= -1.06e-36)
                		tmp = Float64(-t);
                	elseif (t <= 0.145)
                		tmp = Float64(Float64(-y) * z);
                	else
                		tmp = Float64(-t);
                	end
                	return tmp
                end
                
                function tmp_2 = code(x, y, z, t)
                	tmp = 0.0;
                	if (t <= -1.06e-36)
                		tmp = -t;
                	elseif (t <= 0.145)
                		tmp = -y * z;
                	else
                		tmp = -t;
                	end
                	tmp_2 = tmp;
                end
                
                code[x_, y_, z_, t_] := If[LessEqual[t, -1.06e-36], (-t), If[LessEqual[t, 0.145], N[((-y) * z), $MachinePrecision], (-t)]]
                
                \begin{array}{l}
                
                \\
                \begin{array}{l}
                \mathbf{if}\;t \leq -1.06 \cdot 10^{-36}:\\
                \;\;\;\;-t\\
                
                \mathbf{elif}\;t \leq 0.145:\\
                \;\;\;\;\left(-y\right) \cdot z\\
                
                \mathbf{else}:\\
                \;\;\;\;-t\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 2 regimes
                2. if t < -1.05999999999999999e-36 or 0.14499999999999999 < t

                  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 t around inf

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

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

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

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

                  if -1.05999999999999999e-36 < t < 0.14499999999999999

                  1. Initial program 83.6%

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

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

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

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

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

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

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

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

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

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

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

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

                      \[\leadsto \mathsf{log1p}\left(\color{blue}{-y}\right) \cdot z \]
                  7. Applied rewrites19.6%

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

                    \[\leadsto \left(-1 \cdot y\right) \cdot z \]
                  9. Step-by-step derivation
                    1. Applied rewrites18.9%

                      \[\leadsto \left(-y\right) \cdot z \]
                  10. Recombined 2 regimes into one program.
                  11. Add Preprocessing

                  Alternative 11: 46.1% accurate, 18.8× speedup?

                  \[\begin{array}{l} \\ \left(1 - z\right) \cdot y - t \end{array} \]
                  (FPCore (x y z t) :precision binary64 (- (* (- 1.0 z) y) t))
                  double code(double x, double y, double z, double t) {
                  	return ((1.0 - z) * y) - t;
                  }
                  
                  real(8) function code(x, y, z, t)
                      real(8), intent (in) :: x
                      real(8), intent (in) :: y
                      real(8), intent (in) :: z
                      real(8), intent (in) :: t
                      code = ((1.0d0 - z) * y) - t
                  end function
                  
                  public static double code(double x, double y, double z, double t) {
                  	return ((1.0 - z) * y) - t;
                  }
                  
                  def code(x, y, z, t):
                  	return ((1.0 - z) * y) - t
                  
                  function code(x, y, z, t)
                  	return Float64(Float64(Float64(1.0 - z) * y) - t)
                  end
                  
                  function tmp = code(x, y, z, t)
                  	tmp = ((1.0 - z) * y) - t;
                  end
                  
                  code[x_, y_, z_, t_] := N[(N[(N[(1.0 - z), $MachinePrecision] * y), $MachinePrecision] - t), $MachinePrecision]
                  
                  \begin{array}{l}
                  
                  \\
                  \left(1 - z\right) \cdot y - t
                  \end{array}
                  
                  Derivation
                  1. Initial program 89.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}{\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 \left(-1 \cdot \color{blue}{\left(\left(z - 1\right) \cdot y\right)} + \log y \cdot \left(x - 1\right)\right) - t \]
                    2. associate-*r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto y \cdot \color{blue}{\left(1 - z\right)} - t \]
                  7. Step-by-step derivation
                    1. Applied rewrites49.5%

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

                    Alternative 12: 45.9% accurate, 20.5× speedup?

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

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

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

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

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

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

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

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

                      \[\leadsto \left(-1 \cdot y\right) \cdot z - t \]
                    7. Step-by-step derivation
                      1. Applied rewrites49.2%

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

                      Alternative 13: 35.3% accurate, 75.3× speedup?

                      \[\begin{array}{l} \\ -t \end{array} \]
                      (FPCore (x y z t) :precision binary64 (- t))
                      double code(double x, double y, double z, double t) {
                      	return -t;
                      }
                      
                      real(8) function code(x, y, z, t)
                          real(8), intent (in) :: x
                          real(8), intent (in) :: y
                          real(8), intent (in) :: z
                          real(8), intent (in) :: t
                          code = -t
                      end function
                      
                      public static double code(double x, double y, double z, double t) {
                      	return -t;
                      }
                      
                      def code(x, y, z, t):
                      	return -t
                      
                      function code(x, y, z, t)
                      	return Float64(-t)
                      end
                      
                      function tmp = code(x, y, z, t)
                      	tmp = -t;
                      end
                      
                      code[x_, y_, z_, t_] := (-t)
                      
                      \begin{array}{l}
                      
                      \\
                      -t
                      \end{array}
                      
                      Derivation
                      1. Initial program 89.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 t around inf

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

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

                          \[\leadsto \color{blue}{-t} \]
                      5. Applied rewrites38.7%

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

                      Reproduce

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