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

Percentage Accurate: 84.7% → 96.9%
Time: 11.9s
Alternatives: 9
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 9 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.7% 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: 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 83.5%

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

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

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

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

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

    \[\leadsto x \cdot \frac{y - z}{t - z} \]
  6. Add Preprocessing

Alternative 2: 74.3% accurate, 0.3× speedup?

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

\\
\begin{array}{l}
t_1 := x \cdot \left(1 - \frac{y}{z}\right)\\
\mathbf{if}\;z \leq -2.7 \cdot 10^{-25}:\\
\;\;\;\;t\_1\\

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

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

\mathbf{elif}\;z \leq 7.8 \cdot 10^{+234}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -2.70000000000000016e-25 or 2.70000000000000009e-7 < z < 7.7999999999999994e234

    1. Initial program 80.3%

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

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

        \[\leadsto \color{blue}{\frac{y - z}{t - z} \cdot x} \]
      3. *-commutative99.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 84.5%

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

        \[\leadsto x \cdot \color{blue}{\left(-\frac{y - z}{z}\right)} \]
      2. div-sub84.5%

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

        \[\leadsto x \cdot \left(-\color{blue}{\left(\frac{y}{z} + \left(-\frac{z}{z}\right)\right)}\right) \]
      4. *-inverses84.5%

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

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

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

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

    if -2.70000000000000016e-25 < z < 9.0000000000000001e-264

    1. Initial program 89.3%

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

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

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

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

    if 9.0000000000000001e-264 < z < 2.70000000000000009e-7

    1. Initial program 92.3%

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

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

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

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

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

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

    if 7.7999999999999994e234 < z

    1. Initial program 58.7%

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

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

        \[\leadsto \color{blue}{\frac{y - z}{t - z} \cdot x} \]
      3. *-commutative99.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 99.9%

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

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

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

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

        \[\leadsto x \cdot \color{blue}{\frac{-\left(-z\right)}{-\left(t - z\right)}} \]
      2. div-inv99.9%

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \frac{z}{\color{blue}{z + \left(-t\right)}} \]
      4. unsub-neg99.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.7 \cdot 10^{-25}:\\ \;\;\;\;x \cdot \left(1 - \frac{y}{z}\right)\\ \mathbf{elif}\;z \leq 9 \cdot 10^{-264}:\\ \;\;\;\;\left(y - z\right) \cdot \frac{x}{t}\\ \mathbf{elif}\;z \leq 2.7 \cdot 10^{-7}:\\ \;\;\;\;x \cdot \frac{y}{t - z}\\ \mathbf{elif}\;z \leq 7.8 \cdot 10^{+234}:\\ \;\;\;\;x \cdot \left(1 - \frac{y}{z}\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{z}{z - t}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 74.3% accurate, 0.3× speedup?

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

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

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

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

\mathbf{elif}\;z \leq 8.2 \cdot 10^{+234}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -6.00000000000000005e-28 or 2.1999999999999998e-9 < z < 8.19999999999999948e234

    1. Initial program 80.3%

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

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

        \[\leadsto \color{blue}{\frac{y - z}{t - z} \cdot x} \]
      3. *-commutative99.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 84.5%

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

        \[\leadsto x \cdot \color{blue}{\left(-\frac{y - z}{z}\right)} \]
      2. div-sub84.5%

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

        \[\leadsto x \cdot \left(-\color{blue}{\left(\frac{y}{z} + \left(-\frac{z}{z}\right)\right)}\right) \]
      4. *-inverses84.5%

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

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

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

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

    if -6.00000000000000005e-28 < z < 5.89999999999999972e-291

    1. Initial program 88.7%

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

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

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

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

    if 5.89999999999999972e-291 < z < 2.1999999999999998e-9

    1. Initial program 92.8%

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

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

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

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

      \[\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*84.4%

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

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

    if 8.19999999999999948e234 < z

    1. Initial program 58.7%

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

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

        \[\leadsto \color{blue}{\frac{y - z}{t - z} \cdot x} \]
      3. *-commutative99.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 99.9%

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

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

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

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

        \[\leadsto x \cdot \color{blue}{\frac{-\left(-z\right)}{-\left(t - z\right)}} \]
      2. div-inv99.9%

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \frac{z}{\color{blue}{z + \left(-t\right)}} \]
      4. unsub-neg99.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -6 \cdot 10^{-28}:\\ \;\;\;\;x \cdot \left(1 - \frac{y}{z}\right)\\ \mathbf{elif}\;z \leq 5.9 \cdot 10^{-291}:\\ \;\;\;\;\left(y - z\right) \cdot \frac{x}{t}\\ \mathbf{elif}\;z \leq 2.2 \cdot 10^{-9}:\\ \;\;\;\;\frac{x}{\frac{t - z}{y}}\\ \mathbf{elif}\;z \leq 8.2 \cdot 10^{+234}:\\ \;\;\;\;x \cdot \left(1 - \frac{y}{z}\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{z}{z - t}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 75.0% accurate, 0.4× speedup?

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

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

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

\mathbf{elif}\;z \leq 8 \cdot 10^{+234}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -2.60000000000000003e65 or 4.5e-11 < z < 8.00000000000000014e234

    1. Initial program 77.0%

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

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

        \[\leadsto \color{blue}{\frac{y - z}{t - z} \cdot x} \]
      3. *-commutative99.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 87.9%

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

        \[\leadsto x \cdot \color{blue}{\left(-\frac{y - z}{z}\right)} \]
      2. div-sub87.9%

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

        \[\leadsto x \cdot \left(-\color{blue}{\left(\frac{y}{z} + \left(-\frac{z}{z}\right)\right)}\right) \]
      4. *-inverses87.9%

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

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

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

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

    if -2.60000000000000003e65 < z < 4.5e-11

    1. Initial program 91.7%

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

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

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

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

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

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

    if 8.00000000000000014e234 < z

    1. Initial program 58.7%

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

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

        \[\leadsto \color{blue}{\frac{y - z}{t - z} \cdot x} \]
      3. *-commutative99.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 99.9%

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

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

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

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

        \[\leadsto x \cdot \color{blue}{\frac{-\left(-z\right)}{-\left(t - z\right)}} \]
      2. div-inv99.9%

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \frac{z}{\color{blue}{z + \left(-t\right)}} \]
      4. unsub-neg99.9%

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

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

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

Alternative 5: 69.1% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -9 \cdot 10^{-32} \lor \neg \left(z \leq 1.8 \cdot 10^{-10}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{z}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -9.00000000000000009e-32 or 1.8e-10 < z

    1. Initial program 76.9%

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

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

        \[\leadsto \color{blue}{\frac{y - z}{t - z} \cdot x} \]
      3. *-commutative99.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 83.3%

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

        \[\leadsto x \cdot \color{blue}{\left(-\frac{y - z}{z}\right)} \]
      2. div-sub83.4%

        \[\leadsto x \cdot \left(-\color{blue}{\left(\frac{y}{z} - \frac{z}{z}\right)}\right) \]
      3. sub-neg83.4%

        \[\leadsto x \cdot \left(-\color{blue}{\left(\frac{y}{z} + \left(-\frac{z}{z}\right)\right)}\right) \]
      4. *-inverses83.4%

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

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

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

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

    if -9.00000000000000009e-32 < z < 1.8e-10

    1. Initial program 90.7%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{x}{\frac{t}{y}}} \]
    8. Step-by-step derivation
      1. associate-/r/71.5%

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

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

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

Alternative 6: 75.0% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -2.06 \cdot 10^{+65} \lor \neg \left(z \leq 2.2 \cdot 10^{-9}\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 -2.06e+65) (not (<= z 2.2e-9)))
   (* x (- 1.0 (/ y z)))
   (* x (/ y (- t z)))))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((z <= -2.06e+65) || !(z <= 2.2e-9)) {
		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 <= (-2.06d+65)) .or. (.not. (z <= 2.2d-9))) 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 <= -2.06e+65) || !(z <= 2.2e-9)) {
		tmp = x * (1.0 - (y / z));
	} else {
		tmp = x * (y / (t - z));
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (z <= -2.06e+65) or not (z <= 2.2e-9):
		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 <= -2.06e+65) || !(z <= 2.2e-9))
		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 <= -2.06e+65) || ~((z <= 2.2e-9)))
		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, -2.06e+65], N[Not[LessEqual[z, 2.2e-9]], $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 -2.06 \cdot 10^{+65} \lor \neg \left(z \leq 2.2 \cdot 10^{-9}\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 < -2.06000000000000004e65 or 2.1999999999999998e-9 < z

    1. Initial program 73.7%

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

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

        \[\leadsto \color{blue}{\frac{y - z}{t - z} \cdot x} \]
      3. *-commutative99.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 86.0%

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

        \[\leadsto x \cdot \color{blue}{\left(-\frac{y - z}{z}\right)} \]
      2. div-sub86.0%

        \[\leadsto x \cdot \left(-\color{blue}{\left(\frac{y}{z} - \frac{z}{z}\right)}\right) \]
      3. sub-neg86.0%

        \[\leadsto x \cdot \left(-\color{blue}{\left(\frac{y}{z} + \left(-\frac{z}{z}\right)\right)}\right) \]
      4. *-inverses86.0%

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

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

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

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

    if -2.06000000000000004e65 < z < 2.1999999999999998e-9

    1. Initial program 91.7%

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

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

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

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

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

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

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

Alternative 7: 60.6% accurate, 0.6× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -9.1999999999999998e61 or 4.1999999999999996e-6 < z

    1. Initial program 74.1%

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

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

        \[\leadsto \color{blue}{\frac{y - z}{t - z} \cdot x} \]
      3. *-commutative99.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 70.5%

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

    if -9.1999999999999998e61 < z < 4.1999999999999996e-6

    1. Initial program 91.6%

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

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

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

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

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

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

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

Alternative 8: 59.7% accurate, 0.6× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.6600000000000001e62 or 3.1e-4 < z

    1. Initial program 74.1%

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

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

        \[\leadsto \color{blue}{\frac{y - z}{t - z} \cdot x} \]
      3. *-commutative99.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 70.5%

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

    if -1.6600000000000001e62 < z < 3.1e-4

    1. Initial program 91.6%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{\frac{t}{y}}} \]
    7. Simplified67.3%

      \[\leadsto \color{blue}{\frac{x}{\frac{t}{y}}} \]
    8. Step-by-step derivation
      1. associate-/r/68.5%

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

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

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

Alternative 9: 35.3% 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 83.5%

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

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

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

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

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

    \[\leadsto \color{blue}{x} \]
  6. Final simplification39.2%

    \[\leadsto x \]
  7. Add Preprocessing

Developer target: 96.9% 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 2024031 
(FPCore (x y z t)
  :name "Graphics.Rendering.Chart.Plot.AreaSpots:renderAreaSpots4D from Chart-1.5.3"
  :precision binary64

  :herbie-target
  (/ x (/ (- t z) (- y z)))

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