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

Percentage Accurate: 89.5% → 99.8%
Time: 24.5s
Alternatives: 15
Speedup: 1.9×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 15 alternatives:

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

Initial Program: 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.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.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. +-commutative88.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. associate--l+88.0%

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(z + -1, \mathsf{log1p}\left(-y\right), \color{blue}{\mathsf{fma}\left(x - 1, \log y, -t\right)}\right) \]
    9. 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) \]
    10. 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: 98.2% accurate, 1.7× speedup?

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

\\
\begin{array}{l}
t_1 := \left(z + -1\right) \cdot y\\
\mathbf{if}\;-1 + x \leq -20 \lor \neg \left(-1 + x \leq -0.9998\right):\\
\;\;\;\;\left(x \cdot \log y - t\_1\right) - t\\

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -20 < (-.f64 x 1) < -0.99980000000000002

    1. Initial program 81.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 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 95.7% accurate, 1.7× speedup?

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

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

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

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


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

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

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

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

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

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

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

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

    if -5e6 < (-.f64 x 1) < -1

    1. Initial program 80.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(-1 \cdot y\right)}\right) - t \]
    4. Step-by-step derivation
      1. mul-1-neg100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1 < (-.f64 x 1)

    1. Initial program 93.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. +-commutative93.2%

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 95.7% accurate, 1.7× speedup?

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

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

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

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


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

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

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

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

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

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

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

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

    if -5e6 < (-.f64 x 1) < -1

    1. Initial program 80.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(-1 \cdot y\right)}\right) - t \]
    4. Step-by-step derivation
      1. mul-1-neg100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1 < (-.f64 x 1)

    1. Initial program 93.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. +-commutative93.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 90.3% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.8 \cdot 10^{+215} \lor \neg \left(z \leq 4.2 \cdot 10^{+216}\right):\\
\;\;\;\;\left(-t\right) - z \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -5.7999999999999999e215 or 4.20000000000000003e216 < z

    1. Initial program 57.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.9%

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

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

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

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

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

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

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

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

    if -5.7999999999999999e215 < z < 4.20000000000000003e216

    1. Initial program 95.6%

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

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

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

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

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

Alternative 6: 90.1% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.2 \cdot 10^{+217} \lor \neg \left(z \leq 4.1 \cdot 10^{+216}\right):\\
\;\;\;\;\left(-t\right) - z \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -4.2000000000000002e217 or 4.0999999999999998e216 < z

    1. Initial program 57.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.9%

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

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

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

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

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

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

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

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

    if -4.2000000000000002e217 < z < 4.0999999999999998e216

    1. Initial program 95.6%

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

        \[\leadsto \color{blue}{\left(\left(z - 1\right) \cdot \log \left(1 - y\right) + \left(x - 1\right) \cdot \log y\right)} - t \]
      2. fma-define95.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-neg95.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-eval95.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-neg95.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. Taylor expanded in y around 0 95.5%

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

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

Alternative 7: 77.3% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.65 \cdot 10^{+14} \lor \neg \left(t \leq 8.6 \cdot 10^{+74}\right):\\
\;\;\;\;\left(-t\right) - z \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -2.65e14 or 8.60000000000000001e74 < 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 y around 0 99.9%

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

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

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

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

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

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

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

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

    if -2.65e14 < t < 8.60000000000000001e74

    1. Initial program 83.4%

      \[\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. +-commutative83.4%

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

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

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

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

        \[\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. Taylor expanded in y around 0 83.2%

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

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

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

Alternative 8: 87.5% accurate, 1.9× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -9.5e7 or 2400 < t

    1. Initial program 94.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. 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(-1 \cdot y\right)}\right) - t \]
    4. Step-by-step derivation
      1. mul-1-neg99.9%

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

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

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

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

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

    if -9.5e7 < t < 2400

    1. Initial program 81.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. +-commutative81.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-define81.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-neg81.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-eval81.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-neg81.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. Taylor expanded in y around 0 81.4%

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

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

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

Alternative 9: 61.4% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.9 \cdot 10^{+132} \lor \neg \left(z \leq 4.6 \cdot 10^{+146}\right):\\
\;\;\;\;\left(-t\right) - z \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -3.90000000000000001e132 or 4.60000000000000001e146 < z

    1. Initial program 68.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.8%

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

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

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

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

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

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

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

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

    if -3.90000000000000001e132 < z < 4.60000000000000001e146

    1. Initial program 98.7%

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(z + -1, \log \color{blue}{\left(1 + \left(-y\right)\right)}, \left(x - 1\right) \cdot \log y\right) - t \]
      6. log1p-define99.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 y around 0 98.6%

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

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

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

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

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

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

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

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

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

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

Alternative 10: 99.1% accurate, 1.9× speedup?

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

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

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

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

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

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

Alternative 11: 43.6% accurate, 15.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -9 \cdot 10^{-33} \lor \neg \left(t \leq 72000000\right):\\
\;\;\;\;-t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -8.99999999999999982e-33 or 7.2e7 < t

    1. Initial program 94.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. +-commutative94.5%

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

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

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

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

        \[\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. Taylor expanded in t around inf 65.7%

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

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

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

    if -8.99999999999999982e-33 < t < 7.2e7

    1. Initial program 80.8%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-y \cdot z} \]
      2. *-commutative21.9%

        \[\leadsto -\color{blue}{z \cdot y} \]
      3. distribute-rgt-neg-in21.9%

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

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

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

Alternative 12: 46.7% 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 88.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.9%

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

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

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

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

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

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

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

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

      \[\leadsto y \cdot \left(-\color{blue}{\left(-1 + z\right)}\right) - t \]
    6. distribute-neg-in47.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 14: 36.5% 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.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. +-commutative88.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-define88.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-neg88.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-eval88.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-neg88.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-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. Taylor expanded in t around inf 35.7%

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

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

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

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

Alternative 15: 2.9% accurate, 215.0× speedup?

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

\\
y
\end{array}
Derivation
  1. Initial program 88.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.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{y} \]
  10. Final simplification2.8%

    \[\leadsto y \]
  11. Add Preprocessing

Reproduce

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