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

Percentage Accurate: 99.1% → 99.1%
Time: 9.8s
Alternatives: 12
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 12 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(t - y\right)} \end{array} \]
(FPCore (x y z t) :precision binary64 (+ 1.0 (/ x (* (- y z) (- t y)))))
double code(double x, double y, double z, double t) {
	return 1.0 + (x / ((y - z) * (t - 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 - z) * (t - y)))
end function
public static double code(double x, double y, double z, double t) {
	return 1.0 + (x / ((y - z) * (t - y)));
}
def code(x, y, z, t):
	return 1.0 + (x / ((y - z) * (t - y)))
function code(x, y, z, t)
	return Float64(1.0 + Float64(x / Float64(Float64(y - z) * Float64(t - y))))
end
function tmp = code(x, y, z, t)
	tmp = 1.0 + (x / ((y - z) * (t - y)));
end
code[x_, y_, z_, t_] := N[(1.0 + N[(x / N[(N[(y - z), $MachinePrecision] * N[(t - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

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

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

Alternative 2: 85.6% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.2 \cdot 10^{-94} \lor \neg \left(y \leq 1.02 \cdot 10^{-109}\right):\\
\;\;\;\;1 - \frac{x}{y \cdot \left(y - t\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -5.19999999999999988e-94 or 1.02e-109 < 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 89.8%

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

    if -5.19999999999999988e-94 < y < 1.02e-109

    1. Initial program 97.3%

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

      \[\leadsto 1 - \color{blue}{\frac{x}{t \cdot z}} \]
    4. Step-by-step derivation
      1. clear-num83.7%

        \[\leadsto 1 - \color{blue}{\frac{1}{\frac{t \cdot z}{x}}} \]
      2. inv-pow83.7%

        \[\leadsto 1 - \color{blue}{{\left(\frac{t \cdot z}{x}\right)}^{-1}} \]
      3. *-commutative83.7%

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

        \[\leadsto 1 - {\color{blue}{\left(z \cdot \frac{t}{x}\right)}}^{-1} \]
    5. Applied egg-rr81.1%

      \[\leadsto 1 - \color{blue}{{\left(z \cdot \frac{t}{x}\right)}^{-1}} \]
    6. Step-by-step derivation
      1. unpow-181.1%

        \[\leadsto 1 - \color{blue}{\frac{1}{z \cdot \frac{t}{x}}} \]
      2. associate-*r/83.7%

        \[\leadsto 1 - \frac{1}{\color{blue}{\frac{z \cdot t}{x}}} \]
      3. *-commutative83.7%

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

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

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

Alternative 3: 71.1% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -225000 \lor \neg \left(y \leq 1.1 \cdot 10^{+24}\right):\\
\;\;\;\;1 - \frac{x}{y \cdot t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -225000 or 1.10000000000000001e24 < y

    1. Initial program 100.0%

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

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

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

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

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

      \[\leadsto 1 - \color{blue}{\frac{-x}{t \cdot y}} \]
    7. Step-by-step derivation
      1. div-inv72.2%

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

        \[\leadsto 1 - \color{blue}{\left(\sqrt{-x} \cdot \sqrt{-x}\right)} \cdot \frac{1}{t \cdot y} \]
      3. sqrt-unprod55.9%

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

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

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

        \[\leadsto 1 - \color{blue}{x} \cdot \frac{1}{t \cdot y} \]
      7. associate-/r*70.6%

        \[\leadsto 1 - x \cdot \color{blue}{\frac{\frac{1}{t}}{y}} \]
    8. Applied egg-rr70.6%

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

        \[\leadsto 1 - \color{blue}{\frac{x \cdot \frac{1}{t}}{y}} \]
      2. associate-*r/70.5%

        \[\leadsto 1 - \frac{\color{blue}{\frac{x \cdot 1}{t}}}{y} \]
      3. *-rgt-identity70.5%

        \[\leadsto 1 - \frac{\frac{\color{blue}{x}}{t}}{y} \]
      4. associate-/r*70.6%

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

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

    if -225000 < y < 1.10000000000000001e24

    1. Initial program 98.4%

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

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

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

Alternative 4: 71.3% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -60000000000 \lor \neg \left(y \leq 1.3 \cdot 10^{+14}\right):\\
\;\;\;\;1 - \frac{x}{y \cdot z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -6e10 or 1.3e14 < y

    1. Initial program 100.0%

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

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

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

        \[\leadsto 1 - \color{blue}{\frac{-1 \cdot x}{y \cdot z}} \]
      2. neg-mul-171.1%

        \[\leadsto 1 - \frac{\color{blue}{-x}}{y \cdot z} \]
      3. *-commutative71.1%

        \[\leadsto 1 - \frac{-x}{\color{blue}{z \cdot y}} \]
    6. Simplified71.1%

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

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

        \[\leadsto 1 - \color{blue}{\left(\sqrt{-x} \cdot \sqrt{-x}\right)} \cdot \frac{1}{z \cdot y} \]
      3. sqrt-unprod54.9%

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

        \[\leadsto 1 - \sqrt{\color{blue}{x \cdot x}} \cdot \frac{1}{z \cdot y} \]
      5. sqrt-unprod36.0%

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

        \[\leadsto 1 - \color{blue}{x} \cdot \frac{1}{z \cdot y} \]
      7. *-commutative70.7%

        \[\leadsto 1 - x \cdot \frac{1}{\color{blue}{y \cdot z}} \]
    8. Applied egg-rr70.7%

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

        \[\leadsto 1 - \color{blue}{\frac{x \cdot 1}{y \cdot z}} \]
      2. *-rgt-identity70.7%

        \[\leadsto 1 - \frac{\color{blue}{x}}{y \cdot z} \]
    10. Simplified70.7%

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

    if -6e10 < y < 1.3e14

    1. Initial program 98.4%

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

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

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

Alternative 5: 71.2% accurate, 0.6× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.5e6 or 3e12 < y

    1. Initial program 100.0%

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

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

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

        \[\leadsto 1 - \color{blue}{\frac{-1 \cdot x}{y \cdot z}} \]
      2. neg-mul-171.1%

        \[\leadsto 1 - \frac{\color{blue}{-x}}{y \cdot z} \]
      3. *-commutative71.1%

        \[\leadsto 1 - \frac{-x}{\color{blue}{z \cdot y}} \]
    6. Simplified71.1%

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

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

        \[\leadsto 1 - \color{blue}{\left(\sqrt{-x} \cdot \sqrt{-x}\right)} \cdot \frac{1}{z \cdot y} \]
      3. sqrt-unprod54.9%

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

        \[\leadsto 1 - \sqrt{\color{blue}{x \cdot x}} \cdot \frac{1}{z \cdot y} \]
      5. sqrt-unprod36.0%

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

        \[\leadsto 1 - \color{blue}{x} \cdot \frac{1}{z \cdot y} \]
      7. *-commutative70.7%

        \[\leadsto 1 - x \cdot \frac{1}{\color{blue}{y \cdot z}} \]
    8. Applied egg-rr70.7%

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

        \[\leadsto 1 - \color{blue}{\frac{x \cdot 1}{y \cdot z}} \]
      2. *-rgt-identity70.7%

        \[\leadsto 1 - \frac{\color{blue}{x}}{y \cdot z} \]
    10. Simplified70.7%

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

    if -2.5e6 < y < 3e12

    1. Initial program 98.4%

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

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

        \[\leadsto 1 - \color{blue}{\frac{\frac{x}{t}}{z}} \]
      2. div-inv68.9%

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

      \[\leadsto 1 - \color{blue}{\frac{x}{t} \cdot \frac{1}{z}} \]
    6. Step-by-step derivation
      1. un-div-inv68.9%

        \[\leadsto 1 - \color{blue}{\frac{\frac{x}{t}}{z}} \]
    7. Applied egg-rr68.9%

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

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

Alternative 6: 60.0% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;t \leq 2.7 \cdot 10^{+122}:\\
\;\;\;\;1 - \frac{x}{z \cdot t}\\

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


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

    1. Initial program 98.7%

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

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

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

        \[\leadsto 1 - \color{blue}{\frac{-1 \cdot x}{y \cdot z}} \]
      2. neg-mul-160.2%

        \[\leadsto 1 - \frac{\color{blue}{-x}}{y \cdot z} \]
      3. *-commutative60.2%

        \[\leadsto 1 - \frac{-x}{\color{blue}{z \cdot y}} \]
    6. Simplified60.2%

      \[\leadsto 1 - \color{blue}{\frac{-x}{z \cdot y}} \]
    7. Step-by-step derivation
      1. div-inv60.2%

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

        \[\leadsto 1 - \color{blue}{\left(\sqrt{-x} \cdot \sqrt{-x}\right)} \cdot \frac{1}{z \cdot y} \]
      3. sqrt-unprod49.7%

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

        \[\leadsto 1 - \sqrt{\color{blue}{x \cdot x}} \cdot \frac{1}{z \cdot y} \]
      5. sqrt-unprod29.9%

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

        \[\leadsto 1 - \color{blue}{x} \cdot \frac{1}{z \cdot y} \]
      7. *-commutative56.9%

        \[\leadsto 1 - x \cdot \frac{1}{\color{blue}{y \cdot z}} \]
    8. Applied egg-rr56.9%

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

        \[\leadsto 1 - \color{blue}{\frac{x \cdot 1}{y \cdot z}} \]
      2. *-rgt-identity56.9%

        \[\leadsto 1 - \frac{\color{blue}{x}}{y \cdot z} \]
    10. Simplified56.9%

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

    if 1.35000000000000003e-128 < t < 2.6999999999999998e122

    1. Initial program 99.9%

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

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

    if 2.6999999999999998e122 < t

    1. Initial program 100.0%

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

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

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

        \[\leadsto 1 - \color{blue}{\frac{-1 \cdot x}{t \cdot y}} \]
      2. mul-1-neg91.4%

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

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

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

Alternative 7: 64.2% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;t \leq 6 \cdot 10^{+126}:\\
\;\;\;\;1 - \frac{\frac{x}{t}}{z}\\

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


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

    1. Initial program 98.9%

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

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

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

        \[\leadsto 1 - \color{blue}{\frac{-1 \cdot x}{y \cdot z}} \]
      2. neg-mul-160.7%

        \[\leadsto 1 - \frac{\color{blue}{-x}}{y \cdot z} \]
      3. *-commutative60.7%

        \[\leadsto 1 - \frac{-x}{\color{blue}{z \cdot y}} \]
    6. Simplified60.7%

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

    if 5.5999999999999994e-23 < t < 6.0000000000000005e126

    1. Initial program 99.9%

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

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

        \[\leadsto 1 - \color{blue}{\frac{\frac{x}{t}}{z}} \]
      2. div-inv84.6%

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

      \[\leadsto 1 - \color{blue}{\frac{x}{t} \cdot \frac{1}{z}} \]
    6. Step-by-step derivation
      1. un-div-inv84.6%

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

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

    if 6.0000000000000005e126 < t

    1. Initial program 100.0%

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

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

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

        \[\leadsto 1 - \color{blue}{\frac{-1 \cdot x}{t \cdot y}} \]
      2. mul-1-neg91.4%

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

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

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

Alternative 8: 64.2% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;t \leq 1.4 \cdot 10^{+122}:\\
\;\;\;\;1 - \frac{\frac{x}{t}}{z}\\

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


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

    1. Initial program 98.9%

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

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

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

        \[\leadsto 1 - \color{blue}{\frac{-1 \cdot x}{y \cdot z}} \]
      2. neg-mul-160.7%

        \[\leadsto 1 - \frac{\color{blue}{-x}}{y \cdot z} \]
      3. *-commutative60.7%

        \[\leadsto 1 - \frac{-x}{\color{blue}{z \cdot y}} \]
    6. Simplified60.7%

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

    if 7.50000000000000072e-21 < t < 1.4e122

    1. Initial program 99.9%

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

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

        \[\leadsto 1 - \color{blue}{\frac{\frac{x}{t}}{z}} \]
      2. div-inv84.6%

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

      \[\leadsto 1 - \color{blue}{\frac{x}{t} \cdot \frac{1}{z}} \]
    6. Step-by-step derivation
      1. un-div-inv84.6%

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

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

    if 1.4e122 < t

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

Alternative 9: 64.2% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;t \leq 8.8 \cdot 10^{+125}:\\
\;\;\;\;1 - \frac{\frac{x}{t}}{z}\\

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


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

    1. Initial program 98.9%

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

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

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

        \[\leadsto 1 - \color{blue}{\frac{-1 \cdot x}{y \cdot z}} \]
      2. neg-mul-160.7%

        \[\leadsto 1 - \frac{\color{blue}{-x}}{y \cdot z} \]
      3. *-commutative60.7%

        \[\leadsto 1 - \frac{-x}{\color{blue}{z \cdot y}} \]
    6. Simplified60.7%

      \[\leadsto 1 - \color{blue}{\frac{-x}{z \cdot y}} \]
    7. Taylor expanded in x around 0 60.7%

      \[\leadsto 1 - \color{blue}{-1 \cdot \frac{x}{y \cdot z}} \]
    8. Step-by-step derivation
      1. neg-mul-160.7%

        \[\leadsto 1 - \color{blue}{\left(-\frac{x}{y \cdot z}\right)} \]
      2. distribute-neg-frac260.7%

        \[\leadsto 1 - \color{blue}{\frac{x}{-y \cdot z}} \]
      3. *-commutative60.7%

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

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

        \[\leadsto 1 - \color{blue}{\frac{\frac{x}{z}}{-y}} \]
    9. Simplified60.8%

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

    if 2.40000000000000002e-22 < t < 8.79999999999999964e125

    1. Initial program 99.9%

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

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

        \[\leadsto 1 - \color{blue}{\frac{\frac{x}{t}}{z}} \]
      2. div-inv84.6%

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

      \[\leadsto 1 - \color{blue}{\frac{x}{t} \cdot \frac{1}{z}} \]
    6. Step-by-step derivation
      1. un-div-inv84.6%

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

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

    if 8.79999999999999964e125 < t

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

Alternative 10: 76.5% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq 3.7 \cdot 10^{-6}:\\
\;\;\;\;1 + \frac{x}{y \cdot \left(z - y\right)}\\

\mathbf{elif}\;t \leq 4 \cdot 10^{+122}:\\
\;\;\;\;1 - \frac{\frac{x}{t}}{z}\\

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


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

    1. Initial program 98.9%

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

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

    if 3.7000000000000002e-6 < t < 4.00000000000000006e122

    1. Initial program 99.9%

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

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

        \[\leadsto 1 - \color{blue}{\frac{\frac{x}{t}}{z}} \]
      2. div-inv91.2%

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

      \[\leadsto 1 - \color{blue}{\frac{x}{t} \cdot \frac{1}{z}} \]
    6. Step-by-step derivation
      1. un-div-inv91.3%

        \[\leadsto 1 - \color{blue}{\frac{\frac{x}{t}}{z}} \]
    7. Applied egg-rr91.3%

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

    if 4.00000000000000006e122 < t

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

Alternative 11: 81.8% accurate, 0.8× speedup?

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

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


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

    1. Initial program 98.9%

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

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

    if 3.2000000000000002e-21 < t

    1. Initial program 99.9%

      \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-un-lft-identity99.9%

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

        \[\leadsto 1 - \color{blue}{\frac{1}{y - z} \cdot \frac{x}{y - t}} \]
    4. Applied egg-rr99.9%

      \[\leadsto 1 - \color{blue}{\frac{1}{y - z} \cdot \frac{x}{y - t}} \]
    5. Taylor expanded in t around inf 98.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 51.8% accurate, 1.6× speedup?

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

\\
1 - \frac{x}{y \cdot t}
\end{array}
Derivation
  1. Initial program 99.2%

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

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

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

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

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

    \[\leadsto 1 - \color{blue}{\frac{-x}{t \cdot y}} \]
  7. Step-by-step derivation
    1. div-inv57.1%

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

      \[\leadsto 1 - \color{blue}{\left(\sqrt{-x} \cdot \sqrt{-x}\right)} \cdot \frac{1}{t \cdot y} \]
    3. sqrt-unprod46.8%

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

      \[\leadsto 1 - \sqrt{\color{blue}{x \cdot x}} \cdot \frac{1}{t \cdot y} \]
    5. sqrt-unprod24.3%

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

      \[\leadsto 1 - \color{blue}{x} \cdot \frac{1}{t \cdot y} \]
    7. associate-/r*50.3%

      \[\leadsto 1 - x \cdot \color{blue}{\frac{\frac{1}{t}}{y}} \]
  8. Applied egg-rr50.3%

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

      \[\leadsto 1 - \color{blue}{\frac{x \cdot \frac{1}{t}}{y}} \]
    2. associate-*r/50.3%

      \[\leadsto 1 - \frac{\color{blue}{\frac{x \cdot 1}{t}}}{y} \]
    3. *-rgt-identity50.3%

      \[\leadsto 1 - \frac{\frac{\color{blue}{x}}{t}}{y} \]
    4. associate-/r*50.3%

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

    \[\leadsto 1 - \color{blue}{\frac{x}{t \cdot y}} \]
  11. Final simplification50.3%

    \[\leadsto 1 - \frac{x}{y \cdot t} \]
  12. Add Preprocessing

Reproduce

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