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

Percentage Accurate: 89.5% → 99.8%
Time: 19.5s
Alternatives: 20
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 20 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.5× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 99.8% accurate, 0.7× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 99.6% accurate, 1.6× speedup?

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

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

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

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

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

    \[\leadsto \left(\left(-1 + x\right) \cdot \log y + \left(z \cdot \left(1 + \frac{-1}{z}\right)\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 \]
  6. Add Preprocessing

Alternative 4: 99.6% accurate, 1.7× speedup?

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

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

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

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

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

Alternative 5: 94.7% accurate, 1.7× speedup?

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

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

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

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


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

    1. Initial program 95.1%

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

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

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

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

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

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

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

    if -5e16 < (-.f64 x #s(literal 1 binary64)) < 2e21

    1. Initial program 85.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(z + -1, \mathsf{log1p}\left(-y\right), \color{blue}{-1 \cdot \log y - t}\right) \]
    6. Step-by-step derivation
      1. mul-1-neg98.5%

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

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

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

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

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

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

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

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

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

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

    1. Initial program 92.0%

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

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

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

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

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

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

Alternative 6: 99.6% accurate, 1.7× speedup?

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

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

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

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -3.79999999999999978e86 or 0.225000000000000006 < t

    1. Initial program 99.0%

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

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

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

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

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

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

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

    if -3.79999999999999978e86 < t < 0.225000000000000006

    1. Initial program 82.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. +-commutative82.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-define82.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-neg82.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-eval82.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-neg82.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 0 80.3%

      \[\leadsto \color{blue}{\log y \cdot \left(x - 1\right) + \log \left(1 - y\right) \cdot \left(z - 1\right)} \]
    6. Step-by-step derivation
      1. fma-define80.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 89.9% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.65 \cdot 10^{+200} \lor \neg \left(z \leq 6.2 \cdot 10^{+255}\right):\\
\;\;\;\;\left(-t\right) - z \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.65e200 or 6.2000000000000004e255 < z

    1. Initial program 42.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.65e200 < z < 6.2000000000000004e255

    1. Initial program 96.0%

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

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

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

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

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

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

Alternative 9: 99.5% accurate, 1.8× speedup?

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

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

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

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

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

Alternative 10: 89.8% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -3 \cdot 10^{+198} \lor \neg \left(z \leq 7 \cdot 10^{+255}\right):\\
\;\;\;\;\left(-t\right) - z \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -3.00000000000000019e198 or 6.99999999999999971e255 < z

    1. Initial program 42.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.00000000000000019e198 < z < 6.99999999999999971e255

    1. Initial program 96.0%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 77.7% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.4 \cdot 10^{+85} \lor \neg \left(t \leq 1.95 \cdot 10^{+39}\right):\\
\;\;\;\;\left(-t\right) - z \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.4e85 or 1.95e39 < t

    1. Initial program 98.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.4e85 < t < 1.95e39

    1. Initial program 83.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. +-commutative83.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-define83.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-neg83.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-eval83.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-neg83.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 t around 0 80.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 73.6% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.5 \cdot 10^{+156} \lor \neg \left(x \leq 7.5 \cdot 10^{+41}\right):\\
\;\;\;\;x \cdot \log y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -3.5000000000000003e156 or 7.50000000000000072e41 < x

    1. Initial program 94.7%

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.5000000000000003e156 < x < 7.50000000000000072e41

    1. Initial program 86.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. sub-neg86.6%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(z + -1, \mathsf{log1p}\left(-y\right), \color{blue}{-1 \cdot \log y - t}\right) \]
    6. Step-by-step derivation
      1. mul-1-neg89.9%

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-t\right) - \log y} \]
    10. Simplified75.2%

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

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

Alternative 13: 63.8% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.5 \cdot 10^{+156} \lor \neg \left(x \leq 1.85 \cdot 10^{+123}\right):\\
\;\;\;\;x \cdot \log y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -3.5000000000000003e156 or 1.84999999999999998e123 < x

    1. Initial program 96.2%

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.5000000000000003e156 < x < 1.84999999999999998e123

    1. Initial program 86.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 14: 99.2% accurate, 1.9× speedup?

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

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

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

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

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

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

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

Alternative 15: 55.8% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -290:\\
\;\;\;\;\left(-t\right) - z \cdot y\\

\mathbf{elif}\;t \leq 1.8 \cdot 10^{-8}:\\
\;\;\;\;-\log y\\

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


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

    1. Initial program 94.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -290 < t < 1.79999999999999991e-8

    1. Initial program 82.9%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\log y \cdot \left(x - 1\right) + \log \left(1 - y\right) \cdot \left(z - 1\right)} \]
    6. Step-by-step derivation
      1. fma-define82.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-\log y} \]
    11. Simplified41.9%

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

    if 1.79999999999999991e-8 < t

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -290:\\ \;\;\;\;\left(-t\right) - z \cdot y\\ \mathbf{elif}\;t \leq 1.8 \cdot 10^{-8}:\\ \;\;\;\;-\log y\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(\frac{y}{z} - y\right) - t\\ \end{array} \]
  5. Add Preprocessing

Alternative 16: 41.1% accurate, 15.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.8 \cdot 10^{+86} \lor \neg \left(t \leq 36000000000\right):\\
\;\;\;\;-t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -3.79999999999999978e86 or 3.6e10 < t

    1. Initial program 99.0%

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

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

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

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

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

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

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

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

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

    if -3.79999999999999978e86 < t < 3.6e10

    1. Initial program 82.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-y\right)} \cdot z \]
    11. Simplified19.5%

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

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

Alternative 17: 46.1% accurate, 23.9× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 18: 45.9% accurate, 35.8× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto z \cdot \color{blue}{\left(-y\right)} - t \]
  11. Simplified45.3%

    \[\leadsto z \cdot \color{blue}{\left(-y\right)} - t \]
  12. Final simplification45.3%

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

Alternative 19: 35.9% accurate, 107.5× speedup?

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

\\
-t
\end{array}
Derivation
  1. Initial program 89.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 20: 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 89.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto e^{\mathsf{log1p}\left(-t\right)} + \color{blue}{-1} \]
    3. +-commutative15.6%

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

      \[\leadsto -1 + e^{\color{blue}{\log \left(1 + \left(-t\right)\right)}} \]
    5. rem-exp-log34.9%

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

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

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

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

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

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

Reproduce

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