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

Percentage Accurate: 89.0% → 99.8%
Time: 20.4s
Alternatives: 19
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 19 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.0% 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 87.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 99.1% accurate, 0.7× speedup?

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

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

    \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
  2. Add Preprocessing
  3. 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} \]
  4. Step-by-step derivation
    1. associate--l+99.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 63.4% accurate, 1.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \log y\\ t_2 := t - \log y\\ \mathbf{if}\;x \leq -2.9 \cdot 10^{+70}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq -6 \cdot 10^{-124}:\\ \;\;\;\;y \cdot \left(y \cdot \left(z \cdot \left(-0.5 + y \cdot -0.3333333333333333\right)\right) - z\right) - t\\ \mathbf{elif}\;x \leq -4.7 \cdot 10^{-163}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;x \leq 2.6 \cdot 10^{-212}:\\ \;\;\;\;\left(-t\right) - z \cdot y\\ \mathbf{elif}\;x \leq 5.8 \cdot 10^{-161}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;x \leq 1.32 \cdot 10^{+142}:\\ \;\;\;\;y \cdot \left(-0.5 \cdot \left(z \cdot y\right) - z\right) - t\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (log y))) (t_2 (- t (log y))))
   (if (<= x -2.9e+70)
     t_1
     (if (<= x -6e-124)
       (- (* y (- (* y (* z (+ -0.5 (* y -0.3333333333333333)))) z)) t)
       (if (<= x -4.7e-163)
         t_2
         (if (<= x 2.6e-212)
           (- (- t) (* z y))
           (if (<= x 5.8e-161)
             t_2
             (if (<= x 1.32e+142)
               (- (* y (- (* -0.5 (* z y)) z)) t)
               t_1))))))))
double code(double x, double y, double z, double t) {
	double t_1 = x * log(y);
	double t_2 = t - log(y);
	double tmp;
	if (x <= -2.9e+70) {
		tmp = t_1;
	} else if (x <= -6e-124) {
		tmp = (y * ((y * (z * (-0.5 + (y * -0.3333333333333333)))) - z)) - t;
	} else if (x <= -4.7e-163) {
		tmp = t_2;
	} else if (x <= 2.6e-212) {
		tmp = -t - (z * y);
	} else if (x <= 5.8e-161) {
		tmp = t_2;
	} else if (x <= 1.32e+142) {
		tmp = (y * ((-0.5 * (z * y)) - z)) - t;
	} else {
		tmp = 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) :: t_2
    real(8) :: tmp
    t_1 = x * log(y)
    t_2 = t - log(y)
    if (x <= (-2.9d+70)) then
        tmp = t_1
    else if (x <= (-6d-124)) then
        tmp = (y * ((y * (z * ((-0.5d0) + (y * (-0.3333333333333333d0))))) - z)) - t
    else if (x <= (-4.7d-163)) then
        tmp = t_2
    else if (x <= 2.6d-212) then
        tmp = -t - (z * y)
    else if (x <= 5.8d-161) then
        tmp = t_2
    else if (x <= 1.32d+142) then
        tmp = (y * (((-0.5d0) * (z * y)) - z)) - t
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = x * Math.log(y);
	double t_2 = t - Math.log(y);
	double tmp;
	if (x <= -2.9e+70) {
		tmp = t_1;
	} else if (x <= -6e-124) {
		tmp = (y * ((y * (z * (-0.5 + (y * -0.3333333333333333)))) - z)) - t;
	} else if (x <= -4.7e-163) {
		tmp = t_2;
	} else if (x <= 2.6e-212) {
		tmp = -t - (z * y);
	} else if (x <= 5.8e-161) {
		tmp = t_2;
	} else if (x <= 1.32e+142) {
		tmp = (y * ((-0.5 * (z * y)) - z)) - t;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x * math.log(y)
	t_2 = t - math.log(y)
	tmp = 0
	if x <= -2.9e+70:
		tmp = t_1
	elif x <= -6e-124:
		tmp = (y * ((y * (z * (-0.5 + (y * -0.3333333333333333)))) - z)) - t
	elif x <= -4.7e-163:
		tmp = t_2
	elif x <= 2.6e-212:
		tmp = -t - (z * y)
	elif x <= 5.8e-161:
		tmp = t_2
	elif x <= 1.32e+142:
		tmp = (y * ((-0.5 * (z * y)) - z)) - t
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x * log(y))
	t_2 = Float64(t - log(y))
	tmp = 0.0
	if (x <= -2.9e+70)
		tmp = t_1;
	elseif (x <= -6e-124)
		tmp = Float64(Float64(y * Float64(Float64(y * Float64(z * Float64(-0.5 + Float64(y * -0.3333333333333333)))) - z)) - t);
	elseif (x <= -4.7e-163)
		tmp = t_2;
	elseif (x <= 2.6e-212)
		tmp = Float64(Float64(-t) - Float64(z * y));
	elseif (x <= 5.8e-161)
		tmp = t_2;
	elseif (x <= 1.32e+142)
		tmp = Float64(Float64(y * Float64(Float64(-0.5 * Float64(z * y)) - z)) - t);
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x * log(y);
	t_2 = t - log(y);
	tmp = 0.0;
	if (x <= -2.9e+70)
		tmp = t_1;
	elseif (x <= -6e-124)
		tmp = (y * ((y * (z * (-0.5 + (y * -0.3333333333333333)))) - z)) - t;
	elseif (x <= -4.7e-163)
		tmp = t_2;
	elseif (x <= 2.6e-212)
		tmp = -t - (z * y);
	elseif (x <= 5.8e-161)
		tmp = t_2;
	elseif (x <= 1.32e+142)
		tmp = (y * ((-0.5 * (z * y)) - z)) - t;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t - N[Log[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.9e+70], t$95$1, If[LessEqual[x, -6e-124], N[(N[(y * N[(N[(y * N[(z * N[(-0.5 + N[(y * -0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[x, -4.7e-163], t$95$2, If[LessEqual[x, 2.6e-212], N[((-t) - N[(z * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 5.8e-161], t$95$2, If[LessEqual[x, 1.32e+142], N[(N[(y * N[(N[(-0.5 * N[(z * y), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], t$95$1]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x \cdot \log y\\
t_2 := t - \log y\\
\mathbf{if}\;x \leq -2.9 \cdot 10^{+70}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;x \leq -4.7 \cdot 10^{-163}:\\
\;\;\;\;t\_2\\

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

\mathbf{elif}\;x \leq 5.8 \cdot 10^{-161}:\\
\;\;\;\;t\_2\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if x < -2.8999999999999998e70 or 1.3199999999999999e142 < x

    1. Initial program 95.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 93.9%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\log y \cdot x} \]
    8. Simplified78.3%

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

    if -2.8999999999999998e70 < x < -6e-124

    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 z around inf 63.7%

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

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

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

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

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

      \[\leadsto \color{blue}{y \cdot \left(-1 \cdot z + y \cdot \left(-0.5 \cdot z + y \cdot \left(-0.3333333333333333 \cdot z + -0.25 \cdot \left(y \cdot z\right)\right)\right)\right)} - t \]
    7. Taylor expanded in y around 0 72.5%

      \[\leadsto y \cdot \left(-1 \cdot z + \color{blue}{y \cdot \left(-0.5 \cdot z + -0.3333333333333333 \cdot \left(y \cdot z\right)\right)}\right) - t \]
    8. Step-by-step derivation
      1. +-commutative72.5%

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

        \[\leadsto y \cdot \left(-1 \cdot z + y \cdot \left(\color{blue}{\left(-0.3333333333333333 \cdot y\right) \cdot z} + -0.5 \cdot z\right)\right) - t \]
      3. distribute-rgt-out72.5%

        \[\leadsto y \cdot \left(-1 \cdot z + y \cdot \color{blue}{\left(z \cdot \left(-0.3333333333333333 \cdot y + -0.5\right)\right)}\right) - t \]
      4. *-commutative72.5%

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

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

    if -6e-124 < x < -4.7e-163 or 2.6e-212 < x < 5.8e-161

    1. Initial program 87.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 87.1%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{{\left(\sqrt[3]{\mathsf{fma}\left(\log y, -1 + x, -t\right)}\right)}^{3}} \]
      3. add-sqr-sqrt44.3%

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

        \[\leadsto {\left(\sqrt[3]{\mathsf{fma}\left(\log y, -1 + x, \color{blue}{\sqrt{\left(-t\right) \cdot \left(-t\right)}}\right)}\right)}^{3} \]
      5. sqr-neg80.5%

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

        \[\leadsto {\left(\sqrt[3]{\mathsf{fma}\left(\log y, -1 + x, \color{blue}{\sqrt{t} \cdot \sqrt{t}}\right)}\right)}^{3} \]
      7. add-sqr-sqrt75.4%

        \[\leadsto {\left(\sqrt[3]{\mathsf{fma}\left(\log y, -1 + x, \color{blue}{t}\right)}\right)}^{3} \]
    7. Applied egg-rr75.4%

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

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

        \[\leadsto t + \color{blue}{\left(-\log y\right)} \]
      2. unsub-neg76.6%

        \[\leadsto \color{blue}{t - \log y} \]
    10. Simplified76.6%

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

    if -4.7e-163 < x < 2.6e-212

    1. Initial program 80.2%

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

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

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

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

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

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

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

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

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

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

    if 5.8e-161 < x < 1.3199999999999999e142

    1. Initial program 83.0%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.9 \cdot 10^{+70}:\\ \;\;\;\;x \cdot \log y\\ \mathbf{elif}\;x \leq -6 \cdot 10^{-124}:\\ \;\;\;\;y \cdot \left(y \cdot \left(z \cdot \left(-0.5 + y \cdot -0.3333333333333333\right)\right) - z\right) - t\\ \mathbf{elif}\;x \leq -4.7 \cdot 10^{-163}:\\ \;\;\;\;t - \log y\\ \mathbf{elif}\;x \leq 2.6 \cdot 10^{-212}:\\ \;\;\;\;\left(-t\right) - z \cdot y\\ \mathbf{elif}\;x \leq 5.8 \cdot 10^{-161}:\\ \;\;\;\;t - \log y\\ \mathbf{elif}\;x \leq 1.32 \cdot 10^{+142}:\\ \;\;\;\;y \cdot \left(-0.5 \cdot \left(z \cdot y\right) - z\right) - t\\ \mathbf{else}:\\ \;\;\;\;x \cdot \log y\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 74.2% accurate, 1.7× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (-.f64 x 1) < -5.0000000000000002e70 or 2.0000000000000001e142 < (-.f64 x 1)

    1. Initial program 95.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 93.9%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\log y \cdot x} \]
    8. Simplified78.3%

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

    if -5.0000000000000002e70 < (-.f64 x 1) < -0.99999999999800004

    1. Initial program 84.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 83.8%

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

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

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

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

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

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

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

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

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

    if -0.99999999999800004 < (-.f64 x 1) < 2.0000000000000001e142

    1. Initial program 81.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 z around inf 56.1%

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

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

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

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

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

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

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

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

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

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

Alternative 6: 95.0% accurate, 1.7× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;x \cdot \log y - t\\


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

    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 93.4%

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

    if -1.0000000099999999 < (-.f64 x 1) < 5.0000000000000001e29

    1. Initial program 82.8%

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

      \[\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. associate--l+99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.0000000000000001e29 < (-.f64 x 1)

    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 x around inf 93.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \left(\log y + \color{blue}{\left(-\frac{t}{x}\right)}\right) \]
      2. distribute-neg-frac291.3%

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

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

      \[\leadsto \color{blue}{-1 \cdot t + x \cdot \log y} \]
    10. Step-by-step derivation
      1. neg-mul-191.3%

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

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

        \[\leadsto \color{blue}{x \cdot \log y - t} \]
      4. *-commutative91.3%

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

      \[\leadsto \color{blue}{\log y \cdot x - t} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification95.5%

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

Alternative 7: 95.6% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
t_1 := \log y \cdot \left(-1 + x\right)\\
\mathbf{if}\;t \leq -0.00038:\\
\;\;\;\;t \cdot \left(-1 + \log y \cdot \frac{-1 + x}{t}\right)\\

\mathbf{elif}\;t \leq 3.4 \cdot 10^{-9}:\\
\;\;\;\;y \cdot \left(1 - z\right) + t\_1\\

\mathbf{else}:\\
\;\;\;\;t\_1 - t\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -3.8000000000000002e-4

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.8000000000000002e-4 < t < 3.3999999999999998e-9

    1. Initial program 80.2%

      \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
    2. Add Preprocessing
    3. Taylor expanded in 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} \]
    4. Step-by-step derivation
      1. associate--l+99.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.3999999999999998e-9 < t

    1. Initial program 91.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 90.8%

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

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

Alternative 8: 86.7% accurate, 1.8× speedup?

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

    1. Initial program 92.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \left(\log y + \color{blue}{\left(-\frac{t}{x}\right)}\right) \]
      2. distribute-neg-frac290.8%

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

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

      \[\leadsto \color{blue}{-1 \cdot t + x \cdot \log y} \]
    10. Step-by-step derivation
      1. neg-mul-190.8%

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

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

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

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

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

    if -4e15 < (-.f64 x 1) < -0.5

    1. Initial program 84.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 83.4%

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

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

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

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

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

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

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

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

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

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

Alternative 9: 88.2% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.4 \cdot 10^{+171} \lor \neg \left(z \leq 1.45 \cdot 10^{+133}\right):\\
\;\;\;\;z \cdot \mathsf{log1p}\left(-y\right) - t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -5.3999999999999996e171 or 1.4500000000000001e133 < z

    1. Initial program 53.7%

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

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

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

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

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

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

    if -5.3999999999999996e171 < z < 1.4500000000000001e133

    1. Initial program 98.0%

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

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

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

Alternative 10: 65.5% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.06 \cdot 10^{+68} \lor \neg \left(x \leq 1.95 \cdot 10^{+142}\right):\\
\;\;\;\;x \cdot \log y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.06e68 or 1.95e142 < x

    1. Initial program 95.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 93.9%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\log y \cdot x} \]
    8. Simplified78.3%

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

    if -1.06e68 < x < 1.95e142

    1. Initial program 84.2%

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

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

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

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

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

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

      \[\leadsto \color{blue}{y \cdot \left(-1 \cdot z + y \cdot \left(-0.5 \cdot z + y \cdot \left(-0.3333333333333333 \cdot z + -0.25 \cdot \left(y \cdot z\right)\right)\right)\right)} - t \]
    7. Taylor expanded in y around 0 63.4%

      \[\leadsto y \cdot \left(-1 \cdot z + \color{blue}{y \cdot \left(-0.5 \cdot z + -0.3333333333333333 \cdot \left(y \cdot z\right)\right)}\right) - t \]
    8. Step-by-step derivation
      1. +-commutative63.4%

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

        \[\leadsto y \cdot \left(-1 \cdot z + y \cdot \left(\color{blue}{\left(-0.3333333333333333 \cdot y\right) \cdot z} + -0.5 \cdot z\right)\right) - t \]
      3. distribute-rgt-out63.4%

        \[\leadsto y \cdot \left(-1 \cdot z + y \cdot \color{blue}{\left(z \cdot \left(-0.3333333333333333 \cdot y + -0.5\right)\right)}\right) - t \]
      4. *-commutative63.4%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.06 \cdot 10^{+68} \lor \neg \left(x \leq 1.95 \cdot 10^{+142}\right):\\ \;\;\;\;x \cdot \log y\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(y \cdot \left(z \cdot \left(-0.5 + y \cdot -0.3333333333333333\right)\right) - z\right) - t\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 99.1% accurate, 1.9× speedup?

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

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

    \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
  2. Add Preprocessing
  3. 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 \]
  4. Step-by-step derivation
    1. +-commutative99.2%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 45.9% accurate, 11.3× speedup?

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{y \cdot \left(-1 \cdot z + y \cdot \left(-0.5 \cdot z + y \cdot \left(-0.3333333333333333 \cdot z + -0.25 \cdot \left(y \cdot z\right)\right)\right)\right)} - t \]
  7. Taylor expanded in z around 0 48.9%

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

    \[\leadsto y \cdot \left(z \cdot \left(-1 + y \cdot \left(y \cdot \left(y \cdot -0.25 - 0.3333333333333333\right) - 0.5\right)\right)\right) - t \]
  9. Add Preprocessing

Alternative 13: 42.5% accurate, 14.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -0.00105 \lor \neg \left(t \leq 1550000\right):\\
\;\;\;\;-t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -0.00104999999999999994 or 1.55e6 < t

    1. Initial program 94.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 t around inf 67.3%

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

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

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

    if -0.00104999999999999994 < t < 1.55e6

    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 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} \]
    4. Step-by-step derivation
      1. associate--l+99.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 14: 45.9% accurate, 14.3× speedup?

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{y \cdot \left(-1 \cdot z + y \cdot \left(-0.5 \cdot z + y \cdot \left(-0.3333333333333333 \cdot z + -0.25 \cdot \left(y \cdot z\right)\right)\right)\right)} - t \]
  7. Taylor expanded in y around 0 48.9%

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

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

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

      \[\leadsto y \cdot \left(-1 \cdot z + y \cdot \color{blue}{\left(z \cdot \left(-0.3333333333333333 \cdot y + -0.5\right)\right)}\right) - t \]
    4. *-commutative48.9%

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

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

    \[\leadsto y \cdot \left(y \cdot \left(z \cdot \left(-0.5 + y \cdot -0.3333333333333333\right)\right) - z\right) - t \]
  11. Add Preprocessing

Alternative 15: 42.2% accurate, 15.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -0.00105 \lor \neg \left(t \leq 6700000\right):\\
\;\;\;\;-t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -0.00104999999999999994 or 6.7e6 < t

    1. Initial program 94.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 t around inf 67.3%

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

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

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

    if -0.00104999999999999994 < t < 6.7e6

    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 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} \]
    4. Step-by-step derivation
      1. associate--l+99.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 16: 45.8% accurate, 19.5× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 17: 45.5% accurate, 35.8× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 18: 34.9% accurate, 107.5× speedup?

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

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

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

      \[\leadsto \color{blue}{-t} \]
  5. Simplified37.1%

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

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

Alternative 19: 2.3% accurate, 215.0× speedup?

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

\\
t
\end{array}
Derivation
  1. Initial program 87.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 86.9%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{{\left(\sqrt[3]{\mathsf{fma}\left(\log y, -1 + x, -t\right)}\right)}^{3}} \]
    3. add-sqr-sqrt43.0%

      \[\leadsto {\left(\sqrt[3]{\mathsf{fma}\left(\log y, -1 + x, \color{blue}{\sqrt{-t} \cdot \sqrt{-t}}\right)}\right)}^{3} \]
    4. sqrt-unprod51.9%

      \[\leadsto {\left(\sqrt[3]{\mathsf{fma}\left(\log y, -1 + x, \color{blue}{\sqrt{\left(-t\right) \cdot \left(-t\right)}}\right)}\right)}^{3} \]
    5. sqr-neg51.9%

      \[\leadsto {\left(\sqrt[3]{\mathsf{fma}\left(\log y, -1 + x, \sqrt{\color{blue}{t \cdot t}}\right)}\right)}^{3} \]
    6. sqrt-unprod24.0%

      \[\leadsto {\left(\sqrt[3]{\mathsf{fma}\left(\log y, -1 + x, \color{blue}{\sqrt{t} \cdot \sqrt{t}}\right)}\right)}^{3} \]
    7. add-sqr-sqrt48.7%

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

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

    \[\leadsto \color{blue}{t} \]
  9. Final simplification2.1%

    \[\leadsto t \]
  10. Add Preprocessing

Reproduce

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