Data.Random.Distribution.Triangular:triangularCDF from random-fu-0.2.6.2, A

Percentage Accurate: 99.1% → 99.1%
Time: 10.3s
Alternatives: 11
Speedup: 1.0×

Specification

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

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

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

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

Alternative 1: 99.1% accurate, 1.0× speedup?

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

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

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

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

Alternative 2: 87.4% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.1 \cdot 10^{-60}:\\
\;\;\;\;1\\

\mathbf{elif}\;y \leq 2.75 \cdot 10^{-34}:\\
\;\;\;\;1 + \frac{\frac{x}{t}}{y - z}\\

\mathbf{else}:\\
\;\;\;\;1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -3.09999999999999988e-60 or 2.75000000000000007e-34 < y

    1. Initial program 99.9%

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

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

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

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

        \[\leadsto 1 - \left(-\color{blue}{\frac{\frac{x}{t}}{y}}\right) \]
      3. distribute-neg-frac70.7%

        \[\leadsto 1 - \color{blue}{\frac{-\frac{x}{t}}{y}} \]
      4. distribute-frac-neg70.7%

        \[\leadsto 1 - \frac{\color{blue}{\frac{-x}{t}}}{y} \]
    6. Simplified70.7%

      \[\leadsto 1 - \color{blue}{\frac{\frac{-x}{t}}{y}} \]
    7. Step-by-step derivation
      1. expm1-log1p-u69.4%

        \[\leadsto 1 - \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\frac{-x}{t}}{y}\right)\right)} \]
      2. expm1-udef69.4%

        \[\leadsto 1 - \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{\frac{-x}{t}}{y}\right)} - 1\right)} \]
      3. associate-/l/69.4%

        \[\leadsto 1 - \left(e^{\mathsf{log1p}\left(\color{blue}{\frac{-x}{y \cdot t}}\right)} - 1\right) \]
      4. add-sqr-sqrt30.2%

        \[\leadsto 1 - \left(e^{\mathsf{log1p}\left(\frac{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}}{y \cdot t}\right)} - 1\right) \]
      5. sqrt-unprod59.3%

        \[\leadsto 1 - \left(e^{\mathsf{log1p}\left(\frac{\color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}}}{y \cdot t}\right)} - 1\right) \]
      6. sqr-neg59.3%

        \[\leadsto 1 - \left(e^{\mathsf{log1p}\left(\frac{\sqrt{\color{blue}{x \cdot x}}}{y \cdot t}\right)} - 1\right) \]
      7. sqrt-unprod39.4%

        \[\leadsto 1 - \left(e^{\mathsf{log1p}\left(\frac{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}{y \cdot t}\right)} - 1\right) \]
      8. add-sqr-sqrt68.6%

        \[\leadsto 1 - \left(e^{\mathsf{log1p}\left(\frac{\color{blue}{x}}{y \cdot t}\right)} - 1\right) \]
    8. Applied egg-rr68.6%

      \[\leadsto 1 - \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x}{y \cdot t}\right)} - 1\right)} \]
    9. Step-by-step derivation
      1. expm1-def68.6%

        \[\leadsto 1 - \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{y \cdot t}\right)\right)} \]
      2. expm1-log1p69.3%

        \[\leadsto 1 - \color{blue}{\frac{x}{y \cdot t}} \]
    10. Simplified69.3%

      \[\leadsto 1 - \color{blue}{\frac{x}{y \cdot t}} \]
    11. Taylor expanded in x around 0 89.0%

      \[\leadsto \color{blue}{1} \]

    if -3.09999999999999988e-60 < y < 2.75000000000000007e-34

    1. Initial program 98.6%

      \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
    2. Step-by-step derivation
      1. sub-neg98.6%

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

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

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

        \[\leadsto 1 + 1 \cdot \color{blue}{\frac{\frac{-x}{y - z}}{y - t}} \]
      5. associate-*r/96.5%

        \[\leadsto 1 + \color{blue}{\frac{1 \cdot \frac{-x}{y - z}}{y - t}} \]
      6. metadata-eval96.5%

        \[\leadsto 1 + \frac{\color{blue}{\frac{-1}{-1}} \cdot \frac{-x}{y - z}}{y - t} \]
      7. times-frac96.5%

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

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

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

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{-\left(y - z\right)}}}{y - t} \]
      11. sub-neg96.5%

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

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{\left(-y\right) + \left(-\left(-z\right)\right)}}}{y - t} \]
      13. remove-double-neg96.5%

        \[\leadsto 1 + \frac{\frac{x}{\left(-y\right) + \color{blue}{z}}}{y - t} \]
      14. +-commutative96.5%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{z + \left(-y\right)}}}{y - t} \]
      15. sub-neg96.5%

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

      \[\leadsto \color{blue}{1 + \frac{\frac{x}{z - y}}{y - t}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 98.6%

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

        \[\leadsto 1 + \color{blue}{\frac{\frac{x}{y - t}}{z - y}} \]
    7. Simplified98.9%

      \[\leadsto 1 + \color{blue}{\frac{\frac{x}{y - t}}{z - y}} \]
    8. Taylor expanded in t around inf 88.0%

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

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

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

        \[\leadsto 1 + \color{blue}{\frac{-\frac{x}{t}}{z - y}} \]
      4. distribute-frac-neg88.4%

        \[\leadsto 1 + \frac{\color{blue}{\frac{-x}{t}}}{z - y} \]
    10. Simplified88.4%

      \[\leadsto 1 + \color{blue}{\frac{\frac{-x}{t}}{z - y}} \]
    11. Step-by-step derivation
      1. frac-2neg88.4%

        \[\leadsto 1 + \color{blue}{\frac{-\frac{-x}{t}}{-\left(z - y\right)}} \]
      2. div-inv88.4%

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

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

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

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

        \[\leadsto 1 + \frac{x}{t} \cdot \frac{1}{\color{blue}{\left(-z\right) + \left(-\left(-y\right)\right)}} \]
      7. add-sqr-sqrt45.7%

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

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

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

        \[\leadsto 1 + \frac{x}{t} \cdot \frac{1}{\left(-z\right) + \left(-\color{blue}{\sqrt{y} \cdot \sqrt{y}}\right)} \]
      11. add-sqr-sqrt77.8%

        \[\leadsto 1 + \frac{x}{t} \cdot \frac{1}{\left(-z\right) + \left(-\color{blue}{y}\right)} \]
      12. add-sqr-sqrt39.4%

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

        \[\leadsto 1 + \frac{x}{t} \cdot \frac{1}{\left(-z\right) + \color{blue}{\sqrt{\left(-y\right) \cdot \left(-y\right)}}} \]
      14. sqr-neg80.5%

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

        \[\leadsto 1 + \frac{x}{t} \cdot \frac{1}{\left(-z\right) + \color{blue}{\sqrt{y} \cdot \sqrt{y}}} \]
      16. add-sqr-sqrt88.4%

        \[\leadsto 1 + \frac{x}{t} \cdot \frac{1}{\left(-z\right) + \color{blue}{y}} \]
    12. Applied egg-rr88.4%

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

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

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

        \[\leadsto 1 + \frac{\frac{x}{t}}{\color{blue}{y + \left(-z\right)}} \]
      4. unsub-neg88.4%

        \[\leadsto 1 + \frac{\frac{x}{t}}{\color{blue}{y - z}} \]
    14. Simplified88.4%

      \[\leadsto 1 + \color{blue}{\frac{\frac{x}{t}}{y - z}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification88.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -3.1 \cdot 10^{-60}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq 2.75 \cdot 10^{-34}:\\ \;\;\;\;1 + \frac{\frac{x}{t}}{y - z}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 84.3% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.28 \cdot 10^{-145}:\\
\;\;\;\;1 + \frac{\frac{x}{y - t}}{z}\\

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

\mathbf{else}:\\
\;\;\;\;1 + \frac{\frac{x}{t}}{y - z}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.28e-145

    1. Initial program 98.3%

      \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
    2. Step-by-step derivation
      1. sub-neg98.3%

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

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

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

        \[\leadsto 1 + 1 \cdot \color{blue}{\frac{\frac{-x}{y - z}}{y - t}} \]
      5. associate-*r/98.9%

        \[\leadsto 1 + \color{blue}{\frac{1 \cdot \frac{-x}{y - z}}{y - t}} \]
      6. metadata-eval98.9%

        \[\leadsto 1 + \frac{\color{blue}{\frac{-1}{-1}} \cdot \frac{-x}{y - z}}{y - t} \]
      7. times-frac98.9%

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

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

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

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

        \[\leadsto 1 + \frac{\frac{x}{-\color{blue}{\left(y + \left(-z\right)\right)}}}{y - t} \]
      12. distribute-neg-out98.9%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{\left(-y\right) + \left(-\left(-z\right)\right)}}}{y - t} \]
      13. remove-double-neg98.9%

        \[\leadsto 1 + \frac{\frac{x}{\left(-y\right) + \color{blue}{z}}}{y - t} \]
      14. +-commutative98.9%

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

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{z - y}}}{y - t} \]
    3. Simplified98.9%

      \[\leadsto \color{blue}{1 + \frac{\frac{x}{z - y}}{y - t}} \]
    4. Add Preprocessing
    5. Taylor expanded in z around inf 87.8%

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

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

        \[\leadsto 1 + \color{blue}{\frac{\frac{x}{y - t}}{z}} \]
    7. Simplified88.2%

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

    if -1.28e-145 < z < 1.1e-294

    1. Initial program 99.9%

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

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

    if 1.1e-294 < z

    1. Initial program 99.9%

      \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
    2. Step-by-step derivation
      1. sub-neg99.9%

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

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

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

        \[\leadsto 1 + 1 \cdot \color{blue}{\frac{\frac{-x}{y - z}}{y - t}} \]
      5. associate-*r/97.8%

        \[\leadsto 1 + \color{blue}{\frac{1 \cdot \frac{-x}{y - z}}{y - t}} \]
      6. metadata-eval97.8%

        \[\leadsto 1 + \frac{\color{blue}{\frac{-1}{-1}} \cdot \frac{-x}{y - z}}{y - t} \]
      7. times-frac97.8%

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

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

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

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

        \[\leadsto 1 + \frac{\frac{x}{-\color{blue}{\left(y + \left(-z\right)\right)}}}{y - t} \]
      12. distribute-neg-out97.8%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{\left(-y\right) + \left(-\left(-z\right)\right)}}}{y - t} \]
      13. remove-double-neg97.8%

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

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

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{z - y}}}{y - t} \]
    3. Simplified97.8%

      \[\leadsto \color{blue}{1 + \frac{\frac{x}{z - y}}{y - t}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 99.9%

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

        \[\leadsto 1 + \color{blue}{\frac{\frac{x}{y - t}}{z - y}} \]
    7. Simplified99.9%

      \[\leadsto 1 + \color{blue}{\frac{\frac{x}{y - t}}{z - y}} \]
    8. Taylor expanded in t around inf 85.7%

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

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

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

        \[\leadsto 1 + \color{blue}{\frac{-\frac{x}{t}}{z - y}} \]
      4. distribute-frac-neg85.6%

        \[\leadsto 1 + \frac{\color{blue}{\frac{-x}{t}}}{z - y} \]
    10. Simplified85.6%

      \[\leadsto 1 + \color{blue}{\frac{\frac{-x}{t}}{z - y}} \]
    11. Step-by-step derivation
      1. frac-2neg85.6%

        \[\leadsto 1 + \color{blue}{\frac{-\frac{-x}{t}}{-\left(z - y\right)}} \]
      2. div-inv85.6%

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

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

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

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

        \[\leadsto 1 + \frac{x}{t} \cdot \frac{1}{\color{blue}{\left(-z\right) + \left(-\left(-y\right)\right)}} \]
      7. add-sqr-sqrt36.3%

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

        \[\leadsto 1 + \frac{x}{t} \cdot \frac{1}{\left(-z\right) + \left(-\color{blue}{\sqrt{\left(-y\right) \cdot \left(-y\right)}}\right)} \]
      9. sqr-neg81.6%

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

        \[\leadsto 1 + \frac{x}{t} \cdot \frac{1}{\left(-z\right) + \left(-\color{blue}{\sqrt{y} \cdot \sqrt{y}}\right)} \]
      11. add-sqr-sqrt79.3%

        \[\leadsto 1 + \frac{x}{t} \cdot \frac{1}{\left(-z\right) + \left(-\color{blue}{y}\right)} \]
      12. add-sqr-sqrt33.3%

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

        \[\leadsto 1 + \frac{x}{t} \cdot \frac{1}{\left(-z\right) + \color{blue}{\sqrt{\left(-y\right) \cdot \left(-y\right)}}} \]
      14. sqr-neg81.9%

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

        \[\leadsto 1 + \frac{x}{t} \cdot \frac{1}{\left(-z\right) + \color{blue}{\sqrt{y} \cdot \sqrt{y}}} \]
      16. add-sqr-sqrt85.6%

        \[\leadsto 1 + \frac{x}{t} \cdot \frac{1}{\left(-z\right) + \color{blue}{y}} \]
    12. Applied egg-rr85.6%

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

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

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

        \[\leadsto 1 + \frac{\frac{x}{t}}{\color{blue}{y + \left(-z\right)}} \]
      4. unsub-neg85.6%

        \[\leadsto 1 + \frac{\frac{x}{t}}{\color{blue}{y - z}} \]
    14. Simplified85.6%

      \[\leadsto 1 + \color{blue}{\frac{\frac{x}{t}}{y - z}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification88.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.28 \cdot 10^{-145}:\\ \;\;\;\;1 + \frac{\frac{x}{y - t}}{z}\\ \mathbf{elif}\;z \leq 1.1 \cdot 10^{-294}:\\ \;\;\;\;1 - \frac{x}{y \cdot \left(y - t\right)}\\ \mathbf{else}:\\ \;\;\;\;1 + \frac{\frac{x}{t}}{y - z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 84.1% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.28 \cdot 10^{-145}:\\
\;\;\;\;1 + \frac{\frac{x}{y - t}}{z}\\

\mathbf{elif}\;z \leq 9.5 \cdot 10^{-295}:\\
\;\;\;\;1 - \frac{\frac{x}{y}}{y - t}\\

\mathbf{else}:\\
\;\;\;\;1 + \frac{\frac{x}{t}}{y - z}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.28e-145

    1. Initial program 98.3%

      \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
    2. Step-by-step derivation
      1. sub-neg98.3%

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

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

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

        \[\leadsto 1 + 1 \cdot \color{blue}{\frac{\frac{-x}{y - z}}{y - t}} \]
      5. associate-*r/98.9%

        \[\leadsto 1 + \color{blue}{\frac{1 \cdot \frac{-x}{y - z}}{y - t}} \]
      6. metadata-eval98.9%

        \[\leadsto 1 + \frac{\color{blue}{\frac{-1}{-1}} \cdot \frac{-x}{y - z}}{y - t} \]
      7. times-frac98.9%

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

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

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

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

        \[\leadsto 1 + \frac{\frac{x}{-\color{blue}{\left(y + \left(-z\right)\right)}}}{y - t} \]
      12. distribute-neg-out98.9%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{\left(-y\right) + \left(-\left(-z\right)\right)}}}{y - t} \]
      13. remove-double-neg98.9%

        \[\leadsto 1 + \frac{\frac{x}{\left(-y\right) + \color{blue}{z}}}{y - t} \]
      14. +-commutative98.9%

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

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{z - y}}}{y - t} \]
    3. Simplified98.9%

      \[\leadsto \color{blue}{1 + \frac{\frac{x}{z - y}}{y - t}} \]
    4. Add Preprocessing
    5. Taylor expanded in z around inf 87.8%

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

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

        \[\leadsto 1 + \color{blue}{\frac{\frac{x}{y - t}}{z}} \]
    7. Simplified88.2%

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

    if -1.28e-145 < z < 9.5e-295

    1. Initial program 99.9%

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

      \[\leadsto 1 - \color{blue}{\frac{x}{y \cdot \left(y - t\right)}} \]
    4. Step-by-step derivation
      1. associate-/r*99.4%

        \[\leadsto 1 - \color{blue}{\frac{\frac{x}{y}}{y - t}} \]
    5. Simplified99.4%

      \[\leadsto 1 - \color{blue}{\frac{\frac{x}{y}}{y - t}} \]

    if 9.5e-295 < z

    1. Initial program 99.9%

      \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
    2. Step-by-step derivation
      1. sub-neg99.9%

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

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

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

        \[\leadsto 1 + 1 \cdot \color{blue}{\frac{\frac{-x}{y - z}}{y - t}} \]
      5. associate-*r/97.8%

        \[\leadsto 1 + \color{blue}{\frac{1 \cdot \frac{-x}{y - z}}{y - t}} \]
      6. metadata-eval97.8%

        \[\leadsto 1 + \frac{\color{blue}{\frac{-1}{-1}} \cdot \frac{-x}{y - z}}{y - t} \]
      7. times-frac97.8%

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

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

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

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

        \[\leadsto 1 + \frac{\frac{x}{-\color{blue}{\left(y + \left(-z\right)\right)}}}{y - t} \]
      12. distribute-neg-out97.8%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{\left(-y\right) + \left(-\left(-z\right)\right)}}}{y - t} \]
      13. remove-double-neg97.8%

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

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

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{z - y}}}{y - t} \]
    3. Simplified97.8%

      \[\leadsto \color{blue}{1 + \frac{\frac{x}{z - y}}{y - t}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 99.9%

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

        \[\leadsto 1 + \color{blue}{\frac{\frac{x}{y - t}}{z - y}} \]
    7. Simplified99.9%

      \[\leadsto 1 + \color{blue}{\frac{\frac{x}{y - t}}{z - y}} \]
    8. Taylor expanded in t around inf 85.7%

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

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

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

        \[\leadsto 1 + \color{blue}{\frac{-\frac{x}{t}}{z - y}} \]
      4. distribute-frac-neg85.6%

        \[\leadsto 1 + \frac{\color{blue}{\frac{-x}{t}}}{z - y} \]
    10. Simplified85.6%

      \[\leadsto 1 + \color{blue}{\frac{\frac{-x}{t}}{z - y}} \]
    11. Step-by-step derivation
      1. frac-2neg85.6%

        \[\leadsto 1 + \color{blue}{\frac{-\frac{-x}{t}}{-\left(z - y\right)}} \]
      2. div-inv85.6%

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

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

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

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

        \[\leadsto 1 + \frac{x}{t} \cdot \frac{1}{\color{blue}{\left(-z\right) + \left(-\left(-y\right)\right)}} \]
      7. add-sqr-sqrt36.3%

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

        \[\leadsto 1 + \frac{x}{t} \cdot \frac{1}{\left(-z\right) + \left(-\color{blue}{\sqrt{\left(-y\right) \cdot \left(-y\right)}}\right)} \]
      9. sqr-neg81.6%

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

        \[\leadsto 1 + \frac{x}{t} \cdot \frac{1}{\left(-z\right) + \left(-\color{blue}{\sqrt{y} \cdot \sqrt{y}}\right)} \]
      11. add-sqr-sqrt79.3%

        \[\leadsto 1 + \frac{x}{t} \cdot \frac{1}{\left(-z\right) + \left(-\color{blue}{y}\right)} \]
      12. add-sqr-sqrt33.3%

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

        \[\leadsto 1 + \frac{x}{t} \cdot \frac{1}{\left(-z\right) + \color{blue}{\sqrt{\left(-y\right) \cdot \left(-y\right)}}} \]
      14. sqr-neg81.9%

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

        \[\leadsto 1 + \frac{x}{t} \cdot \frac{1}{\left(-z\right) + \color{blue}{\sqrt{y} \cdot \sqrt{y}}} \]
      16. add-sqr-sqrt85.6%

        \[\leadsto 1 + \frac{x}{t} \cdot \frac{1}{\left(-z\right) + \color{blue}{y}} \]
    12. Applied egg-rr85.6%

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

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

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

        \[\leadsto 1 + \frac{\frac{x}{t}}{\color{blue}{y + \left(-z\right)}} \]
      4. unsub-neg85.6%

        \[\leadsto 1 + \frac{\frac{x}{t}}{\color{blue}{y - z}} \]
    14. Simplified85.6%

      \[\leadsto 1 + \color{blue}{\frac{\frac{x}{t}}{y - z}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification88.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.28 \cdot 10^{-145}:\\ \;\;\;\;1 + \frac{\frac{x}{y - t}}{z}\\ \mathbf{elif}\;z \leq 9.5 \cdot 10^{-295}:\\ \;\;\;\;1 - \frac{\frac{x}{y}}{y - t}\\ \mathbf{else}:\\ \;\;\;\;1 + \frac{\frac{x}{t}}{y - z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 84.3% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.7 \cdot 10^{-143}:\\
\;\;\;\;1 + \frac{\frac{x}{y - t}}{z}\\

\mathbf{elif}\;z \leq 1.1 \cdot 10^{-294}:\\
\;\;\;\;1 - \frac{\frac{x}{y}}{y - t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.69999999999999992e-143

    1. Initial program 98.3%

      \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
    2. Step-by-step derivation
      1. sub-neg98.3%

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

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

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

        \[\leadsto 1 + 1 \cdot \color{blue}{\frac{\frac{-x}{y - z}}{y - t}} \]
      5. associate-*r/98.9%

        \[\leadsto 1 + \color{blue}{\frac{1 \cdot \frac{-x}{y - z}}{y - t}} \]
      6. metadata-eval98.9%

        \[\leadsto 1 + \frac{\color{blue}{\frac{-1}{-1}} \cdot \frac{-x}{y - z}}{y - t} \]
      7. times-frac98.9%

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

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

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

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

        \[\leadsto 1 + \frac{\frac{x}{-\color{blue}{\left(y + \left(-z\right)\right)}}}{y - t} \]
      12. distribute-neg-out98.9%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{\left(-y\right) + \left(-\left(-z\right)\right)}}}{y - t} \]
      13. remove-double-neg98.9%

        \[\leadsto 1 + \frac{\frac{x}{\left(-y\right) + \color{blue}{z}}}{y - t} \]
      14. +-commutative98.9%

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

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{z - y}}}{y - t} \]
    3. Simplified98.9%

      \[\leadsto \color{blue}{1 + \frac{\frac{x}{z - y}}{y - t}} \]
    4. Add Preprocessing
    5. Taylor expanded in z around inf 87.8%

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

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

        \[\leadsto 1 + \color{blue}{\frac{\frac{x}{y - t}}{z}} \]
    7. Simplified88.2%

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

    if -1.69999999999999992e-143 < z < 1.1e-294

    1. Initial program 99.9%

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

      \[\leadsto 1 - \color{blue}{\frac{x}{y \cdot \left(y - t\right)}} \]
    4. Step-by-step derivation
      1. associate-/r*99.4%

        \[\leadsto 1 - \color{blue}{\frac{\frac{x}{y}}{y - t}} \]
    5. Simplified99.4%

      \[\leadsto 1 - \color{blue}{\frac{\frac{x}{y}}{y - t}} \]

    if 1.1e-294 < z

    1. Initial program 99.9%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.7 \cdot 10^{-143}:\\ \;\;\;\;1 + \frac{\frac{x}{y - t}}{z}\\ \mathbf{elif}\;z \leq 1.1 \cdot 10^{-294}:\\ \;\;\;\;1 - \frac{\frac{x}{y}}{y - t}\\ \mathbf{else}:\\ \;\;\;\;1 + \frac{x}{\left(y - z\right) \cdot t}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 76.8% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.18 \cdot 10^{-89}:\\
\;\;\;\;1\\

\mathbf{elif}\;t \leq 1.55 \cdot 10^{-130}:\\
\;\;\;\;1 + \frac{x}{y \cdot z}\\

\mathbf{else}:\\
\;\;\;\;1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.18000000000000001e-89 or 1.55000000000000005e-130 < t

    1. Initial program 99.9%

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

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

      \[\leadsto 1 - \color{blue}{-1 \cdot \frac{x}{t \cdot y}} \]
    5. Step-by-step derivation
      1. mul-1-neg66.5%

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

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

        \[\leadsto 1 - \color{blue}{\frac{-\frac{x}{t}}{y}} \]
      4. distribute-frac-neg66.5%

        \[\leadsto 1 - \frac{\color{blue}{\frac{-x}{t}}}{y} \]
    6. Simplified66.5%

      \[\leadsto 1 - \color{blue}{\frac{\frac{-x}{t}}{y}} \]
    7. Step-by-step derivation
      1. expm1-log1p-u61.7%

        \[\leadsto 1 - \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\frac{-x}{t}}{y}\right)\right)} \]
      2. expm1-udef61.7%

        \[\leadsto 1 - \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{\frac{-x}{t}}{y}\right)} - 1\right)} \]
      3. associate-/l/61.7%

        \[\leadsto 1 - \left(e^{\mathsf{log1p}\left(\color{blue}{\frac{-x}{y \cdot t}}\right)} - 1\right) \]
      4. add-sqr-sqrt26.6%

        \[\leadsto 1 - \left(e^{\mathsf{log1p}\left(\frac{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}}{y \cdot t}\right)} - 1\right) \]
      5. sqrt-unprod53.2%

        \[\leadsto 1 - \left(e^{\mathsf{log1p}\left(\frac{\color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}}}{y \cdot t}\right)} - 1\right) \]
      6. sqr-neg53.2%

        \[\leadsto 1 - \left(e^{\mathsf{log1p}\left(\frac{\sqrt{\color{blue}{x \cdot x}}}{y \cdot t}\right)} - 1\right) \]
      7. sqrt-unprod35.6%

        \[\leadsto 1 - \left(e^{\mathsf{log1p}\left(\frac{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}{y \cdot t}\right)} - 1\right) \]
      8. add-sqr-sqrt61.4%

        \[\leadsto 1 - \left(e^{\mathsf{log1p}\left(\frac{\color{blue}{x}}{y \cdot t}\right)} - 1\right) \]
    8. Applied egg-rr61.4%

      \[\leadsto 1 - \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x}{y \cdot t}\right)} - 1\right)} \]
    9. Step-by-step derivation
      1. expm1-def61.4%

        \[\leadsto 1 - \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{y \cdot t}\right)\right)} \]
      2. expm1-log1p62.3%

        \[\leadsto 1 - \color{blue}{\frac{x}{y \cdot t}} \]
    10. Simplified62.3%

      \[\leadsto 1 - \color{blue}{\frac{x}{y \cdot t}} \]
    11. Taylor expanded in x around 0 82.4%

      \[\leadsto \color{blue}{1} \]

    if -1.18000000000000001e-89 < t < 1.55000000000000005e-130

    1. Initial program 98.2%

      \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
    2. Step-by-step derivation
      1. sub-neg98.2%

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

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

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

        \[\leadsto 1 + 1 \cdot \color{blue}{\frac{\frac{-x}{y - z}}{y - t}} \]
      5. associate-*r/99.9%

        \[\leadsto 1 + \color{blue}{\frac{1 \cdot \frac{-x}{y - z}}{y - t}} \]
      6. metadata-eval99.9%

        \[\leadsto 1 + \frac{\color{blue}{\frac{-1}{-1}} \cdot \frac{-x}{y - z}}{y - t} \]
      7. times-frac99.9%

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

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

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

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

        \[\leadsto 1 + \frac{\frac{x}{-\color{blue}{\left(y + \left(-z\right)\right)}}}{y - t} \]
      12. distribute-neg-out99.9%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{\left(-y\right) + \left(-\left(-z\right)\right)}}}{y - t} \]
      13. remove-double-neg99.9%

        \[\leadsto 1 + \frac{\frac{x}{\left(-y\right) + \color{blue}{z}}}{y - t} \]
      14. +-commutative99.9%

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

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{z - y}}}{y - t} \]
    3. Simplified99.9%

      \[\leadsto \color{blue}{1 + \frac{\frac{x}{z - y}}{y - t}} \]
    4. Add Preprocessing
    5. Taylor expanded in z around inf 80.0%

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

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

        \[\leadsto 1 + \color{blue}{\frac{\frac{x}{y - t}}{z}} \]
    7. Simplified81.8%

      \[\leadsto 1 + \color{blue}{\frac{\frac{x}{y - t}}{z}} \]
    8. Taylor expanded in y around inf 74.6%

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

        \[\leadsto 1 + \frac{x}{\color{blue}{z \cdot y}} \]
    10. Simplified74.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1.18 \cdot 10^{-89}:\\ \;\;\;\;1\\ \mathbf{elif}\;t \leq 1.55 \cdot 10^{-130}:\\ \;\;\;\;1 + \frac{x}{y \cdot z}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 84.0% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.8 \cdot 10^{-107}:\\
\;\;\;\;1\\

\mathbf{elif}\;y \leq 5.4 \cdot 10^{-39}:\\
\;\;\;\;1 - \frac{x}{z \cdot t}\\

\mathbf{else}:\\
\;\;\;\;1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -9.79999999999999959e-107 or 5.4000000000000001e-39 < y

    1. Initial program 99.9%

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

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

      \[\leadsto 1 - \color{blue}{-1 \cdot \frac{x}{t \cdot y}} \]
    5. Step-by-step derivation
      1. mul-1-neg70.2%

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

        \[\leadsto 1 - \left(-\color{blue}{\frac{\frac{x}{t}}{y}}\right) \]
      3. distribute-neg-frac70.1%

        \[\leadsto 1 - \color{blue}{\frac{-\frac{x}{t}}{y}} \]
      4. distribute-frac-neg70.1%

        \[\leadsto 1 - \frac{\color{blue}{\frac{-x}{t}}}{y} \]
    6. Simplified70.1%

      \[\leadsto 1 - \color{blue}{\frac{\frac{-x}{t}}{y}} \]
    7. Step-by-step derivation
      1. expm1-log1p-u67.5%

        \[\leadsto 1 - \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\frac{-x}{t}}{y}\right)\right)} \]
      2. expm1-udef67.5%

        \[\leadsto 1 - \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{\frac{-x}{t}}{y}\right)} - 1\right)} \]
      3. associate-/l/67.5%

        \[\leadsto 1 - \left(e^{\mathsf{log1p}\left(\color{blue}{\frac{-x}{y \cdot t}}\right)} - 1\right) \]
      4. add-sqr-sqrt29.5%

        \[\leadsto 1 - \left(e^{\mathsf{log1p}\left(\frac{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}}{y \cdot t}\right)} - 1\right) \]
      5. sqrt-unprod57.9%

        \[\leadsto 1 - \left(e^{\mathsf{log1p}\left(\frac{\color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}}}{y \cdot t}\right)} - 1\right) \]
      6. sqr-neg57.9%

        \[\leadsto 1 - \left(e^{\mathsf{log1p}\left(\frac{\sqrt{\color{blue}{x \cdot x}}}{y \cdot t}\right)} - 1\right) \]
      7. sqrt-unprod38.3%

        \[\leadsto 1 - \left(e^{\mathsf{log1p}\left(\frac{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}{y \cdot t}\right)} - 1\right) \]
      8. add-sqr-sqrt66.8%

        \[\leadsto 1 - \left(e^{\mathsf{log1p}\left(\frac{\color{blue}{x}}{y \cdot t}\right)} - 1\right) \]
    8. Applied egg-rr66.8%

      \[\leadsto 1 - \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x}{y \cdot t}\right)} - 1\right)} \]
    9. Step-by-step derivation
      1. expm1-def66.8%

        \[\leadsto 1 - \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{y \cdot t}\right)\right)} \]
      2. expm1-log1p67.5%

        \[\leadsto 1 - \color{blue}{\frac{x}{y \cdot t}} \]
    10. Simplified67.5%

      \[\leadsto 1 - \color{blue}{\frac{x}{y \cdot t}} \]
    11. Taylor expanded in x around 0 87.6%

      \[\leadsto \color{blue}{1} \]

    if -9.79999999999999959e-107 < y < 5.4000000000000001e-39

    1. Initial program 98.5%

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

      \[\leadsto 1 - \color{blue}{\frac{x}{t \cdot z}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification84.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -9.8 \cdot 10^{-107}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq 5.4 \cdot 10^{-39}:\\ \;\;\;\;1 - \frac{x}{z \cdot t}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 83.6% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2 \cdot 10^{-106}:\\
\;\;\;\;1\\

\mathbf{elif}\;y \leq 1.85 \cdot 10^{-37}:\\
\;\;\;\;1 - \frac{\frac{x}{t}}{z}\\

\mathbf{else}:\\
\;\;\;\;1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.99999999999999988e-106 or 1.85e-37 < y

    1. Initial program 99.9%

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

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

      \[\leadsto 1 - \color{blue}{-1 \cdot \frac{x}{t \cdot y}} \]
    5. Step-by-step derivation
      1. mul-1-neg70.2%

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

        \[\leadsto 1 - \left(-\color{blue}{\frac{\frac{x}{t}}{y}}\right) \]
      3. distribute-neg-frac70.1%

        \[\leadsto 1 - \color{blue}{\frac{-\frac{x}{t}}{y}} \]
      4. distribute-frac-neg70.1%

        \[\leadsto 1 - \frac{\color{blue}{\frac{-x}{t}}}{y} \]
    6. Simplified70.1%

      \[\leadsto 1 - \color{blue}{\frac{\frac{-x}{t}}{y}} \]
    7. Step-by-step derivation
      1. expm1-log1p-u67.5%

        \[\leadsto 1 - \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\frac{-x}{t}}{y}\right)\right)} \]
      2. expm1-udef67.5%

        \[\leadsto 1 - \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{\frac{-x}{t}}{y}\right)} - 1\right)} \]
      3. associate-/l/67.5%

        \[\leadsto 1 - \left(e^{\mathsf{log1p}\left(\color{blue}{\frac{-x}{y \cdot t}}\right)} - 1\right) \]
      4. add-sqr-sqrt29.5%

        \[\leadsto 1 - \left(e^{\mathsf{log1p}\left(\frac{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}}{y \cdot t}\right)} - 1\right) \]
      5. sqrt-unprod57.9%

        \[\leadsto 1 - \left(e^{\mathsf{log1p}\left(\frac{\color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}}}{y \cdot t}\right)} - 1\right) \]
      6. sqr-neg57.9%

        \[\leadsto 1 - \left(e^{\mathsf{log1p}\left(\frac{\sqrt{\color{blue}{x \cdot x}}}{y \cdot t}\right)} - 1\right) \]
      7. sqrt-unprod38.3%

        \[\leadsto 1 - \left(e^{\mathsf{log1p}\left(\frac{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}{y \cdot t}\right)} - 1\right) \]
      8. add-sqr-sqrt66.8%

        \[\leadsto 1 - \left(e^{\mathsf{log1p}\left(\frac{\color{blue}{x}}{y \cdot t}\right)} - 1\right) \]
    8. Applied egg-rr66.8%

      \[\leadsto 1 - \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x}{y \cdot t}\right)} - 1\right)} \]
    9. Step-by-step derivation
      1. expm1-def66.8%

        \[\leadsto 1 - \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{y \cdot t}\right)\right)} \]
      2. expm1-log1p67.5%

        \[\leadsto 1 - \color{blue}{\frac{x}{y \cdot t}} \]
    10. Simplified67.5%

      \[\leadsto 1 - \color{blue}{\frac{x}{y \cdot t}} \]
    11. Taylor expanded in x around 0 87.6%

      \[\leadsto \color{blue}{1} \]

    if -1.99999999999999988e-106 < y < 1.85e-37

    1. Initial program 98.5%

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

      \[\leadsto 1 - \color{blue}{\frac{x}{t \cdot z}} \]
    4. Step-by-step derivation
      1. *-un-lft-identity79.1%

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

        \[\leadsto 1 - \color{blue}{\frac{1}{t} \cdot \frac{x}{z}} \]
    5. Applied egg-rr78.6%

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

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

        \[\leadsto 1 - \frac{\color{blue}{\frac{x}{z}}}{t} \]
    7. Simplified78.6%

      \[\leadsto 1 - \color{blue}{\frac{\frac{x}{z}}{t}} \]
    8. Taylor expanded in x around 0 79.1%

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

        \[\leadsto 1 - \color{blue}{\frac{\frac{x}{t}}{z}} \]
    10. Simplified79.5%

      \[\leadsto 1 - \color{blue}{\frac{\frac{x}{t}}{z}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification84.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2 \cdot 10^{-106}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq 1.85 \cdot 10^{-37}:\\ \;\;\;\;1 - \frac{\frac{x}{t}}{z}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 82.6% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq 8.2 \cdot 10^{-50}:\\
\;\;\;\;1 + \frac{\frac{x}{y - t}}{z}\\

\mathbf{else}:\\
\;\;\;\;1 + \frac{\frac{x}{t}}{y - z}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < 8.19999999999999971e-50

    1. Initial program 99.2%

      \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
    2. Step-by-step derivation
      1. sub-neg99.2%

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

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

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

        \[\leadsto 1 + 1 \cdot \color{blue}{\frac{\frac{-x}{y - z}}{y - t}} \]
      5. associate-*r/99.5%

        \[\leadsto 1 + \color{blue}{\frac{1 \cdot \frac{-x}{y - z}}{y - t}} \]
      6. metadata-eval99.5%

        \[\leadsto 1 + \frac{\color{blue}{\frac{-1}{-1}} \cdot \frac{-x}{y - z}}{y - t} \]
      7. times-frac99.5%

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

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

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

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

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

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{\left(-y\right) + \left(-\left(-z\right)\right)}}}{y - t} \]
      13. remove-double-neg99.5%

        \[\leadsto 1 + \frac{\frac{x}{\left(-y\right) + \color{blue}{z}}}{y - t} \]
      14. +-commutative99.5%

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

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

      \[\leadsto \color{blue}{1 + \frac{\frac{x}{z - y}}{y - t}} \]
    4. Add Preprocessing
    5. Taylor expanded in z around inf 80.3%

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

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

        \[\leadsto 1 + \color{blue}{\frac{\frac{x}{y - t}}{z}} \]
    7. Simplified80.6%

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

    if 8.19999999999999971e-50 < t

    1. Initial program 99.9%

      \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
    2. Step-by-step derivation
      1. sub-neg99.9%

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

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

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

        \[\leadsto 1 + 1 \cdot \color{blue}{\frac{\frac{-x}{y - z}}{y - t}} \]
      5. associate-*r/95.5%

        \[\leadsto 1 + \color{blue}{\frac{1 \cdot \frac{-x}{y - z}}{y - t}} \]
      6. metadata-eval95.5%

        \[\leadsto 1 + \frac{\color{blue}{\frac{-1}{-1}} \cdot \frac{-x}{y - z}}{y - t} \]
      7. times-frac95.5%

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

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

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

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{-\left(y - z\right)}}}{y - t} \]
      11. sub-neg95.5%

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

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{\left(-y\right) + \left(-\left(-z\right)\right)}}}{y - t} \]
      13. remove-double-neg95.5%

        \[\leadsto 1 + \frac{\frac{x}{\left(-y\right) + \color{blue}{z}}}{y - t} \]
      14. +-commutative95.5%

        \[\leadsto 1 + \frac{\frac{x}{\color{blue}{z + \left(-y\right)}}}{y - t} \]
      15. sub-neg95.5%

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

      \[\leadsto \color{blue}{1 + \frac{\frac{x}{z - y}}{y - t}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 99.9%

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

        \[\leadsto 1 + \color{blue}{\frac{\frac{x}{y - t}}{z - y}} \]
    7. Simplified99.8%

      \[\leadsto 1 + \color{blue}{\frac{\frac{x}{y - t}}{z - y}} \]
    8. Taylor expanded in t around inf 98.4%

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

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

        \[\leadsto 1 + \left(-\color{blue}{\frac{\frac{x}{t}}{z - y}}\right) \]
      3. distribute-neg-frac98.3%

        \[\leadsto 1 + \color{blue}{\frac{-\frac{x}{t}}{z - y}} \]
      4. distribute-frac-neg98.3%

        \[\leadsto 1 + \frac{\color{blue}{\frac{-x}{t}}}{z - y} \]
    10. Simplified98.3%

      \[\leadsto 1 + \color{blue}{\frac{\frac{-x}{t}}{z - y}} \]
    11. Step-by-step derivation
      1. frac-2neg98.3%

        \[\leadsto 1 + \color{blue}{\frac{-\frac{-x}{t}}{-\left(z - y\right)}} \]
      2. div-inv98.4%

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

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

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

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

        \[\leadsto 1 + \frac{x}{t} \cdot \frac{1}{\color{blue}{\left(-z\right) + \left(-\left(-y\right)\right)}} \]
      7. add-sqr-sqrt50.7%

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

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

        \[\leadsto 1 + \frac{x}{t} \cdot \frac{1}{\left(-z\right) + \left(-\sqrt{\color{blue}{y \cdot y}}\right)} \]
      10. sqrt-unprod45.1%

        \[\leadsto 1 + \frac{x}{t} \cdot \frac{1}{\left(-z\right) + \left(-\color{blue}{\sqrt{y} \cdot \sqrt{y}}\right)} \]
      11. add-sqr-sqrt91.2%

        \[\leadsto 1 + \frac{x}{t} \cdot \frac{1}{\left(-z\right) + \left(-\color{blue}{y}\right)} \]
      12. add-sqr-sqrt46.2%

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

        \[\leadsto 1 + \frac{x}{t} \cdot \frac{1}{\left(-z\right) + \color{blue}{\sqrt{\left(-y\right) \cdot \left(-y\right)}}} \]
      14. sqr-neg92.4%

        \[\leadsto 1 + \frac{x}{t} \cdot \frac{1}{\left(-z\right) + \sqrt{\color{blue}{y \cdot y}}} \]
      15. sqrt-unprod47.7%

        \[\leadsto 1 + \frac{x}{t} \cdot \frac{1}{\left(-z\right) + \color{blue}{\sqrt{y} \cdot \sqrt{y}}} \]
      16. add-sqr-sqrt98.4%

        \[\leadsto 1 + \frac{x}{t} \cdot \frac{1}{\left(-z\right) + \color{blue}{y}} \]
    12. Applied egg-rr98.4%

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

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

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

        \[\leadsto 1 + \frac{\frac{x}{t}}{\color{blue}{y + \left(-z\right)}} \]
      4. unsub-neg98.3%

        \[\leadsto 1 + \frac{\frac{x}{t}}{\color{blue}{y - z}} \]
    14. Simplified98.3%

      \[\leadsto 1 + \color{blue}{\frac{\frac{x}{t}}{y - z}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification85.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq 8.2 \cdot 10^{-50}:\\ \;\;\;\;1 + \frac{\frac{x}{y - t}}{z}\\ \mathbf{else}:\\ \;\;\;\;1 + \frac{\frac{x}{t}}{y - z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 98.6% accurate, 1.0× speedup?

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

\\
1 + \frac{\frac{x}{y - t}}{z - y}
\end{array}
Derivation
  1. Initial program 99.4%

    \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
  2. Step-by-step derivation
    1. sub-neg99.4%

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

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

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

      \[\leadsto 1 + 1 \cdot \color{blue}{\frac{\frac{-x}{y - z}}{y - t}} \]
    5. associate-*r/98.5%

      \[\leadsto 1 + \color{blue}{\frac{1 \cdot \frac{-x}{y - z}}{y - t}} \]
    6. metadata-eval98.5%

      \[\leadsto 1 + \frac{\color{blue}{\frac{-1}{-1}} \cdot \frac{-x}{y - z}}{y - t} \]
    7. times-frac98.5%

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

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

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

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

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

      \[\leadsto 1 + \frac{\frac{x}{\color{blue}{\left(-y\right) + \left(-\left(-z\right)\right)}}}{y - t} \]
    13. remove-double-neg98.5%

      \[\leadsto 1 + \frac{\frac{x}{\left(-y\right) + \color{blue}{z}}}{y - t} \]
    14. +-commutative98.5%

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

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

    \[\leadsto \color{blue}{1 + \frac{\frac{x}{z - y}}{y - t}} \]
  4. Add Preprocessing
  5. Taylor expanded in x around 0 99.4%

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

      \[\leadsto 1 + \color{blue}{\frac{\frac{x}{y - t}}{z - y}} \]
  7. Simplified99.5%

    \[\leadsto 1 + \color{blue}{\frac{\frac{x}{y - t}}{z - y}} \]
  8. Final simplification99.5%

    \[\leadsto 1 + \frac{\frac{x}{y - t}}{z - y} \]
  9. Add Preprocessing

Alternative 11: 75.5% accurate, 11.0× speedup?

\[\begin{array}{l} \\ 1 \end{array} \]
(FPCore (x y z t) :precision binary64 1.0)
double code(double x, double y, double z, double t) {
	return 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 = 1.0d0
end function
public static double code(double x, double y, double z, double t) {
	return 1.0;
}
def code(x, y, z, t):
	return 1.0
function code(x, y, z, t)
	return 1.0
end
function tmp = code(x, y, z, t)
	tmp = 1.0;
end
code[x_, y_, z_, t_] := 1.0
\begin{array}{l}

\\
1
\end{array}
Derivation
  1. Initial program 99.4%

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

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

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

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

      \[\leadsto 1 - \left(-\color{blue}{\frac{\frac{x}{t}}{y}}\right) \]
    3. distribute-neg-frac57.0%

      \[\leadsto 1 - \color{blue}{\frac{-\frac{x}{t}}{y}} \]
    4. distribute-frac-neg57.0%

      \[\leadsto 1 - \frac{\color{blue}{\frac{-x}{t}}}{y} \]
  6. Simplified57.0%

    \[\leadsto 1 - \color{blue}{\frac{\frac{-x}{t}}{y}} \]
  7. Step-by-step derivation
    1. expm1-log1p-u51.0%

      \[\leadsto 1 - \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\frac{-x}{t}}{y}\right)\right)} \]
    2. expm1-udef51.0%

      \[\leadsto 1 - \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{\frac{-x}{t}}{y}\right)} - 1\right)} \]
    3. associate-/l/51.0%

      \[\leadsto 1 - \left(e^{\mathsf{log1p}\left(\color{blue}{\frac{-x}{y \cdot t}}\right)} - 1\right) \]
    4. add-sqr-sqrt22.4%

      \[\leadsto 1 - \left(e^{\mathsf{log1p}\left(\frac{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}}{y \cdot t}\right)} - 1\right) \]
    5. sqrt-unprod45.9%

      \[\leadsto 1 - \left(e^{\mathsf{log1p}\left(\frac{\color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}}}{y \cdot t}\right)} - 1\right) \]
    6. sqr-neg45.9%

      \[\leadsto 1 - \left(e^{\mathsf{log1p}\left(\frac{\sqrt{\color{blue}{x \cdot x}}}{y \cdot t}\right)} - 1\right) \]
    7. sqrt-unprod27.9%

      \[\leadsto 1 - \left(e^{\mathsf{log1p}\left(\frac{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}{y \cdot t}\right)} - 1\right) \]
    8. add-sqr-sqrt50.1%

      \[\leadsto 1 - \left(e^{\mathsf{log1p}\left(\frac{\color{blue}{x}}{y \cdot t}\right)} - 1\right) \]
  8. Applied egg-rr50.1%

    \[\leadsto 1 - \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x}{y \cdot t}\right)} - 1\right)} \]
  9. Step-by-step derivation
    1. expm1-def50.1%

      \[\leadsto 1 - \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{y \cdot t}\right)\right)} \]
    2. expm1-log1p52.2%

      \[\leadsto 1 - \color{blue}{\frac{x}{y \cdot t}} \]
  10. Simplified52.2%

    \[\leadsto 1 - \color{blue}{\frac{x}{y \cdot t}} \]
  11. Taylor expanded in x around 0 74.0%

    \[\leadsto \color{blue}{1} \]
  12. Final simplification74.0%

    \[\leadsto 1 \]
  13. Add Preprocessing

Reproduce

?
herbie shell --seed 2024011 
(FPCore (x y z t)
  :name "Data.Random.Distribution.Triangular:triangularCDF from random-fu-0.2.6.2, A"
  :precision binary64
  (- 1.0 (/ x (* (- y z) (- y t)))))