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

Percentage Accurate: 88.9% → 99.8%
Time: 21.5s
Alternatives: 15
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 15 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: 88.9% 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) - t\right) \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 fma(Float64(z + -1.0), log1p(Float64(-y)), Float64(Float64(log(y) * Float64(-1.0 + x)) - t))
end
code[x_, y_, z_, t_] := N[(N[(z + -1.0), $MachinePrecision] * N[Log[1 + (-y)], $MachinePrecision] + N[(N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(z + -1, \mathsf{log1p}\left(-y\right), \color{blue}{\left(x - 1\right) \cdot \log y - t}\right) \]
    10. 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 - t\right) \]
    11. metadata-eval99.8%

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

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

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

Alternative 2: 99.8% accurate, 1.0× speedup?

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

\\
\left(\mathsf{log1p}\left(-y\right) \cdot \left(z + -1\right) + \log y \cdot \left(-1 + x\right)\right) - t
\end{array}
Derivation
  1. Initial program 87.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. *-commutative87.8%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(\frac{\log y \cdot \mathsf{fma}\left(x, x, -1\right)}{\color{blue}{1 + x}} + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
  3. Applied egg-rr61.9%

    \[\leadsto \left(\color{blue}{\frac{\log y \cdot \mathsf{fma}\left(x, x, -1\right)}{1 + x}} + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
  4. Step-by-step derivation
    1. associate-/l*63.0%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 99.1% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 99.1% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\left(\mathsf{fma}\left(-0.3333333333333333, {y}^{3} \cdot \left(-1 + z\right), \log y \cdot \left(-1 + x\right)\right) + \left(-1 + z\right) \cdot \mathsf{fma}\left(-0.5, {y}^{2}, -y\right)\right)} - t \]
  5. 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 \]
  6. 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. +-commutative98.9%

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(\log y, -1 + x, \color{blue}{y} + z \cdot \left(-y\right)\right) - t \]
    14. distribute-rgt-neg-in99.0%

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

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

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

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

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

Alternative 5: 98.1% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;-1 + x \leq -5000 \lor \neg \left(-1 + x \leq -0.99999999995\right):\\
\;\;\;\;\left(x \cdot \log y - y \cdot \left(z + -1\right)\right) - t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 x 1) < -5e3 or -0.99999999995 < (-.f64 x 1)

    1. Initial program 92.1%

      \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
    2. 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(-1 \cdot y\right)}\right) - t \]
    3. Step-by-step derivation
      1. mul-1-neg99.5%

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

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

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

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

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

    if -5e3 < (-.f64 x 1) < -0.99999999995

    1. Initial program 82.9%

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

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

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

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

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

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

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

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

        \[\leadsto \left(\color{blue}{\left(-1 \cdot y\right) \cdot \left(z - 1\right)} - \log y\right) - t \]
      5. neg-mul-198.1%

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

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

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

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

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

        \[\leadsto \left(\left(\color{blue}{\left(-\left(-y\right)\right)} + z \cdot \left(-y\right)\right) - \log y\right) - t \]
      11. remove-double-neg98.1%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;-1 + x \leq -5000 \lor \neg \left(-1 + x \leq -0.99999999995\right):\\ \;\;\;\;\left(x \cdot \log y - y \cdot \left(z + -1\right)\right) - t\\ \mathbf{else}:\\ \;\;\;\;\left(\left(y - z \cdot y\right) - \log y\right) - t\\ \end{array} \]

Alternative 6: 94.2% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;-1 + x \leq -5 \cdot 10^{+71}:\\
\;\;\;\;x \cdot \log y - t\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (-.f64 x 1) < -4.99999999999999972e71

    1. Initial program 95.6%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(\color{blue}{\frac{\log y \cdot \mathsf{fma}\left(x, x, -1\right)}{1 + x}} + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
    4. Step-by-step derivation
      1. associate-/l*24.4%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\log y \cdot x} - t \]
    11. Simplified95.1%

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

    if -4.99999999999999972e71 < (-.f64 x 1) < -0.5

    1. Initial program 81.3%

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

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

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

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

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

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

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

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

        \[\leadsto \left(\color{blue}{\left(-1 \cdot y\right) \cdot \left(z - 1\right)} - \log y\right) - t \]
      5. neg-mul-196.4%

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

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

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

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

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

        \[\leadsto \left(\left(\color{blue}{\left(-\left(-y\right)\right)} + z \cdot \left(-y\right)\right) - \log y\right) - t \]
      11. remove-double-neg96.4%

        \[\leadsto \left(\left(\color{blue}{y} + z \cdot \left(-y\right)\right) - \log y\right) - t \]
      12. distribute-rgt-neg-in96.4%

        \[\leadsto \left(\left(y + \color{blue}{\left(-z \cdot y\right)}\right) - \log y\right) - t \]
      13. *-commutative96.4%

        \[\leadsto \left(\left(y + \left(-\color{blue}{y \cdot z}\right)\right) - \log y\right) - t \]
      14. unsub-neg96.4%

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

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

    if -0.5 < (-.f64 x 1)

    1. Initial program 94.9%

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

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

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

Alternative 7: 90.0% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z + -1 \leq -2 \cdot 10^{+253} \lor \neg \left(z + -1 \leq 5 \cdot 10^{+231}\right):\\ \;\;\;\;z \cdot \mathsf{log1p}\left(-y\right) - t\\ \mathbf{else}:\\ \;\;\;\;\log y \cdot \left(-1 + x\right) - t\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (or (<= (+ z -1.0) -2e+253) (not (<= (+ z -1.0) 5e+231)))
   (- (* z (log1p (- y))) t)
   (- (* (log y) (+ -1.0 x)) t)))
double code(double x, double y, double z, double t) {
	double tmp;
	if (((z + -1.0) <= -2e+253) || !((z + -1.0) <= 5e+231)) {
		tmp = (z * log1p(-y)) - t;
	} else {
		tmp = (log(y) * (-1.0 + x)) - t;
	}
	return tmp;
}
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (((z + -1.0) <= -2e+253) || !((z + -1.0) <= 5e+231)) {
		tmp = (z * Math.log1p(-y)) - t;
	} else {
		tmp = (Math.log(y) * (-1.0 + x)) - t;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if ((z + -1.0) <= -2e+253) or not ((z + -1.0) <= 5e+231):
		tmp = (z * math.log1p(-y)) - t
	else:
		tmp = (math.log(y) * (-1.0 + x)) - t
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if ((Float64(z + -1.0) <= -2e+253) || !(Float64(z + -1.0) <= 5e+231))
		tmp = Float64(Float64(z * log1p(Float64(-y))) - t);
	else
		tmp = Float64(Float64(log(y) * Float64(-1.0 + x)) - t);
	end
	return tmp
end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(z + -1.0), $MachinePrecision], -2e+253], N[Not[LessEqual[N[(z + -1.0), $MachinePrecision], 5e+231]], $MachinePrecision]], N[(N[(z * N[Log[1 + (-y)], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 z 1) < -1.9999999999999999e253 or 5.00000000000000028e231 < (-.f64 z 1)

    1. Initial program 36.7%

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

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

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

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

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

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

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

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

    if -1.9999999999999999e253 < (-.f64 z 1) < 5.00000000000000028e231

    1. Initial program 93.1%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z + -1 \leq -2 \cdot 10^{+253} \lor \neg \left(z + -1 \leq 5 \cdot 10^{+231}\right):\\ \;\;\;\;z \cdot \mathsf{log1p}\left(-y\right) - t\\ \mathbf{else}:\\ \;\;\;\;\log y \cdot \left(-1 + x\right) - t\\ \end{array} \]

Alternative 8: 99.1% accurate, 1.9× speedup?

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

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

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

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

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

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

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

Alternative 9: 60.9% accurate, 1.9× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (-.f64 z 1) < -1.00000000000000007e70

    1. Initial program 77.4%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot t + -1 \cdot \left(y \cdot z\right)} \]
    9. Step-by-step derivation
      1. distribute-lft-out52.2%

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

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

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

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

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

    if -1.00000000000000007e70 < (-.f64 z 1) < 1e113

    1. Initial program 99.2%

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

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

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

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

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

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

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

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

        \[\leadsto \left(\color{blue}{\left(-1 \cdot y\right) \cdot \left(z - 1\right)} - \log y\right) - t \]
      5. neg-mul-160.9%

        \[\leadsto \left(\color{blue}{\left(-y\right)} \cdot \left(z - 1\right) - \log y\right) - t \]
      6. sub-neg60.9%

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

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

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

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

        \[\leadsto \left(\left(\color{blue}{\left(-\left(-y\right)\right)} + z \cdot \left(-y\right)\right) - \log y\right) - t \]
      11. remove-double-neg60.9%

        \[\leadsto \left(\left(\color{blue}{y} + z \cdot \left(-y\right)\right) - \log y\right) - t \]
      12. distribute-rgt-neg-in60.9%

        \[\leadsto \left(\left(y + \color{blue}{\left(-z \cdot y\right)}\right) - \log y\right) - t \]
      13. *-commutative60.9%

        \[\leadsto \left(\left(y + \left(-\color{blue}{y \cdot z}\right)\right) - \log y\right) - t \]
      14. unsub-neg60.9%

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

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

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

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

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

    if 1e113 < (-.f64 z 1)

    1. Initial program 60.9%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z + -1 \leq -1 \cdot 10^{+70}:\\ \;\;\;\;-\mathsf{fma}\left(y, z, t\right)\\ \mathbf{elif}\;z + -1 \leq 10^{+113}:\\ \;\;\;\;\left(-\log y\right) - t\\ \mathbf{else}:\\ \;\;\;\;\left(-t\right) - z \cdot y\\ \end{array} \]

Alternative 10: 86.9% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -4 \cdot 10^{-8} \lor \neg \left(x \leq 0.00072\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 -4e-8) (not (<= x 0.00072)))
   (- (* x (log y)) t)
   (- (- (log y)) t)))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((x <= -4e-8) || !(x <= 0.00072)) {
		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 <= (-4d-8)) .or. (.not. (x <= 0.00072d0))) 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 <= -4e-8) || !(x <= 0.00072)) {
		tmp = (x * Math.log(y)) - t;
	} else {
		tmp = -Math.log(y) - t;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (x <= -4e-8) or not (x <= 0.00072):
		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 <= -4e-8) || !(x <= 0.00072))
		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 <= -4e-8) || ~((x <= 0.00072)))
		tmp = (x * log(y)) - t;
	else
		tmp = -log(y) - t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -4e-8], N[Not[LessEqual[x, 0.00072]], $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 -4 \cdot 10^{-8} \lor \neg \left(x \leq 0.00072\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 < -4.0000000000000001e-8 or 7.20000000000000045e-4 < x

    1. Initial program 92.2%

      \[\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. *-commutative92.2%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(\color{blue}{\frac{\log y \cdot \mathsf{fma}\left(x, x, -1\right)}{1 + x}} + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
    4. Step-by-step derivation
      1. associate-/l*45.3%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\log y \cdot x} - t \]
    11. Simplified91.1%

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

    if -4.0000000000000001e-8 < x < 7.20000000000000045e-4

    1. Initial program 82.8%

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

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

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

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

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

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

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

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

        \[\leadsto \left(\color{blue}{\left(-1 \cdot y\right) \cdot \left(z - 1\right)} - \log y\right) - t \]
      5. neg-mul-198.2%

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

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

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

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

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

        \[\leadsto \left(\left(\color{blue}{\left(-\left(-y\right)\right)} + z \cdot \left(-y\right)\right) - \log y\right) - t \]
      11. remove-double-neg98.2%

        \[\leadsto \left(\left(\color{blue}{y} + z \cdot \left(-y\right)\right) - \log y\right) - t \]
      12. distribute-rgt-neg-in98.2%

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

        \[\leadsto \left(\left(y + \left(-\color{blue}{y \cdot z}\right)\right) - \log y\right) - t \]
      14. unsub-neg98.2%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -4 \cdot 10^{-8} \lor \neg \left(x \leq 0.00072\right):\\ \;\;\;\;x \cdot \log y - t\\ \mathbf{else}:\\ \;\;\;\;\left(-\log y\right) - t\\ \end{array} \]

Alternative 11: 87.0% accurate, 2.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -4 \cdot 10^{-8} \lor \neg \left(x \leq 0.00072\right):\\
\;\;\;\;x \cdot \log y - t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -4.0000000000000001e-8 or 7.20000000000000045e-4 < x

    1. Initial program 92.2%

      \[\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. *-commutative92.2%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(\color{blue}{\frac{\log y \cdot \mathsf{fma}\left(x, x, -1\right)}{1 + x}} + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
    4. Step-by-step derivation
      1. associate-/l*45.3%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\log y \cdot x} - t \]
    11. Simplified91.1%

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

    if -4.0000000000000001e-8 < x < 7.20000000000000045e-4

    1. Initial program 82.8%

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

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

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

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

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

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

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

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

        \[\leadsto \left(\color{blue}{\left(-1 \cdot y\right) \cdot \left(z - 1\right)} - \log y\right) - t \]
      5. neg-mul-198.2%

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

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

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

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

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

        \[\leadsto \left(\left(\color{blue}{\left(-\left(-y\right)\right)} + z \cdot \left(-y\right)\right) - \log y\right) - t \]
      11. remove-double-neg98.2%

        \[\leadsto \left(\left(\color{blue}{y} + z \cdot \left(-y\right)\right) - \log y\right) - t \]
      12. distribute-rgt-neg-in98.2%

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

        \[\leadsto \left(\left(y + \left(-\color{blue}{y \cdot z}\right)\right) - \log y\right) - t \]
      14. unsub-neg98.2%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -4 \cdot 10^{-8} \lor \neg \left(x \leq 0.00072\right):\\ \;\;\;\;x \cdot \log y - t\\ \mathbf{else}:\\ \;\;\;\;\left(y - \log y\right) - t\\ \end{array} \]

Alternative 12: 42.7% accurate, 26.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -2 \cdot 10^{-24} \lor \neg \left(t \leq 16000000000\right):\\
\;\;\;\;-t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.99999999999999985e-24 or 1.6e10 < t

    1. Initial program 96.7%

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

      \[\leadsto \color{blue}{-1 \cdot t} \]
    3. Step-by-step derivation
      1. mul-1-neg65.4%

        \[\leadsto \color{blue}{-t} \]
    4. Simplified65.4%

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

    if -1.99999999999999985e-24 < t < 1.6e10

    1. Initial program 80.5%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(-y\right) \cdot z} - t \]
    8. Taylor expanded in y around inf 20.9%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -2 \cdot 10^{-24} \lor \neg \left(t \leq 16000000000\right):\\ \;\;\;\;-t\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(-y\right)\\ \end{array} \]

Alternative 13: 46.2% accurate, 30.7× speedup?

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(\color{blue}{\left(-1 \cdot y\right) \cdot \left(z - 1\right)} - \log y\right) - t \]
    5. neg-mul-161.5%

      \[\leadsto \left(\color{blue}{\left(-y\right)} \cdot \left(z - 1\right) - \log y\right) - t \]
    6. sub-neg61.5%

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

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

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

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

      \[\leadsto \left(\left(\color{blue}{\left(-\left(-y\right)\right)} + z \cdot \left(-y\right)\right) - \log y\right) - t \]
    11. remove-double-neg61.5%

      \[\leadsto \left(\left(\color{blue}{y} + z \cdot \left(-y\right)\right) - \log y\right) - t \]
    12. distribute-rgt-neg-in61.5%

      \[\leadsto \left(\left(y + \color{blue}{\left(-z \cdot y\right)}\right) - \log y\right) - t \]
    13. *-commutative61.5%

      \[\leadsto \left(\left(y + \left(-\color{blue}{y \cdot z}\right)\right) - \log y\right) - t \]
    14. unsub-neg61.5%

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

    \[\leadsto \color{blue}{\left(\left(y - y \cdot z\right) - \log y\right)} - t \]
  8. Taylor expanded in y around inf 42.5%

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

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

Alternative 14: 46.0% accurate, 35.8× speedup?

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

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

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

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

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

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

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

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

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

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

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

Alternative 15: 35.4% 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 87.8%

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

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

      \[\leadsto \color{blue}{-t} \]
  4. Simplified30.8%

    \[\leadsto \color{blue}{-t} \]
  5. Final simplification30.8%

    \[\leadsto -t \]

Reproduce

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