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

Percentage Accurate: 88.8% → 99.8%
Time: 14.1s
Alternatives: 15
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 15 alternatives:

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

Initial Program: 88.8% accurate, 1.0× speedup?

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

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

Alternative 1: 99.8% accurate, 0.7× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 99.4% accurate, 1.0× speedup?

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

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

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

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \left(-0.5 \cdot \left(\left(z + \color{blue}{-1}\right) \cdot {y}^{2}\right) - \left(z - 1\right) \cdot y\right)\right) - t \]
    5. 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 \]
    6. *-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 \]
    7. 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 \]
    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-rgt-in98.9%

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

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

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

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

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

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

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

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

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

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

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

    \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
  2. 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. sub-neg98.9%

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

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \left(-0.5 \cdot \left(\left(z + \color{blue}{-1}\right) \cdot {y}^{2}\right) - \left(z - 1\right) \cdot y\right)\right) - t \]
    5. 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 \]
    6. *-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 \]
    7. 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 \]
    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-rgt-in98.9%

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

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

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

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

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

Alternative 4: 99.1% accurate, 1.8× speedup?

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

\\
\left(\log y \cdot \left(-1 + x\right) + \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.2%

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

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

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \left(-0.5 \cdot \left(\left(z + \color{blue}{-1}\right) \cdot {y}^{2}\right) - \left(z - 1\right) \cdot y\right)\right) - t \]
    5. 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 \]
    6. *-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 \]
    7. 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 \]
    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-rgt-in98.9%

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

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

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

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

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

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

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

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

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

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

Alternative 5: 95.0% accurate, 1.9× speedup?

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

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

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


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

    1. Initial program 94.1%

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

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

    if -2e12 < (-.f64 x 1) < 4e18

    1. Initial program 84.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 94.8% accurate, 1.9× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;t_1 - z \cdot y\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -2.59999999999999984e-5 or 2.2499999999999999e-54 < t

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

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

    if -2.59999999999999984e-5 < t < 2.2499999999999999e-54

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 99.1% accurate, 1.9× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 60.3% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z + -1 \leq -2 \cdot 10^{+128} \lor \neg \left(z + -1 \leq 6 \cdot 10^{+222}\right):\\
\;\;\;\;z \cdot \left(y \cdot \left(y \cdot -0.5\right) - y\right) - t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 z 1) < -2.0000000000000002e128 or 6.00000000000000028e222 < (-.f64 z 1)

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

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

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

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

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

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

        \[\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 \]
      6. *-commutative98.0%

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

        \[\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 \]
      8. +-commutative98.0%

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

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

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

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

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

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

        \[\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 \color{blue}{\left(-1 + z\right)}\right)\right) - t \]
    4. Simplified98.0%

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

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

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

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

        \[\leadsto z \cdot \left(\color{blue}{\left(y \cdot y\right)} \cdot -0.5 - y\right) - t \]
      4. associate-*l*63.2%

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

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

    if -2.0000000000000002e128 < (-.f64 z 1) < 6.00000000000000028e222

    1. Initial program 98.3%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\mathsf{log1p}\left(-y\right), \color{blue}{-1 + z}, -1 \cdot \log y\right) - t \]
      10. mul-1-neg59.4%

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

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

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

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

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

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

Alternative 9: 98.9% accurate, 1.9× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 86.6% accurate, 2.0× speedup?

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

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

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


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

    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 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) + -1 \cdot \left(\left(z - 1\right) \cdot y\right)\right)}\right) - t \]
    3. Step-by-step derivation
      1. mul-1-neg99.3%

        \[\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.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(z - 1\right) \cdot y\right)}\right) - t \]
      3. sub-neg99.3%

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

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

        \[\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 \]
      6. *-commutative99.3%

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

        \[\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 \]
      8. +-commutative99.3%

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

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

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

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

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

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

        \[\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 \color{blue}{\left(-1 + z\right)}\right)\right) - t \]
    4. Simplified99.3%

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

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

    if -350 < x < 1.05e10

    1. Initial program 84.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 87.6% accurate, 2.0× speedup?

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

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

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

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

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

Alternative 12: 46.7% accurate, 19.5× speedup?

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

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

    \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
  2. 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. sub-neg98.9%

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

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \left(-0.5 \cdot \left(\left(z + \color{blue}{-1}\right) \cdot {y}^{2}\right) - \left(z - 1\right) \cdot y\right)\right) - t \]
    5. 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 \]
    6. *-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 \]
    7. 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 \]
    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-rgt-in98.9%

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

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

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

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

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

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

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

      \[\leadsto z \cdot \left(\color{blue}{\left(y \cdot y\right)} \cdot -0.5 - y\right) - t \]
    4. associate-*l*43.4%

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

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

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

Alternative 13: 46.6% accurate, 30.7× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto -1 \cdot \color{blue}{\left(y \cdot \left(z + -1\right)\right)} - t \]
    4. distribute-rgt-in43.4%

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

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

      \[\leadsto -1 \cdot \left(y \cdot z + \color{blue}{\left(-y\right)}\right) - t \]
    7. distribute-lft-out43.4%

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

      \[\leadsto \left(-1 \cdot \left(y \cdot z\right) + \color{blue}{\left(-\left(-y\right)\right)}\right) - t \]
    9. remove-double-neg43.4%

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

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

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

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

    \[\leadsto \color{blue}{\left(y - y \cdot z\right)} - t \]
  10. Final simplification43.4%

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

Alternative 14: 46.4% 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.2%

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

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

      \[\leadsto \left(\left(x - 1\right) \cdot \log y + \left(-0.5 \cdot \left(\left(z + \color{blue}{-1}\right) \cdot {y}^{2}\right) - \left(z - 1\right) \cdot y\right)\right) - t \]
    5. 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 \]
    6. *-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 \]
    7. 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 \]
    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-rgt-in98.9%

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

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

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

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

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

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

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

      \[\leadsto z \cdot \left(\color{blue}{\left(y \cdot y\right)} \cdot -0.5 - y\right) - t \]
    4. associate-*l*43.4%

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

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

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

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

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

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

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

Alternative 15: 35.5% 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.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto -t \]

Reproduce

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