Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, C

Percentage Accurate: 94.5% → 94.5%
Time: 10.4s
Alternatives: 8
Speedup: 1.0×

Specification

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

\\
x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)
\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 8 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: 94.5% accurate, 1.0× speedup?

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

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

Alternative 1: 94.5% accurate, 1.0× speedup?

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

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

    \[x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right) \]
  2. Add Preprocessing
  3. Final simplification93.7%

    \[\leadsto x \cdot \left(\frac{y}{z} + \frac{t}{z + -1}\right) \]
  4. Add Preprocessing

Alternative 2: 63.3% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \frac{t}{z}\\ \mathbf{if}\;z \leq -1.02 \cdot 10^{+14}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 8.5 \cdot 10^{-79}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;z \leq 0.00056:\\ \;\;\;\;x \cdot \left(-t\right)\\ \mathbf{elif}\;z \leq 2.2 \cdot 10^{+158} \lor \neg \left(z \leq 1.4 \cdot 10^{+259}\right):\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (/ t z))))
   (if (<= z -1.02e+14)
     t_1
     (if (<= z 8.5e-79)
       (* y (/ x z))
       (if (<= z 0.00056)
         (* x (- t))
         (if (or (<= z 2.2e+158) (not (<= z 1.4e+259))) (* x (/ y z)) t_1))))))
double code(double x, double y, double z, double t) {
	double t_1 = x * (t / z);
	double tmp;
	if (z <= -1.02e+14) {
		tmp = t_1;
	} else if (z <= 8.5e-79) {
		tmp = y * (x / z);
	} else if (z <= 0.00056) {
		tmp = x * -t;
	} else if ((z <= 2.2e+158) || !(z <= 1.4e+259)) {
		tmp = x * (y / z);
	} 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 = x * (t / z)
    if (z <= (-1.02d+14)) then
        tmp = t_1
    else if (z <= 8.5d-79) then
        tmp = y * (x / z)
    else if (z <= 0.00056d0) then
        tmp = x * -t
    else if ((z <= 2.2d+158) .or. (.not. (z <= 1.4d+259))) then
        tmp = x * (y / z)
    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 = x * (t / z);
	double tmp;
	if (z <= -1.02e+14) {
		tmp = t_1;
	} else if (z <= 8.5e-79) {
		tmp = y * (x / z);
	} else if (z <= 0.00056) {
		tmp = x * -t;
	} else if ((z <= 2.2e+158) || !(z <= 1.4e+259)) {
		tmp = x * (y / z);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x * (t / z)
	tmp = 0
	if z <= -1.02e+14:
		tmp = t_1
	elif z <= 8.5e-79:
		tmp = y * (x / z)
	elif z <= 0.00056:
		tmp = x * -t
	elif (z <= 2.2e+158) or not (z <= 1.4e+259):
		tmp = x * (y / z)
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x * Float64(t / z))
	tmp = 0.0
	if (z <= -1.02e+14)
		tmp = t_1;
	elseif (z <= 8.5e-79)
		tmp = Float64(y * Float64(x / z));
	elseif (z <= 0.00056)
		tmp = Float64(x * Float64(-t));
	elseif ((z <= 2.2e+158) || !(z <= 1.4e+259))
		tmp = Float64(x * Float64(y / z));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x * (t / z);
	tmp = 0.0;
	if (z <= -1.02e+14)
		tmp = t_1;
	elseif (z <= 8.5e-79)
		tmp = y * (x / z);
	elseif (z <= 0.00056)
		tmp = x * -t;
	elseif ((z <= 2.2e+158) || ~((z <= 1.4e+259)))
		tmp = x * (y / z);
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.02e+14], t$95$1, If[LessEqual[z, 8.5e-79], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.00056], N[(x * (-t)), $MachinePrecision], If[Or[LessEqual[z, 2.2e+158], N[Not[LessEqual[z, 1.4e+259]], $MachinePrecision]], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x \cdot \frac{t}{z}\\
\mathbf{if}\;z \leq -1.02 \cdot 10^{+14}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq 8.5 \cdot 10^{-79}:\\
\;\;\;\;y \cdot \frac{x}{z}\\

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

\mathbf{elif}\;z \leq 2.2 \cdot 10^{+158} \lor \neg \left(z \leq 1.4 \cdot 10^{+259}\right):\\
\;\;\;\;x \cdot \frac{y}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -1.02e14 or 2.2000000000000001e158 < z < 1.4e259

    1. Initial program 94.8%

      \[x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf 85.2%

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

      \[\leadsto \frac{\color{blue}{t \cdot x}}{z} \]
    5. Step-by-step derivation
      1. *-commutative66.0%

        \[\leadsto \frac{\color{blue}{x \cdot t}}{z} \]
    6. Simplified66.0%

      \[\leadsto \frac{\color{blue}{x \cdot t}}{z} \]
    7. Step-by-step derivation
      1. associate-/l*71.9%

        \[\leadsto \color{blue}{x \cdot \frac{t}{z}} \]
      2. *-commutative71.9%

        \[\leadsto \color{blue}{\frac{t}{z} \cdot x} \]
    8. Applied egg-rr71.9%

      \[\leadsto \color{blue}{\frac{t}{z} \cdot x} \]

    if -1.02e14 < z < 8.50000000000000029e-79

    1. Initial program 91.7%

      \[x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 74.5%

      \[\leadsto \color{blue}{\frac{x \cdot y}{z}} \]
    4. Step-by-step derivation
      1. *-commutative74.5%

        \[\leadsto \frac{\color{blue}{y \cdot x}}{z} \]
      2. associate-/l*77.0%

        \[\leadsto \color{blue}{y \cdot \frac{x}{z}} \]
    5. Simplified77.0%

      \[\leadsto \color{blue}{y \cdot \frac{x}{z}} \]

    if 8.50000000000000029e-79 < z < 5.5999999999999995e-4

    1. Initial program 99.7%

      \[x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 64.2%

      \[\leadsto \color{blue}{-1 \cdot \frac{t \cdot x}{1 - z}} \]
    4. Step-by-step derivation
      1. mul-1-neg64.2%

        \[\leadsto \color{blue}{-\frac{t \cdot x}{1 - z}} \]
      2. *-commutative64.2%

        \[\leadsto -\frac{\color{blue}{x \cdot t}}{1 - z} \]
      3. associate-/l*64.3%

        \[\leadsto -\color{blue}{x \cdot \frac{t}{1 - z}} \]
      4. distribute-rgt-neg-out64.3%

        \[\leadsto \color{blue}{x \cdot \left(-\frac{t}{1 - z}\right)} \]
      5. distribute-neg-frac264.3%

        \[\leadsto x \cdot \color{blue}{\frac{t}{-\left(1 - z\right)}} \]
      6. neg-sub064.3%

        \[\leadsto x \cdot \frac{t}{\color{blue}{0 - \left(1 - z\right)}} \]
      7. associate--r-64.3%

        \[\leadsto x \cdot \frac{t}{\color{blue}{\left(0 - 1\right) + z}} \]
      8. metadata-eval64.3%

        \[\leadsto x \cdot \frac{t}{\color{blue}{-1} + z} \]
    5. Simplified64.3%

      \[\leadsto \color{blue}{x \cdot \frac{t}{-1 + z}} \]
    6. Taylor expanded in z around 0 59.0%

      \[\leadsto \color{blue}{-1 \cdot \left(t \cdot x\right)} \]
    7. Step-by-step derivation
      1. *-commutative59.0%

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

        \[\leadsto \color{blue}{-x \cdot t} \]
      3. distribute-lft-neg-in59.0%

        \[\leadsto \color{blue}{\left(-x\right) \cdot t} \]
    8. Simplified59.0%

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

    if 5.5999999999999995e-4 < z < 2.2000000000000001e158 or 1.4e259 < z

    1. Initial program 94.2%

      \[x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 60.0%

      \[\leadsto \color{blue}{\frac{x \cdot y}{z}} \]
    4. Step-by-step derivation
      1. associate-*r/67.0%

        \[\leadsto \color{blue}{x \cdot \frac{y}{z}} \]
    5. Simplified67.0%

      \[\leadsto \color{blue}{x \cdot \frac{y}{z}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification72.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.02 \cdot 10^{+14}:\\ \;\;\;\;x \cdot \frac{t}{z}\\ \mathbf{elif}\;z \leq 8.5 \cdot 10^{-79}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;z \leq 0.00056:\\ \;\;\;\;x \cdot \left(-t\right)\\ \mathbf{elif}\;z \leq 2.2 \cdot 10^{+158} \lor \neg \left(z \leq 1.4 \cdot 10^{+259}\right):\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{t}{z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 74.7% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \frac{t}{z}\\ \mathbf{if}\;z \leq -3.6 \cdot 10^{+15}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 1:\\ \;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\ \mathbf{elif}\;z \leq 3 \cdot 10^{+164} \lor \neg \left(z \leq 1.2 \cdot 10^{+253}\right):\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (/ t z))))
   (if (<= z -3.6e+15)
     t_1
     (if (<= z 1.0)
       (* x (- (/ y z) t))
       (if (or (<= z 3e+164) (not (<= z 1.2e+253))) (* x (/ y z)) t_1)))))
double code(double x, double y, double z, double t) {
	double t_1 = x * (t / z);
	double tmp;
	if (z <= -3.6e+15) {
		tmp = t_1;
	} else if (z <= 1.0) {
		tmp = x * ((y / z) - t);
	} else if ((z <= 3e+164) || !(z <= 1.2e+253)) {
		tmp = x * (y / z);
	} 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 = x * (t / z)
    if (z <= (-3.6d+15)) then
        tmp = t_1
    else if (z <= 1.0d0) then
        tmp = x * ((y / z) - t)
    else if ((z <= 3d+164) .or. (.not. (z <= 1.2d+253))) then
        tmp = x * (y / z)
    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 = x * (t / z);
	double tmp;
	if (z <= -3.6e+15) {
		tmp = t_1;
	} else if (z <= 1.0) {
		tmp = x * ((y / z) - t);
	} else if ((z <= 3e+164) || !(z <= 1.2e+253)) {
		tmp = x * (y / z);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x * (t / z)
	tmp = 0
	if z <= -3.6e+15:
		tmp = t_1
	elif z <= 1.0:
		tmp = x * ((y / z) - t)
	elif (z <= 3e+164) or not (z <= 1.2e+253):
		tmp = x * (y / z)
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x * Float64(t / z))
	tmp = 0.0
	if (z <= -3.6e+15)
		tmp = t_1;
	elseif (z <= 1.0)
		tmp = Float64(x * Float64(Float64(y / z) - t));
	elseif ((z <= 3e+164) || !(z <= 1.2e+253))
		tmp = Float64(x * Float64(y / z));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x * (t / z);
	tmp = 0.0;
	if (z <= -3.6e+15)
		tmp = t_1;
	elseif (z <= 1.0)
		tmp = x * ((y / z) - t);
	elseif ((z <= 3e+164) || ~((z <= 1.2e+253)))
		tmp = x * (y / z);
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.6e+15], t$95$1, If[LessEqual[z, 1.0], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, 3e+164], N[Not[LessEqual[z, 1.2e+253]], $MachinePrecision]], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x \cdot \frac{t}{z}\\
\mathbf{if}\;z \leq -3.6 \cdot 10^{+15}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;z \leq 3 \cdot 10^{+164} \lor \neg \left(z \leq 1.2 \cdot 10^{+253}\right):\\
\;\;\;\;x \cdot \frac{y}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -3.6e15 or 3.00000000000000001e164 < z < 1.19999999999999996e253

    1. Initial program 94.8%

      \[x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf 85.2%

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

      \[\leadsto \frac{\color{blue}{t \cdot x}}{z} \]
    5. Step-by-step derivation
      1. *-commutative66.0%

        \[\leadsto \frac{\color{blue}{x \cdot t}}{z} \]
    6. Simplified66.0%

      \[\leadsto \frac{\color{blue}{x \cdot t}}{z} \]
    7. Step-by-step derivation
      1. associate-/l*71.9%

        \[\leadsto \color{blue}{x \cdot \frac{t}{z}} \]
      2. *-commutative71.9%

        \[\leadsto \color{blue}{\frac{t}{z} \cdot x} \]
    8. Applied egg-rr71.9%

      \[\leadsto \color{blue}{\frac{t}{z} \cdot x} \]

    if -3.6e15 < z < 1

    1. Initial program 93.0%

      \[x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 87.9%

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

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

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

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

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

        \[\leadsto \frac{y}{z} \cdot x + \color{blue}{\left(-t\right)} \cdot x \]
      6. distribute-rgt-out91.0%

        \[\leadsto \color{blue}{x \cdot \left(\frac{y}{z} + \left(-t\right)\right)} \]
      7. unsub-neg91.0%

        \[\leadsto x \cdot \color{blue}{\left(\frac{y}{z} - t\right)} \]
    5. Simplified91.0%

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

    if 1 < z < 3.00000000000000001e164 or 1.19999999999999996e253 < z

    1. Initial program 94.2%

      \[x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 60.0%

      \[\leadsto \color{blue}{\frac{x \cdot y}{z}} \]
    4. Step-by-step derivation
      1. associate-*r/67.0%

        \[\leadsto \color{blue}{x \cdot \frac{y}{z}} \]
    5. Simplified67.0%

      \[\leadsto \color{blue}{x \cdot \frac{y}{z}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification81.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.6 \cdot 10^{+15}:\\ \;\;\;\;x \cdot \frac{t}{z}\\ \mathbf{elif}\;z \leq 1:\\ \;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\ \mathbf{elif}\;z \leq 3 \cdot 10^{+164} \lor \neg \left(z \leq 1.2 \cdot 10^{+253}\right):\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{t}{z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 62.9% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := y \cdot \frac{x}{z}\\ \mathbf{if}\;t \leq -4 \cdot 10^{+90}:\\ \;\;\;\;x \cdot \left(-t\right)\\ \mathbf{elif}\;t \leq 2 \cdot 10^{-152}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t \leq 1.4 \cdot 10^{+138}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;t \leq 3.5 \cdot 10^{+222}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t \cdot \frac{x}{z}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* y (/ x z))))
   (if (<= t -4e+90)
     (* x (- t))
     (if (<= t 2e-152)
       t_1
       (if (<= t 1.4e+138)
         (* x (/ y z))
         (if (<= t 3.5e+222) t_1 (* t (/ x z))))))))
double code(double x, double y, double z, double t) {
	double t_1 = y * (x / z);
	double tmp;
	if (t <= -4e+90) {
		tmp = x * -t;
	} else if (t <= 2e-152) {
		tmp = t_1;
	} else if (t <= 1.4e+138) {
		tmp = x * (y / z);
	} else if (t <= 3.5e+222) {
		tmp = t_1;
	} else {
		tmp = t * (x / 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) :: t_1
    real(8) :: tmp
    t_1 = y * (x / z)
    if (t <= (-4d+90)) then
        tmp = x * -t
    else if (t <= 2d-152) then
        tmp = t_1
    else if (t <= 1.4d+138) then
        tmp = x * (y / z)
    else if (t <= 3.5d+222) then
        tmp = t_1
    else
        tmp = t * (x / z)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = y * (x / z);
	double tmp;
	if (t <= -4e+90) {
		tmp = x * -t;
	} else if (t <= 2e-152) {
		tmp = t_1;
	} else if (t <= 1.4e+138) {
		tmp = x * (y / z);
	} else if (t <= 3.5e+222) {
		tmp = t_1;
	} else {
		tmp = t * (x / z);
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = y * (x / z)
	tmp = 0
	if t <= -4e+90:
		tmp = x * -t
	elif t <= 2e-152:
		tmp = t_1
	elif t <= 1.4e+138:
		tmp = x * (y / z)
	elif t <= 3.5e+222:
		tmp = t_1
	else:
		tmp = t * (x / z)
	return tmp
function code(x, y, z, t)
	t_1 = Float64(y * Float64(x / z))
	tmp = 0.0
	if (t <= -4e+90)
		tmp = Float64(x * Float64(-t));
	elseif (t <= 2e-152)
		tmp = t_1;
	elseif (t <= 1.4e+138)
		tmp = Float64(x * Float64(y / z));
	elseif (t <= 3.5e+222)
		tmp = t_1;
	else
		tmp = Float64(t * Float64(x / z));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = y * (x / z);
	tmp = 0.0;
	if (t <= -4e+90)
		tmp = x * -t;
	elseif (t <= 2e-152)
		tmp = t_1;
	elseif (t <= 1.4e+138)
		tmp = x * (y / z);
	elseif (t <= 3.5e+222)
		tmp = t_1;
	else
		tmp = t * (x / z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -4e+90], N[(x * (-t)), $MachinePrecision], If[LessEqual[t, 2e-152], t$95$1, If[LessEqual[t, 1.4e+138], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3.5e+222], t$95$1, N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := y \cdot \frac{x}{z}\\
\mathbf{if}\;t \leq -4 \cdot 10^{+90}:\\
\;\;\;\;x \cdot \left(-t\right)\\

\mathbf{elif}\;t \leq 2 \cdot 10^{-152}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t \leq 1.4 \cdot 10^{+138}:\\
\;\;\;\;x \cdot \frac{y}{z}\\

\mathbf{elif}\;t \leq 3.5 \cdot 10^{+222}:\\
\;\;\;\;t\_1\\

\mathbf{else}:\\
\;\;\;\;t \cdot \frac{x}{z}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if t < -3.99999999999999987e90

    1. Initial program 97.8%

      \[x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 82.6%

      \[\leadsto \color{blue}{-1 \cdot \frac{t \cdot x}{1 - z}} \]
    4. Step-by-step derivation
      1. mul-1-neg82.6%

        \[\leadsto \color{blue}{-\frac{t \cdot x}{1 - z}} \]
      2. *-commutative82.6%

        \[\leadsto -\frac{\color{blue}{x \cdot t}}{1 - z} \]
      3. associate-/l*86.4%

        \[\leadsto -\color{blue}{x \cdot \frac{t}{1 - z}} \]
      4. distribute-rgt-neg-out86.4%

        \[\leadsto \color{blue}{x \cdot \left(-\frac{t}{1 - z}\right)} \]
      5. distribute-neg-frac286.4%

        \[\leadsto x \cdot \color{blue}{\frac{t}{-\left(1 - z\right)}} \]
      6. neg-sub086.4%

        \[\leadsto x \cdot \frac{t}{\color{blue}{0 - \left(1 - z\right)}} \]
      7. associate--r-86.4%

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

        \[\leadsto x \cdot \frac{t}{\color{blue}{-1} + z} \]
    5. Simplified86.4%

      \[\leadsto \color{blue}{x \cdot \frac{t}{-1 + z}} \]
    6. Taylor expanded in z around 0 46.8%

      \[\leadsto \color{blue}{-1 \cdot \left(t \cdot x\right)} \]
    7. Step-by-step derivation
      1. *-commutative46.8%

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

        \[\leadsto \color{blue}{-x \cdot t} \]
      3. distribute-lft-neg-in46.8%

        \[\leadsto \color{blue}{\left(-x\right) \cdot t} \]
    8. Simplified46.8%

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

    if -3.99999999999999987e90 < t < 2.00000000000000013e-152 or 1.4e138 < t < 3.4999999999999998e222

    1. Initial program 89.0%

      \[x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 73.7%

      \[\leadsto \color{blue}{\frac{x \cdot y}{z}} \]
    4. Step-by-step derivation
      1. *-commutative73.7%

        \[\leadsto \frac{\color{blue}{y \cdot x}}{z} \]
      2. associate-/l*81.9%

        \[\leadsto \color{blue}{y \cdot \frac{x}{z}} \]
    5. Simplified81.9%

      \[\leadsto \color{blue}{y \cdot \frac{x}{z}} \]

    if 2.00000000000000013e-152 < t < 1.4e138

    1. Initial program 98.3%

      \[x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 60.8%

      \[\leadsto \color{blue}{\frac{x \cdot y}{z}} \]
    4. Step-by-step derivation
      1. associate-*r/63.6%

        \[\leadsto \color{blue}{x \cdot \frac{y}{z}} \]
    5. Simplified63.6%

      \[\leadsto \color{blue}{x \cdot \frac{y}{z}} \]

    if 3.4999999999999998e222 < t

    1. Initial program 99.9%

      \[x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 72.6%

      \[\leadsto \color{blue}{-1 \cdot \frac{t \cdot x}{1 - z}} \]
    4. Step-by-step derivation
      1. mul-1-neg72.6%

        \[\leadsto \color{blue}{-\frac{t \cdot x}{1 - z}} \]
      2. *-commutative72.6%

        \[\leadsto -\frac{\color{blue}{x \cdot t}}{1 - z} \]
      3. associate-/l*86.1%

        \[\leadsto -\color{blue}{x \cdot \frac{t}{1 - z}} \]
      4. distribute-rgt-neg-out86.1%

        \[\leadsto \color{blue}{x \cdot \left(-\frac{t}{1 - z}\right)} \]
      5. distribute-neg-frac286.1%

        \[\leadsto x \cdot \color{blue}{\frac{t}{-\left(1 - z\right)}} \]
      6. neg-sub086.1%

        \[\leadsto x \cdot \frac{t}{\color{blue}{0 - \left(1 - z\right)}} \]
      7. associate--r-86.1%

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

        \[\leadsto x \cdot \frac{t}{\color{blue}{-1} + z} \]
    5. Simplified86.1%

      \[\leadsto \color{blue}{x \cdot \frac{t}{-1 + z}} \]
    6. Taylor expanded in z around inf 51.3%

      \[\leadsto \color{blue}{\frac{t \cdot x}{z}} \]
    7. Step-by-step derivation
      1. associate-/l*64.7%

        \[\leadsto \color{blue}{t \cdot \frac{x}{z}} \]
    8. Simplified64.7%

      \[\leadsto \color{blue}{t \cdot \frac{x}{z}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification69.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -4 \cdot 10^{+90}:\\ \;\;\;\;x \cdot \left(-t\right)\\ \mathbf{elif}\;t \leq 2 \cdot 10^{-152}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;t \leq 1.4 \cdot 10^{+138}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;t \leq 3.5 \cdot 10^{+222}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;t \cdot \frac{x}{z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 93.6% accurate, 0.6× speedup?

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

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

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


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

    1. Initial program 94.6%

      \[x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf 87.0%

      \[\leadsto \color{blue}{\frac{x \cdot \left(y - -1 \cdot t\right)}{z}} \]
    4. Step-by-step derivation
      1. *-commutative87.0%

        \[\leadsto \frac{\color{blue}{\left(y - -1 \cdot t\right) \cdot x}}{z} \]
      2. remove-double-neg87.0%

        \[\leadsto \frac{\color{blue}{\left(-\left(-\left(y - -1 \cdot t\right)\right)\right)} \cdot x}{z} \]
      3. cancel-sign-sub-inv87.0%

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

        \[\leadsto \frac{\left(-\left(-\left(y + \color{blue}{1} \cdot t\right)\right)\right) \cdot x}{z} \]
      5. *-lft-identity87.0%

        \[\leadsto \frac{\left(-\left(-\left(y + \color{blue}{t}\right)\right)\right) \cdot x}{z} \]
      6. distribute-neg-out87.0%

        \[\leadsto \frac{\left(-\color{blue}{\left(\left(-y\right) + \left(-t\right)\right)}\right) \cdot x}{z} \]
      7. neg-mul-187.0%

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

        \[\leadsto \frac{\left(-\color{blue}{\left(-1 \cdot y - t\right)}\right) \cdot x}{z} \]
      9. mul-1-neg87.0%

        \[\leadsto \frac{\color{blue}{\left(-1 \cdot \left(-1 \cdot y - t\right)\right)} \cdot x}{z} \]
      10. associate-*r*87.0%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(\left(-1 \cdot y - t\right) \cdot x\right)}}{z} \]
      11. *-commutative87.0%

        \[\leadsto \frac{-1 \cdot \color{blue}{\left(x \cdot \left(-1 \cdot y - t\right)\right)}}{z} \]
      12. associate-*r/87.0%

        \[\leadsto \color{blue}{-1 \cdot \frac{x \cdot \left(-1 \cdot y - t\right)}{z}} \]
      13. mul-1-neg87.0%

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

        \[\leadsto -\color{blue}{x \cdot \frac{-1 \cdot y - t}{z}} \]
      15. distribute-rgt-neg-in94.4%

        \[\leadsto \color{blue}{x \cdot \left(-\frac{-1 \cdot y - t}{z}\right)} \]
      16. distribute-neg-frac94.4%

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

      \[\leadsto \color{blue}{x \cdot \frac{t + y}{z}} \]

    if -1e12 < z < 1

    1. Initial program 93.0%

      \[x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 87.9%

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

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

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

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

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

        \[\leadsto \frac{y}{z} \cdot x + \color{blue}{\left(-t\right)} \cdot x \]
      6. distribute-rgt-out91.0%

        \[\leadsto \color{blue}{x \cdot \left(\frac{y}{z} + \left(-t\right)\right)} \]
      7. unsub-neg91.0%

        \[\leadsto x \cdot \color{blue}{\left(\frac{y}{z} - t\right)} \]
    5. Simplified91.0%

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

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

Alternative 6: 41.6% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -7 \cdot 10^{-55} \lor \neg \left(z \leq 7.2\right):\\
\;\;\;\;t \cdot \frac{x}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -7.00000000000000051e-55 or 7.20000000000000018 < z

    1. Initial program 94.2%

      \[x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 56.2%

      \[\leadsto \color{blue}{-1 \cdot \frac{t \cdot x}{1 - z}} \]
    4. Step-by-step derivation
      1. mul-1-neg56.2%

        \[\leadsto \color{blue}{-\frac{t \cdot x}{1 - z}} \]
      2. *-commutative56.2%

        \[\leadsto -\frac{\color{blue}{x \cdot t}}{1 - z} \]
      3. associate-/l*58.9%

        \[\leadsto -\color{blue}{x \cdot \frac{t}{1 - z}} \]
      4. distribute-rgt-neg-out58.9%

        \[\leadsto \color{blue}{x \cdot \left(-\frac{t}{1 - z}\right)} \]
      5. distribute-neg-frac258.9%

        \[\leadsto x \cdot \color{blue}{\frac{t}{-\left(1 - z\right)}} \]
      6. neg-sub058.9%

        \[\leadsto x \cdot \frac{t}{\color{blue}{0 - \left(1 - z\right)}} \]
      7. associate--r-58.9%

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

        \[\leadsto x \cdot \frac{t}{\color{blue}{-1} + z} \]
    5. Simplified58.9%

      \[\leadsto \color{blue}{x \cdot \frac{t}{-1 + z}} \]
    6. Taylor expanded in z around inf 54.8%

      \[\leadsto \color{blue}{\frac{t \cdot x}{z}} \]
    7. Step-by-step derivation
      1. associate-/l*54.2%

        \[\leadsto \color{blue}{t \cdot \frac{x}{z}} \]
    8. Simplified54.2%

      \[\leadsto \color{blue}{t \cdot \frac{x}{z}} \]

    if -7.00000000000000051e-55 < z < 7.20000000000000018

    1. Initial program 93.3%

      \[x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 29.9%

      \[\leadsto \color{blue}{-1 \cdot \frac{t \cdot x}{1 - z}} \]
    4. Step-by-step derivation
      1. mul-1-neg29.9%

        \[\leadsto \color{blue}{-\frac{t \cdot x}{1 - z}} \]
      2. *-commutative29.9%

        \[\leadsto -\frac{\color{blue}{x \cdot t}}{1 - z} \]
      3. associate-/l*30.0%

        \[\leadsto -\color{blue}{x \cdot \frac{t}{1 - z}} \]
      4. distribute-rgt-neg-out30.0%

        \[\leadsto \color{blue}{x \cdot \left(-\frac{t}{1 - z}\right)} \]
      5. distribute-neg-frac230.0%

        \[\leadsto x \cdot \color{blue}{\frac{t}{-\left(1 - z\right)}} \]
      6. neg-sub030.0%

        \[\leadsto x \cdot \frac{t}{\color{blue}{0 - \left(1 - z\right)}} \]
      7. associate--r-30.0%

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

        \[\leadsto x \cdot \frac{t}{\color{blue}{-1} + z} \]
    5. Simplified30.0%

      \[\leadsto \color{blue}{x \cdot \frac{t}{-1 + z}} \]
    6. Taylor expanded in z around 0 29.0%

      \[\leadsto \color{blue}{-1 \cdot \left(t \cdot x\right)} \]
    7. Step-by-step derivation
      1. *-commutative29.0%

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

        \[\leadsto \color{blue}{-x \cdot t} \]
      3. distribute-lft-neg-in29.0%

        \[\leadsto \color{blue}{\left(-x\right) \cdot t} \]
    8. Simplified29.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -7 \cdot 10^{-55} \lor \neg \left(z \leq 7.2\right):\\ \;\;\;\;t \cdot \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(-t\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 63.1% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq -2.6 \cdot 10^{+90}:\\ \;\;\;\;x \cdot \left(-t\right)\\ \mathbf{elif}\;t \leq 3.5 \cdot 10^{+222}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;t \cdot \frac{x}{z}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= t -2.6e+90)
   (* x (- t))
   (if (<= t 3.5e+222) (* x (/ y z)) (* t (/ x z)))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (t <= -2.6e+90) {
		tmp = x * -t;
	} else if (t <= 3.5e+222) {
		tmp = x * (y / z);
	} else {
		tmp = t * (x / 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 <= (-2.6d+90)) then
        tmp = x * -t
    else if (t <= 3.5d+222) then
        tmp = x * (y / z)
    else
        tmp = t * (x / z)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (t <= -2.6e+90) {
		tmp = x * -t;
	} else if (t <= 3.5e+222) {
		tmp = x * (y / z);
	} else {
		tmp = t * (x / z);
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if t <= -2.6e+90:
		tmp = x * -t
	elif t <= 3.5e+222:
		tmp = x * (y / z)
	else:
		tmp = t * (x / z)
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (t <= -2.6e+90)
		tmp = Float64(x * Float64(-t));
	elseif (t <= 3.5e+222)
		tmp = Float64(x * Float64(y / z));
	else
		tmp = Float64(t * Float64(x / z));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (t <= -2.6e+90)
		tmp = x * -t;
	elseif (t <= 3.5e+222)
		tmp = x * (y / z);
	else
		tmp = t * (x / z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[t, -2.6e+90], N[(x * (-t)), $MachinePrecision], If[LessEqual[t, 3.5e+222], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.6 \cdot 10^{+90}:\\
\;\;\;\;x \cdot \left(-t\right)\\

\mathbf{elif}\;t \leq 3.5 \cdot 10^{+222}:\\
\;\;\;\;x \cdot \frac{y}{z}\\

\mathbf{else}:\\
\;\;\;\;t \cdot \frac{x}{z}\\


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

    1. Initial program 97.8%

      \[x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 82.6%

      \[\leadsto \color{blue}{-1 \cdot \frac{t \cdot x}{1 - z}} \]
    4. Step-by-step derivation
      1. mul-1-neg82.6%

        \[\leadsto \color{blue}{-\frac{t \cdot x}{1 - z}} \]
      2. *-commutative82.6%

        \[\leadsto -\frac{\color{blue}{x \cdot t}}{1 - z} \]
      3. associate-/l*86.4%

        \[\leadsto -\color{blue}{x \cdot \frac{t}{1 - z}} \]
      4. distribute-rgt-neg-out86.4%

        \[\leadsto \color{blue}{x \cdot \left(-\frac{t}{1 - z}\right)} \]
      5. distribute-neg-frac286.4%

        \[\leadsto x \cdot \color{blue}{\frac{t}{-\left(1 - z\right)}} \]
      6. neg-sub086.4%

        \[\leadsto x \cdot \frac{t}{\color{blue}{0 - \left(1 - z\right)}} \]
      7. associate--r-86.4%

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

        \[\leadsto x \cdot \frac{t}{\color{blue}{-1} + z} \]
    5. Simplified86.4%

      \[\leadsto \color{blue}{x \cdot \frac{t}{-1 + z}} \]
    6. Taylor expanded in z around 0 46.8%

      \[\leadsto \color{blue}{-1 \cdot \left(t \cdot x\right)} \]
    7. Step-by-step derivation
      1. *-commutative46.8%

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

        \[\leadsto \color{blue}{-x \cdot t} \]
      3. distribute-lft-neg-in46.8%

        \[\leadsto \color{blue}{\left(-x\right) \cdot t} \]
    8. Simplified46.8%

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

    if -2.5999999999999998e90 < t < 3.4999999999999998e222

    1. Initial program 92.3%

      \[x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 69.2%

      \[\leadsto \color{blue}{\frac{x \cdot y}{z}} \]
    4. Step-by-step derivation
      1. associate-*r/70.8%

        \[\leadsto \color{blue}{x \cdot \frac{y}{z}} \]
    5. Simplified70.8%

      \[\leadsto \color{blue}{x \cdot \frac{y}{z}} \]

    if 3.4999999999999998e222 < t

    1. Initial program 99.9%

      \[x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 72.6%

      \[\leadsto \color{blue}{-1 \cdot \frac{t \cdot x}{1 - z}} \]
    4. Step-by-step derivation
      1. mul-1-neg72.6%

        \[\leadsto \color{blue}{-\frac{t \cdot x}{1 - z}} \]
      2. *-commutative72.6%

        \[\leadsto -\frac{\color{blue}{x \cdot t}}{1 - z} \]
      3. associate-/l*86.1%

        \[\leadsto -\color{blue}{x \cdot \frac{t}{1 - z}} \]
      4. distribute-rgt-neg-out86.1%

        \[\leadsto \color{blue}{x \cdot \left(-\frac{t}{1 - z}\right)} \]
      5. distribute-neg-frac286.1%

        \[\leadsto x \cdot \color{blue}{\frac{t}{-\left(1 - z\right)}} \]
      6. neg-sub086.1%

        \[\leadsto x \cdot \frac{t}{\color{blue}{0 - \left(1 - z\right)}} \]
      7. associate--r-86.1%

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

        \[\leadsto x \cdot \frac{t}{\color{blue}{-1} + z} \]
    5. Simplified86.1%

      \[\leadsto \color{blue}{x \cdot \frac{t}{-1 + z}} \]
    6. Taylor expanded in z around inf 51.3%

      \[\leadsto \color{blue}{\frac{t \cdot x}{z}} \]
    7. Step-by-step derivation
      1. associate-/l*64.7%

        \[\leadsto \color{blue}{t \cdot \frac{x}{z}} \]
    8. Simplified64.7%

      \[\leadsto \color{blue}{t \cdot \frac{x}{z}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification65.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -2.6 \cdot 10^{+90}:\\ \;\;\;\;x \cdot \left(-t\right)\\ \mathbf{elif}\;t \leq 3.5 \cdot 10^{+222}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;t \cdot \frac{x}{z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 23.2% accurate, 2.8× speedup?

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

\\
x \cdot \left(-t\right)
\end{array}
Derivation
  1. Initial program 93.7%

    \[x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right) \]
  2. Add Preprocessing
  3. Taylor expanded in y around 0 43.0%

    \[\leadsto \color{blue}{-1 \cdot \frac{t \cdot x}{1 - z}} \]
  4. Step-by-step derivation
    1. mul-1-neg43.0%

      \[\leadsto \color{blue}{-\frac{t \cdot x}{1 - z}} \]
    2. *-commutative43.0%

      \[\leadsto -\frac{\color{blue}{x \cdot t}}{1 - z} \]
    3. associate-/l*44.3%

      \[\leadsto -\color{blue}{x \cdot \frac{t}{1 - z}} \]
    4. distribute-rgt-neg-out44.3%

      \[\leadsto \color{blue}{x \cdot \left(-\frac{t}{1 - z}\right)} \]
    5. distribute-neg-frac244.3%

      \[\leadsto x \cdot \color{blue}{\frac{t}{-\left(1 - z\right)}} \]
    6. neg-sub044.3%

      \[\leadsto x \cdot \frac{t}{\color{blue}{0 - \left(1 - z\right)}} \]
    7. associate--r-44.3%

      \[\leadsto x \cdot \frac{t}{\color{blue}{\left(0 - 1\right) + z}} \]
    8. metadata-eval44.3%

      \[\leadsto x \cdot \frac{t}{\color{blue}{-1} + z} \]
  5. Simplified44.3%

    \[\leadsto \color{blue}{x \cdot \frac{t}{-1 + z}} \]
  6. Taylor expanded in z around 0 20.0%

    \[\leadsto \color{blue}{-1 \cdot \left(t \cdot x\right)} \]
  7. Step-by-step derivation
    1. *-commutative20.0%

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

      \[\leadsto \color{blue}{-x \cdot t} \]
    3. distribute-lft-neg-in20.0%

      \[\leadsto \color{blue}{\left(-x\right) \cdot t} \]
  8. Simplified20.0%

    \[\leadsto \color{blue}{\left(-x\right) \cdot t} \]
  9. Final simplification20.0%

    \[\leadsto x \cdot \left(-t\right) \]
  10. Add Preprocessing

Developer target: 95.0% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \left(\frac{y}{z} - t \cdot \frac{1}{1 - z}\right)\\ t_2 := x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\\ \mathbf{if}\;t\_2 < -7.623226303312042 \cdot 10^{-196}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 < 1.4133944927702302 \cdot 10^{-211}:\\ \;\;\;\;\frac{y \cdot x}{z} + \left(-\frac{t \cdot x}{1 - z}\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (- (/ y z) (* t (/ 1.0 (- 1.0 z))))))
        (t_2 (* x (- (/ y z) (/ t (- 1.0 z))))))
   (if (< t_2 -7.623226303312042e-196)
     t_1
     (if (< t_2 1.4133944927702302e-211)
       (+ (/ (* y x) z) (- (/ (* t x) (- 1.0 z))))
       t_1))))
double code(double x, double y, double z, double t) {
	double t_1 = x * ((y / z) - (t * (1.0 / (1.0 - z))));
	double t_2 = x * ((y / z) - (t / (1.0 - z)));
	double tmp;
	if (t_2 < -7.623226303312042e-196) {
		tmp = t_1;
	} else if (t_2 < 1.4133944927702302e-211) {
		tmp = ((y * x) / z) + -((t * x) / (1.0 - z));
	} 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) :: t_2
    real(8) :: tmp
    t_1 = x * ((y / z) - (t * (1.0d0 / (1.0d0 - z))))
    t_2 = x * ((y / z) - (t / (1.0d0 - z)))
    if (t_2 < (-7.623226303312042d-196)) then
        tmp = t_1
    else if (t_2 < 1.4133944927702302d-211) then
        tmp = ((y * x) / z) + -((t * x) / (1.0d0 - z))
    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 = x * ((y / z) - (t * (1.0 / (1.0 - z))));
	double t_2 = x * ((y / z) - (t / (1.0 - z)));
	double tmp;
	if (t_2 < -7.623226303312042e-196) {
		tmp = t_1;
	} else if (t_2 < 1.4133944927702302e-211) {
		tmp = ((y * x) / z) + -((t * x) / (1.0 - z));
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x * ((y / z) - (t * (1.0 / (1.0 - z))))
	t_2 = x * ((y / z) - (t / (1.0 - z)))
	tmp = 0
	if t_2 < -7.623226303312042e-196:
		tmp = t_1
	elif t_2 < 1.4133944927702302e-211:
		tmp = ((y * x) / z) + -((t * x) / (1.0 - z))
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x * Float64(Float64(y / z) - Float64(t * Float64(1.0 / Float64(1.0 - z)))))
	t_2 = Float64(x * Float64(Float64(y / z) - Float64(t / Float64(1.0 - z))))
	tmp = 0.0
	if (t_2 < -7.623226303312042e-196)
		tmp = t_1;
	elseif (t_2 < 1.4133944927702302e-211)
		tmp = Float64(Float64(Float64(y * x) / z) + Float64(-Float64(Float64(t * x) / Float64(1.0 - z))));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x * ((y / z) - (t * (1.0 / (1.0 - z))));
	t_2 = x * ((y / z) - (t / (1.0 - z)));
	tmp = 0.0;
	if (t_2 < -7.623226303312042e-196)
		tmp = t_1;
	elseif (t_2 < 1.4133944927702302e-211)
		tmp = ((y * x) / z) + -((t * x) / (1.0 - z));
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(N[(y / z), $MachinePrecision] - N[(t * N[(1.0 / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(N[(y / z), $MachinePrecision] - N[(t / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[t$95$2, -7.623226303312042e-196], t$95$1, If[Less[t$95$2, 1.4133944927702302e-211], N[(N[(N[(y * x), $MachinePrecision] / z), $MachinePrecision] + (-N[(N[(t * x), $MachinePrecision] / N[(1.0 - z), $MachinePrecision]), $MachinePrecision])), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x \cdot \left(\frac{y}{z} - t \cdot \frac{1}{1 - z}\right)\\
t_2 := x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\\
\mathbf{if}\;t\_2 < -7.623226303312042 \cdot 10^{-196}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_2 < 1.4133944927702302 \cdot 10^{-211}:\\
\;\;\;\;\frac{y \cdot x}{z} + \left(-\frac{t \cdot x}{1 - z}\right)\\

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


\end{array}
\end{array}

Reproduce

?
herbie shell --seed 2024045 
(FPCore (x y z t)
  :name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, C"
  :precision binary64

  :alt
  (if (< (* x (- (/ y z) (/ t (- 1.0 z)))) -7.623226303312042e-196) (* x (- (/ y z) (* t (/ 1.0 (- 1.0 z))))) (if (< (* x (- (/ y z) (/ t (- 1.0 z)))) 1.4133944927702302e-211) (+ (/ (* y x) z) (- (/ (* t x) (- 1.0 z)))) (* x (- (/ y z) (* t (/ 1.0 (- 1.0 z)))))))

  (* x (- (/ y z) (/ t (- 1.0 z)))))