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

Percentage Accurate: 89.5% → 99.8%
Time: 14.7s
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.5% accurate, 1.0× speedup?

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

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

Alternative 1: 99.8% accurate, 0.7× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 99.6% accurate, 1.7× speedup?

\[\begin{array}{l} \\ \left(\log y \cdot \left(-1 + x\right) + \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
 (-
  (+
   (* (log y) (+ -1.0 x))
   (*
    (+ 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 ((log(y) * (-1.0 + x)) + ((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 = ((log(y) * ((-1.0d0) + x)) + ((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 ((Math.log(y) * (-1.0 + x)) + ((z + -1.0) * (y * (-1.0 + (y * ((y * ((y * -0.25) - 0.3333333333333333)) - 0.5)))))) - t;
}
def code(x, y, z, t):
	return ((math.log(y) * (-1.0 + x)) + ((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(log(y) * Float64(-1.0 + x)) + 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 = ((log(y) * (-1.0 + x)) + ((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[Log[y], $MachinePrecision] * N[(-1.0 + x), $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(\log y \cdot \left(-1 + x\right) + \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 90.6%

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

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

    \[\leadsto \left(\log y \cdot \left(-1 + x\right) + \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 3: 98.0% accurate, 1.7× speedup?

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

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

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


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

    1. Initial program 96.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 + \color{blue}{y \cdot \left(-1 \cdot \left(z - 1\right) + -0.5 \cdot \left(y \cdot \left(z - 1\right)\right)\right)}\right) - t \]
    4. 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} \]
    5. 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. mul-1-neg99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2e13 < (-.f64 x #s(literal 1 binary64)) < -0.0200000000000000004

    1. Initial program 84.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 95.4% accurate, 1.7× speedup?

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

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

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


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

    1. Initial program 96.2%

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

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

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

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

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

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

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

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

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

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

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

    if -2e13 < (-.f64 x #s(literal 1 binary64)) < -1

    1. Initial program 84.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 \left(\left(x - 1\right) \cdot \log y + \color{blue}{y \cdot \left(-1 \cdot \left(z - 1\right) + -0.5 \cdot \left(y \cdot \left(z - 1\right)\right)\right)}\right) - t \]
    4. Taylor expanded in y around 0 98.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 99.5% accurate, 1.7× speedup?

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

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

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

    \[\leadsto \left(\log y \cdot \left(-1 + x\right) + \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.4% accurate, 1.8× speedup?

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

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

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

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

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

Alternative 7: 99.4% accurate, 1.8× speedup?

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

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

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

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

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

Alternative 8: 87.0% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -370000000 \lor \neg \left(t \leq 4.6 \cdot 10^{-15}\right):\\
\;\;\;\;x \cdot \log y - t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -3.7e8 or 4.59999999999999981e-15 < t

    1. Initial program 92.5%

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.7e8 < t < 4.59999999999999981e-15

    1. Initial program 88.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 78.6% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.8 \cdot 10^{+16} \lor \neg \left(t \leq 3600000000\right):\\
\;\;\;\;y \cdot \left(z \cdot \left(-1 + y \cdot -0.5\right)\right) - t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.8e16 or 3.6e9 < t

    1. Initial program 92.1%

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

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

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

    if -1.8e16 < t < 3.6e9

    1. Initial program 89.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 76.2% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.2 \cdot 10^{+61} \lor \neg \left(x \leq 2.9 \cdot 10^{+56}\right):\\
\;\;\;\;x \cdot \log y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -6.1999999999999998e61 or 2.90000000000000007e56 < x

    1. Initial program 97.8%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(z + -1, \mathsf{log1p}\left(-y\right), \left(x + -1\right) \cdot \log y\right) - t} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 68.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. Step-by-step derivation
      1. sub-neg68.2%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\log y \cdot x} \]
    10. Simplified82.5%

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

    if -6.1999999999999998e61 < x < 2.90000000000000007e56

    1. Initial program 86.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 67.2% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.8 \cdot 10^{+61} \lor \neg \left(x \leq 2.1 \cdot 10^{+67}\right):\\
\;\;\;\;x \cdot \log y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -4.7999999999999998e61 or 2.1000000000000001e67 < x

    1. Initial program 97.8%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(z + -1, \mathsf{log1p}\left(-y\right), \left(x + -1\right) \cdot \log y\right) - t} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 68.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. Step-by-step derivation
      1. sub-neg68.2%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\log y \cdot x} \]
    10. Simplified82.5%

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

    if -4.7999999999999998e61 < x < 2.1000000000000001e67

    1. Initial program 86.2%

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

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

      \[\leadsto \left(\color{blue}{-1 \cdot \log y} + \left(z - 1\right) \cdot \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 \]
    5. Step-by-step derivation
      1. mul-1-neg89.2%

        \[\leadsto \left(\color{blue}{\left(-\log y\right)} + \left(z - 1\right) \cdot \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 \]
    6. Simplified89.2%

      \[\leadsto \left(\color{blue}{\left(-\log y\right)} + \left(z - 1\right) \cdot \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 \]
    7. Taylor expanded in z around inf 60.4%

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

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

Alternative 12: 99.0% accurate, 1.9× speedup?

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

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

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

    \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{y \cdot \left(-1 \cdot \left(z - 1\right) + -0.5 \cdot \left(y \cdot \left(z - 1\right)\right)\right)}\right) - t \]
  4. 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} \]
  5. Step-by-step derivation
    1. associate--l+99.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 13: 88.2% accurate, 2.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 14: 42.1% accurate, 11.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.4 \cdot 10^{-8}:\\
\;\;\;\;-t\\

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

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


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

    1. Initial program 92.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.4e-8 < t < 6.50000000000000011e-16

    1. Initial program 88.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{log1p}\left(-y\right)} \cdot z \]
    10. Simplified13.8%

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

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

    if 6.50000000000000011e-16 < t

    1. Initial program 92.7%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-t} \]
    8. Step-by-step derivation
      1. expm1-log1p-u0.4%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(-t\right)\right)} \]
      2. expm1-undefine0.4%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(-t\right)} - 1} \]
    9. Applied egg-rr0.4%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(-t\right)} - 1} \]
    10. Step-by-step derivation
      1. sub-neg0.4%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(-t\right)} + \left(-1\right)} \]
      2. log1p-undefine0.4%

        \[\leadsto e^{\color{blue}{\log \left(1 + \left(-t\right)\right)}} + \left(-1\right) \]
      3. rem-exp-log64.6%

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

        \[\leadsto \color{blue}{\left(1 - t\right)} + \left(-1\right) \]
      5. metadata-eval64.6%

        \[\leadsto \left(1 - t\right) + \color{blue}{-1} \]
    11. Simplified64.6%

      \[\leadsto \color{blue}{\left(1 - t\right) + -1} \]
    12. Taylor expanded in t around inf 64.6%

      \[\leadsto \color{blue}{t \cdot \left(\frac{1}{t} - 1\right)} + -1 \]
  3. Recombined 3 regimes into one program.
  4. Final simplification40.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1.4 \cdot 10^{-8}:\\ \;\;\;\;-t\\ \mathbf{elif}\;t \leq 6.5 \cdot 10^{-16}:\\ \;\;\;\;y \cdot \left(-0.5 \cdot \left(z \cdot y\right) - z\right)\\ \mathbf{else}:\\ \;\;\;\;-1 + t \cdot \left(-1 + \frac{1}{t}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 15: 45.7% accurate, 11.3× speedup?

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

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

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

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

    \[\leadsto \left(\color{blue}{-1 \cdot \log y} + \left(z - 1\right) \cdot \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 \]
  5. Step-by-step derivation
    1. mul-1-neg62.2%

      \[\leadsto \left(\color{blue}{\left(-\log y\right)} + \left(z - 1\right) \cdot \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 \]
  6. Simplified62.2%

    \[\leadsto \left(\color{blue}{\left(-\log y\right)} + \left(z - 1\right) \cdot \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 \]
  7. Taylor expanded in z around inf 44.4%

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

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

Alternative 16: 45.6% accurate, 19.5× speedup?

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

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

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

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

    \[\leadsto \color{blue}{y \cdot \left(z \cdot \left(-0.5 \cdot y - 1\right)\right)} - t \]
  5. Final simplification44.3%

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

Alternative 17: 35.1% 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 90.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 18: 2.3% accurate, 215.0× speedup?

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

\\
0
\end{array}
Derivation
  1. Initial program 90.6%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{-t} \]
  8. Step-by-step derivation
    1. expm1-log1p-u17.2%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(-t\right)\right)} \]
    2. expm1-undefine17.0%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(-t\right)} - 1} \]
  9. Applied egg-rr17.0%

    \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(-t\right)} - 1} \]
  10. Step-by-step derivation
    1. sub-neg17.0%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(-t\right)} + \left(-1\right)} \]
    2. log1p-undefine17.0%

      \[\leadsto e^{\color{blue}{\log \left(1 + \left(-t\right)\right)}} + \left(-1\right) \]
    3. rem-exp-log35.2%

      \[\leadsto \color{blue}{\left(1 + \left(-t\right)\right)} + \left(-1\right) \]
    4. unsub-neg35.2%

      \[\leadsto \color{blue}{\left(1 - t\right)} + \left(-1\right) \]
    5. metadata-eval35.2%

      \[\leadsto \left(1 - t\right) + \color{blue}{-1} \]
  11. Simplified35.2%

    \[\leadsto \color{blue}{\left(1 - t\right) + -1} \]
  12. Taylor expanded in t around 0 2.4%

    \[\leadsto \color{blue}{1} + -1 \]
  13. Step-by-step derivation
    1. metadata-eval2.4%

      \[\leadsto \color{blue}{0} \]
  14. Applied egg-rr2.4%

    \[\leadsto \color{blue}{0} \]
  15. Add Preprocessing

Reproduce

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