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

Percentage Accurate: 88.9% → 99.8%
Time: 16.1s
Alternatives: 19
Speedup: 1.9×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 19 alternatives:

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

Initial Program: 88.9% 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.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.9%

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 99.8% accurate, 0.7× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 99.6% accurate, 1.7× speedup?

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

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

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

    \[\leadsto \left(\left(-1 + x\right) \cdot \log y + \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)\right) - t \]
  5. Add Preprocessing

Alternative 4: 94.9% accurate, 1.7× speedup?

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

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

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


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

    1. Initial program 93.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 93.6%

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

    if -1.00000099999999992 < (-.f64 x #s(literal 1 binary64)) < 2.00000000000000011e32

    1. Initial program 85.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 98.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 99.6% accurate, 1.7× speedup?

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

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

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

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

Alternative 6: 99.5% accurate, 1.8× speedup?

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

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

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

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

Alternative 7: 86.9% accurate, 1.9× speedup?

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

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

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


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

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

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

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

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

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

    if -1.1000000000000001 < x < 1

    1. Initial program 86.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 76.1% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.4 \cdot 10^{+30} \lor \neg \left(x \leq 2.7 \cdot 10^{+34}\right):\\
\;\;\;\;x \cdot \log y - t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -5.3999999999999997e30 or 2.7e34 < x

    1. Initial program 94.3%

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

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

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

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

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

    if -5.3999999999999997e30 < x < 2.7e34

    1. Initial program 85.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 98.2%

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

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

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

        \[\leadsto \left(\log y \cdot \left(x + \color{blue}{-1}\right) + -1 \cdot \left(y \cdot \left(z - 1\right)\right)\right) - t \]
      4. fma-define98.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-neg98.3%

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

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

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

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

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

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

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

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

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

Alternative 9: 88.1% accurate, 1.9× speedup?

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

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

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


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

    1. Initial program 91.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 7.0000000000000002e277 < z

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 88.0% accurate, 1.9× speedup?

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

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

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


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

    1. Initial program 91.6%

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

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

    if 7.49999999999999978e275 < z

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 7.5 \cdot 10^{+275}:\\ \;\;\;\;\left(-1 + x\right) \cdot \log y - t\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(1 - \left(z + \frac{\log y}{y}\right)\right)\\ \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.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 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. Final simplification98.9%

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

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

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


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

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

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

    if 5.1000000000000004e177 < z

    1. Initial program 52.6%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 5.1 \cdot 10^{+177}:\\ \;\;\;\;\left(-1 + x\right) \cdot \log y - t\\ \mathbf{else}:\\ \;\;\;\;z \cdot \mathsf{log1p}\left(-y\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.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 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.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: 43.2% accurate, 14.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -37000 \lor \neg \left(t \leq 2.65 \cdot 10^{+16}\right):\\
\;\;\;\;-t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -37000 or 2.65e16 < t

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

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

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

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

    if -37000 < t < 2.65e16

    1. Initial program 85.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 98.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. associate--l+98.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 15: 42.9% accurate, 15.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -246 \lor \neg \left(t \leq 2.5 \cdot 10^{+16}\right):\\
\;\;\;\;-t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -246 or 2.5e16 < t

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

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

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

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

    if -246 < t < 2.5e16

    1. Initial program 85.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 98.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. associate--l+98.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 16: 46.3% 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.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 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 y around inf 47.4%

    \[\leadsto \color{blue}{y \cdot \left(1 - z\right)} - t \]
  7. Add Preprocessing

Alternative 17: 46.1% 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.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 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 47.2%

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

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

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

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

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

Alternative 18: 35.3% 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.9%

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

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

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

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

Alternative 19: 2.9% accurate, 215.0× speedup?

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

\\
y
\end{array}
Derivation
  1. Initial program 89.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 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. associate--l+98.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{y} \]
  8. Add Preprocessing

Reproduce

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