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

Percentage Accurate: 89.1% → 99.8%
Time: 15.6s
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.1% 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.5× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 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 88.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. +-commutative88.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-define88.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-neg88.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-eval88.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-neg88.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-define99.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 3: 99.0% accurate, 1.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z + -1 \leq -5 \cdot 10^{+20} \lor \neg \left(z + -1 \leq 2 \cdot 10^{+29}\right):\\
\;\;\;\;z \cdot \left(\log y \cdot \frac{-1 + x}{z} - y\right) - t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 z #s(literal 1 binary64)) < -5e20 or 1.99999999999999983e29 < (-.f64 z #s(literal 1 binary64))

    1. Initial program 75.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 y around 0 99.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5e20 < (-.f64 z #s(literal 1 binary64)) < 1.99999999999999983e29

    1. Initial program 99.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 y around 0 99.6%

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

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

Alternative 4: 95.0% accurate, 1.7× speedup?

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

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

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

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


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

    1. Initial program 94.9%

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

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

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

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

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

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

    1. Initial program 84.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    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 y around 0 92.8%

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

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

Alternative 5: 99.5% accurate, 1.8× speedup?

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

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

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

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

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

Alternative 6: 87.3% accurate, 1.9× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -242000 or 1 < 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 y around 0 99.7%

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

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

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

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

    if -242000 < x < 1

    1. Initial program 84.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. Taylor expanded in y around 0 83.5%

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

      \[\leadsto \color{blue}{-1 \cdot \log y} - t \]
    5. Step-by-step derivation
      1. mul-1-neg82.7%

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

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

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

Alternative 7: 87.4% accurate, 1.9× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -242000 or 1 < 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 y around 0 99.7%

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

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

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

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

    if -242000 < x < 1

    1. Initial program 84.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{y - \left(t + \log y\right)} \]
    12. Step-by-step derivation
      1. associate--r+83.0%

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

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

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

Alternative 8: 60.9% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
t_1 := -1 + y \cdot -0.5\\
\mathbf{if}\;z \leq -1.05 \cdot 10^{+167}:\\
\;\;\;\;z \cdot \left(y \cdot t\_1 - \frac{t}{z}\right)\\

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

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


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

    1. Initial program 62.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 y around 0 99.6%

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

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

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

    if -1.05e167 < z < 1.39999999999999994e93

    1. Initial program 97.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. Taylor expanded in y around 0 96.8%

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

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

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

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

    if 1.39999999999999994e93 < z

    1. Initial program 66.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 y around 0 99.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.05 \cdot 10^{+167}:\\ \;\;\;\;z \cdot \left(y \cdot \left(-1 + y \cdot -0.5\right) - \frac{t}{z}\right)\\ \mathbf{elif}\;z \leq 1.4 \cdot 10^{+93}:\\ \;\;\;\;\left(-t\right) - \log y\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(z \cdot \left(-1 + y \cdot -0.5\right)\right) - t\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 89.0% accurate, 1.9× speedup?

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

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

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


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

    1. Initial program 91.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 y around 0 90.4%

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

    if 2e229 < (-.f64 z #s(literal 1 binary64))

    1. Initial program 45.7%

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

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

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

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

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

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

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

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

Alternative 10: 99.2% accurate, 1.9× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 43.1% accurate, 14.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.6 \cdot 10^{-13} \lor \neg \left(t \leq 5400\right):\\
\;\;\;\;-t\\

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


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

    1. Initial program 94.9%

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

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

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

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

    if -1.6e-13 < t < 5400

    1. Initial program 82.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(z + -1, \mathsf{log1p}\left(-y\right), \color{blue}{-1 \cdot \log y - t}\right) \]
    6. Step-by-step derivation
      1. mul-1-neg59.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1.6 \cdot 10^{-13} \lor \neg \left(t \leq 5400\right):\\ \;\;\;\;-t\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(1 - z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 42.8% accurate, 15.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.6 \cdot 10^{-13} \lor \neg \left(t \leq 62000\right):\\
\;\;\;\;-t\\

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


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

    1. Initial program 94.9%

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

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

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

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

    if -1.6e-13 < t < 62000

    1. Initial program 82.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 y around 0 99.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 13: 46.1% accurate, 23.9× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 14: 45.9% accurate, 35.8× speedup?

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

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

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

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

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

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

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

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

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

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

Alternative 15: 35.4% accurate, 107.5× speedup?

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

\\
-t
\end{array}
Derivation
  1. Initial program 88.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 t around inf 33.6%

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

      \[\leadsto \color{blue}{-t} \]
  5. Simplified33.6%

    \[\leadsto \color{blue}{-t} \]
  6. Final simplification33.6%

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

Reproduce

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