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

Percentage Accurate: 89.5% → 99.8%
Time: 16.2s
Alternatives: 17
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 17 alternatives:

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

Initial Program: 89.5% accurate, 1.0× speedup?

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

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

Alternative 1: 99.8% accurate, 0.7× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 99.6% accurate, 1.6× speedup?

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

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

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

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

Alternative 3: 99.6% accurate, 1.7× speedup?

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

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

    \[\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(-0.25 \cdot y - 0.3333333333333333\right) - 0.5\right) - 1\right)\right)}\right) - t \]
  4. Final simplification99.7%

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

Alternative 4: 95.7% accurate, 1.7× speedup?

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

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

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

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


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

    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. Step-by-step derivation
      1. +-commutative94.7%

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 76.4%

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

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

      \[\leadsto \left(\color{blue}{-1 \cdot \log y} + \left(z - 1\right) \cdot \left(y \cdot \left(y \cdot \left(-0.3333333333333333 \cdot y - 0.5\right) - 1\right)\right)\right) - t \]
    5. Step-by-step derivation
      1. mul-1-neg98.4%

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

      \[\leadsto \left(\color{blue}{\left(-\log y\right)} + \left(z - 1\right) \cdot \left(y \cdot \left(y \cdot \left(-0.3333333333333333 \cdot y - 0.5\right) - 1\right)\right)\right) - t \]
    7. Taylor expanded in y around 0 97.4%

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

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

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

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

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

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

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

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

    1. Initial program 99.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 99.8%

      \[\leadsto \color{blue}{-1 \cdot \left(x \cdot \left(-1 \cdot \log y + -1 \cdot \frac{-1 \cdot \log y + \log \left(1 - y\right) \cdot \left(z - 1\right)}{x}\right)\right)} - t \]
    4. Step-by-step derivation
      1. associate-*r*99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 99.6% accurate, 1.7× speedup?

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

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

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

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

Alternative 6: 99.4% accurate, 1.8× speedup?

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

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

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

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

Alternative 7: 89.1% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.5 \cdot 10^{+158}:\\
\;\;\;\;y \cdot \left(y \cdot \left(z \cdot -0.5 + y \cdot \left(z \cdot -0.3333333333333333 + -0.25 \cdot \left(z \cdot y\right)\right)\right) - z\right) - t\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -3.5000000000000001e158

    1. Initial program 48.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 48.4%

      \[\leadsto \color{blue}{-1 \cdot \left(x \cdot \left(-1 \cdot \log y + -1 \cdot \frac{-1 \cdot \log y + \log \left(1 - y\right) \cdot \left(z - 1\right)}{x}\right)\right)} - t \]
    4. Step-by-step derivation
      1. associate-*r*48.4%

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

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

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

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

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

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

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

        \[\leadsto \left(x \cdot \color{blue}{1}\right) \cdot \left(\log y + \frac{-1 \cdot \log y + \log \left(1 - y\right) \cdot \left(z - 1\right)}{x}\right) - t \]
      9. *-rgt-identity48.4%

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

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

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

        \[\leadsto z \cdot \log \color{blue}{\left(1 + \left(-y\right)\right)} - t \]
      2. log1p-undefine81.3%

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

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

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

    if -3.5000000000000001e158 < z < 5.00000000000000007e239

    1. Initial program 95.7%

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

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

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

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

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

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

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

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

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

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

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

    if 5.00000000000000007e239 < z

    1. Initial program 42.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 42.8%

      \[\leadsto \color{blue}{-1 \cdot \left(x \cdot \left(-1 \cdot \log y + -1 \cdot \frac{-1 \cdot \log y + \log \left(1 - y\right) \cdot \left(z - 1\right)}{x}\right)\right)} - t \]
    4. Step-by-step derivation
      1. associate-*r*42.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-y \cdot z\right)} - t \]
      2. distribute-rgt-neg-in80.7%

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

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

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

Alternative 8: 99.3% accurate, 1.8× speedup?

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

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

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

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

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

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

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

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

Alternative 9: 87.3% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1100000 \lor \neg \left(x \leq 2.4 \cdot 10^{+15}\right):\\
\;\;\;\;x \cdot \log y - t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.1e6 or 2.4e15 < x

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

      \[\leadsto \color{blue}{-1 \cdot \left(x \cdot \left(-1 \cdot \log y + -1 \cdot \frac{-1 \cdot \log y + \log \left(1 - y\right) \cdot \left(z - 1\right)}{x}\right)\right)} - t \]
    4. Step-by-step derivation
      1. associate-*r*97.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.1e6 < x < 2.4e15

    1. Initial program 76.4%

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

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

      \[\leadsto \left(\color{blue}{-1 \cdot \log y} + \left(z - 1\right) \cdot \left(y \cdot \left(y \cdot \left(-0.3333333333333333 \cdot y - 0.5\right) - 1\right)\right)\right) - t \]
    5. Step-by-step derivation
      1. mul-1-neg97.5%

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

      \[\leadsto \left(\color{blue}{\left(-\log y\right)} + \left(z - 1\right) \cdot \left(y \cdot \left(y \cdot \left(-0.3333333333333333 \cdot y - 0.5\right) - 1\right)\right)\right) - t \]
    7. Taylor expanded in y around 0 72.3%

      \[\leadsto \color{blue}{-1 \cdot \log y} - t \]
    8. Step-by-step derivation
      1. neg-mul-172.3%

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

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

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

Alternative 10: 60.8% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.5 \cdot 10^{+98}:\\
\;\;\;\;y \cdot \left(y \cdot \left(z \cdot -0.5 + y \cdot \left(z \cdot -0.3333333333333333 + -0.25 \cdot \left(z \cdot y\right)\right)\right) - z\right) - t\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.5000000000000001e98

    1. Initial program 64.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 62.7%

      \[\leadsto \color{blue}{-1 \cdot \left(x \cdot \left(-1 \cdot \log y + -1 \cdot \frac{-1 \cdot \log y + \log \left(1 - y\right) \cdot \left(z - 1\right)}{x}\right)\right)} - t \]
    4. Step-by-step derivation
      1. associate-*r*62.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.5000000000000001e98 < z < 2.45000000000000015e184

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

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

      \[\leadsto \left(\color{blue}{-1 \cdot \log y} + \left(z - 1\right) \cdot \left(y \cdot \left(y \cdot \left(-0.3333333333333333 \cdot y - 0.5\right) - 1\right)\right)\right) - t \]
    5. Step-by-step derivation
      1. mul-1-neg58.7%

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

      \[\leadsto \left(\color{blue}{\left(-\log y\right)} + \left(z - 1\right) \cdot \left(y \cdot \left(y \cdot \left(-0.3333333333333333 \cdot y - 0.5\right) - 1\right)\right)\right) - t \]
    7. Taylor expanded in y around 0 56.2%

      \[\leadsto \color{blue}{-1 \cdot \log y} - t \]
    8. Step-by-step derivation
      1. neg-mul-156.2%

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

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

    if 2.45000000000000015e184 < z

    1. Initial program 59.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 59.8%

      \[\leadsto \color{blue}{-1 \cdot \left(x \cdot \left(-1 \cdot \log y + -1 \cdot \frac{-1 \cdot \log y + \log \left(1 - y\right) \cdot \left(z - 1\right)}{x}\right)\right)} - t \]
    4. Step-by-step derivation
      1. associate-*r*59.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-y \cdot z\right)} - t \]
      2. distribute-rgt-neg-in68.8%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.5 \cdot 10^{+98}:\\ \;\;\;\;y \cdot \left(y \cdot \left(z \cdot -0.5 + y \cdot \left(z \cdot -0.3333333333333333 + -0.25 \cdot \left(z \cdot y\right)\right)\right) - z\right) - t\\ \mathbf{elif}\;z \leq 2.45 \cdot 10^{+184}:\\ \;\;\;\;\left(-\log y\right) - t\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(-y\right) - t\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 99.1% accurate, 1.9× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 46.8% accurate, 9.3× speedup?

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

\\
y \cdot \left(y \cdot \left(z \cdot -0.5 + y \cdot \left(z \cdot -0.3333333333333333 + -0.25 \cdot \left(z \cdot y\right)\right)\right) - z\right) - t
\end{array}
Derivation
  1. Initial program 86.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 85.6%

    \[\leadsto \color{blue}{-1 \cdot \left(x \cdot \left(-1 \cdot \log y + -1 \cdot \frac{-1 \cdot \log y + \log \left(1 - y\right) \cdot \left(z - 1\right)}{x}\right)\right)} - t \]
  4. Step-by-step derivation
    1. associate-*r*85.6%

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

      \[\leadsto \color{blue}{\left(x \cdot -1\right)} \cdot \left(-1 \cdot \log y + -1 \cdot \frac{-1 \cdot \log y + \log \left(1 - y\right) \cdot \left(z - 1\right)}{x}\right) - t \]
    3. distribute-lft-out85.6%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{y \cdot \left(-1 \cdot z + y \cdot \left(-0.5 \cdot z + y \cdot \left(-0.3333333333333333 \cdot z + -0.25 \cdot \left(y \cdot z\right)\right)\right)\right)} - t \]
  10. Final simplification50.5%

    \[\leadsto y \cdot \left(y \cdot \left(z \cdot -0.5 + y \cdot \left(z \cdot -0.3333333333333333 + -0.25 \cdot \left(z \cdot y\right)\right)\right) - z\right) - t \]
  11. Add Preprocessing

Alternative 13: 46.7% accurate, 14.3× speedup?

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

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

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

    \[\leadsto \left(\color{blue}{-1 \cdot \log y} + \left(z - 1\right) \cdot \left(y \cdot \left(y \cdot \left(-0.3333333333333333 \cdot y - 0.5\right) - 1\right)\right)\right) - t \]
  5. Step-by-step derivation
    1. mul-1-neg64.4%

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

    \[\leadsto \left(\color{blue}{\left(-\log y\right)} + \left(z - 1\right) \cdot \left(y \cdot \left(y \cdot \left(-0.3333333333333333 \cdot y - 0.5\right) - 1\right)\right)\right) - t \]
  7. Taylor expanded in z around inf 50.4%

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

    \[\leadsto y \cdot \left(z \cdot \left(-1 + y \cdot \left(y \cdot -0.3333333333333333 - 0.5\right)\right)\right) - t \]
  9. Add Preprocessing

Alternative 14: 46.6% accurate, 19.5× speedup?

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

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

    \[\leadsto \color{blue}{-1 \cdot \left(x \cdot \left(-1 \cdot \log y + -1 \cdot \frac{-1 \cdot \log y + \log \left(1 - y\right) \cdot \left(z - 1\right)}{x}\right)\right)} - t \]
  4. Step-by-step derivation
    1. associate-*r*85.6%

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

      \[\leadsto \color{blue}{\left(x \cdot -1\right)} \cdot \left(-1 \cdot \log y + -1 \cdot \frac{-1 \cdot \log y + \log \left(1 - y\right) \cdot \left(z - 1\right)}{x}\right) - t \]
    3. distribute-lft-out85.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto y \cdot \left(-1 \cdot z + \color{blue}{\left(-0.5 \cdot y\right) \cdot z}\right) - t \]
    2. distribute-rgt-out50.2%

      \[\leadsto y \cdot \color{blue}{\left(z \cdot \left(-1 + -0.5 \cdot y\right)\right)} - t \]
  11. Simplified50.2%

    \[\leadsto \color{blue}{y \cdot \left(z \cdot \left(-1 + -0.5 \cdot y\right)\right)} - t \]
  12. Final simplification50.2%

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

Alternative 15: 46.3% accurate, 35.8× speedup?

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

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

    \[\leadsto \color{blue}{-1 \cdot \left(x \cdot \left(-1 \cdot \log y + -1 \cdot \frac{-1 \cdot \log y + \log \left(1 - y\right) \cdot \left(z - 1\right)}{x}\right)\right)} - t \]
  4. Step-by-step derivation
    1. associate-*r*85.6%

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

      \[\leadsto \color{blue}{\left(x \cdot -1\right)} \cdot \left(-1 \cdot \log y + -1 \cdot \frac{-1 \cdot \log y + \log \left(1 - y\right) \cdot \left(z - 1\right)}{x}\right) - t \]
    3. distribute-lft-out85.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(-y \cdot z\right)} - t \]
    2. distribute-rgt-neg-in49.8%

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

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

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

Alternative 16: 36.3% accurate, 107.5× speedup?

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

\\
-t
\end{array}
Derivation
  1. Initial program 86.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 17: 2.3% accurate, 215.0× speedup?

\[\begin{array}{l} \\ 0 \end{array} \]
(FPCore (x y z t) :precision binary64 0.0)
double code(double x, double y, double z, double t) {
	return 0.0;
}
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
end function
public static double code(double x, double y, double z, double t) {
	return 0.0;
}
def code(x, y, z, t):
	return 0.0
function code(x, y, z, t)
	return 0.0
end
function tmp = code(x, y, z, t)
	tmp = 0.0;
end
code[x_, y_, z_, t_] := 0.0
\begin{array}{l}

\\
0
\end{array}
Derivation
  1. Initial program 86.8%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{-t} \]
  8. Step-by-step derivation
    1. expm1-log1p-u13.8%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(-t\right)\right)} \]
    2. expm1-undefine13.7%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(-t\right)} - 1} \]
  9. Applied egg-rr13.7%

    \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(-t\right)} - 1} \]
  10. Step-by-step derivation
    1. sub-neg13.7%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(-t\right)} + \left(-1\right)} \]
    2. log1p-undefine13.7%

      \[\leadsto e^{\color{blue}{\log \left(1 + \left(-t\right)\right)}} + \left(-1\right) \]
    3. rem-exp-log36.8%

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

      \[\leadsto \color{blue}{\left(1 - t\right)} + \left(-1\right) \]
    5. metadata-eval36.8%

      \[\leadsto \left(1 - t\right) + \color{blue}{-1} \]
  11. Simplified36.8%

    \[\leadsto \color{blue}{\left(1 - t\right) + -1} \]
  12. Taylor expanded in t around 0 2.3%

    \[\leadsto \color{blue}{1} + -1 \]
  13. Step-by-step derivation
    1. metadata-eval2.3%

      \[\leadsto \color{blue}{0} \]
  14. Applied egg-rr2.3%

    \[\leadsto \color{blue}{0} \]
  15. Add Preprocessing

Reproduce

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