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

Percentage Accurate: 89.0% → 99.8%
Time: 19.8s
Alternatives: 18
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 18 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 89.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-neg89.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. +-commutative89.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+89.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-define89.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-neg89.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-eval89.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-neg89.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.9%

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

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

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

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

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

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

Alternative 2: 99.8% accurate, 0.7× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 99.6% accurate, 1.7× speedup?

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

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

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

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

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

Alternative 4: 99.5% accurate, 1.7× speedup?

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

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

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

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

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

Alternative 5: 95.6% accurate, 1.8× speedup?

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

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

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


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

    1. Initial program 93.3%

      \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 99.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. +-commutative99.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -500 < (-.f64 x 1) < -0.999999980000000011

    1. Initial program 85.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 \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. +-commutative98.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 86.2% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
t_1 := x \cdot \log y - t\\
\mathbf{if}\;x \leq -500:\\
\;\;\;\;t\_1\\

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -500 or 1 < x

    1. Initial program 93.0%

      \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 99.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. +-commutative99.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -500 < x < -3.34999999999999987e-93

    1. Initial program 61.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.34999999999999987e-93 < x < 1

    1. Initial program 88.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. +-commutative99.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-\left(t + \log y\right)} \]
      2. distribute-neg-in85.4%

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

        \[\leadsto \color{blue}{\left(-t\right) - \log y} \]
    12. Simplified85.4%

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

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

Alternative 7: 98.2% accurate, 1.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.15999999999999992 or 1 < x

    1. Initial program 93.0%

      \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 99.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. +-commutative99.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.15999999999999992 < x < 1

    1. Initial program 85.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 98.1% accurate, 1.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.15999999999999992 or 1 < x

    1. Initial program 93.0%

      \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 99.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. +-commutative99.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.15999999999999992 < x < 1

    1. Initial program 85.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 99.4% accurate, 1.8× speedup?

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

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

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

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

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

Alternative 10: 60.3% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.9 \cdot 10^{+140} \lor \neg \left(z \leq 4.4 \cdot 10^{+166}\right):\\
\;\;\;\;y \cdot \left(y \cdot \left(z \cdot -0.5 + -0.3333333333333333 \cdot \left(z \cdot y\right)\right) - z\right) - t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -3.89999999999999974e140 or 4.3999999999999998e166 < z

    1. Initial program 61.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.89999999999999974e140 < z < 4.3999999999999998e166

    1. Initial program 99.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-\left(t + \log y\right)} \]
      2. distribute-neg-in63.4%

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

        \[\leadsto \color{blue}{\left(-t\right) - \log y} \]
    12. Simplified63.4%

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

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

Alternative 11: 99.1% accurate, 1.9× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 88.3% accurate, 1.9× speedup?

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

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

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


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

    1. Initial program 93.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.2000000000000001e166 < z

    1. Initial program 57.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 13: 98.9% accurate, 1.9× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 14: 46.9% accurate, 12.6× speedup?

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

\\
y \cdot \left(y \cdot \left(z \cdot -0.5 + -0.3333333333333333 \cdot \left(z \cdot y\right)\right) - z\right) - t
\end{array}
Derivation
  1. Initial program 89.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-neg89.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. +-commutative89.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+89.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-define89.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-neg89.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-eval89.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-neg89.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.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 t around inf 78.8%

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

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

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

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

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

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

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

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

Alternative 15: 46.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 89.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-neg89.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. +-commutative89.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+89.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-define89.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-neg89.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-eval89.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-neg89.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.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 t around inf 78.8%

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

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

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

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

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

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

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

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

Alternative 16: 46.7% accurate, 30.7× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 17: 46.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 89.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 18: 36.0% 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 89.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-neg89.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. +-commutative89.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+89.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-define89.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-neg89.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-eval89.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-neg89.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.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 t around inf 78.8%

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

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

      \[\leadsto \color{blue}{-t} \]
  8. Simplified39.0%

    \[\leadsto \color{blue}{-t} \]
  9. Final simplification39.0%

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

Reproduce

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