Graphics.Rendering.Chart.Plot.AreaSpots:renderAreaSpots4D from Chart-1.5.3

Percentage Accurate: 84.6% → 97.0%
Time: 7.5s
Alternatives: 12
Speedup: 1.0×

Specification

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

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

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

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

Alternative 1: 97.0% accurate, 1.0× speedup?

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

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

    \[\frac{x \cdot \left(y - z\right)}{t - z} \]
  2. Step-by-step derivation
    1. associate-/l*97.3%

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

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

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

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

      \[\leadsto \color{blue}{\frac{x}{t - z} \cdot \frac{y - z}{1}} \]
    3. /-rgt-identity82.8%

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

      \[\leadsto \color{blue}{\frac{x}{\frac{t - z}{y - z}}} \]
  7. Simplified97.4%

    \[\leadsto \color{blue}{\frac{x}{\frac{t - z}{y - z}}} \]
  8. Add Preprocessing

Alternative 2: 74.1% accurate, 0.4× speedup?

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

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

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

\mathbf{elif}\;z \leq 30000000:\\
\;\;\;\;x \cdot \frac{y}{t - z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -1.6e14

    1. Initial program 74.3%

      \[\frac{x \cdot \left(y - z\right)}{t - z} \]
    2. Step-by-step derivation
      1. associate-/l*99.8%

        \[\leadsto \color{blue}{x \cdot \frac{y - z}{t - z}} \]
    3. Simplified99.8%

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

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

        \[\leadsto \color{blue}{-\frac{x \cdot z}{t - z}} \]
      2. distribute-neg-frac258.7%

        \[\leadsto \color{blue}{\frac{x \cdot z}{-\left(t - z\right)}} \]
      3. sub-neg58.7%

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

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

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

        \[\leadsto \frac{x \cdot z}{\color{blue}{z + \left(-t\right)}} \]
      7. sub-neg58.7%

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

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

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

    if -1.6e14 < z < 1.05e-66

    1. Initial program 96.2%

      \[\frac{x \cdot \left(y - z\right)}{t - z} \]
    2. Step-by-step derivation
      1. associate-/l*94.2%

        \[\leadsto \color{blue}{x \cdot \frac{y - z}{t - z}} \]
    3. Simplified94.2%

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

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

    if 1.05e-66 < z < 3e7

    1. Initial program 99.7%

      \[\frac{x \cdot \left(y - z\right)}{t - z} \]
    2. Step-by-step derivation
      1. associate-/l*99.7%

        \[\leadsto \color{blue}{x \cdot \frac{y - z}{t - z}} \]
    3. Simplified99.7%

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

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

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

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

    if 3e7 < z

    1. Initial program 83.1%

      \[\frac{x \cdot \left(y - z\right)}{t - z} \]
    2. Step-by-step derivation
      1. associate-/l*99.9%

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

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

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

        \[\leadsto \color{blue}{-\frac{x \cdot z}{t - z}} \]
      2. distribute-neg-frac271.1%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{x}{\frac{z - t}{z}}} \]
  3. Recombined 4 regimes into one program.
  4. Add Preprocessing

Alternative 3: 76.2% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.8 \cdot 10^{+14} \lor \neg \left(z \leq 450000\right):\\
\;\;\;\;x \cdot \frac{z}{z - t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.8e14 or 4.5e5 < z

    1. Initial program 79.2%

      \[\frac{x \cdot \left(y - z\right)}{t - z} \]
    2. Step-by-step derivation
      1. associate-/l*99.8%

        \[\leadsto \color{blue}{x \cdot \frac{y - z}{t - z}} \]
    3. Simplified99.8%

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

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

        \[\leadsto \color{blue}{-\frac{x \cdot z}{t - z}} \]
      2. distribute-neg-frac265.6%

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

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

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

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

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

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

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

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

    if -1.8e14 < z < 4.5e5

    1. Initial program 96.6%

      \[\frac{x \cdot \left(y - z\right)}{t - z} \]
    2. Step-by-step derivation
      1. associate-/l*94.9%

        \[\leadsto \color{blue}{x \cdot \frac{y - z}{t - z}} \]
    3. Simplified94.9%

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

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

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

        \[\leadsto \color{blue}{\frac{x}{t - z} \cdot \frac{y - z}{1}} \]
      3. /-rgt-identity89.3%

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

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

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

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

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

Alternative 4: 76.0% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.12 \cdot 10^{+14} \lor \neg \left(z \leq 7500000\right):\\
\;\;\;\;x \cdot \frac{z}{z - t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.12e14 or 7.5e6 < z

    1. Initial program 79.2%

      \[\frac{x \cdot \left(y - z\right)}{t - z} \]
    2. Step-by-step derivation
      1. associate-/l*99.8%

        \[\leadsto \color{blue}{x \cdot \frac{y - z}{t - z}} \]
    3. Simplified99.8%

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

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

        \[\leadsto \color{blue}{-\frac{x \cdot z}{t - z}} \]
      2. distribute-neg-frac265.6%

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

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

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

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

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

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

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

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

    if -1.12e14 < z < 7.5e6

    1. Initial program 96.6%

      \[\frac{x \cdot \left(y - z\right)}{t - z} \]
    2. Step-by-step derivation
      1. associate-/l*94.9%

        \[\leadsto \color{blue}{x \cdot \frac{y - z}{t - z}} \]
    3. Simplified94.9%

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

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

        \[\leadsto \color{blue}{x \cdot \frac{y}{t - z}} \]
    7. Simplified76.5%

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

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

Alternative 5: 75.3% accurate, 0.5× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -9.99999999999999946e33 or 2.2000000000000001e-46 < z

    1. Initial program 80.4%

      \[\frac{x \cdot \left(y - z\right)}{t - z} \]
    2. Step-by-step derivation
      1. associate-/l*99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.99999999999999946e33 < z < 2.2000000000000001e-46

    1. Initial program 95.8%

      \[\frac{x \cdot \left(y - z\right)}{t - z} \]
    2. Step-by-step derivation
      1. associate-/l*94.8%

        \[\leadsto \color{blue}{x \cdot \frac{y - z}{t - z}} \]
    3. Simplified94.8%

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

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

        \[\leadsto \color{blue}{x \cdot \frac{y}{t - z}} \]
    7. Simplified76.2%

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

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

Alternative 6: 69.6% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -2 \cdot 10^{-96} \lor \neg \left(z \leq 1.15 \cdot 10^{-66}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{z}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.9999999999999998e-96 or 1.14999999999999996e-66 < z

    1. Initial program 84.1%

      \[\frac{x \cdot \left(y - z\right)}{t - z} \]
    2. Step-by-step derivation
      1. associate-/l*99.8%

        \[\leadsto \color{blue}{x \cdot \frac{y - z}{t - z}} \]
    3. Simplified99.8%

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

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

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

        \[\leadsto -\color{blue}{x \cdot \frac{y - z}{z}} \]
      3. distribute-rgt-neg-in66.6%

        \[\leadsto \color{blue}{x \cdot \left(-\frac{y - z}{z}\right)} \]
      4. distribute-frac-neg66.6%

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

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

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

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

        \[\leadsto x \cdot \frac{\color{blue}{z + \left(-y\right)}}{z} \]
      9. sub-neg66.6%

        \[\leadsto x \cdot \frac{\color{blue}{z - y}}{z} \]
      10. div-sub66.6%

        \[\leadsto x \cdot \color{blue}{\left(\frac{z}{z} - \frac{y}{z}\right)} \]
      11. *-inverses66.6%

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

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

    if -1.9999999999999998e-96 < z < 1.14999999999999996e-66

    1. Initial program 95.8%

      \[\frac{x \cdot \left(y - z\right)}{t - z} \]
    2. Step-by-step derivation
      1. associate-/l*92.5%

        \[\leadsto \color{blue}{x \cdot \frac{y - z}{t - z}} \]
    3. Simplified92.5%

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

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

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

Alternative 7: 76.2% accurate, 0.5× speedup?

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

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

\mathbf{elif}\;z \leq 3300000:\\
\;\;\;\;\frac{x}{\frac{t - z}{y}}\\

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


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

    1. Initial program 74.3%

      \[\frac{x \cdot \left(y - z\right)}{t - z} \]
    2. Step-by-step derivation
      1. associate-/l*99.8%

        \[\leadsto \color{blue}{x \cdot \frac{y - z}{t - z}} \]
    3. Simplified99.8%

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

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

        \[\leadsto \color{blue}{-\frac{x \cdot z}{t - z}} \]
      2. distribute-neg-frac258.7%

        \[\leadsto \color{blue}{\frac{x \cdot z}{-\left(t - z\right)}} \]
      3. sub-neg58.7%

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

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

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

        \[\leadsto \frac{x \cdot z}{\color{blue}{z + \left(-t\right)}} \]
      7. sub-neg58.7%

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

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

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

    if -1.12e14 < z < 3.3e6

    1. Initial program 96.6%

      \[\frac{x \cdot \left(y - z\right)}{t - z} \]
    2. Step-by-step derivation
      1. associate-/l*94.9%

        \[\leadsto \color{blue}{x \cdot \frac{y - z}{t - z}} \]
    3. Simplified94.9%

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

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

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

        \[\leadsto \color{blue}{\frac{x}{t - z} \cdot \frac{y - z}{1}} \]
      3. /-rgt-identity89.3%

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

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

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

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

    if 3.3e6 < z

    1. Initial program 83.1%

      \[\frac{x \cdot \left(y - z\right)}{t - z} \]
    2. Step-by-step derivation
      1. associate-/l*99.9%

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

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

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

        \[\leadsto \color{blue}{-\frac{x \cdot z}{t - z}} \]
      2. distribute-neg-frac271.1%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{x}{\frac{z - t}{z}}} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 8: 60.1% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.6 \cdot 10^{+14}:\\
\;\;\;\;x\\

\mathbf{elif}\;z \leq 2.2 \cdot 10^{-46}:\\
\;\;\;\;\frac{x \cdot y}{t}\\

\mathbf{else}:\\
\;\;\;\;x\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -3.6e14 or 2.2000000000000001e-46 < z

    1. Initial program 80.4%

      \[\frac{x \cdot \left(y - z\right)}{t - z} \]
    2. Step-by-step derivation
      1. associate-/l*99.8%

        \[\leadsto \color{blue}{x \cdot \frac{y - z}{t - z}} \]
    3. Simplified99.8%

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

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

    if -3.6e14 < z < 2.2000000000000001e-46

    1. Initial program 96.4%

      \[\frac{x \cdot \left(y - z\right)}{t - z} \]
    2. Step-by-step derivation
      1. associate-/l*94.6%

        \[\leadsto \color{blue}{x \cdot \frac{y - z}{t - z}} \]
    3. Simplified94.6%

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

      \[\leadsto \color{blue}{\frac{x \cdot y}{t}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 9: 61.0% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.9 \cdot 10^{+34}:\\
\;\;\;\;x\\

\mathbf{elif}\;z \leq 2.2 \cdot 10^{-46}:\\
\;\;\;\;\frac{x}{\frac{t}{y}}\\

\mathbf{else}:\\
\;\;\;\;x\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -3.90000000000000019e34 or 2.2000000000000001e-46 < z

    1. Initial program 80.4%

      \[\frac{x \cdot \left(y - z\right)}{t - z} \]
    2. Step-by-step derivation
      1. associate-/l*99.9%

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

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

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

    if -3.90000000000000019e34 < z < 2.2000000000000001e-46

    1. Initial program 95.8%

      \[\frac{x \cdot \left(y - z\right)}{t - z} \]
    2. Step-by-step derivation
      1. associate-/l*94.8%

        \[\leadsto \color{blue}{x \cdot \frac{y - z}{t - z}} \]
    3. Simplified94.8%

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

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

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

        \[\leadsto \color{blue}{\frac{x}{t - z} \cdot \frac{y - z}{1}} \]
      3. /-rgt-identity89.8%

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

        \[\leadsto \color{blue}{\frac{x}{\frac{t - z}{y - z}}} \]
    7. Simplified95.0%

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

      \[\leadsto \frac{x}{\color{blue}{\frac{t}{y}}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 10: 60.9% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.25 \cdot 10^{+35}:\\
\;\;\;\;x\\

\mathbf{elif}\;z \leq 2.2 \cdot 10^{-46}:\\
\;\;\;\;x \cdot \frac{y}{t}\\

\mathbf{else}:\\
\;\;\;\;x\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.25000000000000005e35 or 2.2000000000000001e-46 < z

    1. Initial program 80.4%

      \[\frac{x \cdot \left(y - z\right)}{t - z} \]
    2. Step-by-step derivation
      1. associate-/l*99.9%

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

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

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

    if -1.25000000000000005e35 < z < 2.2000000000000001e-46

    1. Initial program 95.8%

      \[\frac{x \cdot \left(y - z\right)}{t - z} \]
    2. Step-by-step derivation
      1. associate-/l*94.8%

        \[\leadsto \color{blue}{x \cdot \frac{y - z}{t - z}} \]
    3. Simplified94.8%

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

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

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

      \[\leadsto \color{blue}{x \cdot \frac{y}{t}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 11: 96.9% accurate, 1.0× speedup?

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

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

    \[\frac{x \cdot \left(y - z\right)}{t - z} \]
  2. Step-by-step derivation
    1. associate-/l*97.3%

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

    \[\leadsto \color{blue}{x \cdot \frac{y - z}{t - z}} \]
  4. Add Preprocessing
  5. Add Preprocessing

Alternative 12: 35.5% accurate, 9.0× speedup?

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

\\
x
\end{array}
Derivation
  1. Initial program 88.2%

    \[\frac{x \cdot \left(y - z\right)}{t - z} \]
  2. Step-by-step derivation
    1. associate-/l*97.3%

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

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

    \[\leadsto \color{blue}{x} \]
  6. Add Preprocessing

Developer Target 1: 97.0% accurate, 1.0× speedup?

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

\\
\frac{x}{\frac{t - z}{y - z}}
\end{array}

Reproduce

?
herbie shell --seed 2024186 
(FPCore (x y z t)
  :name "Graphics.Rendering.Chart.Plot.AreaSpots:renderAreaSpots4D from Chart-1.5.3"
  :precision binary64

  :alt
  (! :herbie-platform default (/ x (/ (- t z) (- y z))))

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