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

Percentage Accurate: 89.3% → 99.8%
Time: 15.6s
Alternatives: 13
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 13 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.3% 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 91.0%

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

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

      \[\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+91.0%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 99.7% accurate, 1.7× speedup?

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

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

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

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

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

Alternative 4: 99.6% accurate, 1.7× speedup?

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

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

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

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

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

Alternative 5: 94.6% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
t_1 := \left(-1 + x\right) \cdot \log y\\
\mathbf{if}\;t \leq -4 \cdot 10^{+50} \lor \neg \left(t \leq 2.55 \cdot 10^{-14}\right):\\
\;\;\;\;t\_1 - t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -4.0000000000000003e50 or 2.5499999999999999e-14 < t

    1. Initial program 97.1%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(z + -1, \mathsf{log1p}\left(-y\right), \left(x + -1\right) \cdot \log y\right) - t} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. add-sqr-sqrt75.9%

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

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

      \[\leadsto \mathsf{fma}\left(z + -1, \mathsf{log1p}\left(-y\right), \color{blue}{{\left(\sqrt{\left(x + -1\right) \cdot \log y}\right)}^{2}}\right) - t \]
    7. Taylor expanded in y around 0 96.7%

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

    if -4.0000000000000003e50 < t < 2.5499999999999999e-14

    1. Initial program 86.3%

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

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

        \[\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+86.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 99.5% accurate, 1.8× speedup?

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

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

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

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

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

Alternative 7: 69.4% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.6 \cdot 10^{-62} \lor \neg \left(x \leq 0.0122\right):\\
\;\;\;\;x \cdot \left(\log y - \frac{t}{x}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -3.6e-62 or 0.0122000000000000008 < x

    1. Initial program 93.4%

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

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

        \[\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+93.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(1 - \color{blue}{\frac{x \cdot \log y}{t}}\right) \cdot \left(-t\right) \]
    10. Step-by-step derivation
      1. associate-/l*71.2%

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

      \[\leadsto \left(1 - \color{blue}{x \cdot \frac{\log y}{t}}\right) \cdot \left(-t\right) \]
    12. Taylor expanded in x around inf 90.2%

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

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

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

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

    if -3.6e-62 < x < 0.0122000000000000008

    1. Initial program 87.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-t} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification72.2%

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

Alternative 8: 57.8% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.05 \cdot 10^{+89} \lor \neg \left(x \leq 230000000000\right):\\
\;\;\;\;x \cdot \log y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.04999999999999993e89 or 2.3e11 < x

    1. Initial program 96.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.04999999999999993e89 < x < 2.3e11

    1. Initial program 86.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-t} \]
    9. Simplified46.3%

      \[\leadsto \color{blue}{-t} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification62.5%

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

Alternative 9: 99.1% accurate, 1.9× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 88.2% accurate, 2.0× speedup?

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(z + -1, \log \color{blue}{\left(1 + \left(-y\right)\right)}, \left(x - 1\right) \cdot \log y\right) - t \]
    6. log1p-define99.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. Step-by-step derivation
    1. add-sqr-sqrt73.1%

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

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

    \[\leadsto \mathsf{fma}\left(z + -1, \mathsf{log1p}\left(-y\right), \color{blue}{{\left(\sqrt{\left(x + -1\right) \cdot \log y}\right)}^{2}}\right) - t \]
  7. Taylor expanded in y around 0 89.7%

    \[\leadsto \color{blue}{\log y \cdot \left(x - 1\right) - t} \]
  8. Final simplification89.7%

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

Alternative 11: 42.1% accurate, 13.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -8.8 \cdot 10^{+49} \lor \neg \left(t \leq 1.5 \cdot 10^{-10}\right):\\
\;\;\;\;-t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -8.8000000000000003e49 or 1.5e-10 < t

    1. Initial program 97.0%

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

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

        \[\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+97.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-t} \]
    9. Simplified67.8%

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

    if -8.8000000000000003e49 < t < 1.5e-10

    1. Initial program 86.4%

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

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

        \[\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+86.4%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{y \cdot \left(z \cdot \left(\frac{1}{z} - 1\right)\right)} \]
    11. Step-by-step derivation
      1. *-commutative17.0%

        \[\leadsto \color{blue}{\left(z \cdot \left(\frac{1}{z} - 1\right)\right) \cdot y} \]
      2. sub-neg17.0%

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

        \[\leadsto \left(z \cdot \left(\frac{1}{z} + \color{blue}{-1}\right)\right) \cdot y \]
      4. +-commutative17.0%

        \[\leadsto \left(z \cdot \color{blue}{\left(-1 + \frac{1}{z}\right)}\right) \cdot y \]
      5. distribute-rgt-in17.0%

        \[\leadsto \color{blue}{\left(-1 \cdot z + \frac{1}{z} \cdot z\right)} \cdot y \]
      6. mul-1-neg17.0%

        \[\leadsto \left(\color{blue}{\left(-z\right)} + \frac{1}{z} \cdot z\right) \cdot y \]
      7. lft-mult-inverse17.0%

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

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

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

        \[\leadsto \left(-\left(z + \color{blue}{\left(-1\right)}\right)\right) \cdot y \]
      11. sub-neg17.0%

        \[\leadsto \left(-\color{blue}{\left(z - 1\right)}\right) \cdot y \]
      12. distribute-lft-neg-in17.0%

        \[\leadsto \color{blue}{-\left(z - 1\right) \cdot y} \]
      13. distribute-rgt-neg-in17.0%

        \[\leadsto \color{blue}{\left(z - 1\right) \cdot \left(-y\right)} \]
      14. sub-neg17.0%

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

        \[\leadsto \left(z + \color{blue}{-1}\right) \cdot \left(-y\right) \]
      16. +-commutative17.0%

        \[\leadsto \color{blue}{\left(-1 + z\right)} \cdot \left(-y\right) \]
    12. Simplified17.0%

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

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

Alternative 12: 41.8% accurate, 15.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -8.8 \cdot 10^{+49} \lor \neg \left(t \leq 1.5 \cdot 10^{-10}\right):\\
\;\;\;\;-t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -8.8000000000000003e49 or 1.5e-10 < t

    1. Initial program 97.0%

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

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

        \[\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+97.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-t} \]
    9. Simplified67.8%

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

    if -8.8000000000000003e49 < t < 1.5e-10

    1. Initial program 86.4%

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

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

        \[\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+86.4%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-y\right)} \cdot z \]
    12. Simplified16.6%

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

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

Alternative 13: 35.6% 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 91.0%

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

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

      \[\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+91.0%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-t} \]
  9. Simplified31.8%

    \[\leadsto \color{blue}{-t} \]
  10. Add Preprocessing

Reproduce

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