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

Percentage Accurate: 89.2% → 99.8%
Time: 14.9s
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: 89.2% accurate, 1.0× speedup?

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

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

Alternative 1: 99.8% accurate, 0.5× speedup?

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

\\
\mathsf{fma}\left(x + -1, \log y, \mathsf{fma}\left(-1 + z, \mathsf{log1p}\left(-y\right), -t\right)\right)
\end{array}
Derivation
  1. Initial program 90.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. associate--l+90.0%

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 99.8% accurate, 0.7× speedup?

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

\\
\mathsf{fma}\left(-1 + z, \mathsf{log1p}\left(-y\right), \log y \cdot \left(x + -1\right)\right) - t
\end{array}
Derivation
  1. Initial program 90.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. +-commutative90.0%

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

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

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

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

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

Alternative 3: 99.6% accurate, 0.9× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 99.5% accurate, 1.8× speedup?

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

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

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

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

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

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

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

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

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

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

Alternative 5: 95.3% accurate, 1.8× speedup?

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

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

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

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


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

    1. Initial program 92.0%

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

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

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

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

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

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

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

    if -4.00000000000000021e32 < (-.f64 x 1) < -1

    1. Initial program 84.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1 < (-.f64 x 1)

    1. Initial program 99.1%

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

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

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

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

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

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

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

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

Alternative 6: 99.0% accurate, 1.9× speedup?

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

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

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

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

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

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

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

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

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

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

Alternative 7: 77.8% accurate, 2.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.2 \cdot 10^{+54} \lor \neg \left(t \leq 2.5 \cdot 10^{+18}\right):\\
\;\;\;\;z \cdot \left(-0.5 \cdot \left(y \cdot y\right) - y\right) - t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.19999999999999999e54 or 2.5e18 < t

    1. Initial program 90.4%

      \[\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 + \left(z - 1\right) \cdot \color{blue}{\left(-1 \cdot y + -0.5 \cdot {y}^{2}\right)}\right) - t \]
    3. Step-by-step derivation
      1. +-commutative99.3%

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.19999999999999999e54 < t < 2.5e18

    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. fma-def89.7%

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 87.2% accurate, 2.0× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -490 or 400 < t

    1. Initial program 91.4%

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

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

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

      \[\leadsto \color{blue}{x \cdot \log y} - t \]
    6. Step-by-step derivation
      1. *-commutative90.3%

        \[\leadsto \color{blue}{\log y \cdot x} - t \]
    7. Simplified90.3%

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

    if -490 < t < 400

    1. Initial program 88.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 88.9% accurate, 2.0× speedup?

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

    1. Initial program 95.4%

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

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

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

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

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

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

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

    if 2.54999999999999981e211 < z

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 59.6% accurate, 2.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.25 \cdot 10^{+193} \lor \neg \left(z \leq 1.7 \cdot 10^{+158}\right):\\
\;\;\;\;z \cdot \left(-0.5 \cdot \left(y \cdot y\right) - y\right) - t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.24999999999999993e193 or 1.7e158 < z

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.24999999999999993e193 < z < 1.7e158

    1. Initial program 97.9%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\log y \cdot \left(x - 1\right) - t} \]
    5. Step-by-step derivation
      1. fma-neg97.9%

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

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \log y - t} \]
    8. Step-by-step derivation
      1. mul-1-neg61.5%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.25 \cdot 10^{+193} \lor \neg \left(z \leq 1.7 \cdot 10^{+158}\right):\\ \;\;\;\;z \cdot \left(-0.5 \cdot \left(y \cdot y\right) - y\right) - t\\ \mathbf{else}:\\ \;\;\;\;\left(-t\right) - \log y\\ \end{array} \]

Alternative 11: 54.1% accurate, 2.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.1 \cdot 10^{-61} \lor \neg \left(t \leq 0.00195\right):\\
\;\;\;\;z \cdot \left(-0.5 \cdot \left(y \cdot y\right) - y\right) - t\\

\mathbf{else}:\\
\;\;\;\;-\log y\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -2.0999999999999999e-61 or 0.0019499999999999999 < t

    1. Initial program 89.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.0999999999999999e-61 < t < 0.0019499999999999999

    1. Initial program 90.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. +-commutative90.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-def90.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-neg90.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-eval90.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-neg90.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.7%

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

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

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

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

      \[\leadsto \color{blue}{\log y \cdot \left(x - 1\right) - t} \]
    5. Step-by-step derivation
      1. fma-neg89.6%

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

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \log y - t} \]
    8. Step-by-step derivation
      1. mul-1-neg43.4%

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

      \[\leadsto \color{blue}{\left(-\log y\right) - t} \]
    10. Taylor expanded in t around 0 42.8%

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

        \[\leadsto \color{blue}{-\log y} \]
    12. Simplified42.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -2.1 \cdot 10^{-61} \lor \neg \left(t \leq 0.00195\right):\\ \;\;\;\;z \cdot \left(-0.5 \cdot \left(y \cdot y\right) - y\right) - t\\ \mathbf{else}:\\ \;\;\;\;-\log y\\ \end{array} \]

Alternative 12: 45.1% 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 90.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 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 13: 35.6% accurate, 35.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq 7.6 \cdot 10^{+202}:\\
\;\;\;\;-t\\

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


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

    1. Initial program 95.3%

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

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

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

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

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

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

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

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

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

    if 7.6000000000000001e202 < z

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{z \cdot \left(-y\right)} \]
    10. Simplified50.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 7.6 \cdot 10^{+202}:\\ \;\;\;\;-t\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(-z\right)\\ \end{array} \]

Alternative 14: 44.8% accurate, 35.8× speedup?

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

\\
\left(-t\right) - y \cdot z
\end{array}
Derivation
  1. Initial program 90.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 99.2%

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(\frac{\mathsf{fma}\left(x, x, \color{blue}{-1}\right) \cdot \log y}{x - -1} + \left(z - 1\right) \cdot \left(-y\right)\right) - t \]
    8. sub-neg74.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 \left(-y\right)\right) - t \]
    9. metadata-eval74.8%

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

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

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

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

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

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

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

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

Alternative 15: 34.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 90.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. +-commutative90.0%

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

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

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

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

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

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

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

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

    \[\leadsto -t \]

Reproduce

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