Graphics.Rasterific.CubicBezier:cachedBezierAt from Rasterific-0.6.1

Percentage Accurate: 92.1% → 95.1%
Time: 11.3s
Alternatives: 12
Speedup: 0.9×

Specification

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

\\
\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 12 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 92.1% accurate, 1.0× speedup?

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

\\
\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b
\end{array}

Alternative 1: 95.1% accurate, 0.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq 4 \cdot 10^{-5}:\\
\;\;\;\;\mathsf{fma}\left(a, t + b \cdot z, \mathsf{fma}\left(y, z, x\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\left(a \cdot t + \left(x + z \cdot y\right)\right) + b \cdot \left(a \cdot z\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < 4.00000000000000033e-5

    1. Initial program 92.5%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
    2. Step-by-step derivation
      1. associate-+l+92.5%

        \[\leadsto \color{blue}{\left(x + y \cdot z\right) + \left(t \cdot a + \left(a \cdot z\right) \cdot b\right)} \]
      2. +-commutative92.5%

        \[\leadsto \color{blue}{\left(t \cdot a + \left(a \cdot z\right) \cdot b\right) + \left(x + y \cdot z\right)} \]
      3. *-commutative92.5%

        \[\leadsto \left(t \cdot a + \color{blue}{b \cdot \left(a \cdot z\right)}\right) + \left(x + y \cdot z\right) \]
      4. *-commutative92.5%

        \[\leadsto \left(t \cdot a + b \cdot \color{blue}{\left(z \cdot a\right)}\right) + \left(x + y \cdot z\right) \]
      5. associate-*l*95.0%

        \[\leadsto \left(t \cdot a + \color{blue}{\left(b \cdot z\right) \cdot a}\right) + \left(x + y \cdot z\right) \]
      6. distribute-rgt-out96.5%

        \[\leadsto \color{blue}{a \cdot \left(t + b \cdot z\right)} + \left(x + y \cdot z\right) \]
      7. fma-def97.1%

        \[\leadsto \color{blue}{\mathsf{fma}\left(a, t + b \cdot z, x + y \cdot z\right)} \]
      8. *-commutative97.1%

        \[\leadsto \mathsf{fma}\left(a, t + \color{blue}{z \cdot b}, x + y \cdot z\right) \]
      9. +-commutative97.1%

        \[\leadsto \mathsf{fma}\left(a, t + z \cdot b, \color{blue}{y \cdot z + x}\right) \]
      10. fma-def97.1%

        \[\leadsto \mathsf{fma}\left(a, t + z \cdot b, \color{blue}{\mathsf{fma}\left(y, z, x\right)}\right) \]
    3. Simplified97.1%

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

    if 4.00000000000000033e-5 < b

    1. Initial program 98.3%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
  3. Recombined 2 regimes into one program.
  4. Final simplification97.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 4 \cdot 10^{-5}:\\ \;\;\;\;\mathsf{fma}\left(a, t + b \cdot z, \mathsf{fma}\left(y, z, x\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(a \cdot t + \left(x + z \cdot y\right)\right) + b \cdot \left(a \cdot z\right)\\ \end{array} \]

Alternative 2: 95.2% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(a \cdot t + \left(x + z \cdot y\right)\right) + b \cdot \left(a \cdot z\right)\\ \mathbf{if}\;t_1 \leq 5 \cdot 10^{+298}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;z \cdot y + a \cdot \left(t + b \cdot z\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (+ (+ (* a t) (+ x (* z y))) (* b (* a z)))))
   (if (<= t_1 5e+298) t_1 (+ (* z y) (* a (+ t (* b z)))))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = ((a * t) + (x + (z * y))) + (b * (a * z));
	double tmp;
	if (t_1 <= 5e+298) {
		tmp = t_1;
	} else {
		tmp = (z * y) + (a * (t + (b * z)));
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8) :: t_1
    real(8) :: tmp
    t_1 = ((a * t) + (x + (z * y))) + (b * (a * z))
    if (t_1 <= 5d+298) then
        tmp = t_1
    else
        tmp = (z * y) + (a * (t + (b * z)))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = ((a * t) + (x + (z * y))) + (b * (a * z));
	double tmp;
	if (t_1 <= 5e+298) {
		tmp = t_1;
	} else {
		tmp = (z * y) + (a * (t + (b * z)));
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	t_1 = ((a * t) + (x + (z * y))) + (b * (a * z))
	tmp = 0
	if t_1 <= 5e+298:
		tmp = t_1
	else:
		tmp = (z * y) + (a * (t + (b * z)))
	return tmp
function code(x, y, z, t, a, b)
	t_1 = Float64(Float64(Float64(a * t) + Float64(x + Float64(z * y))) + Float64(b * Float64(a * z)))
	tmp = 0.0
	if (t_1 <= 5e+298)
		tmp = t_1;
	else
		tmp = Float64(Float64(z * y) + Float64(a * Float64(t + Float64(b * z))));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	t_1 = ((a * t) + (x + (z * y))) + (b * (a * z));
	tmp = 0.0;
	if (t_1 <= 5e+298)
		tmp = t_1;
	else
		tmp = (z * y) + (a * (t + (b * z)));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(a * t), $MachinePrecision] + N[(x + N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(b * N[(a * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 5e+298], t$95$1, N[(N[(z * y), $MachinePrecision] + N[(a * N[(t + N[(b * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \left(a \cdot t + \left(x + z \cdot y\right)\right) + b \cdot \left(a \cdot z\right)\\
\mathbf{if}\;t_1 \leq 5 \cdot 10^{+298}:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;z \cdot y + a \cdot \left(t + b \cdot z\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (+.f64 (+.f64 (+.f64 x (*.f64 y z)) (*.f64 t a)) (*.f64 (*.f64 a z) b)) < 5.0000000000000003e298

    1. Initial program 98.1%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]

    if 5.0000000000000003e298 < (+.f64 (+.f64 (+.f64 x (*.f64 y z)) (*.f64 t a)) (*.f64 (*.f64 a z) b))

    1. Initial program 76.2%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
    2. Step-by-step derivation
      1. associate-+l+76.2%

        \[\leadsto \color{blue}{\left(x + y \cdot z\right) + \left(t \cdot a + \left(a \cdot z\right) \cdot b\right)} \]
      2. +-commutative76.2%

        \[\leadsto \color{blue}{\left(t \cdot a + \left(a \cdot z\right) \cdot b\right) + \left(x + y \cdot z\right)} \]
      3. *-commutative76.2%

        \[\leadsto \left(t \cdot a + \color{blue}{b \cdot \left(a \cdot z\right)}\right) + \left(x + y \cdot z\right) \]
      4. *-commutative76.2%

        \[\leadsto \left(t \cdot a + b \cdot \color{blue}{\left(z \cdot a\right)}\right) + \left(x + y \cdot z\right) \]
      5. associate-*l*86.0%

        \[\leadsto \left(t \cdot a + \color{blue}{\left(b \cdot z\right) \cdot a}\right) + \left(x + y \cdot z\right) \]
      6. distribute-rgt-out92.0%

        \[\leadsto \color{blue}{a \cdot \left(t + b \cdot z\right)} + \left(x + y \cdot z\right) \]
      7. fma-def94.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(a, t + b \cdot z, x + y \cdot z\right)} \]
      8. *-commutative94.0%

        \[\leadsto \mathsf{fma}\left(a, t + \color{blue}{z \cdot b}, x + y \cdot z\right) \]
      9. +-commutative94.0%

        \[\leadsto \mathsf{fma}\left(a, t + z \cdot b, \color{blue}{y \cdot z + x}\right) \]
      10. fma-def94.0%

        \[\leadsto \mathsf{fma}\left(a, t + z \cdot b, \color{blue}{\mathsf{fma}\left(y, z, x\right)}\right) \]
    3. Simplified94.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(a, t + z \cdot b, \mathsf{fma}\left(y, z, x\right)\right)} \]
    4. Taylor expanded in x around 0 92.0%

      \[\leadsto \color{blue}{y \cdot z + a \cdot \left(z \cdot b + t\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification96.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(a \cdot t + \left(x + z \cdot y\right)\right) + b \cdot \left(a \cdot z\right) \leq 5 \cdot 10^{+298}:\\ \;\;\;\;\left(a \cdot t + \left(x + z \cdot y\right)\right) + b \cdot \left(a \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot y + a \cdot \left(t + b \cdot z\right)\\ \end{array} \]

Alternative 3: 38.5% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := a \cdot \left(b \cdot z\right)\\ \mathbf{if}\;a \leq -1.12 \cdot 10^{-35}:\\ \;\;\;\;a \cdot t\\ \mathbf{elif}\;a \leq -1.1 \cdot 10^{-89}:\\ \;\;\;\;x\\ \mathbf{elif}\;a \leq -6.8 \cdot 10^{-115}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq 7.8 \cdot 10^{+14}:\\ \;\;\;\;z \cdot y\\ \mathbf{elif}\;a \leq 6.7 \cdot 10^{+156} \lor \neg \left(a \leq 9 \cdot 10^{+279}\right):\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;a \cdot t\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (* a (* b z))))
   (if (<= a -1.12e-35)
     (* a t)
     (if (<= a -1.1e-89)
       x
       (if (<= a -6.8e-115)
         t_1
         (if (<= a 7.8e+14)
           (* z y)
           (if (or (<= a 6.7e+156) (not (<= a 9e+279))) t_1 (* a t))))))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = a * (b * z);
	double tmp;
	if (a <= -1.12e-35) {
		tmp = a * t;
	} else if (a <= -1.1e-89) {
		tmp = x;
	} else if (a <= -6.8e-115) {
		tmp = t_1;
	} else if (a <= 7.8e+14) {
		tmp = z * y;
	} else if ((a <= 6.7e+156) || !(a <= 9e+279)) {
		tmp = t_1;
	} else {
		tmp = a * t;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8) :: t_1
    real(8) :: tmp
    t_1 = a * (b * z)
    if (a <= (-1.12d-35)) then
        tmp = a * t
    else if (a <= (-1.1d-89)) then
        tmp = x
    else if (a <= (-6.8d-115)) then
        tmp = t_1
    else if (a <= 7.8d+14) then
        tmp = z * y
    else if ((a <= 6.7d+156) .or. (.not. (a <= 9d+279))) then
        tmp = t_1
    else
        tmp = a * t
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = a * (b * z);
	double tmp;
	if (a <= -1.12e-35) {
		tmp = a * t;
	} else if (a <= -1.1e-89) {
		tmp = x;
	} else if (a <= -6.8e-115) {
		tmp = t_1;
	} else if (a <= 7.8e+14) {
		tmp = z * y;
	} else if ((a <= 6.7e+156) || !(a <= 9e+279)) {
		tmp = t_1;
	} else {
		tmp = a * t;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	t_1 = a * (b * z)
	tmp = 0
	if a <= -1.12e-35:
		tmp = a * t
	elif a <= -1.1e-89:
		tmp = x
	elif a <= -6.8e-115:
		tmp = t_1
	elif a <= 7.8e+14:
		tmp = z * y
	elif (a <= 6.7e+156) or not (a <= 9e+279):
		tmp = t_1
	else:
		tmp = a * t
	return tmp
function code(x, y, z, t, a, b)
	t_1 = Float64(a * Float64(b * z))
	tmp = 0.0
	if (a <= -1.12e-35)
		tmp = Float64(a * t);
	elseif (a <= -1.1e-89)
		tmp = x;
	elseif (a <= -6.8e-115)
		tmp = t_1;
	elseif (a <= 7.8e+14)
		tmp = Float64(z * y);
	elseif ((a <= 6.7e+156) || !(a <= 9e+279))
		tmp = t_1;
	else
		tmp = Float64(a * t);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	t_1 = a * (b * z);
	tmp = 0.0;
	if (a <= -1.12e-35)
		tmp = a * t;
	elseif (a <= -1.1e-89)
		tmp = x;
	elseif (a <= -6.8e-115)
		tmp = t_1;
	elseif (a <= 7.8e+14)
		tmp = z * y;
	elseif ((a <= 6.7e+156) || ~((a <= 9e+279)))
		tmp = t_1;
	else
		tmp = a * t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(a * N[(b * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -1.12e-35], N[(a * t), $MachinePrecision], If[LessEqual[a, -1.1e-89], x, If[LessEqual[a, -6.8e-115], t$95$1, If[LessEqual[a, 7.8e+14], N[(z * y), $MachinePrecision], If[Or[LessEqual[a, 6.7e+156], N[Not[LessEqual[a, 9e+279]], $MachinePrecision]], t$95$1, N[(a * t), $MachinePrecision]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := a \cdot \left(b \cdot z\right)\\
\mathbf{if}\;a \leq -1.12 \cdot 10^{-35}:\\
\;\;\;\;a \cdot t\\

\mathbf{elif}\;a \leq -1.1 \cdot 10^{-89}:\\
\;\;\;\;x\\

\mathbf{elif}\;a \leq -6.8 \cdot 10^{-115}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;a \leq 7.8 \cdot 10^{+14}:\\
\;\;\;\;z \cdot y\\

\mathbf{elif}\;a \leq 6.7 \cdot 10^{+156} \lor \neg \left(a \leq 9 \cdot 10^{+279}\right):\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;a \cdot t\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if a < -1.12e-35 or 6.7e156 < a < 8.9999999999999999e279

    1. Initial program 89.1%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
    2. Step-by-step derivation
      1. *-commutative89.1%

        \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{\left(z \cdot a\right)} \cdot b \]
      2. associate-*l*91.1%

        \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{z \cdot \left(a \cdot b\right)} \]
    3. Simplified91.1%

      \[\leadsto \color{blue}{\left(\left(x + y \cdot z\right) + t \cdot a\right) + z \cdot \left(a \cdot b\right)} \]
    4. Taylor expanded in t around inf 51.7%

      \[\leadsto \color{blue}{a \cdot t} \]

    if -1.12e-35 < a < -1.10000000000000006e-89

    1. Initial program 99.8%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
    2. Step-by-step derivation
      1. *-commutative99.8%

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

        \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{z \cdot \left(a \cdot b\right)} \]
    3. Simplified99.8%

      \[\leadsto \color{blue}{\left(\left(x + y \cdot z\right) + t \cdot a\right) + z \cdot \left(a \cdot b\right)} \]
    4. Taylor expanded in x around inf 47.3%

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

    if -1.10000000000000006e-89 < a < -6.7999999999999996e-115 or 7.8e14 < a < 6.7e156 or 8.9999999999999999e279 < a

    1. Initial program 88.3%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
    2. Step-by-step derivation
      1. *-commutative88.3%

        \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{\left(z \cdot a\right)} \cdot b \]
      2. associate-*l*88.3%

        \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{z \cdot \left(a \cdot b\right)} \]
    3. Simplified88.3%

      \[\leadsto \color{blue}{\left(\left(x + y \cdot z\right) + t \cdot a\right) + z \cdot \left(a \cdot b\right)} \]
    4. Taylor expanded in z around inf 60.2%

      \[\leadsto \color{blue}{z \cdot \left(a \cdot b + y\right)} \]
    5. Taylor expanded in a around inf 57.9%

      \[\leadsto \color{blue}{a \cdot \left(b \cdot z\right)} \]
    6. Step-by-step derivation
      1. *-commutative57.9%

        \[\leadsto a \cdot \color{blue}{\left(z \cdot b\right)} \]
    7. Simplified57.9%

      \[\leadsto \color{blue}{a \cdot \left(z \cdot b\right)} \]

    if -6.7999999999999996e-115 < a < 7.8e14

    1. Initial program 99.1%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
    2. Step-by-step derivation
      1. *-commutative99.1%

        \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{\left(z \cdot a\right)} \cdot b \]
      2. associate-*l*99.0%

        \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{z \cdot \left(a \cdot b\right)} \]
    3. Simplified99.0%

      \[\leadsto \color{blue}{\left(\left(x + y \cdot z\right) + t \cdot a\right) + z \cdot \left(a \cdot b\right)} \]
    4. Taylor expanded in y around inf 48.5%

      \[\leadsto \color{blue}{y \cdot z} \]
    5. Step-by-step derivation
      1. *-commutative48.5%

        \[\leadsto \color{blue}{z \cdot y} \]
    6. Simplified48.5%

      \[\leadsto \color{blue}{z \cdot y} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification50.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -1.12 \cdot 10^{-35}:\\ \;\;\;\;a \cdot t\\ \mathbf{elif}\;a \leq -1.1 \cdot 10^{-89}:\\ \;\;\;\;x\\ \mathbf{elif}\;a \leq -6.8 \cdot 10^{-115}:\\ \;\;\;\;a \cdot \left(b \cdot z\right)\\ \mathbf{elif}\;a \leq 7.8 \cdot 10^{+14}:\\ \;\;\;\;z \cdot y\\ \mathbf{elif}\;a \leq 6.7 \cdot 10^{+156} \lor \neg \left(a \leq 9 \cdot 10^{+279}\right):\\ \;\;\;\;a \cdot \left(b \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;a \cdot t\\ \end{array} \]

Alternative 4: 92.8% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq 5.8 \cdot 10^{+168}:\\ \;\;\;\;\left(a \cdot t + \left(x + z \cdot y\right)\right) + z \cdot \left(b \cdot a\right)\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(t + b \cdot z\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (<= a 5.8e+168)
   (+ (+ (* a t) (+ x (* z y))) (* z (* b a)))
   (* a (+ t (* b z)))))
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (a <= 5.8e+168) {
		tmp = ((a * t) + (x + (z * y))) + (z * (b * a));
	} else {
		tmp = a * (t + (b * z));
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8) :: tmp
    if (a <= 5.8d+168) then
        tmp = ((a * t) + (x + (z * y))) + (z * (b * a))
    else
        tmp = a * (t + (b * z))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (a <= 5.8e+168) {
		tmp = ((a * t) + (x + (z * y))) + (z * (b * a));
	} else {
		tmp = a * (t + (b * z));
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	tmp = 0
	if a <= 5.8e+168:
		tmp = ((a * t) + (x + (z * y))) + (z * (b * a))
	else:
		tmp = a * (t + (b * z))
	return tmp
function code(x, y, z, t, a, b)
	tmp = 0.0
	if (a <= 5.8e+168)
		tmp = Float64(Float64(Float64(a * t) + Float64(x + Float64(z * y))) + Float64(z * Float64(b * a)));
	else
		tmp = Float64(a * Float64(t + Float64(b * z)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	tmp = 0.0;
	if (a <= 5.8e+168)
		tmp = ((a * t) + (x + (z * y))) + (z * (b * a));
	else
		tmp = a * (t + (b * z));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, 5.8e+168], N[(N[(N[(a * t), $MachinePrecision] + N[(x + N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(z * N[(b * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[(t + N[(b * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;a \leq 5.8 \cdot 10^{+168}:\\
\;\;\;\;\left(a \cdot t + \left(x + z \cdot y\right)\right) + z \cdot \left(b \cdot a\right)\\

\mathbf{else}:\\
\;\;\;\;a \cdot \left(t + b \cdot z\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < 5.8e168

    1. Initial program 95.2%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
    2. Step-by-step derivation
      1. *-commutative95.2%

        \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{\left(z \cdot a\right)} \cdot b \]
      2. associate-*l*96.1%

        \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{z \cdot \left(a \cdot b\right)} \]
    3. Simplified96.1%

      \[\leadsto \color{blue}{\left(\left(x + y \cdot z\right) + t \cdot a\right) + z \cdot \left(a \cdot b\right)} \]

    if 5.8e168 < a

    1. Initial program 83.1%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
    2. Step-by-step derivation
      1. *-commutative83.1%

        \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{\left(z \cdot a\right)} \cdot b \]
      2. associate-*l*82.7%

        \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{z \cdot \left(a \cdot b\right)} \]
    3. Simplified82.7%

      \[\leadsto \color{blue}{\left(\left(x + y \cdot z\right) + t \cdot a\right) + z \cdot \left(a \cdot b\right)} \]
    4. Taylor expanded in a around inf 96.8%

      \[\leadsto \color{blue}{\left(t + b \cdot z\right) \cdot a} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification96.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq 5.8 \cdot 10^{+168}:\\ \;\;\;\;\left(a \cdot t + \left(x + z \cdot y\right)\right) + z \cdot \left(b \cdot a\right)\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(t + b \cdot z\right)\\ \end{array} \]

Alternative 5: 82.1% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.75 \cdot 10^{+48} \lor \neg \left(a \leq 3.8 \cdot 10^{+20}\right):\\
\;\;\;\;a \cdot \left(t + b \cdot z\right)\\

\mathbf{else}:\\
\;\;\;\;z \cdot y + \left(x + a \cdot t\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -1.7499999999999999e48 or 3.8e20 < a

    1. Initial program 87.4%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
    2. Step-by-step derivation
      1. *-commutative87.4%

        \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{\left(z \cdot a\right)} \cdot b \]
      2. associate-*l*89.0%

        \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{z \cdot \left(a \cdot b\right)} \]
    3. Simplified89.0%

      \[\leadsto \color{blue}{\left(\left(x + y \cdot z\right) + t \cdot a\right) + z \cdot \left(a \cdot b\right)} \]
    4. Taylor expanded in a around inf 83.3%

      \[\leadsto \color{blue}{\left(t + b \cdot z\right) \cdot a} \]

    if -1.7499999999999999e48 < a < 3.8e20

    1. Initial program 99.3%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
    2. Step-by-step derivation
      1. *-commutative99.3%

        \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{\left(z \cdot a\right)} \cdot b \]
      2. associate-*l*99.2%

        \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{z \cdot \left(a \cdot b\right)} \]
    3. Simplified99.2%

      \[\leadsto \color{blue}{\left(\left(x + y \cdot z\right) + t \cdot a\right) + z \cdot \left(a \cdot b\right)} \]
    4. Taylor expanded in b around 0 86.8%

      \[\leadsto \color{blue}{y \cdot z + \left(a \cdot t + x\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification85.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -1.75 \cdot 10^{+48} \lor \neg \left(a \leq 3.8 \cdot 10^{+20}\right):\\ \;\;\;\;a \cdot \left(t + b \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot y + \left(x + a \cdot t\right)\\ \end{array} \]

Alternative 6: 83.2% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
t_1 := a \cdot \left(t + b \cdot z\right)\\
\mathbf{if}\;a \leq -7.2 \cdot 10^{-20}:\\
\;\;\;\;z \cdot y + t_1\\

\mathbf{elif}\;a \leq 2.5 \cdot 10^{+21}:\\
\;\;\;\;z \cdot y + \left(x + a \cdot t\right)\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if a < -7.19999999999999948e-20

    1. Initial program 91.9%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
    2. Step-by-step derivation
      1. associate-+l+91.9%

        \[\leadsto \color{blue}{\left(x + y \cdot z\right) + \left(t \cdot a + \left(a \cdot z\right) \cdot b\right)} \]
      2. +-commutative91.9%

        \[\leadsto \color{blue}{\left(t \cdot a + \left(a \cdot z\right) \cdot b\right) + \left(x + y \cdot z\right)} \]
      3. *-commutative91.9%

        \[\leadsto \left(t \cdot a + \color{blue}{b \cdot \left(a \cdot z\right)}\right) + \left(x + y \cdot z\right) \]
      4. *-commutative91.9%

        \[\leadsto \left(t \cdot a + b \cdot \color{blue}{\left(z \cdot a\right)}\right) + \left(x + y \cdot z\right) \]
      5. associate-*l*98.5%

        \[\leadsto \left(t \cdot a + \color{blue}{\left(b \cdot z\right) \cdot a}\right) + \left(x + y \cdot z\right) \]
      6. distribute-rgt-out99.9%

        \[\leadsto \color{blue}{a \cdot \left(t + b \cdot z\right)} + \left(x + y \cdot z\right) \]
      7. fma-def100.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(a, t + b \cdot z, x + y \cdot z\right)} \]
      8. *-commutative100.0%

        \[\leadsto \mathsf{fma}\left(a, t + \color{blue}{z \cdot b}, x + y \cdot z\right) \]
      9. +-commutative100.0%

        \[\leadsto \mathsf{fma}\left(a, t + z \cdot b, \color{blue}{y \cdot z + x}\right) \]
      10. fma-def100.0%

        \[\leadsto \mathsf{fma}\left(a, t + z \cdot b, \color{blue}{\mathsf{fma}\left(y, z, x\right)}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(a, t + z \cdot b, \mathsf{fma}\left(y, z, x\right)\right)} \]
    4. Taylor expanded in x around 0 89.6%

      \[\leadsto \color{blue}{y \cdot z + a \cdot \left(z \cdot b + t\right)} \]

    if -7.19999999999999948e-20 < a < 2.5e21

    1. Initial program 99.2%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
    2. Step-by-step derivation
      1. *-commutative99.2%

        \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{\left(z \cdot a\right)} \cdot b \]
      2. associate-*l*99.2%

        \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{z \cdot \left(a \cdot b\right)} \]
    3. Simplified99.2%

      \[\leadsto \color{blue}{\left(\left(x + y \cdot z\right) + t \cdot a\right) + z \cdot \left(a \cdot b\right)} \]
    4. Taylor expanded in b around 0 87.5%

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

    if 2.5e21 < a

    1. Initial program 84.4%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
    2. Step-by-step derivation
      1. *-commutative84.4%

        \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{\left(z \cdot a\right)} \cdot b \]
      2. associate-*l*86.0%

        \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{z \cdot \left(a \cdot b\right)} \]
    3. Simplified86.0%

      \[\leadsto \color{blue}{\left(\left(x + y \cdot z\right) + t \cdot a\right) + z \cdot \left(a \cdot b\right)} \]
    4. Taylor expanded in a around inf 87.1%

      \[\leadsto \color{blue}{\left(t + b \cdot z\right) \cdot a} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification88.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -7.2 \cdot 10^{-20}:\\ \;\;\;\;z \cdot y + a \cdot \left(t + b \cdot z\right)\\ \mathbf{elif}\;a \leq 2.5 \cdot 10^{+21}:\\ \;\;\;\;z \cdot y + \left(x + a \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(t + b \cdot z\right)\\ \end{array} \]

Alternative 7: 38.3% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -2.6 \cdot 10^{-37}:\\ \;\;\;\;a \cdot t\\ \mathbf{elif}\;a \leq -6.6 \cdot 10^{-96}:\\ \;\;\;\;x\\ \mathbf{elif}\;a \leq -2.6 \cdot 10^{-123}:\\ \;\;\;\;a \cdot t\\ \mathbf{elif}\;a \leq 5.7 \cdot 10^{-25}:\\ \;\;\;\;z \cdot y\\ \mathbf{else}:\\ \;\;\;\;a \cdot t\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (<= a -2.6e-37)
   (* a t)
   (if (<= a -6.6e-96)
     x
     (if (<= a -2.6e-123) (* a t) (if (<= a 5.7e-25) (* z y) (* a t))))))
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (a <= -2.6e-37) {
		tmp = a * t;
	} else if (a <= -6.6e-96) {
		tmp = x;
	} else if (a <= -2.6e-123) {
		tmp = a * t;
	} else if (a <= 5.7e-25) {
		tmp = z * y;
	} else {
		tmp = a * t;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8) :: tmp
    if (a <= (-2.6d-37)) then
        tmp = a * t
    else if (a <= (-6.6d-96)) then
        tmp = x
    else if (a <= (-2.6d-123)) then
        tmp = a * t
    else if (a <= 5.7d-25) then
        tmp = z * y
    else
        tmp = a * t
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (a <= -2.6e-37) {
		tmp = a * t;
	} else if (a <= -6.6e-96) {
		tmp = x;
	} else if (a <= -2.6e-123) {
		tmp = a * t;
	} else if (a <= 5.7e-25) {
		tmp = z * y;
	} else {
		tmp = a * t;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	tmp = 0
	if a <= -2.6e-37:
		tmp = a * t
	elif a <= -6.6e-96:
		tmp = x
	elif a <= -2.6e-123:
		tmp = a * t
	elif a <= 5.7e-25:
		tmp = z * y
	else:
		tmp = a * t
	return tmp
function code(x, y, z, t, a, b)
	tmp = 0.0
	if (a <= -2.6e-37)
		tmp = Float64(a * t);
	elseif (a <= -6.6e-96)
		tmp = x;
	elseif (a <= -2.6e-123)
		tmp = Float64(a * t);
	elseif (a <= 5.7e-25)
		tmp = Float64(z * y);
	else
		tmp = Float64(a * t);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	tmp = 0.0;
	if (a <= -2.6e-37)
		tmp = a * t;
	elseif (a <= -6.6e-96)
		tmp = x;
	elseif (a <= -2.6e-123)
		tmp = a * t;
	elseif (a <= 5.7e-25)
		tmp = z * y;
	else
		tmp = a * t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -2.6e-37], N[(a * t), $MachinePrecision], If[LessEqual[a, -6.6e-96], x, If[LessEqual[a, -2.6e-123], N[(a * t), $MachinePrecision], If[LessEqual[a, 5.7e-25], N[(z * y), $MachinePrecision], N[(a * t), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.6 \cdot 10^{-37}:\\
\;\;\;\;a \cdot t\\

\mathbf{elif}\;a \leq -6.6 \cdot 10^{-96}:\\
\;\;\;\;x\\

\mathbf{elif}\;a \leq -2.6 \cdot 10^{-123}:\\
\;\;\;\;a \cdot t\\

\mathbf{elif}\;a \leq 5.7 \cdot 10^{-25}:\\
\;\;\;\;z \cdot y\\

\mathbf{else}:\\
\;\;\;\;a \cdot t\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if a < -2.5999999999999998e-37 or -6.5999999999999998e-96 < a < -2.59999999999999995e-123 or 5.7000000000000004e-25 < a

    1. Initial program 89.5%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
    2. Step-by-step derivation
      1. *-commutative89.5%

        \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{\left(z \cdot a\right)} \cdot b \]
      2. associate-*l*90.9%

        \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{z \cdot \left(a \cdot b\right)} \]
    3. Simplified90.9%

      \[\leadsto \color{blue}{\left(\left(x + y \cdot z\right) + t \cdot a\right) + z \cdot \left(a \cdot b\right)} \]
    4. Taylor expanded in t around inf 45.4%

      \[\leadsto \color{blue}{a \cdot t} \]

    if -2.5999999999999998e-37 < a < -6.5999999999999998e-96

    1. Initial program 99.8%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
    2. Step-by-step derivation
      1. *-commutative99.8%

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

        \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{z \cdot \left(a \cdot b\right)} \]
    3. Simplified99.8%

      \[\leadsto \color{blue}{\left(\left(x + y \cdot z\right) + t \cdot a\right) + z \cdot \left(a \cdot b\right)} \]
    4. Taylor expanded in x around inf 47.3%

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

    if -2.59999999999999995e-123 < a < 5.7000000000000004e-25

    1. Initial program 99.0%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
    2. Step-by-step derivation
      1. *-commutative99.0%

        \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{\left(z \cdot a\right)} \cdot b \]
      2. associate-*l*99.0%

        \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{z \cdot \left(a \cdot b\right)} \]
    3. Simplified99.0%

      \[\leadsto \color{blue}{\left(\left(x + y \cdot z\right) + t \cdot a\right) + z \cdot \left(a \cdot b\right)} \]
    4. Taylor expanded in y around inf 50.1%

      \[\leadsto \color{blue}{y \cdot z} \]
    5. Step-by-step derivation
      1. *-commutative50.1%

        \[\leadsto \color{blue}{z \cdot y} \]
    6. Simplified50.1%

      \[\leadsto \color{blue}{z \cdot y} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification47.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -2.6 \cdot 10^{-37}:\\ \;\;\;\;a \cdot t\\ \mathbf{elif}\;a \leq -6.6 \cdot 10^{-96}:\\ \;\;\;\;x\\ \mathbf{elif}\;a \leq -2.6 \cdot 10^{-123}:\\ \;\;\;\;a \cdot t\\ \mathbf{elif}\;a \leq 5.7 \cdot 10^{-25}:\\ \;\;\;\;z \cdot y\\ \mathbf{else}:\\ \;\;\;\;a \cdot t\\ \end{array} \]

Alternative 8: 73.1% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.8 \cdot 10^{-92} \lor \neg \left(z \leq 2.1 \cdot 10^{+24}\right):\\
\;\;\;\;z \cdot \left(y + b \cdot a\right)\\

\mathbf{else}:\\
\;\;\;\;x + a \cdot t\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -8.79999999999999949e-92 or 2.1000000000000001e24 < z

    1. Initial program 89.8%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
    2. Step-by-step derivation
      1. *-commutative89.8%

        \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{\left(z \cdot a\right)} \cdot b \]
      2. associate-*l*95.1%

        \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{z \cdot \left(a \cdot b\right)} \]
    3. Simplified95.1%

      \[\leadsto \color{blue}{\left(\left(x + y \cdot z\right) + t \cdot a\right) + z \cdot \left(a \cdot b\right)} \]
    4. Taylor expanded in z around inf 73.0%

      \[\leadsto \color{blue}{z \cdot \left(a \cdot b + y\right)} \]

    if -8.79999999999999949e-92 < z < 2.1000000000000001e24

    1. Initial program 99.1%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
    2. Step-by-step derivation
      1. *-commutative99.1%

        \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{\left(z \cdot a\right)} \cdot b \]
      2. associate-*l*93.9%

        \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{z \cdot \left(a \cdot b\right)} \]
    3. Simplified93.9%

      \[\leadsto \color{blue}{\left(\left(x + y \cdot z\right) + t \cdot a\right) + z \cdot \left(a \cdot b\right)} \]
    4. Taylor expanded in z around 0 78.5%

      \[\leadsto \color{blue}{a \cdot t + x} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification75.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -8.8 \cdot 10^{-92} \lor \neg \left(z \leq 2.1 \cdot 10^{+24}\right):\\ \;\;\;\;z \cdot \left(y + b \cdot a\right)\\ \mathbf{else}:\\ \;\;\;\;x + a \cdot t\\ \end{array} \]

Alternative 9: 56.8% accurate, 1.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -8.5 \cdot 10^{+100} \lor \neg \left(b \leq 6.2 \cdot 10^{+165}\right):\\
\;\;\;\;z \cdot \left(b \cdot a\right)\\

\mathbf{else}:\\
\;\;\;\;x + a \cdot t\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < -8.50000000000000043e100 or 6.2000000000000003e165 < b

    1. Initial program 93.3%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
    2. Step-by-step derivation
      1. *-commutative93.3%

        \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{\left(z \cdot a\right)} \cdot b \]
      2. associate-*l*86.9%

        \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{z \cdot \left(a \cdot b\right)} \]
    3. Simplified86.9%

      \[\leadsto \color{blue}{\left(\left(x + y \cdot z\right) + t \cdot a\right) + z \cdot \left(a \cdot b\right)} \]
    4. Taylor expanded in z around inf 70.3%

      \[\leadsto \color{blue}{z \cdot \left(a \cdot b + y\right)} \]
    5. Taylor expanded in a around inf 56.8%

      \[\leadsto z \cdot \color{blue}{\left(a \cdot b\right)} \]

    if -8.50000000000000043e100 < b < 6.2000000000000003e165

    1. Initial program 94.1%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
    2. Step-by-step derivation
      1. *-commutative94.1%

        \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{\left(z \cdot a\right)} \cdot b \]
      2. associate-*l*97.7%

        \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{z \cdot \left(a \cdot b\right)} \]
    3. Simplified97.7%

      \[\leadsto \color{blue}{\left(\left(x + y \cdot z\right) + t \cdot a\right) + z \cdot \left(a \cdot b\right)} \]
    4. Taylor expanded in z around 0 59.9%

      \[\leadsto \color{blue}{a \cdot t + x} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification59.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -8.5 \cdot 10^{+100} \lor \neg \left(b \leq 6.2 \cdot 10^{+165}\right):\\ \;\;\;\;z \cdot \left(b \cdot a\right)\\ \mathbf{else}:\\ \;\;\;\;x + a \cdot t\\ \end{array} \]

Alternative 10: 62.7% accurate, 1.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.6 \cdot 10^{-123} \lor \neg \left(a \leq 2.15 \cdot 10^{-19}\right):\\
\;\;\;\;x + a \cdot t\\

\mathbf{else}:\\
\;\;\;\;x + z \cdot y\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -2.59999999999999995e-123 or 2.15e-19 < a

    1. Initial program 90.6%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
    2. Step-by-step derivation
      1. *-commutative90.6%

        \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{\left(z \cdot a\right)} \cdot b \]
      2. associate-*l*91.8%

        \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{z \cdot \left(a \cdot b\right)} \]
    3. Simplified91.8%

      \[\leadsto \color{blue}{\left(\left(x + y \cdot z\right) + t \cdot a\right) + z \cdot \left(a \cdot b\right)} \]
    4. Taylor expanded in z around 0 57.9%

      \[\leadsto \color{blue}{a \cdot t + x} \]

    if -2.59999999999999995e-123 < a < 2.15e-19

    1. Initial program 99.0%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
    2. Step-by-step derivation
      1. *-commutative99.0%

        \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{\left(z \cdot a\right)} \cdot b \]
      2. associate-*l*99.0%

        \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{z \cdot \left(a \cdot b\right)} \]
    3. Simplified99.0%

      \[\leadsto \color{blue}{\left(\left(x + y \cdot z\right) + t \cdot a\right) + z \cdot \left(a \cdot b\right)} \]
    4. Taylor expanded in a around 0 82.4%

      \[\leadsto \color{blue}{y \cdot z + x} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification67.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -2.6 \cdot 10^{-123} \lor \neg \left(a \leq 2.15 \cdot 10^{-19}\right):\\ \;\;\;\;x + a \cdot t\\ \mathbf{else}:\\ \;\;\;\;x + z \cdot y\\ \end{array} \]

Alternative 11: 39.5% accurate, 2.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -1.1 \cdot 10^{-36}:\\ \;\;\;\;a \cdot t\\ \mathbf{elif}\;a \leq 9.3 \cdot 10^{-32}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;a \cdot t\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (<= a -1.1e-36) (* a t) (if (<= a 9.3e-32) x (* a t))))
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (a <= -1.1e-36) {
		tmp = a * t;
	} else if (a <= 9.3e-32) {
		tmp = x;
	} else {
		tmp = a * t;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8) :: tmp
    if (a <= (-1.1d-36)) then
        tmp = a * t
    else if (a <= 9.3d-32) then
        tmp = x
    else
        tmp = a * t
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (a <= -1.1e-36) {
		tmp = a * t;
	} else if (a <= 9.3e-32) {
		tmp = x;
	} else {
		tmp = a * t;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	tmp = 0
	if a <= -1.1e-36:
		tmp = a * t
	elif a <= 9.3e-32:
		tmp = x
	else:
		tmp = a * t
	return tmp
function code(x, y, z, t, a, b)
	tmp = 0.0
	if (a <= -1.1e-36)
		tmp = Float64(a * t);
	elseif (a <= 9.3e-32)
		tmp = x;
	else
		tmp = Float64(a * t);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	tmp = 0.0;
	if (a <= -1.1e-36)
		tmp = a * t;
	elseif (a <= 9.3e-32)
		tmp = x;
	else
		tmp = a * t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -1.1e-36], N[(a * t), $MachinePrecision], If[LessEqual[a, 9.3e-32], x, N[(a * t), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.1 \cdot 10^{-36}:\\
\;\;\;\;a \cdot t\\

\mathbf{elif}\;a \leq 9.3 \cdot 10^{-32}:\\
\;\;\;\;x\\

\mathbf{else}:\\
\;\;\;\;a \cdot t\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -1.1e-36 or 9.29999999999999977e-32 < a

    1. Initial program 89.2%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
    2. Step-by-step derivation
      1. *-commutative89.2%

        \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{\left(z \cdot a\right)} \cdot b \]
      2. associate-*l*90.6%

        \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{z \cdot \left(a \cdot b\right)} \]
    3. Simplified90.6%

      \[\leadsto \color{blue}{\left(\left(x + y \cdot z\right) + t \cdot a\right) + z \cdot \left(a \cdot b\right)} \]
    4. Taylor expanded in t around inf 45.2%

      \[\leadsto \color{blue}{a \cdot t} \]

    if -1.1e-36 < a < 9.29999999999999977e-32

    1. Initial program 99.1%

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
    2. Step-by-step derivation
      1. *-commutative99.1%

        \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{\left(z \cdot a\right)} \cdot b \]
      2. associate-*l*99.1%

        \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{z \cdot \left(a \cdot b\right)} \]
    3. Simplified99.1%

      \[\leadsto \color{blue}{\left(\left(x + y \cdot z\right) + t \cdot a\right) + z \cdot \left(a \cdot b\right)} \]
    4. Taylor expanded in x around inf 36.2%

      \[\leadsto \color{blue}{x} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification41.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -1.1 \cdot 10^{-36}:\\ \;\;\;\;a \cdot t\\ \mathbf{elif}\;a \leq 9.3 \cdot 10^{-32}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;a \cdot t\\ \end{array} \]

Alternative 12: 26.9% accurate, 15.0× speedup?

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

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

    \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
  2. Step-by-step derivation
    1. *-commutative93.8%

      \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{\left(z \cdot a\right)} \cdot b \]
    2. associate-*l*94.6%

      \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{z \cdot \left(a \cdot b\right)} \]
  3. Simplified94.6%

    \[\leadsto \color{blue}{\left(\left(x + y \cdot z\right) + t \cdot a\right) + z \cdot \left(a \cdot b\right)} \]
  4. Taylor expanded in x around inf 23.2%

    \[\leadsto \color{blue}{x} \]
  5. Final simplification23.2%

    \[\leadsto x \]

Developer target: 97.1% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := z \cdot \left(b \cdot a + y\right) + \left(x + t \cdot a\right)\\ \mathbf{if}\;z < -11820553527347888000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z < 4.7589743188364287 \cdot 10^{-122}:\\ \;\;\;\;\left(b \cdot z + t\right) \cdot a + \left(z \cdot y + x\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (+ (* z (+ (* b a) y)) (+ x (* t a)))))
   (if (< z -11820553527347888000.0)
     t_1
     (if (< z 4.7589743188364287e-122)
       (+ (* (+ (* b z) t) a) (+ (* z y) x))
       t_1))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = (z * ((b * a) + y)) + (x + (t * a));
	double tmp;
	if (z < -11820553527347888000.0) {
		tmp = t_1;
	} else if (z < 4.7589743188364287e-122) {
		tmp = (((b * z) + t) * a) + ((z * y) + x);
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8) :: t_1
    real(8) :: tmp
    t_1 = (z * ((b * a) + y)) + (x + (t * a))
    if (z < (-11820553527347888000.0d0)) then
        tmp = t_1
    else if (z < 4.7589743188364287d-122) then
        tmp = (((b * z) + t) * a) + ((z * y) + x)
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = (z * ((b * a) + y)) + (x + (t * a));
	double tmp;
	if (z < -11820553527347888000.0) {
		tmp = t_1;
	} else if (z < 4.7589743188364287e-122) {
		tmp = (((b * z) + t) * a) + ((z * y) + x);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	t_1 = (z * ((b * a) + y)) + (x + (t * a))
	tmp = 0
	if z < -11820553527347888000.0:
		tmp = t_1
	elif z < 4.7589743188364287e-122:
		tmp = (((b * z) + t) * a) + ((z * y) + x)
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a, b)
	t_1 = Float64(Float64(z * Float64(Float64(b * a) + y)) + Float64(x + Float64(t * a)))
	tmp = 0.0
	if (z < -11820553527347888000.0)
		tmp = t_1;
	elseif (z < 4.7589743188364287e-122)
		tmp = Float64(Float64(Float64(Float64(b * z) + t) * a) + Float64(Float64(z * y) + x));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	t_1 = (z * ((b * a) + y)) + (x + (t * a));
	tmp = 0.0;
	if (z < -11820553527347888000.0)
		tmp = t_1;
	elseif (z < 4.7589743188364287e-122)
		tmp = (((b * z) + t) * a) + ((z * y) + x);
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(z * N[(N[(b * a), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision] + N[(x + N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[z, -11820553527347888000.0], t$95$1, If[Less[z, 4.7589743188364287e-122], N[(N[(N[(N[(b * z), $MachinePrecision] + t), $MachinePrecision] * a), $MachinePrecision] + N[(N[(z * y), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := z \cdot \left(b \cdot a + y\right) + \left(x + t \cdot a\right)\\
\mathbf{if}\;z < -11820553527347888000:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z < 4.7589743188364287 \cdot 10^{-122}:\\
\;\;\;\;\left(b \cdot z + t\right) \cdot a + \left(z \cdot y + x\right)\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}

Reproduce

?
herbie shell --seed 2023279 
(FPCore (x y z t a b)
  :name "Graphics.Rasterific.CubicBezier:cachedBezierAt from Rasterific-0.6.1"
  :precision binary64

  :herbie-target
  (if (< z -11820553527347888000.0) (+ (* z (+ (* b a) y)) (+ x (* t a))) (if (< z 4.7589743188364287e-122) (+ (* (+ (* b z) t) a) (+ (* z y) x)) (+ (* z (+ (* b a) y)) (+ x (* t a)))))

  (+ (+ (+ x (* y z)) (* t a)) (* (* a z) b)))