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

Percentage Accurate: 89.6% → 99.8%
Time: 23.2s
Alternatives: 21
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 21 alternatives:

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

Initial Program: 89.6% accurate, 1.0× speedup?

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

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

Alternative 1: 99.8% accurate, 0.5× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 99.6% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

Alternative 3: 99.6% accurate, 1.7× speedup?

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

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

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

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

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

Alternative 4: 97.9% accurate, 1.7× speedup?

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

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

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


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

    1. Initial program 96.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -10 < (-.f64 x #s(literal 1 binary64)) < -0.999999997999999946

    1. Initial program 82.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. fma-define82.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 99.5% accurate, 1.7× speedup?

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

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

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

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

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

Alternative 6: 95.5% accurate, 1.8× speedup?

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

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

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


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

    1. Initial program 96.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. fma-define96.9%

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

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

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

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

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

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

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

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

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

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

    1. Initial program 81.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 99.4% accurate, 1.8× speedup?

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

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

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

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

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

Alternative 8: 99.2% accurate, 1.8× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 87.5% accurate, 1.9× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1 or 2.7000000000000002e-9 < x

    1. Initial program 96.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. fma-define96.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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} \]
    9. Taylor expanded in x around inf 94.5%

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

        \[\leadsto \color{blue}{\log y \cdot x} - t \]
    11. Simplified94.5%

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

    if -1 < x < 2.7000000000000002e-9

    1. Initial program 82.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. fma-define82.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 75.7% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.08 \cdot 10^{+108} \lor \neg \left(x \leq 4 \cdot 10^{+47}\right):\\
\;\;\;\;x \cdot \log y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.0800000000000001e108 or 4.0000000000000002e47 < x

    1. Initial program 96.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. fma-define96.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\log y \cdot x} \]
    10. Simplified73.3%

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

    if -1.0800000000000001e108 < x < 4.0000000000000002e47

    1. Initial program 84.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. fma-define84.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-\log y\right) + \left(-t\right)} \]
      4. unsub-neg75.8%

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

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

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

Alternative 11: 66.0% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.4 \cdot 10^{+139} \lor \neg \left(x \leq 9.5 \cdot 10^{+48}\right):\\
\;\;\;\;x \cdot \log y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -3.4000000000000002e139 or 9.4999999999999997e48 < x

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\log y \cdot x} \]
    10. Simplified76.1%

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

    if -3.4000000000000002e139 < x < 9.4999999999999997e48

    1. Initial program 84.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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} \]
    9. Taylor expanded in y around inf 65.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 55.5% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -24 \lor \neg \left(t \leq 2.15 \cdot 10^{-14}\right):\\
\;\;\;\;\left(-t\right) - z \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -24 or 2.14999999999999999e-14 < t

    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. Step-by-step derivation
      1. fma-define94.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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} \]
    9. Taylor expanded in z around inf 76.7%

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

        \[\leadsto \color{blue}{\left(-y \cdot z\right)} - t \]
      2. distribute-rgt-neg-in76.7%

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

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

    if -24 < t < 2.14999999999999999e-14

    1. Initial program 83.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-\log y\right) + \left(-t\right)} \]
      4. unsub-neg37.4%

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

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

      \[\leadsto \color{blue}{-1 \cdot \log y} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification59.0%

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

Alternative 13: 89.4% accurate, 1.9× speedup?

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

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

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


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

    1. Initial program 48.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. fma-define48.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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} \]
    9. Taylor expanded in z around inf 77.7%

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

        \[\leadsto \color{blue}{\left(-y \cdot z\right)} - t \]
      2. distribute-rgt-neg-in77.7%

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

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

    if -7.3999999999999998e227 < z

    1. Initial program 93.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. fma-define93.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 15: 41.7% accurate, 14.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.9 \cdot 10^{-34} \lor \neg \left(t \leq 1.05 \cdot 10^{+60}\right):\\
\;\;\;\;-t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.9000000000000001e-34 or 1.0500000000000001e60 < t

    1. Initial program 97.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. fma-define97.2%

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-t} \]
    7. Simplified74.9%

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

    if -1.9000000000000001e-34 < t < 1.0500000000000001e60

    1. Initial program 81.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. fma-define81.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 16: 41.7% accurate, 14.3× speedup?

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

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

\mathbf{elif}\;t \leq 7.1 \cdot 10^{+59}:\\
\;\;\;\;y \cdot \left(1 - z\right)\\

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


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

    1. Initial program 97.8%

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.9000000000000001e-34 < t < 7.10000000000000003e59

    1. Initial program 81.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. fma-define81.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 7.10000000000000003e59 < t

    1. Initial program 96.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. fma-define96.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(1 - t\right) + -1} \]
    12. Step-by-step derivation
      1. associate-+l-79.6%

        \[\leadsto \color{blue}{1 - \left(t - -1\right)} \]
    13. Applied egg-rr79.6%

      \[\leadsto \color{blue}{1 - \left(t - -1\right)} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 17: 41.4% accurate, 15.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.3 \cdot 10^{-36} \lor \neg \left(t \leq 7.1 \cdot 10^{+59}\right):\\
\;\;\;\;-t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -2.29999999999999996e-36 or 7.10000000000000003e59 < t

    1. Initial program 97.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. fma-define97.2%

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-t} \]
    7. Simplified74.9%

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

    if -2.29999999999999996e-36 < t < 7.10000000000000003e59

    1. Initial program 81.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. fma-define81.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-y\right)} \cdot z \]
    13. Simplified20.8%

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

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

Alternative 18: 45.8% 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.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(-y, -1 + z, \mathsf{fma}\left(\log y, -1 + x, -t\right)\right)} \]
  8. Taylor expanded in x around 0 99.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} \]
  9. Taylor expanded in y around inf 51.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 19: 45.7% accurate, 35.8× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(-y, -1 + z, \mathsf{fma}\left(\log y, -1 + x, -t\right)\right)} \]
  8. Taylor expanded in x around 0 99.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} \]
  9. Taylor expanded in z around inf 51.2%

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

      \[\leadsto \color{blue}{\left(-y \cdot z\right)} - t \]
    2. distribute-rgt-neg-in51.2%

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

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

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

Alternative 20: 35.7% 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.6%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 21: 2.3% accurate, 215.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Reproduce

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