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

Percentage Accurate: 89.5% → 99.8%
Time: 22.1s
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: 89.5% accurate, 1.0× speedup?

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

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

Alternative 1: 99.8% accurate, 0.7× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 99.6% accurate, 0.7× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 99.6% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 99.1% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \left(\color{blue}{\left(\log y \cdot \sqrt{x + -1}\right) \cdot \sqrt{x + -1}} + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
  7. 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 \]
  8. 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. mul-1-neg98.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 85.0% accurate, 1.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(-\log y\right) - t\\ t_2 := x \cdot \log y - t\\ \mathbf{if}\;x \leq -37000000000:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;x \leq -5.5 \cdot 10^{-257}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 2.4 \cdot 10^{-275}:\\ \;\;\;\;y \cdot \left(1 - z\right) - t\\ \mathbf{elif}\;x \leq 10^{-31}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (- (- (log y)) t)) (t_2 (- (* x (log y)) t)))
   (if (<= x -37000000000.0)
     t_2
     (if (<= x -5.5e-257)
       t_1
       (if (<= x 2.4e-275) (- (* y (- 1.0 z)) t) (if (<= x 1e-31) t_1 t_2))))))
double code(double x, double y, double z, double t) {
	double t_1 = -log(y) - t;
	double t_2 = (x * log(y)) - t;
	double tmp;
	if (x <= -37000000000.0) {
		tmp = t_2;
	} else if (x <= -5.5e-257) {
		tmp = t_1;
	} else if (x <= 2.4e-275) {
		tmp = (y * (1.0 - z)) - t;
	} else if (x <= 1e-31) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	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) :: t_2
    real(8) :: tmp
    t_1 = -log(y) - t
    t_2 = (x * log(y)) - t
    if (x <= (-37000000000.0d0)) then
        tmp = t_2
    else if (x <= (-5.5d-257)) then
        tmp = t_1
    else if (x <= 2.4d-275) then
        tmp = (y * (1.0d0 - z)) - t
    else if (x <= 1d-31) then
        tmp = t_1
    else
        tmp = t_2
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = -Math.log(y) - t;
	double t_2 = (x * Math.log(y)) - t;
	double tmp;
	if (x <= -37000000000.0) {
		tmp = t_2;
	} else if (x <= -5.5e-257) {
		tmp = t_1;
	} else if (x <= 2.4e-275) {
		tmp = (y * (1.0 - z)) - t;
	} else if (x <= 1e-31) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = -math.log(y) - t
	t_2 = (x * math.log(y)) - t
	tmp = 0
	if x <= -37000000000.0:
		tmp = t_2
	elif x <= -5.5e-257:
		tmp = t_1
	elif x <= 2.4e-275:
		tmp = (y * (1.0 - z)) - t
	elif x <= 1e-31:
		tmp = t_1
	else:
		tmp = t_2
	return tmp
function code(x, y, z, t)
	t_1 = Float64(Float64(-log(y)) - t)
	t_2 = Float64(Float64(x * log(y)) - t)
	tmp = 0.0
	if (x <= -37000000000.0)
		tmp = t_2;
	elseif (x <= -5.5e-257)
		tmp = t_1;
	elseif (x <= 2.4e-275)
		tmp = Float64(Float64(y * Float64(1.0 - z)) - t);
	elseif (x <= 1e-31)
		tmp = t_1;
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = -log(y) - t;
	t_2 = (x * log(y)) - t;
	tmp = 0.0;
	if (x <= -37000000000.0)
		tmp = t_2;
	elseif (x <= -5.5e-257)
		tmp = t_1;
	elseif (x <= 2.4e-275)
		tmp = (y * (1.0 - z)) - t;
	elseif (x <= 1e-31)
		tmp = t_1;
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[((-N[Log[y], $MachinePrecision]) - t), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]}, If[LessEqual[x, -37000000000.0], t$95$2, If[LessEqual[x, -5.5e-257], t$95$1, If[LessEqual[x, 2.4e-275], N[(N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[x, 1e-31], t$95$1, t$95$2]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \left(-\log y\right) - t\\
t_2 := x \cdot \log y - t\\
\mathbf{if}\;x \leq -37000000000:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;x \leq -5.5 \cdot 10^{-257}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \leq 2.4 \cdot 10^{-275}:\\
\;\;\;\;y \cdot \left(1 - z\right) - t\\

\mathbf{elif}\;x \leq 10^{-31}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -3.7e10 or 1e-31 < x

    1. Initial program 93.6%

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

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

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

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

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

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

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

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

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

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

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

    if -3.7e10 < x < -5.50000000000000025e-257 or 2.39999999999999991e-275 < x < 1e-31

    1. Initial program 86.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. +-commutative86.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.50000000000000025e-257 < x < 2.39999999999999991e-275

    1. Initial program 48.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -37000000000:\\ \;\;\;\;x \cdot \log y - t\\ \mathbf{elif}\;x \leq -5.5 \cdot 10^{-257}:\\ \;\;\;\;\left(-\log y\right) - t\\ \mathbf{elif}\;x \leq 2.4 \cdot 10^{-275}:\\ \;\;\;\;y \cdot \left(1 - z\right) - t\\ \mathbf{elif}\;x \leq 10^{-31}:\\ \;\;\;\;\left(-\log y\right) - t\\ \mathbf{else}:\\ \;\;\;\;x \cdot \log y - t\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 97.0% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -37000000000 \lor \neg \left(x \leq 4.6 \cdot 10^{-35}\right):\\
\;\;\;\;\left(x \cdot \log y - z \cdot y\right) - t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -3.7e10 or 4.5999999999999998e-35 < x

    1. Initial program 93.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(\color{blue}{\log y \cdot x} + z \cdot \left(-y\right)\right) - t \]
    12. Step-by-step derivation
      1. distribute-rgt-neg-out99.1%

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

        \[\leadsto \color{blue}{\left(\log y \cdot x - z \cdot y\right)} - t \]
    13. Applied egg-rr99.1%

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

    if -3.7e10 < x < 4.5999999999999998e-35

    1. Initial program 82.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 95.8% accurate, 1.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -9.5000000000000005e-15 or 1.7999999999999999e-22 < x

    1. Initial program 95.3%

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

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

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

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

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

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

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

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

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

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

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

    if -9.5000000000000005e-15 < x < 1.7999999999999999e-22

    1. Initial program 80.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 87.3% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -38000000000 \lor \neg \left(t \leq 0.00092\right):\\
\;\;\;\;x \cdot \log y - t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -3.8e10 or 9.2000000000000003e-4 < t

    1. Initial program 94.2%

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

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

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

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

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

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

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

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

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

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

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

    if -3.8e10 < t < 9.2000000000000003e-4

    1. Initial program 82.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. +-commutative82.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\log y, -1 + x, -t\right)} \]
    8. Step-by-step derivation
      1. fma-udef81.1%

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(x + -1\right) \cdot \log y + \sqrt{\color{blue}{t \cdot t}} \]
      11. sqrt-unprod37.2%

        \[\leadsto \left(x + -1\right) \cdot \log y + \color{blue}{\sqrt{t} \cdot \sqrt{t}} \]
      12. add-sqr-sqrt80.1%

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

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

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

Alternative 9: 60.4% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.55 \cdot 10^{+143}:\\
\;\;\;\;\left(-z \cdot y\right) - t\\

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

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


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

    1. Initial program 58.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(-\color{blue}{z \cdot y}\right) - t \]
      3. distribute-rgt-neg-in60.0%

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

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

    if -2.55000000000000019e143 < z < 6.20000000000000023e85

    1. Initial program 98.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 6.20000000000000023e85 < z

    1. Initial program 70.3%

      \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative70.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 99.1% accurate, 1.9× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \left(\color{blue}{\left(\log y \cdot \sqrt{x + -1}\right) \cdot \sqrt{x + -1}} + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
  7. 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 \]
  8. 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. mul-1-neg98.9%

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

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

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

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

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

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

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

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

Alternative 11: 88.7% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq 2.95 \cdot 10^{+170}:\\
\;\;\;\;\left(-1 + x\right) \cdot \log y - t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 2.9499999999999997e170

    1. Initial program 91.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. +-commutative91.8%

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

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

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

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

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

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

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

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

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

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

    if 2.9499999999999997e170 < z

    1. Initial program 56.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 99.0% accurate, 1.9× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 13: 46.3% 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.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \left(\color{blue}{\left(\log y \cdot \sqrt{x + -1}\right) \cdot \sqrt{x + -1}} + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
  7. 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 \]
  8. 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. mul-1-neg98.9%

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

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

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

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

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

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

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

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

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

Alternative 14: 46.1% accurate, 35.8× speedup?

\[\begin{array}{l} \\ \left(-z \cdot 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(-Float64(z * 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}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 15: 35.9% 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.9%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-t} \]
  7. Simplified32.1%

    \[\leadsto \color{blue}{-t} \]
  8. Final simplification32.1%

    \[\leadsto -t \]
  9. Add Preprocessing

Reproduce

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