Optimisation.CirclePacking:place from circle-packing-0.1.0.4, D

Percentage Accurate: 92.3% → 98.0%
Time: 8.9s
Alternatives: 9
Speedup: 1.1×

Specification

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

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

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

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

Alternative 1: 98.0% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(\frac{y}{t}, z - x, x\right) \end{array} \]
(FPCore (x y z t) :precision binary64 (fma (/ y t) (- z x) x))
double code(double x, double y, double z, double t) {
	return fma((y / t), (z - x), x);
}
function code(x, y, z, t)
	return fma(Float64(y / t), Float64(z - x), x)
end
code[x_, y_, z_, t_] := N[(N[(y / t), $MachinePrecision] * N[(z - x), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(\frac{y}{t}, z - x, x\right)
\end{array}
Derivation
  1. Initial program 92.4%

    \[x + \frac{y \cdot \left(z - x\right)}{t} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift--.f64N/A

      \[\leadsto x + \frac{y \cdot \color{blue}{\left(z - x\right)}}{t} \]
    2. lift-*.f64N/A

      \[\leadsto x + \frac{\color{blue}{y \cdot \left(z - x\right)}}{t} \]
    3. remove-double-negN/A

      \[\leadsto x + \frac{\color{blue}{\mathsf{neg}\left(\left(\mathsf{neg}\left(y \cdot \left(z - x\right)\right)\right)\right)}}{t} \]
    4. remove-double-negN/A

      \[\leadsto x + \frac{\color{blue}{y \cdot \left(z - x\right)}}{t} \]
    5. lift-/.f64N/A

      \[\leadsto x + \color{blue}{\frac{y \cdot \left(z - x\right)}{t}} \]
    6. +-commutativeN/A

      \[\leadsto \color{blue}{\frac{y \cdot \left(z - x\right)}{t} + x} \]
    7. lift-/.f64N/A

      \[\leadsto \color{blue}{\frac{y \cdot \left(z - x\right)}{t}} + x \]
    8. lift-*.f64N/A

      \[\leadsto \frac{\color{blue}{y \cdot \left(z - x\right)}}{t} + x \]
    9. *-commutativeN/A

      \[\leadsto \frac{\color{blue}{\left(z - x\right) \cdot y}}{t} + x \]
    10. associate-/l*N/A

      \[\leadsto \color{blue}{\left(z - x\right) \cdot \frac{y}{t}} + x \]
    11. *-commutativeN/A

      \[\leadsto \color{blue}{\frac{y}{t} \cdot \left(z - x\right)} + x \]
    12. lower-fma.f64N/A

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y}{t}, z - x, x\right)} \]
    13. lower-/.f6498.1

      \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{y}{t}}, z - x, x\right) \]
  4. Applied rewrites98.1%

    \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y}{t}, z - x, x\right)} \]
  5. Add Preprocessing

Alternative 2: 85.1% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \mathsf{fma}\left(z, \frac{y}{t}, x\right)\\ \mathbf{if}\;z \leq -4.2 \cdot 10^{-38}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 1.7 \cdot 10^{-5}:\\ \;\;\;\;\mathsf{fma}\left(-\frac{x}{t}, y, x\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (fma z (/ y t) x)))
   (if (<= z -4.2e-38) t_1 (if (<= z 1.7e-5) (fma (- (/ x t)) y x) t_1))))
double code(double x, double y, double z, double t) {
	double t_1 = fma(z, (y / t), x);
	double tmp;
	if (z <= -4.2e-38) {
		tmp = t_1;
	} else if (z <= 1.7e-5) {
		tmp = fma(-(x / t), y, x);
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(x, y, z, t)
	t_1 = fma(z, Float64(y / t), x)
	tmp = 0.0
	if (z <= -4.2e-38)
		tmp = t_1;
	elseif (z <= 1.7e-5)
		tmp = fma(Float64(-Float64(x / t)), y, x);
	else
		tmp = t_1;
	end
	return tmp
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(y / t), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[z, -4.2e-38], t$95$1, If[LessEqual[z, 1.7e-5], N[((-N[(x / t), $MachinePrecision]) * y + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(z, \frac{y}{t}, x\right)\\
\mathbf{if}\;z \leq -4.2 \cdot 10^{-38}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq 1.7 \cdot 10^{-5}:\\
\;\;\;\;\mathsf{fma}\left(-\frac{x}{t}, y, x\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -4.20000000000000026e-38 or 1.7e-5 < z

    1. Initial program 94.1%

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

      \[\leadsto x + \color{blue}{\frac{y \cdot z}{t}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto x + \color{blue}{\frac{y \cdot z}{t}} \]
      2. lower-*.f6489.1

        \[\leadsto x + \frac{\color{blue}{y \cdot z}}{t} \]
    5. Applied rewrites89.1%

      \[\leadsto x + \color{blue}{\frac{y \cdot z}{t}} \]
    6. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto x + \frac{\color{blue}{y \cdot z}}{t} \]
      2. lift-/.f64N/A

        \[\leadsto x + \color{blue}{\frac{y \cdot z}{t}} \]
      3. +-commutativeN/A

        \[\leadsto \color{blue}{\frac{y \cdot z}{t} + x} \]
      4. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{y \cdot z}{t}} + x \]
      5. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{y \cdot z}}{t} + x \]
      6. *-commutativeN/A

        \[\leadsto \frac{\color{blue}{z \cdot y}}{t} + x \]
      7. associate-/l*N/A

        \[\leadsto \color{blue}{z \cdot \frac{y}{t}} + x \]
      8. lift-/.f64N/A

        \[\leadsto z \cdot \color{blue}{\frac{y}{t}} + x \]
      9. lower-fma.f6492.6

        \[\leadsto \color{blue}{\mathsf{fma}\left(z, \frac{y}{t}, x\right)} \]
    7. Applied rewrites92.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(z, \frac{y}{t}, x\right)} \]

    if -4.20000000000000026e-38 < z < 1.7e-5

    1. Initial program 90.5%

      \[x + \frac{y \cdot \left(z - x\right)}{t} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto x + \frac{y \cdot \color{blue}{\left(z - x\right)}}{t} \]
      2. lift-*.f64N/A

        \[\leadsto x + \frac{\color{blue}{y \cdot \left(z - x\right)}}{t} \]
      3. remove-double-negN/A

        \[\leadsto x + \frac{\color{blue}{\mathsf{neg}\left(\left(\mathsf{neg}\left(y \cdot \left(z - x\right)\right)\right)\right)}}{t} \]
      4. remove-double-negN/A

        \[\leadsto x + \frac{\color{blue}{y \cdot \left(z - x\right)}}{t} \]
      5. lift-/.f64N/A

        \[\leadsto x + \color{blue}{\frac{y \cdot \left(z - x\right)}{t}} \]
      6. +-commutativeN/A

        \[\leadsto \color{blue}{\frac{y \cdot \left(z - x\right)}{t} + x} \]
      7. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{y \cdot \left(z - x\right)}{t}} + x \]
      8. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{y \cdot \left(z - x\right)}}{t} + x \]
      9. associate-/l*N/A

        \[\leadsto \color{blue}{y \cdot \frac{z - x}{t}} + x \]
      10. *-commutativeN/A

        \[\leadsto \color{blue}{\frac{z - x}{t} \cdot y} + x \]
      11. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{z - x}{t}, y, x\right)} \]
      12. lower-/.f6499.9

        \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{z - x}{t}}, y, x\right) \]
    4. Applied rewrites99.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{z - x}{t}, y, x\right)} \]
    5. Taylor expanded in z around 0

      \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{-1 \cdot x}}{t}, y, x\right) \]
    6. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{\mathsf{neg}\left(x\right)}}{t}, y, x\right) \]
      2. lower-neg.f6490.4

        \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{-x}}{t}, y, x\right) \]
    7. Applied rewrites90.4%

      \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{-x}}{t}, y, x\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification91.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -4.2 \cdot 10^{-38}:\\ \;\;\;\;\mathsf{fma}\left(z, \frac{y}{t}, x\right)\\ \mathbf{elif}\;z \leq 1.7 \cdot 10^{-5}:\\ \;\;\;\;\mathsf{fma}\left(-\frac{x}{t}, y, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(z, \frac{y}{t}, x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 86.9% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \mathsf{fma}\left(z, \frac{y}{t}, x\right)\\ \mathbf{if}\;z \leq -1.35 \cdot 10^{-37}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 2.5 \cdot 10^{-5}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y}{t}, -x, x\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (fma z (/ y t) x)))
   (if (<= z -1.35e-37) t_1 (if (<= z 2.5e-5) (fma (/ y t) (- x) x) t_1))))
double code(double x, double y, double z, double t) {
	double t_1 = fma(z, (y / t), x);
	double tmp;
	if (z <= -1.35e-37) {
		tmp = t_1;
	} else if (z <= 2.5e-5) {
		tmp = fma((y / t), -x, x);
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(x, y, z, t)
	t_1 = fma(z, Float64(y / t), x)
	tmp = 0.0
	if (z <= -1.35e-37)
		tmp = t_1;
	elseif (z <= 2.5e-5)
		tmp = fma(Float64(y / t), Float64(-x), x);
	else
		tmp = t_1;
	end
	return tmp
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(y / t), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[z, -1.35e-37], t$95$1, If[LessEqual[z, 2.5e-5], N[(N[(y / t), $MachinePrecision] * (-x) + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(z, \frac{y}{t}, x\right)\\
\mathbf{if}\;z \leq -1.35 \cdot 10^{-37}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq 2.5 \cdot 10^{-5}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{t}, -x, x\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.35000000000000008e-37 or 2.50000000000000012e-5 < z

    1. Initial program 94.1%

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

      \[\leadsto x + \color{blue}{\frac{y \cdot z}{t}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto x + \color{blue}{\frac{y \cdot z}{t}} \]
      2. lower-*.f6489.1

        \[\leadsto x + \frac{\color{blue}{y \cdot z}}{t} \]
    5. Applied rewrites89.1%

      \[\leadsto x + \color{blue}{\frac{y \cdot z}{t}} \]
    6. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto x + \frac{\color{blue}{y \cdot z}}{t} \]
      2. lift-/.f64N/A

        \[\leadsto x + \color{blue}{\frac{y \cdot z}{t}} \]
      3. +-commutativeN/A

        \[\leadsto \color{blue}{\frac{y \cdot z}{t} + x} \]
      4. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{y \cdot z}{t}} + x \]
      5. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{y \cdot z}}{t} + x \]
      6. *-commutativeN/A

        \[\leadsto \frac{\color{blue}{z \cdot y}}{t} + x \]
      7. associate-/l*N/A

        \[\leadsto \color{blue}{z \cdot \frac{y}{t}} + x \]
      8. lift-/.f64N/A

        \[\leadsto z \cdot \color{blue}{\frac{y}{t}} + x \]
      9. lower-fma.f6492.6

        \[\leadsto \color{blue}{\mathsf{fma}\left(z, \frac{y}{t}, x\right)} \]
    7. Applied rewrites92.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(z, \frac{y}{t}, x\right)} \]

    if -1.35000000000000008e-37 < z < 2.50000000000000012e-5

    1. Initial program 90.5%

      \[x + \frac{y \cdot \left(z - x\right)}{t} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto x + \frac{y \cdot \color{blue}{\left(z - x\right)}}{t} \]
      2. lift-*.f64N/A

        \[\leadsto x + \frac{\color{blue}{y \cdot \left(z - x\right)}}{t} \]
      3. remove-double-negN/A

        \[\leadsto x + \frac{\color{blue}{\mathsf{neg}\left(\left(\mathsf{neg}\left(y \cdot \left(z - x\right)\right)\right)\right)}}{t} \]
      4. remove-double-negN/A

        \[\leadsto x + \frac{\color{blue}{y \cdot \left(z - x\right)}}{t} \]
      5. lift-/.f64N/A

        \[\leadsto x + \color{blue}{\frac{y \cdot \left(z - x\right)}{t}} \]
      6. +-commutativeN/A

        \[\leadsto \color{blue}{\frac{y \cdot \left(z - x\right)}{t} + x} \]
      7. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{y \cdot \left(z - x\right)}{t}} + x \]
      8. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{y \cdot \left(z - x\right)}}{t} + x \]
      9. *-commutativeN/A

        \[\leadsto \frac{\color{blue}{\left(z - x\right) \cdot y}}{t} + x \]
      10. associate-/l*N/A

        \[\leadsto \color{blue}{\left(z - x\right) \cdot \frac{y}{t}} + x \]
      11. *-commutativeN/A

        \[\leadsto \color{blue}{\frac{y}{t} \cdot \left(z - x\right)} + x \]
      12. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y}{t}, z - x, x\right)} \]
      13. lower-/.f6496.1

        \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{y}{t}}, z - x, x\right) \]
    4. Applied rewrites96.1%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y}{t}, z - x, x\right)} \]
    5. Taylor expanded in z around 0

      \[\leadsto \mathsf{fma}\left(\frac{y}{t}, \color{blue}{-1 \cdot x}, x\right) \]
    6. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(\frac{y}{t}, \color{blue}{\mathsf{neg}\left(x\right)}, x\right) \]
      2. lower-neg.f6490.4

        \[\leadsto \mathsf{fma}\left(\frac{y}{t}, \color{blue}{-x}, x\right) \]
    7. Applied rewrites90.4%

      \[\leadsto \mathsf{fma}\left(\frac{y}{t}, \color{blue}{-x}, x\right) \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 4: 81.5% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \mathsf{fma}\left(z, \frac{y}{t}, x\right)\\ \mathbf{if}\;z \leq -4.2 \cdot 10^{-38}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 1.7 \cdot 10^{-5}:\\ \;\;\;\;\frac{x}{t} \cdot \left(t - y\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (fma z (/ y t) x)))
   (if (<= z -4.2e-38) t_1 (if (<= z 1.7e-5) (* (/ x t) (- t y)) t_1))))
double code(double x, double y, double z, double t) {
	double t_1 = fma(z, (y / t), x);
	double tmp;
	if (z <= -4.2e-38) {
		tmp = t_1;
	} else if (z <= 1.7e-5) {
		tmp = (x / t) * (t - y);
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(x, y, z, t)
	t_1 = fma(z, Float64(y / t), x)
	tmp = 0.0
	if (z <= -4.2e-38)
		tmp = t_1;
	elseif (z <= 1.7e-5)
		tmp = Float64(Float64(x / t) * Float64(t - y));
	else
		tmp = t_1;
	end
	return tmp
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(y / t), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[z, -4.2e-38], t$95$1, If[LessEqual[z, 1.7e-5], N[(N[(x / t), $MachinePrecision] * N[(t - y), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(z, \frac{y}{t}, x\right)\\
\mathbf{if}\;z \leq -4.2 \cdot 10^{-38}:\\
\;\;\;\;t\_1\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -4.20000000000000026e-38 or 1.7e-5 < z

    1. Initial program 94.1%

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

      \[\leadsto x + \color{blue}{\frac{y \cdot z}{t}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto x + \color{blue}{\frac{y \cdot z}{t}} \]
      2. lower-*.f6489.1

        \[\leadsto x + \frac{\color{blue}{y \cdot z}}{t} \]
    5. Applied rewrites89.1%

      \[\leadsto x + \color{blue}{\frac{y \cdot z}{t}} \]
    6. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto x + \frac{\color{blue}{y \cdot z}}{t} \]
      2. lift-/.f64N/A

        \[\leadsto x + \color{blue}{\frac{y \cdot z}{t}} \]
      3. +-commutativeN/A

        \[\leadsto \color{blue}{\frac{y \cdot z}{t} + x} \]
      4. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{y \cdot z}{t}} + x \]
      5. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{y \cdot z}}{t} + x \]
      6. *-commutativeN/A

        \[\leadsto \frac{\color{blue}{z \cdot y}}{t} + x \]
      7. associate-/l*N/A

        \[\leadsto \color{blue}{z \cdot \frac{y}{t}} + x \]
      8. lift-/.f64N/A

        \[\leadsto z \cdot \color{blue}{\frac{y}{t}} + x \]
      9. lower-fma.f6492.6

        \[\leadsto \color{blue}{\mathsf{fma}\left(z, \frac{y}{t}, x\right)} \]
    7. Applied rewrites92.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(z, \frac{y}{t}, x\right)} \]

    if -4.20000000000000026e-38 < z < 1.7e-5

    1. Initial program 90.5%

      \[x + \frac{y \cdot \left(z - x\right)}{t} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto x + \frac{y \cdot \color{blue}{\left(z - x\right)}}{t} \]
      2. lift-*.f64N/A

        \[\leadsto x + \frac{\color{blue}{y \cdot \left(z - x\right)}}{t} \]
      3. remove-double-negN/A

        \[\leadsto x + \frac{\color{blue}{\mathsf{neg}\left(\left(\mathsf{neg}\left(y \cdot \left(z - x\right)\right)\right)\right)}}{t} \]
      4. remove-double-negN/A

        \[\leadsto x + \frac{\color{blue}{y \cdot \left(z - x\right)}}{t} \]
      5. lift-/.f64N/A

        \[\leadsto x + \color{blue}{\frac{y \cdot \left(z - x\right)}{t}} \]
      6. +-commutativeN/A

        \[\leadsto \color{blue}{\frac{y \cdot \left(z - x\right)}{t} + x} \]
      7. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{y \cdot \left(z - x\right)}{t}} + x \]
      8. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{y \cdot \left(z - x\right)}}{t} + x \]
      9. associate-/l*N/A

        \[\leadsto \color{blue}{y \cdot \frac{z - x}{t}} + x \]
      10. *-commutativeN/A

        \[\leadsto \color{blue}{\frac{z - x}{t} \cdot y} + x \]
      11. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{z - x}{t}, y, x\right)} \]
      12. lower-/.f6499.9

        \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{z - x}{t}}, y, x\right) \]
    4. Applied rewrites99.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{z - x}{t}, y, x\right)} \]
    5. Taylor expanded in z around 0

      \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{-1 \cdot x}}{t}, y, x\right) \]
    6. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{\mathsf{neg}\left(x\right)}}{t}, y, x\right) \]
      2. lower-neg.f6490.4

        \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{-x}}{t}, y, x\right) \]
    7. Applied rewrites90.4%

      \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{-x}}{t}, y, x\right) \]
    8. Taylor expanded in t around 0

      \[\leadsto \color{blue}{\frac{-1 \cdot \left(x \cdot y\right) + t \cdot x}{t}} \]
    9. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{-1 \cdot \left(x \cdot y\right) + t \cdot x}{t}} \]
      2. +-commutativeN/A

        \[\leadsto \frac{\color{blue}{t \cdot x + -1 \cdot \left(x \cdot y\right)}}{t} \]
      3. mul-1-negN/A

        \[\leadsto \frac{t \cdot x + \color{blue}{\left(\mathsf{neg}\left(x \cdot y\right)\right)}}{t} \]
      4. unsub-negN/A

        \[\leadsto \frac{\color{blue}{t \cdot x - x \cdot y}}{t} \]
      5. *-commutativeN/A

        \[\leadsto \frac{\color{blue}{x \cdot t} - x \cdot y}{t} \]
      6. distribute-lft-out--N/A

        \[\leadsto \frac{\color{blue}{x \cdot \left(t - y\right)}}{t} \]
      7. lower-*.f64N/A

        \[\leadsto \frac{\color{blue}{x \cdot \left(t - y\right)}}{t} \]
      8. lower--.f6472.7

        \[\leadsto \frac{x \cdot \color{blue}{\left(t - y\right)}}{t} \]
    10. Applied rewrites72.7%

      \[\leadsto \color{blue}{\frac{x \cdot \left(t - y\right)}{t}} \]
    11. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto \frac{x \cdot \color{blue}{\left(t - y\right)}}{t} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{x \cdot \left(t - y\right)}}{t} \]
      3. clear-numN/A

        \[\leadsto \color{blue}{\frac{1}{\frac{t}{x \cdot \left(t - y\right)}}} \]
      4. associate-/r/N/A

        \[\leadsto \color{blue}{\frac{1}{t} \cdot \left(x \cdot \left(t - y\right)\right)} \]
      5. lift-*.f64N/A

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

        \[\leadsto \color{blue}{\left(\frac{1}{t} \cdot x\right) \cdot \left(t - y\right)} \]
      7. associate-*l/N/A

        \[\leadsto \color{blue}{\frac{1 \cdot x}{t}} \cdot \left(t - y\right) \]
      8. *-lft-identityN/A

        \[\leadsto \frac{\color{blue}{x}}{t} \cdot \left(t - y\right) \]
      9. lower-*.f64N/A

        \[\leadsto \color{blue}{\frac{x}{t} \cdot \left(t - y\right)} \]
      10. lower-/.f6484.2

        \[\leadsto \color{blue}{\frac{x}{t}} \cdot \left(t - y\right) \]
    12. Applied rewrites84.2%

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

Alternative 5: 84.2% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := y \cdot \frac{z - x}{t}\\ \mathbf{if}\;y \leq -5.5 \cdot 10^{+34}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq 2.65 \cdot 10^{+74}:\\ \;\;\;\;\mathsf{fma}\left(z, \frac{y}{t}, x\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* y (/ (- z x) t))))
   (if (<= y -5.5e+34) t_1 (if (<= y 2.65e+74) (fma z (/ y t) x) t_1))))
double code(double x, double y, double z, double t) {
	double t_1 = y * ((z - x) / t);
	double tmp;
	if (y <= -5.5e+34) {
		tmp = t_1;
	} else if (y <= 2.65e+74) {
		tmp = fma(z, (y / t), x);
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(x, y, z, t)
	t_1 = Float64(y * Float64(Float64(z - x) / t))
	tmp = 0.0
	if (y <= -5.5e+34)
		tmp = t_1;
	elseif (y <= 2.65e+74)
		tmp = fma(z, Float64(y / t), x);
	else
		tmp = t_1;
	end
	return tmp
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(N[(z - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -5.5e+34], t$95$1, If[LessEqual[y, 2.65e+74], N[(z * N[(y / t), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq 2.65 \cdot 10^{+74}:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{y}{t}, x\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -5.4999999999999996e34 or 2.6499999999999999e74 < y

    1. Initial program 86.6%

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

      \[\leadsto \color{blue}{y \cdot \left(\frac{z}{t} - \frac{x}{t}\right)} \]
    4. Step-by-step derivation
      1. div-subN/A

        \[\leadsto y \cdot \color{blue}{\frac{z - x}{t}} \]
      2. lower-*.f64N/A

        \[\leadsto \color{blue}{y \cdot \frac{z - x}{t}} \]
      3. lower-/.f64N/A

        \[\leadsto y \cdot \color{blue}{\frac{z - x}{t}} \]
      4. lower--.f6486.7

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

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

    if -5.4999999999999996e34 < y < 2.6499999999999999e74

    1. Initial program 97.1%

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

      \[\leadsto x + \color{blue}{\frac{y \cdot z}{t}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto x + \color{blue}{\frac{y \cdot z}{t}} \]
      2. lower-*.f6484.2

        \[\leadsto x + \frac{\color{blue}{y \cdot z}}{t} \]
    5. Applied rewrites84.2%

      \[\leadsto x + \color{blue}{\frac{y \cdot z}{t}} \]
    6. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto x + \frac{\color{blue}{y \cdot z}}{t} \]
      2. lift-/.f64N/A

        \[\leadsto x + \color{blue}{\frac{y \cdot z}{t}} \]
      3. +-commutativeN/A

        \[\leadsto \color{blue}{\frac{y \cdot z}{t} + x} \]
      4. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{y \cdot z}{t}} + x \]
      5. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{y \cdot z}}{t} + x \]
      6. *-commutativeN/A

        \[\leadsto \frac{\color{blue}{z \cdot y}}{t} + x \]
      7. associate-/l*N/A

        \[\leadsto \color{blue}{z \cdot \frac{y}{t}} + x \]
      8. lift-/.f64N/A

        \[\leadsto z \cdot \color{blue}{\frac{y}{t}} + x \]
      9. lower-fma.f6486.3

        \[\leadsto \color{blue}{\mathsf{fma}\left(z, \frac{y}{t}, x\right)} \]
    7. Applied rewrites86.3%

      \[\leadsto \color{blue}{\mathsf{fma}\left(z, \frac{y}{t}, x\right)} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 6: 73.6% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \mathsf{fma}\left(z, \frac{y}{t}, x\right)\\ \mathbf{if}\;z \leq 9 \cdot 10^{-280}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 4 \cdot 10^{-109}:\\ \;\;\;\;-y \cdot \frac{x}{t}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (fma z (/ y t) x)))
   (if (<= z 9e-280) t_1 (if (<= z 4e-109) (- (* y (/ x t))) t_1))))
double code(double x, double y, double z, double t) {
	double t_1 = fma(z, (y / t), x);
	double tmp;
	if (z <= 9e-280) {
		tmp = t_1;
	} else if (z <= 4e-109) {
		tmp = -(y * (x / t));
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(x, y, z, t)
	t_1 = fma(z, Float64(y / t), x)
	tmp = 0.0
	if (z <= 9e-280)
		tmp = t_1;
	elseif (z <= 4e-109)
		tmp = Float64(-Float64(y * Float64(x / t)));
	else
		tmp = t_1;
	end
	return tmp
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(y / t), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[z, 9e-280], t$95$1, If[LessEqual[z, 4e-109], (-N[(y * N[(x / t), $MachinePrecision]), $MachinePrecision]), t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(z, \frac{y}{t}, x\right)\\
\mathbf{if}\;z \leq 9 \cdot 10^{-280}:\\
\;\;\;\;t\_1\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 8.9999999999999991e-280 or 4e-109 < z

    1. Initial program 92.0%

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

      \[\leadsto x + \color{blue}{\frac{y \cdot z}{t}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto x + \color{blue}{\frac{y \cdot z}{t}} \]
      2. lower-*.f6479.5

        \[\leadsto x + \frac{\color{blue}{y \cdot z}}{t} \]
    5. Applied rewrites79.5%

      \[\leadsto x + \color{blue}{\frac{y \cdot z}{t}} \]
    6. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto x + \frac{\color{blue}{y \cdot z}}{t} \]
      2. lift-/.f64N/A

        \[\leadsto x + \color{blue}{\frac{y \cdot z}{t}} \]
      3. +-commutativeN/A

        \[\leadsto \color{blue}{\frac{y \cdot z}{t} + x} \]
      4. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{y \cdot z}{t}} + x \]
      5. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{y \cdot z}}{t} + x \]
      6. *-commutativeN/A

        \[\leadsto \frac{\color{blue}{z \cdot y}}{t} + x \]
      7. associate-/l*N/A

        \[\leadsto \color{blue}{z \cdot \frac{y}{t}} + x \]
      8. lift-/.f64N/A

        \[\leadsto z \cdot \color{blue}{\frac{y}{t}} + x \]
      9. lower-fma.f6486.4

        \[\leadsto \color{blue}{\mathsf{fma}\left(z, \frac{y}{t}, x\right)} \]
    7. Applied rewrites86.4%

      \[\leadsto \color{blue}{\mathsf{fma}\left(z, \frac{y}{t}, x\right)} \]

    if 8.9999999999999991e-280 < z < 4e-109

    1. Initial program 94.2%

      \[x + \frac{y \cdot \left(z - x\right)}{t} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto x + \frac{y \cdot \color{blue}{\left(z - x\right)}}{t} \]
      2. lift-*.f64N/A

        \[\leadsto x + \frac{\color{blue}{y \cdot \left(z - x\right)}}{t} \]
      3. remove-double-negN/A

        \[\leadsto x + \frac{\color{blue}{\mathsf{neg}\left(\left(\mathsf{neg}\left(y \cdot \left(z - x\right)\right)\right)\right)}}{t} \]
      4. remove-double-negN/A

        \[\leadsto x + \frac{\color{blue}{y \cdot \left(z - x\right)}}{t} \]
      5. lift-/.f64N/A

        \[\leadsto x + \color{blue}{\frac{y \cdot \left(z - x\right)}{t}} \]
      6. +-commutativeN/A

        \[\leadsto \color{blue}{\frac{y \cdot \left(z - x\right)}{t} + x} \]
      7. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{y \cdot \left(z - x\right)}{t}} + x \]
      8. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{y \cdot \left(z - x\right)}}{t} + x \]
      9. *-commutativeN/A

        \[\leadsto \frac{\color{blue}{\left(z - x\right) \cdot y}}{t} + x \]
      10. associate-/l*N/A

        \[\leadsto \color{blue}{\left(z - x\right) \cdot \frac{y}{t}} + x \]
      11. *-commutativeN/A

        \[\leadsto \color{blue}{\frac{y}{t} \cdot \left(z - x\right)} + x \]
      12. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y}{t}, z - x, x\right)} \]
      13. lower-/.f6490.3

        \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{y}{t}}, z - x, x\right) \]
    4. Applied rewrites90.3%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y}{t}, z - x, x\right)} \]
    5. Taylor expanded in y around inf

      \[\leadsto \color{blue}{y \cdot \left(\frac{z}{t} - \frac{x}{t}\right)} \]
    6. Step-by-step derivation
      1. div-subN/A

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

        \[\leadsto \color{blue}{\frac{y \cdot \left(z - x\right)}{t}} \]
      3. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{y \cdot \left(z - x\right)}{t}} \]
      4. lower-*.f64N/A

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

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

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

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

        \[\leadsto \frac{\color{blue}{\left(-1 \cdot x\right) \cdot y}}{t} \]
      2. *-commutativeN/A

        \[\leadsto \frac{\color{blue}{y \cdot \left(-1 \cdot x\right)}}{t} \]
      3. lower-*.f64N/A

        \[\leadsto \frac{\color{blue}{y \cdot \left(-1 \cdot x\right)}}{t} \]
      4. mul-1-negN/A

        \[\leadsto \frac{y \cdot \color{blue}{\left(\mathsf{neg}\left(x\right)\right)}}{t} \]
      5. lower-neg.f6457.8

        \[\leadsto \frac{y \cdot \color{blue}{\left(-x\right)}}{t} \]
    10. Applied rewrites57.8%

      \[\leadsto \frac{\color{blue}{y \cdot \left(-x\right)}}{t} \]
    11. Step-by-step derivation
      1. lift-neg.f64N/A

        \[\leadsto \frac{y \cdot \color{blue}{\left(\mathsf{neg}\left(x\right)\right)}}{t} \]
      2. associate-/l*N/A

        \[\leadsto \color{blue}{y \cdot \frac{\mathsf{neg}\left(x\right)}{t}} \]
      3. *-commutativeN/A

        \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(x\right)}{t} \cdot y} \]
      4. lower-*.f64N/A

        \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(x\right)}{t} \cdot y} \]
      5. lower-/.f6461.6

        \[\leadsto \color{blue}{\frac{-x}{t}} \cdot y \]
    12. Applied rewrites61.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 9 \cdot 10^{-280}:\\ \;\;\;\;\mathsf{fma}\left(z, \frac{y}{t}, x\right)\\ \mathbf{elif}\;z \leq 4 \cdot 10^{-109}:\\ \;\;\;\;-y \cdot \frac{x}{t}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(z, \frac{y}{t}, x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 47.0% accurate, 0.8× speedup?

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

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

\mathbf{elif}\;t \leq 1.05 \cdot 10^{+59}:\\
\;\;\;\;\frac{y}{t} \cdot z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.9500000000000001e71 or 1.04999999999999992e59 < t

    1. Initial program 83.2%

      \[x + \frac{y \cdot \left(z - x\right)}{t} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto x + \frac{y \cdot \color{blue}{\left(z - x\right)}}{t} \]
      2. lift-*.f64N/A

        \[\leadsto x + \frac{\color{blue}{y \cdot \left(z - x\right)}}{t} \]
      3. remove-double-negN/A

        \[\leadsto x + \frac{\color{blue}{\mathsf{neg}\left(\left(\mathsf{neg}\left(y \cdot \left(z - x\right)\right)\right)\right)}}{t} \]
      4. remove-double-negN/A

        \[\leadsto x + \frac{\color{blue}{y \cdot \left(z - x\right)}}{t} \]
      5. lift-/.f64N/A

        \[\leadsto x + \color{blue}{\frac{y \cdot \left(z - x\right)}{t}} \]
      6. +-commutativeN/A

        \[\leadsto \color{blue}{\frac{y \cdot \left(z - x\right)}{t} + x} \]
      7. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{y \cdot \left(z - x\right)}{t}} + x \]
      8. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{y \cdot \left(z - x\right)}}{t} + x \]
      9. associate-/l*N/A

        \[\leadsto \color{blue}{y \cdot \frac{z - x}{t}} + x \]
      10. *-commutativeN/A

        \[\leadsto \color{blue}{\frac{z - x}{t} \cdot y} + x \]
      11. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{z - x}{t}, y, x\right)} \]
      12. lower-/.f6499.9

        \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{z - x}{t}}, y, x\right) \]
    4. Applied rewrites99.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{z - x}{t}, y, x\right)} \]
    5. Taylor expanded in z around 0

      \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{-1 \cdot x}}{t}, y, x\right) \]
    6. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{\mathsf{neg}\left(x\right)}}{t}, y, x\right) \]
      2. lower-neg.f6485.2

        \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{-x}}{t}, y, x\right) \]
    7. Applied rewrites85.2%

      \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{-x}}{t}, y, x\right) \]
    8. Taylor expanded in t around 0

      \[\leadsto \color{blue}{\frac{-1 \cdot \left(x \cdot y\right) + t \cdot x}{t}} \]
    9. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{-1 \cdot \left(x \cdot y\right) + t \cdot x}{t}} \]
      2. +-commutativeN/A

        \[\leadsto \frac{\color{blue}{t \cdot x + -1 \cdot \left(x \cdot y\right)}}{t} \]
      3. mul-1-negN/A

        \[\leadsto \frac{t \cdot x + \color{blue}{\left(\mathsf{neg}\left(x \cdot y\right)\right)}}{t} \]
      4. unsub-negN/A

        \[\leadsto \frac{\color{blue}{t \cdot x - x \cdot y}}{t} \]
      5. *-commutativeN/A

        \[\leadsto \frac{\color{blue}{x \cdot t} - x \cdot y}{t} \]
      6. distribute-lft-out--N/A

        \[\leadsto \frac{\color{blue}{x \cdot \left(t - y\right)}}{t} \]
      7. lower-*.f64N/A

        \[\leadsto \frac{\color{blue}{x \cdot \left(t - y\right)}}{t} \]
      8. lower--.f6448.5

        \[\leadsto \frac{x \cdot \color{blue}{\left(t - y\right)}}{t} \]
    10. Applied rewrites48.5%

      \[\leadsto \color{blue}{\frac{x \cdot \left(t - y\right)}{t}} \]
    11. Taylor expanded in t around inf

      \[\leadsto \frac{\color{blue}{t \cdot x}}{t} \]
    12. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{\color{blue}{x \cdot t}}{t} \]
      2. lower-*.f6446.2

        \[\leadsto \frac{\color{blue}{x \cdot t}}{t} \]
    13. Applied rewrites46.2%

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

    if -1.9500000000000001e71 < t < 1.04999999999999992e59

    1. Initial program 97.6%

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

      \[\leadsto \color{blue}{\frac{y \cdot z}{t}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{y \cdot z}{t}} \]
      2. lower-*.f6449.8

        \[\leadsto \frac{\color{blue}{y \cdot z}}{t} \]
    5. Applied rewrites49.8%

      \[\leadsto \color{blue}{\frac{y \cdot z}{t}} \]
    6. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{\color{blue}{z \cdot y}}{t} \]
      2. associate-/l*N/A

        \[\leadsto \color{blue}{z \cdot \frac{y}{t}} \]
      3. lift-/.f64N/A

        \[\leadsto z \cdot \color{blue}{\frac{y}{t}} \]
      4. lower-*.f6456.1

        \[\leadsto \color{blue}{z \cdot \frac{y}{t}} \]
    7. Applied rewrites56.1%

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

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

Alternative 8: 76.7% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(z, \frac{y}{t}, x\right) \end{array} \]
(FPCore (x y z t) :precision binary64 (fma z (/ y t) x))
double code(double x, double y, double z, double t) {
	return fma(z, (y / t), x);
}
function code(x, y, z, t)
	return fma(z, Float64(y / t), x)
end
code[x_, y_, z_, t_] := N[(z * N[(y / t), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(z, \frac{y}{t}, x\right)
\end{array}
Derivation
  1. Initial program 92.4%

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

    \[\leadsto x + \color{blue}{\frac{y \cdot z}{t}} \]
  4. Step-by-step derivation
    1. lower-/.f64N/A

      \[\leadsto x + \color{blue}{\frac{y \cdot z}{t}} \]
    2. lower-*.f6472.5

      \[\leadsto x + \frac{\color{blue}{y \cdot z}}{t} \]
  5. Applied rewrites72.5%

    \[\leadsto x + \color{blue}{\frac{y \cdot z}{t}} \]
  6. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto x + \frac{\color{blue}{y \cdot z}}{t} \]
    2. lift-/.f64N/A

      \[\leadsto x + \color{blue}{\frac{y \cdot z}{t}} \]
    3. +-commutativeN/A

      \[\leadsto \color{blue}{\frac{y \cdot z}{t} + x} \]
    4. lift-/.f64N/A

      \[\leadsto \color{blue}{\frac{y \cdot z}{t}} + x \]
    5. lift-*.f64N/A

      \[\leadsto \frac{\color{blue}{y \cdot z}}{t} + x \]
    6. *-commutativeN/A

      \[\leadsto \frac{\color{blue}{z \cdot y}}{t} + x \]
    7. associate-/l*N/A

      \[\leadsto \color{blue}{z \cdot \frac{y}{t}} + x \]
    8. lift-/.f64N/A

      \[\leadsto z \cdot \color{blue}{\frac{y}{t}} + x \]
    9. lower-fma.f6478.1

      \[\leadsto \color{blue}{\mathsf{fma}\left(z, \frac{y}{t}, x\right)} \]
  7. Applied rewrites78.1%

    \[\leadsto \color{blue}{\mathsf{fma}\left(z, \frac{y}{t}, x\right)} \]
  8. Add Preprocessing

Alternative 9: 41.1% accurate, 1.4× speedup?

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

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

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

    \[\leadsto \color{blue}{\frac{y \cdot z}{t}} \]
  4. Step-by-step derivation
    1. lower-/.f64N/A

      \[\leadsto \color{blue}{\frac{y \cdot z}{t}} \]
    2. lower-*.f6437.1

      \[\leadsto \frac{\color{blue}{y \cdot z}}{t} \]
  5. Applied rewrites37.1%

    \[\leadsto \color{blue}{\frac{y \cdot z}{t}} \]
  6. Step-by-step derivation
    1. *-commutativeN/A

      \[\leadsto \frac{\color{blue}{z \cdot y}}{t} \]
    2. associate-/l*N/A

      \[\leadsto \color{blue}{z \cdot \frac{y}{t}} \]
    3. lift-/.f64N/A

      \[\leadsto z \cdot \color{blue}{\frac{y}{t}} \]
    4. lower-*.f6442.2

      \[\leadsto \color{blue}{z \cdot \frac{y}{t}} \]
  7. Applied rewrites42.2%

    \[\leadsto \color{blue}{z \cdot \frac{y}{t}} \]
  8. Final simplification42.2%

    \[\leadsto \frac{y}{t} \cdot z \]
  9. Add Preprocessing

Developer Target 1: 91.4% accurate, 0.6× speedup?

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

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

Reproduce

?
herbie shell --seed 2024219 
(FPCore (x y z t)
  :name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, D"
  :precision binary64

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

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