Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, H

Percentage Accurate: 95.6% → 99.2%
Time: 10.8s
Alternatives: 10
Speedup: 1.0×

Specification

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

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

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

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

Alternative 1: 99.2% accurate, 0.7× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 z #s(literal 3 binary64)) < -2.00000000000000011e32 or 7.9999999999999993e-96 < (*.f64 z #s(literal 3 binary64))

    1. Initial program 99.1%

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

    if -2.00000000000000011e32 < (*.f64 z #s(literal 3 binary64)) < 7.9999999999999993e-96

    1. Initial program 89.5%

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

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

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

        \[\leadsto \color{blue}{\left(\frac{1}{3} \cdot \frac{t}{y \cdot z} - \frac{1}{3} \cdot \frac{y}{z}\right) + x} \]
      3. distribute-lft-out--N/A

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{3}, \frac{t}{y \cdot z} - \frac{y}{z}, x\right)} \]
      5. associate-/r*N/A

        \[\leadsto \mathsf{fma}\left(\frac{1}{3}, \color{blue}{\frac{\frac{t}{y}}{z}} - \frac{y}{z}, x\right) \]
      6. div-subN/A

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

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

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

        \[\leadsto \mathsf{fma}\left(0.3333333333333333, \frac{\color{blue}{\frac{t}{y}} - y}{z}, x\right) \]
    5. Simplified99.8%

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

Alternative 2: 97.7% accurate, 1.0× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.2e-64 or 8.49999999999999956e-107 < y

    1. Initial program 98.0%

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

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

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

        \[\leadsto \color{blue}{\left(\frac{1}{3} \cdot \frac{t}{y \cdot z} - \frac{1}{3} \cdot \frac{y}{z}\right) + x} \]
      3. distribute-lft-out--N/A

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{3}, \frac{t}{y \cdot z} - \frac{y}{z}, x\right)} \]
      5. associate-/r*N/A

        \[\leadsto \mathsf{fma}\left(\frac{1}{3}, \color{blue}{\frac{\frac{t}{y}}{z}} - \frac{y}{z}, x\right) \]
      6. div-subN/A

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

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

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

        \[\leadsto \mathsf{fma}\left(0.3333333333333333, \frac{\color{blue}{\frac{t}{y}} - y}{z}, x\right) \]
    5. Simplified98.6%

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

    if -2.2e-64 < y < 8.49999999999999956e-107

    1. Initial program 88.7%

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

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

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

        \[\leadsto \color{blue}{\left(\frac{1}{3} \cdot \frac{t}{y \cdot z} - \frac{1}{3} \cdot \frac{y}{z}\right) + x} \]
      3. distribute-lft-out--N/A

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{3}, \frac{t}{y \cdot z} - \frac{y}{z}, x\right)} \]
      5. associate-/r*N/A

        \[\leadsto \mathsf{fma}\left(\frac{1}{3}, \color{blue}{\frac{\frac{t}{y}}{z}} - \frac{y}{z}, x\right) \]
      6. div-subN/A

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

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

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

        \[\leadsto \mathsf{fma}\left(0.3333333333333333, \frac{\color{blue}{\frac{t}{y}} - y}{z}, x\right) \]
    5. Simplified86.2%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(y, x, \frac{1}{3} \cdot \frac{t}{z}\right)}}{y} \]
      5. associate-*r/N/A

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

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

        \[\leadsto \frac{\mathsf{fma}\left(y, x, \color{blue}{t \cdot \frac{\frac{1}{3}}{z}}\right)}{y} \]
      8. metadata-evalN/A

        \[\leadsto \frac{\mathsf{fma}\left(y, x, t \cdot \frac{\color{blue}{\frac{1}{3} \cdot 1}}{z}\right)}{y} \]
      9. associate-*r/N/A

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

        \[\leadsto \frac{\mathsf{fma}\left(y, x, \color{blue}{t \cdot \left(\frac{1}{3} \cdot \frac{1}{z}\right)}\right)}{y} \]
      11. associate-*r/N/A

        \[\leadsto \frac{\mathsf{fma}\left(y, x, t \cdot \color{blue}{\frac{\frac{1}{3} \cdot 1}{z}}\right)}{y} \]
      12. metadata-evalN/A

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

        \[\leadsto \frac{\mathsf{fma}\left(y, x, t \cdot \color{blue}{\frac{0.3333333333333333}{z}}\right)}{y} \]
    8. Simplified96.9%

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

Alternative 3: 97.7% accurate, 1.0× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.22e-79 or 6.80000000000000031e-104 < y

    1. Initial program 98.1%

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

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

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

        \[\leadsto \color{blue}{\left(\frac{1}{3} \cdot \frac{t}{y \cdot z} - \frac{1}{3} \cdot \frac{y}{z}\right) + x} \]
      3. distribute-lft-out--N/A

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{3}, \frac{t}{y \cdot z} - \frac{y}{z}, x\right)} \]
      5. associate-/r*N/A

        \[\leadsto \mathsf{fma}\left(\frac{1}{3}, \color{blue}{\frac{\frac{t}{y}}{z}} - \frac{y}{z}, x\right) \]
      6. div-subN/A

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

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

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

        \[\leadsto \mathsf{fma}\left(0.3333333333333333, \frac{\color{blue}{\frac{t}{y}} - y}{z}, x\right) \]
    5. Simplified98.6%

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

    if -1.22e-79 < y < 6.80000000000000031e-104

    1. Initial program 88.6%

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\frac{1}{3}, \frac{t}{z}, \color{blue}{y \cdot x}\right)}{y} \]
      5. lower-*.f6496.8

        \[\leadsto \frac{\mathsf{fma}\left(0.3333333333333333, \frac{t}{z}, \color{blue}{y \cdot x}\right)}{y} \]
    5. Simplified96.8%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(0.3333333333333333, \frac{t}{z}, y \cdot x\right)}{y}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification97.9%

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

Alternative 4: 94.0% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq 1.18 \cdot 10^{+182}:\\ \;\;\;\;\mathsf{fma}\left(0.3333333333333333, \frac{\frac{t}{y} - y}{z}, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(0.3333333333333333, \frac{t}{z \cdot y}, x\right)\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= t 1.18e+182)
   (fma 0.3333333333333333 (/ (- (/ t y) y) z) x)
   (fma 0.3333333333333333 (/ t (* z y)) x)))
double code(double x, double y, double z, double t) {
	double tmp;
	if (t <= 1.18e+182) {
		tmp = fma(0.3333333333333333, (((t / y) - y) / z), x);
	} else {
		tmp = fma(0.3333333333333333, (t / (z * y)), x);
	}
	return tmp;
}
function code(x, y, z, t)
	tmp = 0.0
	if (t <= 1.18e+182)
		tmp = fma(0.3333333333333333, Float64(Float64(Float64(t / y) - y) / z), x);
	else
		tmp = fma(0.3333333333333333, Float64(t / Float64(z * y)), x);
	end
	return tmp
end
code[x_, y_, z_, t_] := If[LessEqual[t, 1.18e+182], N[(0.3333333333333333 * N[(N[(N[(t / y), $MachinePrecision] - y), $MachinePrecision] / z), $MachinePrecision] + x), $MachinePrecision], N[(0.3333333333333333 * N[(t / N[(z * y), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;t \leq 1.18 \cdot 10^{+182}:\\
\;\;\;\;\mathsf{fma}\left(0.3333333333333333, \frac{\frac{t}{y} - y}{z}, x\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(0.3333333333333333, \frac{t}{z \cdot y}, x\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < 1.1799999999999999e182

    1. Initial program 93.9%

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

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

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

        \[\leadsto \color{blue}{\left(\frac{1}{3} \cdot \frac{t}{y \cdot z} - \frac{1}{3} \cdot \frac{y}{z}\right) + x} \]
      3. distribute-lft-out--N/A

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{3}, \frac{t}{y \cdot z} - \frac{y}{z}, x\right)} \]
      5. associate-/r*N/A

        \[\leadsto \mathsf{fma}\left(\frac{1}{3}, \color{blue}{\frac{\frac{t}{y}}{z}} - \frac{y}{z}, x\right) \]
      6. div-subN/A

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

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

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

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

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

    if 1.1799999999999999e182 < t

    1. Initial program 99.8%

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

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

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

        \[\leadsto \color{blue}{\left(\frac{1}{3} \cdot \frac{t}{y \cdot z} - \frac{1}{3} \cdot \frac{y}{z}\right) + x} \]
      3. distribute-lft-out--N/A

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{3}, \frac{t}{y \cdot z} - \frac{y}{z}, x\right)} \]
      5. associate-/r*N/A

        \[\leadsto \mathsf{fma}\left(\frac{1}{3}, \color{blue}{\frac{\frac{t}{y}}{z}} - \frac{y}{z}, x\right) \]
      6. div-subN/A

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(\frac{1}{3}, \color{blue}{\frac{t}{y \cdot z}}, x\right) \]
    7. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{1}{3}, \color{blue}{\frac{t}{y \cdot z}}, x\right) \]
      2. lower-*.f6491.9

        \[\leadsto \mathsf{fma}\left(0.3333333333333333, \frac{t}{\color{blue}{y \cdot z}}, x\right) \]
    8. Simplified91.9%

      \[\leadsto \mathsf{fma}\left(0.3333333333333333, \color{blue}{\frac{t}{y \cdot z}}, x\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification96.0%

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

Alternative 5: 89.5% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -25000000000000:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{-0.3333333333333333}{z}, x\right)\\

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.3333333333333333, \frac{y}{z}, x\right)\\


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

    1. Initial program 98.4%

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

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

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

        \[\leadsto y \cdot \color{blue}{\left(\left(\mathsf{neg}\left(\frac{1}{3} \cdot \frac{1}{z}\right)\right) + \frac{x}{y}\right)} \]
      3. distribute-lft-inN/A

        \[\leadsto \color{blue}{y \cdot \left(\mathsf{neg}\left(\frac{1}{3} \cdot \frac{1}{z}\right)\right) + y \cdot \frac{x}{y}} \]
      4. associate-*r/N/A

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

        \[\leadsto y \cdot \left(\mathsf{neg}\left(\frac{1}{3} \cdot \frac{1}{z}\right)\right) + \frac{\color{blue}{x \cdot y}}{y} \]
      6. associate-/l*N/A

        \[\leadsto y \cdot \left(\mathsf{neg}\left(\frac{1}{3} \cdot \frac{1}{z}\right)\right) + \color{blue}{x \cdot \frac{y}{y}} \]
      7. *-inversesN/A

        \[\leadsto y \cdot \left(\mathsf{neg}\left(\frac{1}{3} \cdot \frac{1}{z}\right)\right) + x \cdot \color{blue}{1} \]
      8. *-rgt-identityN/A

        \[\leadsto y \cdot \left(\mathsf{neg}\left(\frac{1}{3} \cdot \frac{1}{z}\right)\right) + \color{blue}{x} \]
      9. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, \mathsf{neg}\left(\frac{1}{3} \cdot \frac{1}{z}\right), x\right)} \]
      10. associate-*r/N/A

        \[\leadsto \mathsf{fma}\left(y, \mathsf{neg}\left(\color{blue}{\frac{\frac{1}{3} \cdot 1}{z}}\right), x\right) \]
      11. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(y, \mathsf{neg}\left(\frac{\color{blue}{\frac{1}{3}}}{z}\right), x\right) \]
      12. distribute-neg-fracN/A

        \[\leadsto \mathsf{fma}\left(y, \color{blue}{\frac{\mathsf{neg}\left(\frac{1}{3}\right)}{z}}, x\right) \]
      13. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(y, \frac{\color{blue}{\frac{-1}{3}}}{z}, x\right) \]
      14. lower-/.f6495.8

        \[\leadsto \mathsf{fma}\left(y, \color{blue}{\frac{-0.3333333333333333}{z}}, x\right) \]
    5. Simplified95.8%

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

    if -2.5e13 < y < 4.19999999999999977e-5

    1. Initial program 90.6%

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

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

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

        \[\leadsto \color{blue}{\left(\frac{1}{3} \cdot \frac{t}{y \cdot z} - \frac{1}{3} \cdot \frac{y}{z}\right) + x} \]
      3. distribute-lft-out--N/A

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{3}, \frac{t}{y \cdot z} - \frac{y}{z}, x\right)} \]
      5. associate-/r*N/A

        \[\leadsto \mathsf{fma}\left(\frac{1}{3}, \color{blue}{\frac{\frac{t}{y}}{z}} - \frac{y}{z}, x\right) \]
      6. div-subN/A

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(\frac{1}{3}, \color{blue}{\frac{t}{y \cdot z}}, x\right) \]
    7. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{1}{3}, \color{blue}{\frac{t}{y \cdot z}}, x\right) \]
      2. lower-*.f6487.8

        \[\leadsto \mathsf{fma}\left(0.3333333333333333, \frac{t}{\color{blue}{y \cdot z}}, x\right) \]
    8. Simplified87.8%

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

    if 4.19999999999999977e-5 < y

    1. Initial program 99.8%

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

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

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

        \[\leadsto \color{blue}{\left(\frac{1}{3} \cdot \frac{t}{y \cdot z} - \frac{1}{3} \cdot \frac{y}{z}\right) + x} \]
      3. distribute-lft-out--N/A

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{3}, \frac{t}{y \cdot z} - \frac{y}{z}, x\right)} \]
      5. associate-/r*N/A

        \[\leadsto \mathsf{fma}\left(\frac{1}{3}, \color{blue}{\frac{\frac{t}{y}}{z}} - \frac{y}{z}, x\right) \]
      6. div-subN/A

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

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

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

        \[\leadsto \mathsf{fma}\left(0.3333333333333333, \frac{\color{blue}{\frac{t}{y}} - y}{z}, x\right) \]
    5. Simplified99.8%

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

      \[\leadsto \mathsf{fma}\left(\frac{1}{3}, \color{blue}{-1 \cdot \frac{y}{z}}, x\right) \]
    7. Step-by-step derivation
      1. associate-*r/N/A

        \[\leadsto \mathsf{fma}\left(\frac{1}{3}, \color{blue}{\frac{-1 \cdot y}{z}}, x\right) \]
      2. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(\frac{1}{3}, \frac{\color{blue}{\mathsf{neg}\left(y\right)}}{z}, x\right) \]
      3. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{1}{3}, \color{blue}{\frac{\mathsf{neg}\left(y\right)}{z}}, x\right) \]
      4. lower-neg.f6494.5

        \[\leadsto \mathsf{fma}\left(0.3333333333333333, \frac{\color{blue}{-y}}{z}, x\right) \]
    8. Simplified94.5%

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

      \[\leadsto \color{blue}{x + \frac{-1}{3} \cdot \frac{y}{z}} \]
    10. Step-by-step derivation
      1. +-commutativeN/A

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

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

        \[\leadsto \mathsf{fma}\left(-0.3333333333333333, \color{blue}{\frac{y}{z}}, x\right) \]
    11. Simplified94.5%

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

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

Alternative 6: 75.8% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.16 \cdot 10^{-7}:\\ \;\;\;\;\mathsf{fma}\left(y, \frac{-0.3333333333333333}{z}, x\right)\\ \mathbf{elif}\;y \leq 1.45 \cdot 10^{-32}:\\ \;\;\;\;\frac{t \cdot 0.3333333333333333}{z \cdot y}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-0.3333333333333333, \frac{y}{z}, x\right)\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= y -1.16e-7)
   (fma y (/ -0.3333333333333333 z) x)
   (if (<= y 1.45e-32)
     (/ (* t 0.3333333333333333) (* z y))
     (fma -0.3333333333333333 (/ y z) x))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= -1.16e-7) {
		tmp = fma(y, (-0.3333333333333333 / z), x);
	} else if (y <= 1.45e-32) {
		tmp = (t * 0.3333333333333333) / (z * y);
	} else {
		tmp = fma(-0.3333333333333333, (y / z), x);
	}
	return tmp;
}
function code(x, y, z, t)
	tmp = 0.0
	if (y <= -1.16e-7)
		tmp = fma(y, Float64(-0.3333333333333333 / z), x);
	elseif (y <= 1.45e-32)
		tmp = Float64(Float64(t * 0.3333333333333333) / Float64(z * y));
	else
		tmp = fma(-0.3333333333333333, Float64(y / z), x);
	end
	return tmp
end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.16e-7], N[(y * N[(-0.3333333333333333 / z), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[y, 1.45e-32], N[(N[(t * 0.3333333333333333), $MachinePrecision] / N[(z * y), $MachinePrecision]), $MachinePrecision], N[(-0.3333333333333333 * N[(y / z), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.16 \cdot 10^{-7}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{-0.3333333333333333}{z}, x\right)\\

\mathbf{elif}\;y \leq 1.45 \cdot 10^{-32}:\\
\;\;\;\;\frac{t \cdot 0.3333333333333333}{z \cdot y}\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.3333333333333333, \frac{y}{z}, x\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.1600000000000001e-7

    1. Initial program 98.5%

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

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

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

        \[\leadsto y \cdot \color{blue}{\left(\left(\mathsf{neg}\left(\frac{1}{3} \cdot \frac{1}{z}\right)\right) + \frac{x}{y}\right)} \]
      3. distribute-lft-inN/A

        \[\leadsto \color{blue}{y \cdot \left(\mathsf{neg}\left(\frac{1}{3} \cdot \frac{1}{z}\right)\right) + y \cdot \frac{x}{y}} \]
      4. associate-*r/N/A

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

        \[\leadsto y \cdot \left(\mathsf{neg}\left(\frac{1}{3} \cdot \frac{1}{z}\right)\right) + \frac{\color{blue}{x \cdot y}}{y} \]
      6. associate-/l*N/A

        \[\leadsto y \cdot \left(\mathsf{neg}\left(\frac{1}{3} \cdot \frac{1}{z}\right)\right) + \color{blue}{x \cdot \frac{y}{y}} \]
      7. *-inversesN/A

        \[\leadsto y \cdot \left(\mathsf{neg}\left(\frac{1}{3} \cdot \frac{1}{z}\right)\right) + x \cdot \color{blue}{1} \]
      8. *-rgt-identityN/A

        \[\leadsto y \cdot \left(\mathsf{neg}\left(\frac{1}{3} \cdot \frac{1}{z}\right)\right) + \color{blue}{x} \]
      9. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, \mathsf{neg}\left(\frac{1}{3} \cdot \frac{1}{z}\right), x\right)} \]
      10. associate-*r/N/A

        \[\leadsto \mathsf{fma}\left(y, \mathsf{neg}\left(\color{blue}{\frac{\frac{1}{3} \cdot 1}{z}}\right), x\right) \]
      11. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(y, \mathsf{neg}\left(\frac{\color{blue}{\frac{1}{3}}}{z}\right), x\right) \]
      12. distribute-neg-fracN/A

        \[\leadsto \mathsf{fma}\left(y, \color{blue}{\frac{\mathsf{neg}\left(\frac{1}{3}\right)}{z}}, x\right) \]
      13. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(y, \frac{\color{blue}{\frac{-1}{3}}}{z}, x\right) \]
      14. lower-/.f6494.7

        \[\leadsto \mathsf{fma}\left(y, \color{blue}{\frac{-0.3333333333333333}{z}}, x\right) \]
    5. Simplified94.7%

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

    if -1.1600000000000001e-7 < y < 1.44999999999999998e-32

    1. Initial program 89.7%

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

      \[\leadsto \color{blue}{\frac{1}{3} \cdot \frac{t}{y \cdot z}} \]
    4. Step-by-step derivation
      1. associate-*r/N/A

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

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

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

        \[\leadsto \frac{0.3333333333333333 \cdot t}{\color{blue}{y \cdot z}} \]
    5. Simplified59.3%

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

    if 1.44999999999999998e-32 < y

    1. Initial program 99.8%

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

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

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

        \[\leadsto \color{blue}{\left(\frac{1}{3} \cdot \frac{t}{y \cdot z} - \frac{1}{3} \cdot \frac{y}{z}\right) + x} \]
      3. distribute-lft-out--N/A

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{3}, \frac{t}{y \cdot z} - \frac{y}{z}, x\right)} \]
      5. associate-/r*N/A

        \[\leadsto \mathsf{fma}\left(\frac{1}{3}, \color{blue}{\frac{\frac{t}{y}}{z}} - \frac{y}{z}, x\right) \]
      6. div-subN/A

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

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

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

        \[\leadsto \mathsf{fma}\left(0.3333333333333333, \frac{\color{blue}{\frac{t}{y}} - y}{z}, x\right) \]
    5. Simplified99.8%

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

      \[\leadsto \mathsf{fma}\left(\frac{1}{3}, \color{blue}{-1 \cdot \frac{y}{z}}, x\right) \]
    7. Step-by-step derivation
      1. associate-*r/N/A

        \[\leadsto \mathsf{fma}\left(\frac{1}{3}, \color{blue}{\frac{-1 \cdot y}{z}}, x\right) \]
      2. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(\frac{1}{3}, \frac{\color{blue}{\mathsf{neg}\left(y\right)}}{z}, x\right) \]
      3. lower-/.f64N/A

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

        \[\leadsto \mathsf{fma}\left(0.3333333333333333, \frac{\color{blue}{-y}}{z}, x\right) \]
    8. Simplified90.5%

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

      \[\leadsto \color{blue}{x + \frac{-1}{3} \cdot \frac{y}{z}} \]
    10. Step-by-step derivation
      1. +-commutativeN/A

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

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

        \[\leadsto \mathsf{fma}\left(-0.3333333333333333, \color{blue}{\frac{y}{z}}, x\right) \]
    11. Simplified90.5%

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

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

Alternative 7: 46.3% accurate, 1.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.15 \cdot 10^{+77}:\\
\;\;\;\;\frac{y \cdot -0.3333333333333333}{z}\\

\mathbf{elif}\;y \leq 6.6 \cdot 10^{-8}:\\
\;\;\;\;\frac{x \cdot y}{y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -2.14999999999999996e77

    1. Initial program 99.8%

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

      \[\leadsto \color{blue}{\frac{1}{3} \cdot \frac{t}{y \cdot z} - \frac{1}{3} \cdot \frac{y}{z}} \]
    4. Step-by-step derivation
      1. associate-/r*N/A

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

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

        \[\leadsto \frac{\frac{1}{3} \cdot \frac{t}{y}}{z} - \color{blue}{\frac{\frac{1}{3} \cdot y}{z}} \]
      4. div-subN/A

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

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

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

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

        \[\leadsto \frac{\frac{1}{3} \cdot \color{blue}{\left(\frac{t}{y} - y\right)}}{z} \]
      9. lower-/.f6480.7

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

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

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

        \[\leadsto \frac{\color{blue}{y \cdot \frac{-1}{3}}}{z} \]
      2. lower-*.f6477.7

        \[\leadsto \frac{\color{blue}{y \cdot -0.3333333333333333}}{z} \]
    8. Simplified77.7%

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

    if -2.14999999999999996e77 < y < 6.59999999999999954e-8

    1. Initial program 90.5%

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

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

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

        \[\leadsto \color{blue}{\left(\frac{1}{3} \cdot \frac{t}{y \cdot z} - \frac{1}{3} \cdot \frac{y}{z}\right) + x} \]
      3. distribute-lft-out--N/A

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{3}, \frac{t}{y \cdot z} - \frac{y}{z}, x\right)} \]
      5. associate-/r*N/A

        \[\leadsto \mathsf{fma}\left(\frac{1}{3}, \color{blue}{\frac{\frac{t}{y}}{z}} - \frac{y}{z}, x\right) \]
      6. div-subN/A

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(y, x, \frac{1}{3} \cdot \frac{t}{z}\right)}}{y} \]
      5. associate-*r/N/A

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

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

        \[\leadsto \frac{\mathsf{fma}\left(y, x, \color{blue}{t \cdot \frac{\frac{1}{3}}{z}}\right)}{y} \]
      8. metadata-evalN/A

        \[\leadsto \frac{\mathsf{fma}\left(y, x, t \cdot \frac{\color{blue}{\frac{1}{3} \cdot 1}}{z}\right)}{y} \]
      9. associate-*r/N/A

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

        \[\leadsto \frac{\mathsf{fma}\left(y, x, \color{blue}{t \cdot \left(\frac{1}{3} \cdot \frac{1}{z}\right)}\right)}{y} \]
      11. associate-*r/N/A

        \[\leadsto \frac{\mathsf{fma}\left(y, x, t \cdot \color{blue}{\frac{\frac{1}{3} \cdot 1}{z}}\right)}{y} \]
      12. metadata-evalN/A

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

        \[\leadsto \frac{\mathsf{fma}\left(y, x, t \cdot \color{blue}{\frac{0.3333333333333333}{z}}\right)}{y} \]
    8. Simplified93.9%

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

      \[\leadsto \frac{\color{blue}{x \cdot y}}{y} \]
    10. Step-by-step derivation
      1. lower-*.f6434.1

        \[\leadsto \frac{\color{blue}{x \cdot y}}{y} \]
    11. Simplified34.1%

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

    if 6.59999999999999954e-8 < y

    1. Initial program 99.8%

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

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

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

        \[\leadsto \color{blue}{\left(\frac{1}{3} \cdot \frac{t}{y \cdot z} - \frac{1}{3} \cdot \frac{y}{z}\right) + x} \]
      3. distribute-lft-out--N/A

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{3}, \frac{t}{y \cdot z} - \frac{y}{z}, x\right)} \]
      5. associate-/r*N/A

        \[\leadsto \mathsf{fma}\left(\frac{1}{3}, \color{blue}{\frac{\frac{t}{y}}{z}} - \frac{y}{z}, x\right) \]
      6. div-subN/A

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

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

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

        \[\leadsto \mathsf{fma}\left(0.3333333333333333, \frac{\color{blue}{\frac{t}{y}} - y}{z}, x\right) \]
    5. Simplified99.8%

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

      \[\leadsto \color{blue}{\frac{1}{3} \cdot \frac{\frac{t}{y} - y}{z}} \]
    7. Step-by-step derivation
      1. associate-*r/N/A

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

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

        \[\leadsto \color{blue}{\left(\frac{t}{y} - y\right) \cdot \frac{\frac{1}{3}}{z}} \]
      4. metadata-evalN/A

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

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

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

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

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

        \[\leadsto \left(\frac{t}{y} - y\right) \cdot \color{blue}{\frac{\frac{1}{3} \cdot 1}{z}} \]
      10. metadata-evalN/A

        \[\leadsto \left(\frac{t}{y} - y\right) \cdot \frac{\color{blue}{\frac{1}{3}}}{z} \]
      11. lower-/.f6471.6

        \[\leadsto \left(\frac{t}{y} - y\right) \cdot \color{blue}{\frac{0.3333333333333333}{z}} \]
    8. Simplified71.6%

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

      \[\leadsto \color{blue}{\frac{-1}{3} \cdot \frac{y}{z} + \frac{1}{3} \cdot \frac{t}{y \cdot z}} \]
    10. Simplified58.6%

      \[\leadsto \color{blue}{-0.3333333333333333 \cdot \frac{y \cdot y - t}{y \cdot z}} \]
    11. Taylor expanded in y around inf

      \[\leadsto \frac{-1}{3} \cdot \color{blue}{\frac{y}{z}} \]
    12. Step-by-step derivation
      1. lower-/.f6466.4

        \[\leadsto -0.3333333333333333 \cdot \color{blue}{\frac{y}{z}} \]
    13. Simplified66.4%

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

Alternative 8: 46.3% accurate, 1.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.15 \cdot 10^{+77}:\\
\;\;\;\;y \cdot \frac{-0.3333333333333333}{z}\\

\mathbf{elif}\;y \leq 6.6 \cdot 10^{-8}:\\
\;\;\;\;\frac{x \cdot y}{y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -2.14999999999999996e77

    1. Initial program 99.8%

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

      \[\leadsto \color{blue}{\frac{-1}{3} \cdot \frac{y}{z}} \]
    4. Step-by-step derivation
      1. associate-*r/N/A

        \[\leadsto \color{blue}{\frac{\frac{-1}{3} \cdot y}{z}} \]
      2. *-commutativeN/A

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

        \[\leadsto \color{blue}{y \cdot \frac{\frac{-1}{3}}{z}} \]
      4. metadata-evalN/A

        \[\leadsto y \cdot \frac{\color{blue}{\mathsf{neg}\left(\frac{1}{3}\right)}}{z} \]
      5. distribute-neg-fracN/A

        \[\leadsto y \cdot \color{blue}{\left(\mathsf{neg}\left(\frac{\frac{1}{3}}{z}\right)\right)} \]
      6. metadata-evalN/A

        \[\leadsto y \cdot \left(\mathsf{neg}\left(\frac{\color{blue}{\frac{1}{3} \cdot 1}}{z}\right)\right) \]
      7. associate-*r/N/A

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

        \[\leadsto \color{blue}{y \cdot \left(\mathsf{neg}\left(\frac{1}{3} \cdot \frac{1}{z}\right)\right)} \]
      9. associate-*r/N/A

        \[\leadsto y \cdot \left(\mathsf{neg}\left(\color{blue}{\frac{\frac{1}{3} \cdot 1}{z}}\right)\right) \]
      10. metadata-evalN/A

        \[\leadsto y \cdot \left(\mathsf{neg}\left(\frac{\color{blue}{\frac{1}{3}}}{z}\right)\right) \]
      11. distribute-neg-fracN/A

        \[\leadsto y \cdot \color{blue}{\frac{\mathsf{neg}\left(\frac{1}{3}\right)}{z}} \]
      12. metadata-evalN/A

        \[\leadsto y \cdot \frac{\color{blue}{\frac{-1}{3}}}{z} \]
      13. lower-/.f6477.7

        \[\leadsto y \cdot \color{blue}{\frac{-0.3333333333333333}{z}} \]
    5. Simplified77.7%

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

    if -2.14999999999999996e77 < y < 6.59999999999999954e-8

    1. Initial program 90.5%

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

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

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

        \[\leadsto \color{blue}{\left(\frac{1}{3} \cdot \frac{t}{y \cdot z} - \frac{1}{3} \cdot \frac{y}{z}\right) + x} \]
      3. distribute-lft-out--N/A

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{3}, \frac{t}{y \cdot z} - \frac{y}{z}, x\right)} \]
      5. associate-/r*N/A

        \[\leadsto \mathsf{fma}\left(\frac{1}{3}, \color{blue}{\frac{\frac{t}{y}}{z}} - \frac{y}{z}, x\right) \]
      6. div-subN/A

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(y, x, \frac{1}{3} \cdot \frac{t}{z}\right)}}{y} \]
      5. associate-*r/N/A

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

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

        \[\leadsto \frac{\mathsf{fma}\left(y, x, \color{blue}{t \cdot \frac{\frac{1}{3}}{z}}\right)}{y} \]
      8. metadata-evalN/A

        \[\leadsto \frac{\mathsf{fma}\left(y, x, t \cdot \frac{\color{blue}{\frac{1}{3} \cdot 1}}{z}\right)}{y} \]
      9. associate-*r/N/A

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

        \[\leadsto \frac{\mathsf{fma}\left(y, x, \color{blue}{t \cdot \left(\frac{1}{3} \cdot \frac{1}{z}\right)}\right)}{y} \]
      11. associate-*r/N/A

        \[\leadsto \frac{\mathsf{fma}\left(y, x, t \cdot \color{blue}{\frac{\frac{1}{3} \cdot 1}{z}}\right)}{y} \]
      12. metadata-evalN/A

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

        \[\leadsto \frac{\mathsf{fma}\left(y, x, t \cdot \color{blue}{\frac{0.3333333333333333}{z}}\right)}{y} \]
    8. Simplified93.9%

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

      \[\leadsto \frac{\color{blue}{x \cdot y}}{y} \]
    10. Step-by-step derivation
      1. lower-*.f6434.1

        \[\leadsto \frac{\color{blue}{x \cdot y}}{y} \]
    11. Simplified34.1%

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

    if 6.59999999999999954e-8 < y

    1. Initial program 99.8%

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

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

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

        \[\leadsto \color{blue}{\left(\frac{1}{3} \cdot \frac{t}{y \cdot z} - \frac{1}{3} \cdot \frac{y}{z}\right) + x} \]
      3. distribute-lft-out--N/A

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{3}, \frac{t}{y \cdot z} - \frac{y}{z}, x\right)} \]
      5. associate-/r*N/A

        \[\leadsto \mathsf{fma}\left(\frac{1}{3}, \color{blue}{\frac{\frac{t}{y}}{z}} - \frac{y}{z}, x\right) \]
      6. div-subN/A

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

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

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

        \[\leadsto \mathsf{fma}\left(0.3333333333333333, \frac{\color{blue}{\frac{t}{y}} - y}{z}, x\right) \]
    5. Simplified99.8%

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

      \[\leadsto \color{blue}{\frac{1}{3} \cdot \frac{\frac{t}{y} - y}{z}} \]
    7. Step-by-step derivation
      1. associate-*r/N/A

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

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

        \[\leadsto \color{blue}{\left(\frac{t}{y} - y\right) \cdot \frac{\frac{1}{3}}{z}} \]
      4. metadata-evalN/A

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

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

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

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

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

        \[\leadsto \left(\frac{t}{y} - y\right) \cdot \color{blue}{\frac{\frac{1}{3} \cdot 1}{z}} \]
      10. metadata-evalN/A

        \[\leadsto \left(\frac{t}{y} - y\right) \cdot \frac{\color{blue}{\frac{1}{3}}}{z} \]
      11. lower-/.f6471.6

        \[\leadsto \left(\frac{t}{y} - y\right) \cdot \color{blue}{\frac{0.3333333333333333}{z}} \]
    8. Simplified71.6%

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

      \[\leadsto \color{blue}{\frac{-1}{3} \cdot \frac{y}{z} + \frac{1}{3} \cdot \frac{t}{y \cdot z}} \]
    10. Simplified58.6%

      \[\leadsto \color{blue}{-0.3333333333333333 \cdot \frac{y \cdot y - t}{y \cdot z}} \]
    11. Taylor expanded in y around inf

      \[\leadsto \frac{-1}{3} \cdot \color{blue}{\frac{y}{z}} \]
    12. Step-by-step derivation
      1. lower-/.f6466.4

        \[\leadsto -0.3333333333333333 \cdot \color{blue}{\frac{y}{z}} \]
    13. Simplified66.4%

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

Alternative 9: 64.1% accurate, 2.4× speedup?

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

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

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

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

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

      \[\leadsto \color{blue}{\left(\frac{1}{3} \cdot \frac{t}{y \cdot z} - \frac{1}{3} \cdot \frac{y}{z}\right) + x} \]
    3. distribute-lft-out--N/A

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{3}, \frac{t}{y \cdot z} - \frac{y}{z}, x\right)} \]
    5. associate-/r*N/A

      \[\leadsto \mathsf{fma}\left(\frac{1}{3}, \color{blue}{\frac{\frac{t}{y}}{z}} - \frac{y}{z}, x\right) \]
    6. div-subN/A

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

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

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

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

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

    \[\leadsto \mathsf{fma}\left(\frac{1}{3}, \color{blue}{-1 \cdot \frac{y}{z}}, x\right) \]
  7. Step-by-step derivation
    1. associate-*r/N/A

      \[\leadsto \mathsf{fma}\left(\frac{1}{3}, \color{blue}{\frac{-1 \cdot y}{z}}, x\right) \]
    2. mul-1-negN/A

      \[\leadsto \mathsf{fma}\left(\frac{1}{3}, \frac{\color{blue}{\mathsf{neg}\left(y\right)}}{z}, x\right) \]
    3. lower-/.f64N/A

      \[\leadsto \mathsf{fma}\left(\frac{1}{3}, \color{blue}{\frac{\mathsf{neg}\left(y\right)}{z}}, x\right) \]
    4. lower-neg.f6463.0

      \[\leadsto \mathsf{fma}\left(0.3333333333333333, \frac{\color{blue}{-y}}{z}, x\right) \]
  8. Simplified63.0%

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

    \[\leadsto \color{blue}{x + \frac{-1}{3} \cdot \frac{y}{z}} \]
  10. Step-by-step derivation
    1. +-commutativeN/A

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

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

      \[\leadsto \mathsf{fma}\left(-0.3333333333333333, \color{blue}{\frac{y}{z}}, x\right) \]
  11. Simplified63.0%

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

Alternative 10: 35.1% accurate, 2.6× speedup?

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

\\
-0.3333333333333333 \cdot \frac{y}{z}
\end{array}
Derivation
  1. Initial program 94.5%

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

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

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

      \[\leadsto \color{blue}{\left(\frac{1}{3} \cdot \frac{t}{y \cdot z} - \frac{1}{3} \cdot \frac{y}{z}\right) + x} \]
    3. distribute-lft-out--N/A

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{3}, \frac{t}{y \cdot z} - \frac{y}{z}, x\right)} \]
    5. associate-/r*N/A

      \[\leadsto \mathsf{fma}\left(\frac{1}{3}, \color{blue}{\frac{\frac{t}{y}}{z}} - \frac{y}{z}, x\right) \]
    6. div-subN/A

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{1}{3} \cdot \frac{\frac{t}{y} - y}{z}} \]
  7. Step-by-step derivation
    1. associate-*r/N/A

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

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

      \[\leadsto \color{blue}{\left(\frac{t}{y} - y\right) \cdot \frac{\frac{1}{3}}{z}} \]
    4. metadata-evalN/A

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

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

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

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

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

      \[\leadsto \left(\frac{t}{y} - y\right) \cdot \color{blue}{\frac{\frac{1}{3} \cdot 1}{z}} \]
    10. metadata-evalN/A

      \[\leadsto \left(\frac{t}{y} - y\right) \cdot \frac{\color{blue}{\frac{1}{3}}}{z} \]
    11. lower-/.f6465.3

      \[\leadsto \left(\frac{t}{y} - y\right) \cdot \color{blue}{\frac{0.3333333333333333}{z}} \]
  8. Simplified65.3%

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

    \[\leadsto \color{blue}{\frac{-1}{3} \cdot \frac{y}{z} + \frac{1}{3} \cdot \frac{t}{y \cdot z}} \]
  10. Simplified55.8%

    \[\leadsto \color{blue}{-0.3333333333333333 \cdot \frac{y \cdot y - t}{y \cdot z}} \]
  11. Taylor expanded in y around inf

    \[\leadsto \frac{-1}{3} \cdot \color{blue}{\frac{y}{z}} \]
  12. Step-by-step derivation
    1. lower-/.f6433.8

      \[\leadsto -0.3333333333333333 \cdot \color{blue}{\frac{y}{z}} \]
  13. Simplified33.8%

    \[\leadsto -0.3333333333333333 \cdot \color{blue}{\frac{y}{z}} \]
  14. Add Preprocessing

Developer Target 1: 96.1% accurate, 0.9× speedup?

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

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

Reproduce

?
herbie shell --seed 2024215 
(FPCore (x y z t)
  :name "Diagrams.Solve.Polynomial:cubForm  from diagrams-solve-0.1, H"
  :precision binary64

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

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