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

Percentage Accurate: 89.6% → 99.8%
Time: 14.3s
Alternatives: 14
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 14 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.6% accurate, 1.0× speedup?

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

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

Alternative 1: 99.8% accurate, 0.7× speedup?

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

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

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

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

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

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

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

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

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

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

Alternative 2: 99.5% accurate, 1.0× speedup?

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

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

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

    \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\left(-0.5 \cdot \left(\left(z - 1\right) \cdot {y}^{2}\right) + \left(-0.3333333333333333 \cdot \left(\left(z - 1\right) \cdot {y}^{3}\right) + -1 \cdot \left(\left(z - 1\right) \cdot y\right)\right)\right)}\right) - t \]
  3. Step-by-step derivation
    1. associate-+r+99.3%

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

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

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

    \[\leadsto \left(\left(x - 1\right) \cdot \log y + \color{blue}{\left(\mathsf{fma}\left(0.3333333333333333 + -0.3333333333333333 \cdot z, {y}^{3}, \left(y \cdot y\right) \cdot \left(0.5 + -0.5 \cdot z\right)\right) - y \cdot \left(-1 + z\right)\right)}\right) - t \]
  5. Taylor expanded in z around inf 99.1%

    \[\leadsto \left(\left(x - 1\right) \cdot \log y + \left(\color{blue}{\left(-0.5 \cdot {y}^{2} + -0.3333333333333333 \cdot {y}^{3}\right) \cdot z} - y \cdot \left(-1 + z\right)\right)\right) - t \]
  6. Step-by-step derivation
    1. *-commutative99.1%

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

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \left(z \cdot \color{blue}{\mathsf{fma}\left(-0.5, {y}^{2}, -0.3333333333333333 \cdot {y}^{3}\right)} - y \cdot \left(-1 + z\right)\right)\right) - t \]
    3. unpow299.1%

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

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

    \[\leadsto \left(\left(x - 1\right) \cdot \log y + \left(\color{blue}{z \cdot \mathsf{fma}\left(-0.5, y \cdot y, {y}^{3} \cdot -0.3333333333333333\right)} - y \cdot \left(-1 + z\right)\right)\right) - t \]
  8. Step-by-step derivation
    1. fma-udef99.1%

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \left(z \cdot \color{blue}{\left(-0.5 \cdot \left(y \cdot y\right) + {y}^{3} \cdot -0.3333333333333333\right)} - y \cdot \left(-1 + z\right)\right)\right) - t \]
  9. Applied egg-rr99.1%

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

    \[\leadsto \left(\left(x + -1\right) \cdot \log y + \left(z \cdot \left(-0.5 \cdot \left(y \cdot y\right) + {y}^{3} \cdot -0.3333333333333333\right) - y \cdot \left(z + -1\right)\right)\right) - t \]

Alternative 3: 99.4% accurate, 1.7× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 97.8% accurate, 1.8× speedup?

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

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

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


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

    1. Initial program 92.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2e13 < (-.f64 x 1) < -1

    1. Initial program 87.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. add-cbrt-cube86.7%

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

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

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

        \[\leadsto \left(\sqrt[3]{{\left(\left(x + \color{blue}{-1}\right) \cdot \log y\right)}^{3}} + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
    3. Applied egg-rr86.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\left(\color{blue}{\left(-\left(-y\right)\right)} + z \cdot \left(-y\right)\right) - \log y\right) - t \]
      11. remove-double-neg98.3%

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

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

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

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

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

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

Alternative 5: 99.1% accurate, 1.8× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 95.0% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x + -1 \leq -2 \cdot 10^{+31}:\\
\;\;\;\;x \cdot \log y - t\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (-.f64 x 1) < -1.9999999999999999e31

    1. Initial program 93.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(\color{blue}{\frac{\log y \cdot \mathsf{fma}\left(x, x, -1\right)}{1 + x}} + \left(\left(y \cdot y\right) \cdot \left(0.5 + -0.5 \cdot z\right) - y \cdot \left(-1 + z\right)\right)\right) - t \]
    7. Step-by-step derivation
      1. associate-/l*51.6%

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

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

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

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

    if -1.9999999999999999e31 < (-.f64 x 1) < -1

    1. Initial program 85.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\left(\color{blue}{\left(-\left(-y\right)\right)} + z \cdot \left(-y\right)\right) - \log y\right) - t \]
      11. remove-double-neg97.8%

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

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

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

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

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

    if -1 < (-.f64 x 1)

    1. Initial program 94.5%

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

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

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

Alternative 7: 99.1% accurate, 1.9× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 76.4% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -4.5 \cdot 10^{+24} \lor \neg \left(x \leq 4.2 \cdot 10^{-13}\right):\\ \;\;\;\;x \cdot \log y - t\\ \mathbf{else}:\\ \;\;\;\;z \cdot \mathsf{log1p}\left(-y\right) - t\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (or (<= x -4.5e+24) (not (<= x 4.2e-13)))
   (- (* x (log y)) t)
   (- (* z (log1p (- y))) t)))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((x <= -4.5e+24) || !(x <= 4.2e-13)) {
		tmp = (x * log(y)) - t;
	} else {
		tmp = (z * log1p(-y)) - t;
	}
	return tmp;
}
public static double code(double x, double y, double z, double t) {
	double tmp;
	if ((x <= -4.5e+24) || !(x <= 4.2e-13)) {
		tmp = (x * Math.log(y)) - t;
	} else {
		tmp = (z * Math.log1p(-y)) - t;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (x <= -4.5e+24) or not (x <= 4.2e-13):
		tmp = (x * math.log(y)) - t
	else:
		tmp = (z * math.log1p(-y)) - t
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if ((x <= -4.5e+24) || !(x <= 4.2e-13))
		tmp = Float64(Float64(x * log(y)) - t);
	else
		tmp = Float64(Float64(z * log1p(Float64(-y))) - t);
	end
	return tmp
end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -4.5e+24], N[Not[LessEqual[x, 4.2e-13]], $MachinePrecision]], N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(z * N[Log[1 + (-y)], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.5 \cdot 10^{+24} \lor \neg \left(x \leq 4.2 \cdot 10^{-13}\right):\\
\;\;\;\;x \cdot \log y - t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -4.50000000000000019e24 or 4.19999999999999977e-13 < x

    1. Initial program 94.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(\color{blue}{\frac{\log y \cdot \mathsf{fma}\left(x, x, -1\right)}{1 + x}} + \left(\left(y \cdot y\right) \cdot \left(0.5 + -0.5 \cdot z\right) - y \cdot \left(-1 + z\right)\right)\right) - t \]
    7. Step-by-step derivation
      1. associate-/l*55.0%

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

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

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

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

    if -4.50000000000000019e24 < x < 4.19999999999999977e-13

    1. Initial program 85.7%

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

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

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

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

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

        \[\leadsto z \cdot \mathsf{log1p}\left(\color{blue}{-y}\right) - t \]
    4. Simplified62.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -4.5 \cdot 10^{+24} \lor \neg \left(x \leq 4.2 \cdot 10^{-13}\right):\\ \;\;\;\;x \cdot \log y - t\\ \mathbf{else}:\\ \;\;\;\;z \cdot \mathsf{log1p}\left(-y\right) - t\\ \end{array} \]

Alternative 9: 76.2% accurate, 2.0× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2.7e24 or 4.19999999999999977e-13 < x

    1. Initial program 94.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(\color{blue}{\frac{\log y \cdot \mathsf{fma}\left(x, x, -1\right)}{1 + x}} + \left(\left(y \cdot y\right) \cdot \left(0.5 + -0.5 \cdot z\right) - y \cdot \left(-1 + z\right)\right)\right) - t \]
    7. Step-by-step derivation
      1. associate-/l*55.0%

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

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

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

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

    if -2.7e24 < x < 4.19999999999999977e-13

    1. Initial program 85.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(\color{blue}{\frac{\log y \cdot \mathsf{fma}\left(x, x, -1\right)}{1 + x}} + \left(\left(y \cdot y\right) \cdot \left(0.5 + -0.5 \cdot z\right) - y \cdot \left(-1 + z\right)\right)\right) - t \]
    7. Step-by-step derivation
      1. associate-/l*99.2%

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

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

      \[\leadsto \color{blue}{\left(-0.5 \cdot {y}^{2} - y\right) \cdot z} - t \]
    10. Step-by-step derivation
      1. *-commutative62.8%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.7 \cdot 10^{+24} \lor \neg \left(x \leq 4.2 \cdot 10^{-13}\right):\\ \;\;\;\;x \cdot \log y - t\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(-0.5 \cdot \left(y \cdot y\right) - y\right) - t\\ \end{array} \]

Alternative 10: 88.9% accurate, 2.0× speedup?

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

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

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


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

    1. Initial program 22.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(\color{blue}{\frac{\log y \cdot \mathsf{fma}\left(x, x, -1\right)}{1 + x}} + \left(\left(y \cdot y\right) \cdot \left(0.5 + -0.5 \cdot z\right) - y \cdot \left(-1 + z\right)\right)\right) - t \]
    7. Step-by-step derivation
      1. associate-/l*99.6%

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

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

      \[\leadsto \color{blue}{\left(-0.5 \cdot {y}^{2} - y\right) \cdot z} - t \]
    10. Step-by-step derivation
      1. *-commutative99.8%

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

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

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

    if -1.99999999999999992e275 < z

    1. Initial program 91.8%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2 \cdot 10^{+275}:\\ \;\;\;\;z \cdot \left(-0.5 \cdot \left(y \cdot y\right) - y\right) - t\\ \mathbf{else}:\\ \;\;\;\;\left(x + -1\right) \cdot \log y - t\\ \end{array} \]

Alternative 11: 45.2% accurate, 19.5× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \left(\color{blue}{\frac{\log y \cdot \mathsf{fma}\left(x, x, -1\right)}{1 + x}} + \left(\left(y \cdot y\right) \cdot \left(0.5 + -0.5 \cdot z\right) - y \cdot \left(-1 + z\right)\right)\right) - t \]
  7. Step-by-step derivation
    1. associate-/l*78.0%

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

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

    \[\leadsto \color{blue}{\left(-0.5 \cdot {y}^{2} - y\right) \cdot z} - t \]
  10. Step-by-step derivation
    1. *-commutative47.0%

      \[\leadsto \color{blue}{z \cdot \left(-0.5 \cdot {y}^{2} - y\right)} - t \]
    2. unpow247.0%

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

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

    \[\leadsto z \cdot \left(-0.5 \cdot \left(y \cdot y\right) - y\right) - t \]

Alternative 12: 45.2% accurate, 30.7× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto y \cdot \left(1 - z\right) - t \]

Alternative 13: 45.0% accurate, 35.8× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto z \cdot \left(-y\right) - t \]

Alternative 14: 35.1% accurate, 107.5× speedup?

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-t} \]
  6. Simplified36.3%

    \[\leadsto \color{blue}{-t} \]
  7. Final simplification36.3%

    \[\leadsto -t \]

Reproduce

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