Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, B

Percentage Accurate: 85.5% → 99.8%
Time: 13.5s
Alternatives: 11
Speedup: 1.9×

Specification

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

\\
\left(x \cdot \log y + z \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 11 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: 85.5% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

Alternative 2: 99.4% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

Alternative 3: 76.8% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \log y\\ \mathbf{if}\;x \leq -2.2 \cdot 10^{+121}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -7.2 \cdot 10^{+62}:\\ \;\;\;\;z \cdot \left(y \cdot \left(y \cdot -0.5\right) - y\right) - t\\ \mathbf{elif}\;x \leq -4.2 \cdot 10^{+26} \lor \neg \left(x \leq 9 \cdot 10^{+96}\right):\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \left(y \cdot \left(z \cdot y\right)\right) - \left(t + z \cdot y\right)\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (log y))))
   (if (<= x -2.2e+121)
     t_1
     (if (<= x -7.2e+62)
       (- (* z (- (* y (* y -0.5)) y)) t)
       (if (or (<= x -4.2e+26) (not (<= x 9e+96)))
         t_1
         (- (* -0.5 (* y (* z y))) (+ t (* z y))))))))
double code(double x, double y, double z, double t) {
	double t_1 = x * log(y);
	double tmp;
	if (x <= -2.2e+121) {
		tmp = t_1;
	} else if (x <= -7.2e+62) {
		tmp = (z * ((y * (y * -0.5)) - y)) - t;
	} else if ((x <= -4.2e+26) || !(x <= 9e+96)) {
		tmp = t_1;
	} else {
		tmp = (-0.5 * (y * (z * y))) - (t + (z * y));
	}
	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 <= (-2.2d+121)) then
        tmp = t_1
    else if (x <= (-7.2d+62)) then
        tmp = (z * ((y * (y * (-0.5d0))) - y)) - t
    else if ((x <= (-4.2d+26)) .or. (.not. (x <= 9d+96))) then
        tmp = t_1
    else
        tmp = ((-0.5d0) * (y * (z * y))) - (t + (z * y))
    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 <= -2.2e+121) {
		tmp = t_1;
	} else if (x <= -7.2e+62) {
		tmp = (z * ((y * (y * -0.5)) - y)) - t;
	} else if ((x <= -4.2e+26) || !(x <= 9e+96)) {
		tmp = t_1;
	} else {
		tmp = (-0.5 * (y * (z * y))) - (t + (z * y));
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x * math.log(y)
	tmp = 0
	if x <= -2.2e+121:
		tmp = t_1
	elif x <= -7.2e+62:
		tmp = (z * ((y * (y * -0.5)) - y)) - t
	elif (x <= -4.2e+26) or not (x <= 9e+96):
		tmp = t_1
	else:
		tmp = (-0.5 * (y * (z * y))) - (t + (z * y))
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x * log(y))
	tmp = 0.0
	if (x <= -2.2e+121)
		tmp = t_1;
	elseif (x <= -7.2e+62)
		tmp = Float64(Float64(z * Float64(Float64(y * Float64(y * -0.5)) - y)) - t);
	elseif ((x <= -4.2e+26) || !(x <= 9e+96))
		tmp = t_1;
	else
		tmp = Float64(Float64(-0.5 * Float64(y * Float64(z * y))) - Float64(t + Float64(z * y)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x * log(y);
	tmp = 0.0;
	if (x <= -2.2e+121)
		tmp = t_1;
	elseif (x <= -7.2e+62)
		tmp = (z * ((y * (y * -0.5)) - y)) - t;
	elseif ((x <= -4.2e+26) || ~((x <= 9e+96)))
		tmp = t_1;
	else
		tmp = (-0.5 * (y * (z * y))) - (t + (z * y));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.2e+121], t$95$1, If[LessEqual[x, -7.2e+62], N[(N[(z * N[(N[(y * N[(y * -0.5), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], If[Or[LessEqual[x, -4.2e+26], N[Not[LessEqual[x, 9e+96]], $MachinePrecision]], t$95$1, N[(N[(-0.5 * N[(y * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(t + N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x \cdot \log y\\
\mathbf{if}\;x \leq -2.2 \cdot 10^{+121}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \leq -7.2 \cdot 10^{+62}:\\
\;\;\;\;z \cdot \left(y \cdot \left(y \cdot -0.5\right) - y\right) - t\\

\mathbf{elif}\;x \leq -4.2 \cdot 10^{+26} \lor \neg \left(x \leq 9 \cdot 10^{+96}\right):\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -2.20000000000000001e121 or -7.2e62 < x < -4.2000000000000002e26 or 8.99999999999999914e96 < x

    1. Initial program 98.5%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\log y \cdot x - t} \]
    5. Step-by-step derivation
      1. fma-neg97.5%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\log y, x, -t\right)} \]
    7. Taylor expanded in x around inf 82.2%

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

    if -2.20000000000000001e121 < x < -7.2e62

    1. Initial program 64.5%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(z, \log \left(1 - y\right), -t\right)} \]
      2. sub-neg37.1%

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

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

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

        \[\leadsto \mathsf{fma}\left(z, \mathsf{log1p}\left(\color{blue}{-y}\right), -t\right) \]
    6. Simplified69.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(z, \mathsf{log1p}\left(-y\right), -t\right)} \]
    7. Taylor expanded in y around 0 69.9%

      \[\leadsto \color{blue}{-0.5 \cdot \left({y}^{2} \cdot z\right) + \left(-1 \cdot t + -1 \cdot \left(y \cdot z\right)\right)} \]
    8. Step-by-step derivation
      1. mul-1-neg69.9%

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

        \[\leadsto -0.5 \cdot \left({y}^{2} \cdot z\right) + \color{blue}{\left(-1 \cdot \left(y \cdot z\right) + \left(-t\right)\right)} \]
      3. associate-+r+69.9%

        \[\leadsto \color{blue}{\left(-0.5 \cdot \left({y}^{2} \cdot z\right) + -1 \cdot \left(y \cdot z\right)\right) + \left(-t\right)} \]
      4. associate-*r*69.9%

        \[\leadsto \left(\color{blue}{\left(-0.5 \cdot {y}^{2}\right) \cdot z} + -1 \cdot \left(y \cdot z\right)\right) + \left(-t\right) \]
      5. associate-*r*69.9%

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

        \[\leadsto \color{blue}{z \cdot \left(-0.5 \cdot {y}^{2} + -1 \cdot y\right)} + \left(-t\right) \]
      7. mul-1-neg69.9%

        \[\leadsto z \cdot \left(-0.5 \cdot {y}^{2} + \color{blue}{\left(-y\right)}\right) + \left(-t\right) \]
      8. unsub-neg69.9%

        \[\leadsto z \cdot \color{blue}{\left(-0.5 \cdot {y}^{2} - y\right)} + \left(-t\right) \]
      9. *-commutative69.9%

        \[\leadsto z \cdot \left(\color{blue}{{y}^{2} \cdot -0.5} - y\right) + \left(-t\right) \]
      10. unpow269.9%

        \[\leadsto z \cdot \left(\color{blue}{\left(y \cdot y\right)} \cdot -0.5 - y\right) + \left(-t\right) \]
      11. associate-*l*69.9%

        \[\leadsto z \cdot \left(\color{blue}{y \cdot \left(y \cdot -0.5\right)} - y\right) + \left(-t\right) \]
    9. Simplified69.9%

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

    if -4.2000000000000002e26 < x < 8.99999999999999914e96

    1. Initial program 81.7%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(z, \color{blue}{\mathsf{log1p}\left(-1 \cdot y\right)}, -t\right) \]
      5. mul-1-neg83.4%

        \[\leadsto \mathsf{fma}\left(z, \mathsf{log1p}\left(\color{blue}{-y}\right), -t\right) \]
    6. Simplified83.4%

      \[\leadsto \color{blue}{\mathsf{fma}\left(z, \mathsf{log1p}\left(-y\right), -t\right)} \]
    7. Taylor expanded in y around 0 82.8%

      \[\leadsto \color{blue}{-0.5 \cdot \left({y}^{2} \cdot z\right) + \left(-1 \cdot t + -1 \cdot \left(y \cdot z\right)\right)} \]
    8. Step-by-step derivation
      1. expm1-log1p-u75.8%

        \[\leadsto -0.5 \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({y}^{2} \cdot z\right)\right)} + \left(-1 \cdot t + -1 \cdot \left(y \cdot z\right)\right) \]
      2. expm1-udef75.6%

        \[\leadsto -0.5 \cdot \color{blue}{\left(e^{\mathsf{log1p}\left({y}^{2} \cdot z\right)} - 1\right)} + \left(-1 \cdot t + -1 \cdot \left(y \cdot z\right)\right) \]
      3. unpow275.6%

        \[\leadsto -0.5 \cdot \left(e^{\mathsf{log1p}\left(\color{blue}{\left(y \cdot y\right)} \cdot z\right)} - 1\right) + \left(-1 \cdot t + -1 \cdot \left(y \cdot z\right)\right) \]
      4. associate-*l*75.6%

        \[\leadsto -0.5 \cdot \left(e^{\mathsf{log1p}\left(\color{blue}{y \cdot \left(y \cdot z\right)}\right)} - 1\right) + \left(-1 \cdot t + -1 \cdot \left(y \cdot z\right)\right) \]
    9. Applied egg-rr75.6%

      \[\leadsto -0.5 \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(y \cdot \left(y \cdot z\right)\right)} - 1\right)} + \left(-1 \cdot t + -1 \cdot \left(y \cdot z\right)\right) \]
    10. Step-by-step derivation
      1. expm1-def75.8%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.2 \cdot 10^{+121}:\\ \;\;\;\;x \cdot \log y\\ \mathbf{elif}\;x \leq -7.2 \cdot 10^{+62}:\\ \;\;\;\;z \cdot \left(y \cdot \left(y \cdot -0.5\right) - y\right) - t\\ \mathbf{elif}\;x \leq -4.2 \cdot 10^{+26} \lor \neg \left(x \leq 9 \cdot 10^{+96}\right):\\ \;\;\;\;x \cdot \log y\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \left(y \cdot \left(z \cdot y\right)\right) - \left(t + z \cdot y\right)\\ \end{array} \]

Alternative 4: 89.7% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1.12 \cdot 10^{-162} \lor \neg \left(x \leq 6 \cdot 10^{-34}\right):\\ \;\;\;\;x \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 (or (<= x -1.12e-162) (not (<= x 6e-34)))
   (- (* x (log y)) t)
   (- (* z (log1p (- y))) t)))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((x <= -1.12e-162) || !(x <= 6e-34)) {
		tmp = (x * 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 ((x <= -1.12e-162) || !(x <= 6e-34)) {
		tmp = (x * Math.log(y)) - t;
	} else {
		tmp = (z * Math.log1p(-y)) - t;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (x <= -1.12e-162) or not (x <= 6e-34):
		tmp = (x * math.log(y)) - t
	else:
		tmp = (z * math.log1p(-y)) - t
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if ((x <= -1.12e-162) || !(x <= 6e-34))
		tmp = Float64(Float64(x * log(y)) - t);
	else
		tmp = Float64(Float64(z * log1p(Float64(-y))) - t);
	end
	return tmp
end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.12e-162], N[Not[LessEqual[x, 6e-34]], $MachinePrecision]], N[(N[(x * 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}\;x \leq -1.12 \cdot 10^{-162} \lor \neg \left(x \leq 6 \cdot 10^{-34}\right):\\
\;\;\;\;x \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 x < -1.12e-162 or 6e-34 < x

    1. Initial program 90.9%

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

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

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

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

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

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

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

    if -1.12e-162 < x < 6e-34

    1. Initial program 79.6%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.12 \cdot 10^{-162} \lor \neg \left(x \leq 6 \cdot 10^{-34}\right):\\ \;\;\;\;x \cdot \log y - t\\ \mathbf{else}:\\ \;\;\;\;z \cdot \mathsf{log1p}\left(-y\right) - t\\ \end{array} \]

Alternative 5: 89.5% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -7 \cdot 10^{-164} \lor \neg \left(x \leq 6 \cdot 10^{-34}\right):\\
\;\;\;\;x \cdot \log y - t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -6.9999999999999999e-164 or 6e-34 < x

    1. Initial program 90.9%

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

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

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

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

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

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

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

    if -6.9999999999999999e-164 < x < 6e-34

    1. Initial program 79.6%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(z, \log \left(1 - y\right), -t\right)} \]
      2. sub-neg73.4%

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

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

        \[\leadsto \mathsf{fma}\left(z, \color{blue}{\mathsf{log1p}\left(-1 \cdot y\right)}, -t\right) \]
      5. mul-1-neg93.8%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(z, \mathsf{log1p}\left(-y\right), -t\right)} \]
    7. Taylor expanded in y around 0 93.3%

      \[\leadsto \color{blue}{-0.5 \cdot \left({y}^{2} \cdot z\right) + \left(-1 \cdot t + -1 \cdot \left(y \cdot z\right)\right)} \]
    8. Step-by-step derivation
      1. expm1-log1p-u85.7%

        \[\leadsto -0.5 \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({y}^{2} \cdot z\right)\right)} + \left(-1 \cdot t + -1 \cdot \left(y \cdot z\right)\right) \]
      2. expm1-udef85.5%

        \[\leadsto -0.5 \cdot \color{blue}{\left(e^{\mathsf{log1p}\left({y}^{2} \cdot z\right)} - 1\right)} + \left(-1 \cdot t + -1 \cdot \left(y \cdot z\right)\right) \]
      3. unpow285.5%

        \[\leadsto -0.5 \cdot \left(e^{\mathsf{log1p}\left(\color{blue}{\left(y \cdot y\right)} \cdot z\right)} - 1\right) + \left(-1 \cdot t + -1 \cdot \left(y \cdot z\right)\right) \]
      4. associate-*l*85.5%

        \[\leadsto -0.5 \cdot \left(e^{\mathsf{log1p}\left(\color{blue}{y \cdot \left(y \cdot z\right)}\right)} - 1\right) + \left(-1 \cdot t + -1 \cdot \left(y \cdot z\right)\right) \]
    9. Applied egg-rr85.5%

      \[\leadsto -0.5 \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(y \cdot \left(y \cdot z\right)\right)} - 1\right)} + \left(-1 \cdot t + -1 \cdot \left(y \cdot z\right)\right) \]
    10. Step-by-step derivation
      1. expm1-def85.7%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -7 \cdot 10^{-164} \lor \neg \left(x \leq 6 \cdot 10^{-34}\right):\\ \;\;\;\;x \cdot \log y - t\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \left(y \cdot \left(z \cdot y\right)\right) - \left(t + z \cdot y\right)\\ \end{array} \]

Alternative 6: 99.1% accurate, 1.9× speedup?

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

\\
\left(x \cdot \log y - z \cdot y\right) - t
\end{array}
Derivation
  1. Initial program 86.9%

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

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

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

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

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

      \[\leadsto \left(\log \left({y}^{x}\right) + \color{blue}{\left(-y \cdot z\right)}\right) - t \]
    5. unsub-neg46.2%

      \[\leadsto \color{blue}{\left(\log \left({y}^{x}\right) - y \cdot z\right)} - t \]
    6. log-pow98.6%

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

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

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

    \[\leadsto \left(x \cdot \log y - z \cdot y\right) - t \]

Alternative 7: 57.0% accurate, 16.2× speedup?

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

\\
-0.5 \cdot \left(y \cdot \left(z \cdot y\right)\right) - \left(t + z \cdot y\right)
\end{array}
Derivation
  1. Initial program 86.9%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(z, \color{blue}{\mathsf{log1p}\left(-1 \cdot y\right)}, -t\right) \]
    5. mul-1-neg59.4%

      \[\leadsto \mathsf{fma}\left(z, \mathsf{log1p}\left(\color{blue}{-y}\right), -t\right) \]
  6. Simplified59.4%

    \[\leadsto \color{blue}{\mathsf{fma}\left(z, \mathsf{log1p}\left(-y\right), -t\right)} \]
  7. Taylor expanded in y around 0 58.8%

    \[\leadsto \color{blue}{-0.5 \cdot \left({y}^{2} \cdot z\right) + \left(-1 \cdot t + -1 \cdot \left(y \cdot z\right)\right)} \]
  8. Step-by-step derivation
    1. expm1-log1p-u51.8%

      \[\leadsto -0.5 \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({y}^{2} \cdot z\right)\right)} + \left(-1 \cdot t + -1 \cdot \left(y \cdot z\right)\right) \]
    2. expm1-udef51.7%

      \[\leadsto -0.5 \cdot \color{blue}{\left(e^{\mathsf{log1p}\left({y}^{2} \cdot z\right)} - 1\right)} + \left(-1 \cdot t + -1 \cdot \left(y \cdot z\right)\right) \]
    3. unpow251.7%

      \[\leadsto -0.5 \cdot \left(e^{\mathsf{log1p}\left(\color{blue}{\left(y \cdot y\right)} \cdot z\right)} - 1\right) + \left(-1 \cdot t + -1 \cdot \left(y \cdot z\right)\right) \]
    4. associate-*l*51.7%

      \[\leadsto -0.5 \cdot \left(e^{\mathsf{log1p}\left(\color{blue}{y \cdot \left(y \cdot z\right)}\right)} - 1\right) + \left(-1 \cdot t + -1 \cdot \left(y \cdot z\right)\right) \]
  9. Applied egg-rr51.7%

    \[\leadsto -0.5 \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(y \cdot \left(y \cdot z\right)\right)} - 1\right)} + \left(-1 \cdot t + -1 \cdot \left(y \cdot z\right)\right) \]
  10. Step-by-step derivation
    1. expm1-def51.8%

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

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

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

    \[\leadsto -0.5 \cdot \left(y \cdot \left(z \cdot y\right)\right) - \left(t + z \cdot y\right) \]

Alternative 8: 57.0% accurate, 19.2× speedup?

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

\\
z \cdot \left(y \cdot \left(y \cdot -0.5\right) - y\right) - t
\end{array}
Derivation
  1. Initial program 86.9%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(z, \color{blue}{\mathsf{log1p}\left(-1 \cdot y\right)}, -t\right) \]
    5. mul-1-neg59.4%

      \[\leadsto \mathsf{fma}\left(z, \mathsf{log1p}\left(\color{blue}{-y}\right), -t\right) \]
  6. Simplified59.4%

    \[\leadsto \color{blue}{\mathsf{fma}\left(z, \mathsf{log1p}\left(-y\right), -t\right)} \]
  7. Taylor expanded in y around 0 58.8%

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

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

      \[\leadsto -0.5 \cdot \left({y}^{2} \cdot z\right) + \color{blue}{\left(-1 \cdot \left(y \cdot z\right) + \left(-t\right)\right)} \]
    3. associate-+r+58.8%

      \[\leadsto \color{blue}{\left(-0.5 \cdot \left({y}^{2} \cdot z\right) + -1 \cdot \left(y \cdot z\right)\right) + \left(-t\right)} \]
    4. associate-*r*58.8%

      \[\leadsto \left(\color{blue}{\left(-0.5 \cdot {y}^{2}\right) \cdot z} + -1 \cdot \left(y \cdot z\right)\right) + \left(-t\right) \]
    5. associate-*r*58.8%

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

      \[\leadsto \color{blue}{z \cdot \left(-0.5 \cdot {y}^{2} + -1 \cdot y\right)} + \left(-t\right) \]
    7. mul-1-neg58.8%

      \[\leadsto z \cdot \left(-0.5 \cdot {y}^{2} + \color{blue}{\left(-y\right)}\right) + \left(-t\right) \]
    8. unsub-neg58.8%

      \[\leadsto z \cdot \color{blue}{\left(-0.5 \cdot {y}^{2} - y\right)} + \left(-t\right) \]
    9. *-commutative58.8%

      \[\leadsto z \cdot \left(\color{blue}{{y}^{2} \cdot -0.5} - y\right) + \left(-t\right) \]
    10. unpow258.8%

      \[\leadsto z \cdot \left(\color{blue}{\left(y \cdot y\right)} \cdot -0.5 - y\right) + \left(-t\right) \]
    11. associate-*l*58.8%

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

    \[\leadsto \color{blue}{z \cdot \left(y \cdot \left(y \cdot -0.5\right) - y\right) + \left(-t\right)} \]
  10. Final simplification58.8%

    \[\leadsto z \cdot \left(y \cdot \left(y \cdot -0.5\right) - y\right) - t \]

Alternative 9: 56.6% accurate, 35.2× 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.9%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(z, \color{blue}{\mathsf{log1p}\left(-1 \cdot y\right)}, -t\right) \]
    5. mul-1-neg59.4%

      \[\leadsto \mathsf{fma}\left(z, \mathsf{log1p}\left(\color{blue}{-y}\right), -t\right) \]
  6. Simplified59.4%

    \[\leadsto \color{blue}{\mathsf{fma}\left(z, \mathsf{log1p}\left(-y\right), -t\right)} \]
  7. Taylor expanded in y around 0 58.2%

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

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

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

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

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

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

    \[\leadsto \color{blue}{y \cdot \left(-z\right) - t} \]
  10. Final simplification58.2%

    \[\leadsto z \cdot \left(-y\right) - t \]

Alternative 10: 42.4% accurate, 105.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.9%

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

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

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

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

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

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

    \[\leadsto \color{blue}{-1 \cdot t} \]
  5. Step-by-step derivation
    1. mul-1-neg44.8%

      \[\leadsto \color{blue}{-t} \]
  6. Simplified44.8%

    \[\leadsto \color{blue}{-t} \]
  7. Final simplification44.8%

    \[\leadsto -t \]

Alternative 11: 2.3% accurate, 211.0× 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 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.9%

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

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

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

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

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

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

    \[\leadsto \color{blue}{\log y \cdot x - t} \]
  5. Step-by-step derivation
    1. fma-neg84.9%

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(\log y, x, -t\right)} \]
  7. Step-by-step derivation
    1. add-exp-log42.7%

      \[\leadsto \color{blue}{e^{\log \left(\mathsf{fma}\left(\log y, x, -t\right)\right)}} \]
    2. add-sqr-sqrt34.1%

      \[\leadsto e^{\log \left(\mathsf{fma}\left(\log y, x, \color{blue}{\sqrt{-t} \cdot \sqrt{-t}}\right)\right)} \]
    3. sqrt-unprod34.2%

      \[\leadsto e^{\log \left(\mathsf{fma}\left(\log y, x, \color{blue}{\sqrt{\left(-t\right) \cdot \left(-t\right)}}\right)\right)} \]
    4. sqr-neg34.2%

      \[\leadsto e^{\log \left(\mathsf{fma}\left(\log y, x, \sqrt{\color{blue}{t \cdot t}}\right)\right)} \]
    5. sqrt-unprod8.4%

      \[\leadsto e^{\log \left(\mathsf{fma}\left(\log y, x, \color{blue}{\sqrt{t} \cdot \sqrt{t}}\right)\right)} \]
    6. add-sqr-sqrt21.4%

      \[\leadsto e^{\log \left(\mathsf{fma}\left(\log y, x, \color{blue}{t}\right)\right)} \]
  8. Applied egg-rr21.4%

    \[\leadsto \color{blue}{e^{\log \left(\mathsf{fma}\left(\log y, x, t\right)\right)}} \]
  9. Taylor expanded in x around 0 2.2%

    \[\leadsto \color{blue}{t} \]
  10. Final simplification2.2%

    \[\leadsto t \]

Developer target: 99.6% accurate, 1.6× speedup?

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

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

Reproduce

?
herbie shell --seed 2023257 
(FPCore (x y z t)
  :name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, B"
  :precision binary64

  :herbie-target
  (- (* (- z) (+ (+ (* 0.5 (* y y)) y) (* (/ 0.3333333333333333 (* 1.0 (* 1.0 1.0))) (* y (* y y))))) (- t (* x (log y))))

  (- (+ (* x (log y)) (* z (log (- 1.0 y)))) t))