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

Percentage Accurate: 89.2% → 99.8%
Time: 25.2s
Alternatives: 16
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 16 alternatives:

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

Initial Program: 89.2% accurate, 1.0× speedup?

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

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

Alternative 1: 99.8% accurate, 1.0× speedup?

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

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

    \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
  2. Add Preprocessing
  3. Applied egg-rr0

    \[\leadsto expr\]
  4. Add Preprocessing

Alternative 2: 99.6% accurate, 1.7× speedup?

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

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

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

    \[\leadsto expr\]
  4. Simplified0

    \[\leadsto expr\]
  5. Add Preprocessing

Alternative 3: 99.6% accurate, 1.7× speedup?

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

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

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

    \[\leadsto expr\]
  4. Simplified0

    \[\leadsto expr\]
  5. Add Preprocessing

Alternative 4: 65.9% accurate, 1.7× speedup?

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

\\
\begin{array}{l}
t_1 := \log y \cdot x\\
\mathbf{if}\;x \leq -1.5 \cdot 10^{+134}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \leq -9.6 \cdot 10^{+92}:\\
\;\;\;\;\left(0 - y \cdot z\right) - t\\

\mathbf{elif}\;x \leq -1.3 \cdot 10^{+49}:\\
\;\;\;\;t\_1\\

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

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.49999999999999998e134 or -9.60000000000000018e92 < x < -1.29999999999999994e49 or 2.89999999999999984e62 < x

    1. Initial program 97.9%

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

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]

    if -1.49999999999999998e134 < x < -9.60000000000000018e92

    1. Initial program 89.0%

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

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Taylor expanded in z around inf 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]
    7. Taylor expanded in y around 0 0

      \[\leadsto expr\]
    8. Simplified0

      \[\leadsto expr\]

    if -1.29999999999999994e49 < x < 2.89999999999999984e62

    1. Initial program 86.6%

      \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
    2. Add Preprocessing
    3. Applied egg-rr0

      \[\leadsto expr\]
    4. Taylor expanded in y around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
    6. Taylor expanded in y around inf 0

      \[\leadsto expr\]
    7. Simplified0

      \[\leadsto expr\]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 5: 99.6% accurate, 1.7× speedup?

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

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

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

    \[\leadsto expr\]
  4. Simplified0

    \[\leadsto expr\]
  5. Add Preprocessing

Alternative 6: 95.3% accurate, 1.8× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -9.49999999999999998e-4 or 3.8000000000000001e-35 < x

    1. Initial program 96.1%

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

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]

    if -9.49999999999999998e-4 < x < 3.8000000000000001e-35

    1. Initial program 85.1%

      \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
    2. Add Preprocessing
    3. Applied egg-rr0

      \[\leadsto expr\]
    4. Taylor expanded in y around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
    6. Taylor expanded in x around 0 0

      \[\leadsto expr\]
    7. Simplified0

      \[\leadsto expr\]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 7: 99.4% accurate, 1.8× speedup?

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

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

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

    \[\leadsto expr\]
  4. Simplified0

    \[\leadsto expr\]
  5. Add Preprocessing

Alternative 8: 90.0% accurate, 1.8× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -5.6000000000000004e196

    1. Initial program 52.5%

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

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Taylor expanded in z around inf 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]

    if -5.6000000000000004e196 < z < 1.5499999999999999e183

    1. Initial program 96.4%

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

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]

    if 1.5499999999999999e183 < z

    1. Initial program 62.7%

      \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
    2. Add Preprocessing
    3. Applied egg-rr0

      \[\leadsto expr\]
    4. Taylor expanded in y around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
    6. Taylor expanded in y around inf 0

      \[\leadsto expr\]
    7. Simplified0

      \[\leadsto expr\]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 9: 86.8% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
t_1 := \log y \cdot x - t\\
\mathbf{if}\;t \leq -340:\\
\;\;\;\;t\_1\\

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

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -340 or 2.60000000000000004e-15 < t

    1. Initial program 92.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 x around inf 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]

    if -340 < t < 2.60000000000000004e-15

    1. Initial program 89.2%

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

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Taylor expanded in t around 0 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 10: 78.6% accurate, 1.9× speedup?

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

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

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

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


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

    1. Initial program 90.7%

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

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Taylor expanded in z around inf 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]

    if -4.4e15 < t < 2.8e19

    1. Initial program 90.0%

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

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Taylor expanded in t around 0 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]

    if 2.8e19 < t

    1. Initial program 92.5%

      \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
    2. Add Preprocessing
    3. Applied egg-rr0

      \[\leadsto expr\]
    4. Taylor expanded in y around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
    6. Taylor expanded in y around inf 0

      \[\leadsto expr\]
    7. Simplified0

      \[\leadsto expr\]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 11: 99.1% accurate, 1.9× speedup?

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

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

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

    \[\leadsto expr\]
  4. Simplified0

    \[\leadsto expr\]
  5. Add Preprocessing

Alternative 12: 99.0% accurate, 1.9× speedup?

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

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

    \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
  2. Add Preprocessing
  3. Applied egg-rr0

    \[\leadsto expr\]
  4. Taylor expanded in y around 0 0

    \[\leadsto expr\]
  5. Simplified0

    \[\leadsto expr\]
  6. Taylor expanded in z around inf 0

    \[\leadsto expr\]
  7. Simplified0

    \[\leadsto expr\]
  8. Add Preprocessing

Alternative 13: 42.5% accurate, 14.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.8 \cdot 10^{+19}:\\
\;\;\;\;-t\\

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

\mathbf{else}:\\
\;\;\;\;-t\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -2.8e19 or 950 < t

    1. Initial program 92.7%

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

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Applied egg-rr0

      \[\leadsto expr\]

    if -2.8e19 < t < 950

    1. Initial program 89.0%

      \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
    2. Add Preprocessing
    3. Applied egg-rr0

      \[\leadsto expr\]
    4. Taylor expanded in y around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
    6. Taylor expanded in y around inf 0

      \[\leadsto expr\]
    7. Simplified0

      \[\leadsto expr\]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 14: 42.3% accurate, 15.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.8 \cdot 10^{+19}:\\
\;\;\;\;-t\\

\mathbf{elif}\;t \leq 115:\\
\;\;\;\;\left(-y\right) \cdot z\\

\mathbf{else}:\\
\;\;\;\;-t\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -2.8e19 or 115 < t

    1. Initial program 92.7%

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

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Applied egg-rr0

      \[\leadsto expr\]

    if -2.8e19 < t < 115

    1. Initial program 89.0%

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

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Taylor expanded in y around 0 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]
    7. Applied egg-rr0

      \[\leadsto expr\]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 15: 45.8% accurate, 30.7× speedup?

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

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

    \[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t \]
  2. Add Preprocessing
  3. Applied egg-rr0

    \[\leadsto expr\]
  4. Taylor expanded in y around 0 0

    \[\leadsto expr\]
  5. Simplified0

    \[\leadsto expr\]
  6. Taylor expanded in y around inf 0

    \[\leadsto expr\]
  7. Simplified0

    \[\leadsto expr\]
  8. Add Preprocessing

Alternative 16: 35.3% accurate, 107.5× speedup?

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

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

    \[\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 t around inf 0

    \[\leadsto expr\]
  4. Simplified0

    \[\leadsto expr\]
  5. Applied egg-rr0

    \[\leadsto expr\]
  6. Add Preprocessing

Reproduce

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