Diagrams.Solve.Polynomial:quartForm from diagrams-solve-0.1, C

Percentage Accurate: 97.8% → 99.3%
Time: 13.9s
Alternatives: 17
Speedup: 0.5×

Specification

?
\[\begin{array}{l} \\ \left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \end{array} \]
(FPCore (x y z t a b c)
 :precision binary64
 (+ (- (+ (* x y) (/ (* z t) 16.0)) (/ (* a b) 4.0)) c))
double code(double x, double y, double z, double t, double a, double b, double c) {
	return (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c;
}
real(8) function code(x, y, z, t, a, b, c)
    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), intent (in) :: c
    code = (((x * y) + ((z * t) / 16.0d0)) - ((a * b) / 4.0d0)) + c
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
	return (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c;
}
def code(x, y, z, t, a, b, c):
	return (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c
function code(x, y, z, t, a, b, c)
	return Float64(Float64(Float64(Float64(x * y) + Float64(Float64(z * t) / 16.0)) - Float64(Float64(a * b) / 4.0)) + c)
end
function tmp = code(x, y, z, t, a, b, c)
	tmp = (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c;
end
code[x_, y_, z_, t_, a_, b_, c_] := N[(N[(N[(N[(x * y), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] / 16.0), $MachinePrecision]), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] / 4.0), $MachinePrecision]), $MachinePrecision] + c), $MachinePrecision]
\begin{array}{l}

\\
\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c
\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 17 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: 97.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \end{array} \]
(FPCore (x y z t a b c)
 :precision binary64
 (+ (- (+ (* x y) (/ (* z t) 16.0)) (/ (* a b) 4.0)) c))
double code(double x, double y, double z, double t, double a, double b, double c) {
	return (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c;
}
real(8) function code(x, y, z, t, a, b, c)
    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), intent (in) :: c
    code = (((x * y) + ((z * t) / 16.0d0)) - ((a * b) / 4.0d0)) + c
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
	return (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c;
}
def code(x, y, z, t, a, b, c):
	return (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c
function code(x, y, z, t, a, b, c)
	return Float64(Float64(Float64(Float64(x * y) + Float64(Float64(z * t) / 16.0)) - Float64(Float64(a * b) / 4.0)) + c)
end
function tmp = code(x, y, z, t, a, b, c)
	tmp = (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c;
end
code[x_, y_, z_, t_, a_, b_, c_] := N[(N[(N[(N[(x * y), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] / 16.0), $MachinePrecision]), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] / 4.0), $MachinePrecision]), $MachinePrecision] + c), $MachinePrecision]
\begin{array}{l}

\\
\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c
\end{array}

Alternative 1: 99.3% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4} \leq \infty:\\ \;\;\;\;c + \left(\left(x \cdot y + z \cdot \left(t \cdot 0.0625\right)\right) - a \cdot \frac{b}{4}\right)\\ \mathbf{else}:\\ \;\;\;\;t \cdot \left(z \cdot 0.0625 + a \cdot \frac{b \cdot -0.25}{t}\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b c)
 :precision binary64
 (if (<= (- (+ (* x y) (/ (* z t) 16.0)) (/ (* a b) 4.0)) INFINITY)
   (+ c (- (+ (* x y) (* z (* t 0.0625))) (* a (/ b 4.0))))
   (* t (+ (* z 0.0625) (* a (/ (* b -0.25) t))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
	double tmp;
	if ((((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) <= ((double) INFINITY)) {
		tmp = c + (((x * y) + (z * (t * 0.0625))) - (a * (b / 4.0)));
	} else {
		tmp = t * ((z * 0.0625) + (a * ((b * -0.25) / t)));
	}
	return tmp;
}
public static double code(double x, double y, double z, double t, double a, double b, double c) {
	double tmp;
	if ((((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) <= Double.POSITIVE_INFINITY) {
		tmp = c + (((x * y) + (z * (t * 0.0625))) - (a * (b / 4.0)));
	} else {
		tmp = t * ((z * 0.0625) + (a * ((b * -0.25) / t)));
	}
	return tmp;
}
def code(x, y, z, t, a, b, c):
	tmp = 0
	if (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) <= math.inf:
		tmp = c + (((x * y) + (z * (t * 0.0625))) - (a * (b / 4.0)))
	else:
		tmp = t * ((z * 0.0625) + (a * ((b * -0.25) / t)))
	return tmp
function code(x, y, z, t, a, b, c)
	tmp = 0.0
	if (Float64(Float64(Float64(x * y) + Float64(Float64(z * t) / 16.0)) - Float64(Float64(a * b) / 4.0)) <= Inf)
		tmp = Float64(c + Float64(Float64(Float64(x * y) + Float64(z * Float64(t * 0.0625))) - Float64(a * Float64(b / 4.0))));
	else
		tmp = Float64(t * Float64(Float64(z * 0.0625) + Float64(a * Float64(Float64(b * -0.25) / t))));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c)
	tmp = 0.0;
	if ((((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) <= Inf)
		tmp = c + (((x * y) + (z * (t * 0.0625))) - (a * (b / 4.0)));
	else
		tmp = t * ((z * 0.0625) + (a * ((b * -0.25) / t)));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[N[(N[(N[(x * y), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] / 16.0), $MachinePrecision]), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] / 4.0), $MachinePrecision]), $MachinePrecision], Infinity], N[(c + N[(N[(N[(x * y), $MachinePrecision] + N[(z * N[(t * 0.0625), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(a * N[(b / 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(N[(z * 0.0625), $MachinePrecision] + N[(a * N[(N[(b * -0.25), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4} \leq \infty:\\
\;\;\;\;c + \left(\left(x \cdot y + z \cdot \left(t \cdot 0.0625\right)\right) - a \cdot \frac{b}{4}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 (+.f64 (*.f64 x y) (/.f64 (*.f64 z t) #s(literal 16 binary64))) (/.f64 (*.f64 a b) #s(literal 4 binary64))) < +inf.0

    1. Initial program 99.6%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Step-by-step derivation
      1. associate-+l-99.6%

        \[\leadsto \color{blue}{\left(x \cdot y + \frac{z \cdot t}{16}\right) - \left(\frac{a \cdot b}{4} - c\right)} \]
      2. +-commutative99.6%

        \[\leadsto \color{blue}{\left(\frac{z \cdot t}{16} + x \cdot y\right)} - \left(\frac{a \cdot b}{4} - c\right) \]
      3. *-commutative99.6%

        \[\leadsto \left(\frac{\color{blue}{t \cdot z}}{16} + x \cdot y\right) - \left(\frac{a \cdot b}{4} - c\right) \]
      4. +-commutative99.6%

        \[\leadsto \color{blue}{\left(x \cdot y + \frac{t \cdot z}{16}\right)} - \left(\frac{a \cdot b}{4} - c\right) \]
      5. associate-+l-99.6%

        \[\leadsto \color{blue}{\left(\left(x \cdot y + \frac{t \cdot z}{16}\right) - \frac{a \cdot b}{4}\right) + c} \]
      6. fma-define99.6%

        \[\leadsto \left(\color{blue}{\mathsf{fma}\left(x, y, \frac{t \cdot z}{16}\right)} - \frac{a \cdot b}{4}\right) + c \]
      7. *-commutative99.6%

        \[\leadsto \left(\mathsf{fma}\left(x, y, \frac{\color{blue}{z \cdot t}}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
      8. associate-/l*100.0%

        \[\leadsto \left(\mathsf{fma}\left(x, y, \color{blue}{z \cdot \frac{t}{16}}\right) - \frac{a \cdot b}{4}\right) + c \]
      9. associate-/l*100.0%

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

      \[\leadsto \color{blue}{\left(\mathsf{fma}\left(x, y, z \cdot \frac{t}{16}\right) - a \cdot \frac{b}{4}\right) + c} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-undefine100.0%

        \[\leadsto \left(\color{blue}{\left(x \cdot y + z \cdot \frac{t}{16}\right)} - a \cdot \frac{b}{4}\right) + c \]
      2. associate-*r/99.6%

        \[\leadsto \left(\left(x \cdot y + \color{blue}{\frac{z \cdot t}{16}}\right) - a \cdot \frac{b}{4}\right) + c \]
      3. +-commutative99.6%

        \[\leadsto \left(\color{blue}{\left(\frac{z \cdot t}{16} + x \cdot y\right)} - a \cdot \frac{b}{4}\right) + c \]
      4. associate-*r/100.0%

        \[\leadsto \left(\left(\color{blue}{z \cdot \frac{t}{16}} + x \cdot y\right) - a \cdot \frac{b}{4}\right) + c \]
      5. div-inv100.0%

        \[\leadsto \left(\left(z \cdot \color{blue}{\left(t \cdot \frac{1}{16}\right)} + x \cdot y\right) - a \cdot \frac{b}{4}\right) + c \]
      6. metadata-eval100.0%

        \[\leadsto \left(\left(z \cdot \left(t \cdot \color{blue}{0.0625}\right) + x \cdot y\right) - a \cdot \frac{b}{4}\right) + c \]
    6. Applied egg-rr100.0%

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

    if +inf.0 < (-.f64 (+.f64 (*.f64 x y) (/.f64 (*.f64 z t) #s(literal 16 binary64))) (/.f64 (*.f64 a b) #s(literal 4 binary64)))

    1. Initial program 0.0%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 50.0%

      \[\leadsto \color{blue}{\left(c + 0.0625 \cdot \left(t \cdot z\right)\right) - 0.25 \cdot \left(a \cdot b\right)} \]
    4. Step-by-step derivation
      1. *-commutative50.0%

        \[\leadsto \left(c + 0.0625 \cdot \left(t \cdot z\right)\right) - \color{blue}{\left(a \cdot b\right) \cdot 0.25} \]
      2. +-commutative50.0%

        \[\leadsto \color{blue}{\left(0.0625 \cdot \left(t \cdot z\right) + c\right)} - \left(a \cdot b\right) \cdot 0.25 \]
      3. metadata-eval50.0%

        \[\leadsto \left(0.0625 \cdot \left(t \cdot z\right) + c\right) - \left(a \cdot b\right) \cdot \color{blue}{\frac{1}{4}} \]
      4. div-inv50.0%

        \[\leadsto \left(0.0625 \cdot \left(t \cdot z\right) + c\right) - \color{blue}{\frac{a \cdot b}{4}} \]
      5. associate-*r/50.0%

        \[\leadsto \left(0.0625 \cdot \left(t \cdot z\right) + c\right) - \color{blue}{a \cdot \frac{b}{4}} \]
      6. associate--l+50.0%

        \[\leadsto \color{blue}{0.0625 \cdot \left(t \cdot z\right) + \left(c - a \cdot \frac{b}{4}\right)} \]
      7. *-commutative50.0%

        \[\leadsto \color{blue}{\left(t \cdot z\right) \cdot 0.0625} + \left(c - a \cdot \frac{b}{4}\right) \]
      8. *-commutative50.0%

        \[\leadsto \color{blue}{\left(z \cdot t\right)} \cdot 0.0625 + \left(c - a \cdot \frac{b}{4}\right) \]
      9. associate-*r*50.0%

        \[\leadsto \color{blue}{z \cdot \left(t \cdot 0.0625\right)} + \left(c - a \cdot \frac{b}{4}\right) \]
      10. div-inv50.0%

        \[\leadsto z \cdot \left(t \cdot 0.0625\right) + \left(c - a \cdot \color{blue}{\left(b \cdot \frac{1}{4}\right)}\right) \]
      11. metadata-eval50.0%

        \[\leadsto z \cdot \left(t \cdot 0.0625\right) + \left(c - a \cdot \left(b \cdot \color{blue}{0.25}\right)\right) \]
    5. Applied egg-rr50.0%

      \[\leadsto \color{blue}{z \cdot \left(t \cdot 0.0625\right) + \left(c - a \cdot \left(b \cdot 0.25\right)\right)} \]
    6. Taylor expanded in t around inf 62.5%

      \[\leadsto \color{blue}{t \cdot \left(\left(0.0625 \cdot z + \frac{c}{t}\right) - 0.25 \cdot \frac{a \cdot b}{t}\right)} \]
    7. Step-by-step derivation
      1. associate--l+62.5%

        \[\leadsto t \cdot \color{blue}{\left(0.0625 \cdot z + \left(\frac{c}{t} - 0.25 \cdot \frac{a \cdot b}{t}\right)\right)} \]
      2. associate-*r/62.5%

        \[\leadsto t \cdot \left(0.0625 \cdot z + \left(\frac{c}{t} - \color{blue}{\frac{0.25 \cdot \left(a \cdot b\right)}{t}}\right)\right) \]
      3. div-sub62.5%

        \[\leadsto t \cdot \left(0.0625 \cdot z + \color{blue}{\frac{c - 0.25 \cdot \left(a \cdot b\right)}{t}}\right) \]
      4. cancel-sign-sub-inv62.5%

        \[\leadsto t \cdot \left(0.0625 \cdot z + \frac{\color{blue}{c + \left(-0.25\right) \cdot \left(a \cdot b\right)}}{t}\right) \]
      5. metadata-eval62.5%

        \[\leadsto t \cdot \left(0.0625 \cdot z + \frac{c + \color{blue}{-0.25} \cdot \left(a \cdot b\right)}{t}\right) \]
      6. +-commutative62.5%

        \[\leadsto t \cdot \left(0.0625 \cdot z + \frac{\color{blue}{-0.25 \cdot \left(a \cdot b\right) + c}}{t}\right) \]
      7. *-commutative62.5%

        \[\leadsto t \cdot \left(0.0625 \cdot z + \frac{\color{blue}{\left(a \cdot b\right) \cdot -0.25} + c}{t}\right) \]
    8. Simplified62.5%

      \[\leadsto \color{blue}{t \cdot \left(0.0625 \cdot z + \frac{\left(a \cdot b\right) \cdot -0.25 + c}{t}\right)} \]
    9. Taylor expanded in a around inf 62.5%

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

        \[\leadsto t \cdot \left(0.0625 \cdot z + \color{blue}{\frac{-0.25 \cdot \left(a \cdot b\right)}{t}}\right) \]
      2. *-commutative62.5%

        \[\leadsto t \cdot \left(0.0625 \cdot z + \frac{\color{blue}{\left(a \cdot b\right) \cdot -0.25}}{t}\right) \]
      3. associate-*r*62.5%

        \[\leadsto t \cdot \left(0.0625 \cdot z + \frac{\color{blue}{a \cdot \left(b \cdot -0.25\right)}}{t}\right) \]
      4. associate-*r/87.5%

        \[\leadsto t \cdot \left(0.0625 \cdot z + \color{blue}{a \cdot \frac{b \cdot -0.25}{t}}\right) \]
      5. *-commutative87.5%

        \[\leadsto t \cdot \left(0.0625 \cdot z + a \cdot \frac{\color{blue}{-0.25 \cdot b}}{t}\right) \]
    11. Simplified87.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4} \leq \infty:\\ \;\;\;\;c + \left(\left(x \cdot y + z \cdot \left(t \cdot 0.0625\right)\right) - a \cdot \frac{b}{4}\right)\\ \mathbf{else}:\\ \;\;\;\;t \cdot \left(z \cdot 0.0625 + a \cdot \frac{b \cdot -0.25}{t}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 98.9% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(x, y, \mathsf{fma}\left(z, \frac{t}{16}, \frac{a \cdot b}{-4}\right)\right) + c \end{array} \]
(FPCore (x y z t a b c)
 :precision binary64
 (+ (fma x y (fma z (/ t 16.0) (/ (* a b) -4.0))) c))
double code(double x, double y, double z, double t, double a, double b, double c) {
	return fma(x, y, fma(z, (t / 16.0), ((a * b) / -4.0))) + c;
}
function code(x, y, z, t, a, b, c)
	return Float64(fma(x, y, fma(z, Float64(t / 16.0), Float64(Float64(a * b) / -4.0))) + c)
end
code[x_, y_, z_, t_, a_, b_, c_] := N[(N[(x * y + N[(z * N[(t / 16.0), $MachinePrecision] + N[(N[(a * b), $MachinePrecision] / -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + c), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(x, y, \mathsf{fma}\left(z, \frac{t}{16}, \frac{a \cdot b}{-4}\right)\right) + c
\end{array}
Derivation
  1. Initial program 96.5%

    \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
  2. Step-by-step derivation
    1. associate--l+96.5%

      \[\leadsto \color{blue}{\left(x \cdot y + \left(\frac{z \cdot t}{16} - \frac{a \cdot b}{4}\right)\right)} + c \]
    2. fma-define98.1%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, \frac{z \cdot t}{16} - \frac{a \cdot b}{4}\right)} + c \]
    3. associate-/l*98.4%

      \[\leadsto \mathsf{fma}\left(x, y, \color{blue}{z \cdot \frac{t}{16}} - \frac{a \cdot b}{4}\right) + c \]
    4. fmm-def98.8%

      \[\leadsto \mathsf{fma}\left(x, y, \color{blue}{\mathsf{fma}\left(z, \frac{t}{16}, -\frac{a \cdot b}{4}\right)}\right) + c \]
    5. distribute-neg-frac298.8%

      \[\leadsto \mathsf{fma}\left(x, y, \mathsf{fma}\left(z, \frac{t}{16}, \color{blue}{\frac{a \cdot b}{-4}}\right)\right) + c \]
    6. metadata-eval98.8%

      \[\leadsto \mathsf{fma}\left(x, y, \mathsf{fma}\left(z, \frac{t}{16}, \frac{a \cdot b}{\color{blue}{-4}}\right)\right) + c \]
  3. Simplified98.8%

    \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, \mathsf{fma}\left(z, \frac{t}{16}, \frac{a \cdot b}{-4}\right)\right) + c} \]
  4. Add Preprocessing
  5. Final simplification98.8%

    \[\leadsto \mathsf{fma}\left(x, y, \mathsf{fma}\left(z, \frac{t}{16}, \frac{a \cdot b}{-4}\right)\right) + c \]
  6. Add Preprocessing

Alternative 3: 98.2% accurate, 0.1× speedup?

\[\begin{array}{l} \\ c + \left(\mathsf{fma}\left(x, y, z \cdot \frac{t}{16}\right) - a \cdot \frac{b}{4}\right) \end{array} \]
(FPCore (x y z t a b c)
 :precision binary64
 (+ c (- (fma x y (* z (/ t 16.0))) (* a (/ b 4.0)))))
double code(double x, double y, double z, double t, double a, double b, double c) {
	return c + (fma(x, y, (z * (t / 16.0))) - (a * (b / 4.0)));
}
function code(x, y, z, t, a, b, c)
	return Float64(c + Float64(fma(x, y, Float64(z * Float64(t / 16.0))) - Float64(a * Float64(b / 4.0))))
end
code[x_, y_, z_, t_, a_, b_, c_] := N[(c + N[(N[(x * y + N[(z * N[(t / 16.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(a * N[(b / 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
c + \left(\mathsf{fma}\left(x, y, z \cdot \frac{t}{16}\right) - a \cdot \frac{b}{4}\right)
\end{array}
Derivation
  1. Initial program 96.5%

    \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
  2. Step-by-step derivation
    1. associate-+l-96.5%

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

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

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

      \[\leadsto \color{blue}{\left(x \cdot y + \frac{t \cdot z}{16}\right)} - \left(\frac{a \cdot b}{4} - c\right) \]
    5. associate-+l-96.5%

      \[\leadsto \color{blue}{\left(\left(x \cdot y + \frac{t \cdot z}{16}\right) - \frac{a \cdot b}{4}\right) + c} \]
    6. fma-define97.7%

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

      \[\leadsto \left(\mathsf{fma}\left(x, y, \frac{\color{blue}{z \cdot t}}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    8. associate-/l*98.0%

      \[\leadsto \left(\mathsf{fma}\left(x, y, \color{blue}{z \cdot \frac{t}{16}}\right) - \frac{a \cdot b}{4}\right) + c \]
    9. associate-/l*98.0%

      \[\leadsto \left(\mathsf{fma}\left(x, y, z \cdot \frac{t}{16}\right) - \color{blue}{a \cdot \frac{b}{4}}\right) + c \]
  3. Simplified98.0%

    \[\leadsto \color{blue}{\left(\mathsf{fma}\left(x, y, z \cdot \frac{t}{16}\right) - a \cdot \frac{b}{4}\right) + c} \]
  4. Add Preprocessing
  5. Final simplification98.0%

    \[\leadsto c + \left(\mathsf{fma}\left(x, y, z \cdot \frac{t}{16}\right) - a \cdot \frac{b}{4}\right) \]
  6. Add Preprocessing

Alternative 4: 43.3% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := a \cdot \left(b \cdot -0.25\right)\\ \mathbf{if}\;x \cdot y \leq -1.2 \cdot 10^{+132}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;x \cdot y \leq -1.08 \cdot 10^{+39}:\\ \;\;\;\;c\\ \mathbf{elif}\;x \cdot y \leq -9.6 \cdot 10^{-134}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \cdot y \leq -5.5 \cdot 10^{-303}:\\ \;\;\;\;c\\ \mathbf{elif}\;x \cdot y \leq 9.2 \cdot 10^{-110}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \cdot y \leq 3.1 \cdot 10^{+102}:\\ \;\;\;\;c\\ \mathbf{elif}\;x \cdot y \leq 1.06 \cdot 10^{+135}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \end{array} \]
(FPCore (x y z t a b c)
 :precision binary64
 (let* ((t_1 (* a (* b -0.25))))
   (if (<= (* x y) -1.2e+132)
     (* x y)
     (if (<= (* x y) -1.08e+39)
       c
       (if (<= (* x y) -9.6e-134)
         t_1
         (if (<= (* x y) -5.5e-303)
           c
           (if (<= (* x y) 9.2e-110)
             t_1
             (if (<= (* x y) 3.1e+102)
               c
               (if (<= (* x y) 1.06e+135) t_1 (* x y))))))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
	double t_1 = a * (b * -0.25);
	double tmp;
	if ((x * y) <= -1.2e+132) {
		tmp = x * y;
	} else if ((x * y) <= -1.08e+39) {
		tmp = c;
	} else if ((x * y) <= -9.6e-134) {
		tmp = t_1;
	} else if ((x * y) <= -5.5e-303) {
		tmp = c;
	} else if ((x * y) <= 9.2e-110) {
		tmp = t_1;
	} else if ((x * y) <= 3.1e+102) {
		tmp = c;
	} else if ((x * y) <= 1.06e+135) {
		tmp = t_1;
	} else {
		tmp = x * y;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b, c)
    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), intent (in) :: c
    real(8) :: t_1
    real(8) :: tmp
    t_1 = a * (b * (-0.25d0))
    if ((x * y) <= (-1.2d+132)) then
        tmp = x * y
    else if ((x * y) <= (-1.08d+39)) then
        tmp = c
    else if ((x * y) <= (-9.6d-134)) then
        tmp = t_1
    else if ((x * y) <= (-5.5d-303)) then
        tmp = c
    else if ((x * y) <= 9.2d-110) then
        tmp = t_1
    else if ((x * y) <= 3.1d+102) then
        tmp = c
    else if ((x * y) <= 1.06d+135) then
        tmp = t_1
    else
        tmp = x * y
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
	double t_1 = a * (b * -0.25);
	double tmp;
	if ((x * y) <= -1.2e+132) {
		tmp = x * y;
	} else if ((x * y) <= -1.08e+39) {
		tmp = c;
	} else if ((x * y) <= -9.6e-134) {
		tmp = t_1;
	} else if ((x * y) <= -5.5e-303) {
		tmp = c;
	} else if ((x * y) <= 9.2e-110) {
		tmp = t_1;
	} else if ((x * y) <= 3.1e+102) {
		tmp = c;
	} else if ((x * y) <= 1.06e+135) {
		tmp = t_1;
	} else {
		tmp = x * y;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c):
	t_1 = a * (b * -0.25)
	tmp = 0
	if (x * y) <= -1.2e+132:
		tmp = x * y
	elif (x * y) <= -1.08e+39:
		tmp = c
	elif (x * y) <= -9.6e-134:
		tmp = t_1
	elif (x * y) <= -5.5e-303:
		tmp = c
	elif (x * y) <= 9.2e-110:
		tmp = t_1
	elif (x * y) <= 3.1e+102:
		tmp = c
	elif (x * y) <= 1.06e+135:
		tmp = t_1
	else:
		tmp = x * y
	return tmp
function code(x, y, z, t, a, b, c)
	t_1 = Float64(a * Float64(b * -0.25))
	tmp = 0.0
	if (Float64(x * y) <= -1.2e+132)
		tmp = Float64(x * y);
	elseif (Float64(x * y) <= -1.08e+39)
		tmp = c;
	elseif (Float64(x * y) <= -9.6e-134)
		tmp = t_1;
	elseif (Float64(x * y) <= -5.5e-303)
		tmp = c;
	elseif (Float64(x * y) <= 9.2e-110)
		tmp = t_1;
	elseif (Float64(x * y) <= 3.1e+102)
		tmp = c;
	elseif (Float64(x * y) <= 1.06e+135)
		tmp = t_1;
	else
		tmp = Float64(x * y);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c)
	t_1 = a * (b * -0.25);
	tmp = 0.0;
	if ((x * y) <= -1.2e+132)
		tmp = x * y;
	elseif ((x * y) <= -1.08e+39)
		tmp = c;
	elseif ((x * y) <= -9.6e-134)
		tmp = t_1;
	elseif ((x * y) <= -5.5e-303)
		tmp = c;
	elseif ((x * y) <= 9.2e-110)
		tmp = t_1;
	elseif ((x * y) <= 3.1e+102)
		tmp = c;
	elseif ((x * y) <= 1.06e+135)
		tmp = t_1;
	else
		tmp = x * y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(a * N[(b * -0.25), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -1.2e+132], N[(x * y), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], -1.08e+39], c, If[LessEqual[N[(x * y), $MachinePrecision], -9.6e-134], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], -5.5e-303], c, If[LessEqual[N[(x * y), $MachinePrecision], 9.2e-110], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 3.1e+102], c, If[LessEqual[N[(x * y), $MachinePrecision], 1.06e+135], t$95$1, N[(x * y), $MachinePrecision]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := a \cdot \left(b \cdot -0.25\right)\\
\mathbf{if}\;x \cdot y \leq -1.2 \cdot 10^{+132}:\\
\;\;\;\;x \cdot y\\

\mathbf{elif}\;x \cdot y \leq -1.08 \cdot 10^{+39}:\\
\;\;\;\;c\\

\mathbf{elif}\;x \cdot y \leq -9.6 \cdot 10^{-134}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \cdot y \leq -5.5 \cdot 10^{-303}:\\
\;\;\;\;c\\

\mathbf{elif}\;x \cdot y \leq 9.2 \cdot 10^{-110}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \cdot y \leq 3.1 \cdot 10^{+102}:\\
\;\;\;\;c\\

\mathbf{elif}\;x \cdot y \leq 1.06 \cdot 10^{+135}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x y) < -1.2000000000000001e132 or 1.06e135 < (*.f64 x y)

    1. Initial program 94.1%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 85.0%

      \[\leadsto \color{blue}{\left(c + x \cdot y\right) - 0.25 \cdot \left(a \cdot b\right)} \]
    4. Taylor expanded in x around inf 85.3%

      \[\leadsto \color{blue}{x \cdot \left(\left(y + \frac{c}{x}\right) - 0.25 \cdot \frac{a \cdot b}{x}\right)} \]
    5. Step-by-step derivation
      1. associate--l+85.3%

        \[\leadsto x \cdot \color{blue}{\left(y + \left(\frac{c}{x} - 0.25 \cdot \frac{a \cdot b}{x}\right)\right)} \]
      2. associate-*r/85.3%

        \[\leadsto x \cdot \left(y + \left(\frac{c}{x} - \color{blue}{\frac{0.25 \cdot \left(a \cdot b\right)}{x}}\right)\right) \]
      3. div-sub85.3%

        \[\leadsto x \cdot \left(y + \color{blue}{\frac{c - 0.25 \cdot \left(a \cdot b\right)}{x}}\right) \]
      4. cancel-sign-sub-inv85.3%

        \[\leadsto x \cdot \left(y + \frac{\color{blue}{c + \left(-0.25\right) \cdot \left(a \cdot b\right)}}{x}\right) \]
      5. metadata-eval85.3%

        \[\leadsto x \cdot \left(y + \frac{c + \color{blue}{-0.25} \cdot \left(a \cdot b\right)}{x}\right) \]
      6. +-commutative85.3%

        \[\leadsto x \cdot \left(y + \frac{\color{blue}{-0.25 \cdot \left(a \cdot b\right) + c}}{x}\right) \]
      7. *-commutative85.3%

        \[\leadsto x \cdot \left(y + \frac{\color{blue}{\left(a \cdot b\right) \cdot -0.25} + c}{x}\right) \]
    6. Simplified85.3%

      \[\leadsto \color{blue}{x \cdot \left(y + \frac{\left(a \cdot b\right) \cdot -0.25 + c}{x}\right)} \]
    7. Taylor expanded in x around inf 76.6%

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

    if -1.2000000000000001e132 < (*.f64 x y) < -1.07999999999999998e39 or -9.60000000000000038e-134 < (*.f64 x y) < -5.50000000000000018e-303 or 9.2000000000000006e-110 < (*.f64 x y) < 3.09999999999999987e102

    1. Initial program 97.5%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in c around inf 40.0%

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

    if -1.07999999999999998e39 < (*.f64 x y) < -9.60000000000000038e-134 or -5.50000000000000018e-303 < (*.f64 x y) < 9.2000000000000006e-110 or 3.09999999999999987e102 < (*.f64 x y) < 1.06e135

    1. Initial program 97.9%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 95.0%

      \[\leadsto \color{blue}{\left(c + 0.0625 \cdot \left(t \cdot z\right)\right) - 0.25 \cdot \left(a \cdot b\right)} \]
    4. Step-by-step derivation
      1. *-commutative95.0%

        \[\leadsto \left(c + 0.0625 \cdot \left(t \cdot z\right)\right) - \color{blue}{\left(a \cdot b\right) \cdot 0.25} \]
      2. +-commutative95.0%

        \[\leadsto \color{blue}{\left(0.0625 \cdot \left(t \cdot z\right) + c\right)} - \left(a \cdot b\right) \cdot 0.25 \]
      3. metadata-eval95.0%

        \[\leadsto \left(0.0625 \cdot \left(t \cdot z\right) + c\right) - \left(a \cdot b\right) \cdot \color{blue}{\frac{1}{4}} \]
      4. div-inv95.0%

        \[\leadsto \left(0.0625 \cdot \left(t \cdot z\right) + c\right) - \color{blue}{\frac{a \cdot b}{4}} \]
      5. associate-*r/95.0%

        \[\leadsto \left(0.0625 \cdot \left(t \cdot z\right) + c\right) - \color{blue}{a \cdot \frac{b}{4}} \]
      6. associate--l+95.0%

        \[\leadsto \color{blue}{0.0625 \cdot \left(t \cdot z\right) + \left(c - a \cdot \frac{b}{4}\right)} \]
      7. *-commutative95.0%

        \[\leadsto \color{blue}{\left(t \cdot z\right) \cdot 0.0625} + \left(c - a \cdot \frac{b}{4}\right) \]
      8. *-commutative95.0%

        \[\leadsto \color{blue}{\left(z \cdot t\right)} \cdot 0.0625 + \left(c - a \cdot \frac{b}{4}\right) \]
      9. associate-*r*95.0%

        \[\leadsto \color{blue}{z \cdot \left(t \cdot 0.0625\right)} + \left(c - a \cdot \frac{b}{4}\right) \]
      10. div-inv95.0%

        \[\leadsto z \cdot \left(t \cdot 0.0625\right) + \left(c - a \cdot \color{blue}{\left(b \cdot \frac{1}{4}\right)}\right) \]
      11. metadata-eval95.0%

        \[\leadsto z \cdot \left(t \cdot 0.0625\right) + \left(c - a \cdot \left(b \cdot \color{blue}{0.25}\right)\right) \]
    5. Applied egg-rr95.0%

      \[\leadsto \color{blue}{z \cdot \left(t \cdot 0.0625\right) + \left(c - a \cdot \left(b \cdot 0.25\right)\right)} \]
    6. Taylor expanded in t around inf 84.5%

      \[\leadsto \color{blue}{t \cdot \left(\left(0.0625 \cdot z + \frac{c}{t}\right) - 0.25 \cdot \frac{a \cdot b}{t}\right)} \]
    7. Step-by-step derivation
      1. associate--l+84.5%

        \[\leadsto t \cdot \color{blue}{\left(0.0625 \cdot z + \left(\frac{c}{t} - 0.25 \cdot \frac{a \cdot b}{t}\right)\right)} \]
      2. associate-*r/84.5%

        \[\leadsto t \cdot \left(0.0625 \cdot z + \left(\frac{c}{t} - \color{blue}{\frac{0.25 \cdot \left(a \cdot b\right)}{t}}\right)\right) \]
      3. div-sub84.6%

        \[\leadsto t \cdot \left(0.0625 \cdot z + \color{blue}{\frac{c - 0.25 \cdot \left(a \cdot b\right)}{t}}\right) \]
      4. cancel-sign-sub-inv84.6%

        \[\leadsto t \cdot \left(0.0625 \cdot z + \frac{\color{blue}{c + \left(-0.25\right) \cdot \left(a \cdot b\right)}}{t}\right) \]
      5. metadata-eval84.6%

        \[\leadsto t \cdot \left(0.0625 \cdot z + \frac{c + \color{blue}{-0.25} \cdot \left(a \cdot b\right)}{t}\right) \]
      6. +-commutative84.6%

        \[\leadsto t \cdot \left(0.0625 \cdot z + \frac{\color{blue}{-0.25 \cdot \left(a \cdot b\right) + c}}{t}\right) \]
      7. *-commutative84.6%

        \[\leadsto t \cdot \left(0.0625 \cdot z + \frac{\color{blue}{\left(a \cdot b\right) \cdot -0.25} + c}{t}\right) \]
    8. Simplified84.6%

      \[\leadsto \color{blue}{t \cdot \left(0.0625 \cdot z + \frac{\left(a \cdot b\right) \cdot -0.25 + c}{t}\right)} \]
    9. Taylor expanded in a around inf 40.3%

      \[\leadsto \color{blue}{-0.25 \cdot \left(a \cdot b\right)} \]
    10. Step-by-step derivation
      1. *-commutative40.3%

        \[\leadsto \color{blue}{\left(a \cdot b\right) \cdot -0.25} \]
      2. associate-*r*40.3%

        \[\leadsto \color{blue}{a \cdot \left(b \cdot -0.25\right)} \]
      3. *-commutative40.3%

        \[\leadsto a \cdot \color{blue}{\left(-0.25 \cdot b\right)} \]
    11. Simplified40.3%

      \[\leadsto \color{blue}{a \cdot \left(-0.25 \cdot b\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification52.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -1.2 \cdot 10^{+132}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;x \cdot y \leq -1.08 \cdot 10^{+39}:\\ \;\;\;\;c\\ \mathbf{elif}\;x \cdot y \leq -9.6 \cdot 10^{-134}:\\ \;\;\;\;a \cdot \left(b \cdot -0.25\right)\\ \mathbf{elif}\;x \cdot y \leq -5.5 \cdot 10^{-303}:\\ \;\;\;\;c\\ \mathbf{elif}\;x \cdot y \leq 9.2 \cdot 10^{-110}:\\ \;\;\;\;a \cdot \left(b \cdot -0.25\right)\\ \mathbf{elif}\;x \cdot y \leq 3.1 \cdot 10^{+102}:\\ \;\;\;\;c\\ \mathbf{elif}\;x \cdot y \leq 1.06 \cdot 10^{+135}:\\ \;\;\;\;a \cdot \left(b \cdot -0.25\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 85.2% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \cdot b \leq -2 \cdot 10^{+305}:\\ \;\;\;\;a \cdot \left(b \cdot -0.25\right)\\ \mathbf{elif}\;a \cdot b \leq -4 \cdot 10^{+206} \lor \neg \left(a \cdot b \leq -4 \cdot 10^{+158}\right) \land a \cdot b \leq 10^{+106}:\\ \;\;\;\;c + \left(x \cdot y + 0.0625 \cdot \left(z \cdot t\right)\right)\\ \mathbf{else}:\\ \;\;\;\;c + b \cdot \left(a \cdot -0.25\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b c)
 :precision binary64
 (if (<= (* a b) -2e+305)
   (* a (* b -0.25))
   (if (or (<= (* a b) -4e+206)
           (and (not (<= (* a b) -4e+158)) (<= (* a b) 1e+106)))
     (+ c (+ (* x y) (* 0.0625 (* z t))))
     (+ c (* b (* a -0.25))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
	double tmp;
	if ((a * b) <= -2e+305) {
		tmp = a * (b * -0.25);
	} else if (((a * b) <= -4e+206) || (!((a * b) <= -4e+158) && ((a * b) <= 1e+106))) {
		tmp = c + ((x * y) + (0.0625 * (z * t)));
	} else {
		tmp = c + (b * (a * -0.25));
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b, c)
    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), intent (in) :: c
    real(8) :: tmp
    if ((a * b) <= (-2d+305)) then
        tmp = a * (b * (-0.25d0))
    else if (((a * b) <= (-4d+206)) .or. (.not. ((a * b) <= (-4d+158))) .and. ((a * b) <= 1d+106)) then
        tmp = c + ((x * y) + (0.0625d0 * (z * t)))
    else
        tmp = c + (b * (a * (-0.25d0)))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
	double tmp;
	if ((a * b) <= -2e+305) {
		tmp = a * (b * -0.25);
	} else if (((a * b) <= -4e+206) || (!((a * b) <= -4e+158) && ((a * b) <= 1e+106))) {
		tmp = c + ((x * y) + (0.0625 * (z * t)));
	} else {
		tmp = c + (b * (a * -0.25));
	}
	return tmp;
}
def code(x, y, z, t, a, b, c):
	tmp = 0
	if (a * b) <= -2e+305:
		tmp = a * (b * -0.25)
	elif ((a * b) <= -4e+206) or (not ((a * b) <= -4e+158) and ((a * b) <= 1e+106)):
		tmp = c + ((x * y) + (0.0625 * (z * t)))
	else:
		tmp = c + (b * (a * -0.25))
	return tmp
function code(x, y, z, t, a, b, c)
	tmp = 0.0
	if (Float64(a * b) <= -2e+305)
		tmp = Float64(a * Float64(b * -0.25));
	elseif ((Float64(a * b) <= -4e+206) || (!(Float64(a * b) <= -4e+158) && (Float64(a * b) <= 1e+106)))
		tmp = Float64(c + Float64(Float64(x * y) + Float64(0.0625 * Float64(z * t))));
	else
		tmp = Float64(c + Float64(b * Float64(a * -0.25)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c)
	tmp = 0.0;
	if ((a * b) <= -2e+305)
		tmp = a * (b * -0.25);
	elseif (((a * b) <= -4e+206) || (~(((a * b) <= -4e+158)) && ((a * b) <= 1e+106)))
		tmp = c + ((x * y) + (0.0625 * (z * t)));
	else
		tmp = c + (b * (a * -0.25));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[N[(a * b), $MachinePrecision], -2e+305], N[(a * N[(b * -0.25), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[N[(a * b), $MachinePrecision], -4e+206], And[N[Not[LessEqual[N[(a * b), $MachinePrecision], -4e+158]], $MachinePrecision], LessEqual[N[(a * b), $MachinePrecision], 1e+106]]], N[(c + N[(N[(x * y), $MachinePrecision] + N[(0.0625 * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c + N[(b * N[(a * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -2 \cdot 10^{+305}:\\
\;\;\;\;a \cdot \left(b \cdot -0.25\right)\\

\mathbf{elif}\;a \cdot b \leq -4 \cdot 10^{+206} \lor \neg \left(a \cdot b \leq -4 \cdot 10^{+158}\right) \land a \cdot b \leq 10^{+106}:\\
\;\;\;\;c + \left(x \cdot y + 0.0625 \cdot \left(z \cdot t\right)\right)\\

\mathbf{else}:\\
\;\;\;\;c + b \cdot \left(a \cdot -0.25\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 a b) < -1.9999999999999999e305

    1. Initial program 86.4%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 90.9%

      \[\leadsto \color{blue}{\left(c + 0.0625 \cdot \left(t \cdot z\right)\right) - 0.25 \cdot \left(a \cdot b\right)} \]
    4. Step-by-step derivation
      1. *-commutative90.9%

        \[\leadsto \left(c + 0.0625 \cdot \left(t \cdot z\right)\right) - \color{blue}{\left(a \cdot b\right) \cdot 0.25} \]
      2. +-commutative90.9%

        \[\leadsto \color{blue}{\left(0.0625 \cdot \left(t \cdot z\right) + c\right)} - \left(a \cdot b\right) \cdot 0.25 \]
      3. metadata-eval90.9%

        \[\leadsto \left(0.0625 \cdot \left(t \cdot z\right) + c\right) - \left(a \cdot b\right) \cdot \color{blue}{\frac{1}{4}} \]
      4. div-inv90.9%

        \[\leadsto \left(0.0625 \cdot \left(t \cdot z\right) + c\right) - \color{blue}{\frac{a \cdot b}{4}} \]
      5. associate-*r/90.9%

        \[\leadsto \left(0.0625 \cdot \left(t \cdot z\right) + c\right) - \color{blue}{a \cdot \frac{b}{4}} \]
      6. associate--l+90.9%

        \[\leadsto \color{blue}{0.0625 \cdot \left(t \cdot z\right) + \left(c - a \cdot \frac{b}{4}\right)} \]
      7. *-commutative90.9%

        \[\leadsto \color{blue}{\left(t \cdot z\right) \cdot 0.0625} + \left(c - a \cdot \frac{b}{4}\right) \]
      8. *-commutative90.9%

        \[\leadsto \color{blue}{\left(z \cdot t\right)} \cdot 0.0625 + \left(c - a \cdot \frac{b}{4}\right) \]
      9. associate-*r*90.9%

        \[\leadsto \color{blue}{z \cdot \left(t \cdot 0.0625\right)} + \left(c - a \cdot \frac{b}{4}\right) \]
      10. div-inv90.9%

        \[\leadsto z \cdot \left(t \cdot 0.0625\right) + \left(c - a \cdot \color{blue}{\left(b \cdot \frac{1}{4}\right)}\right) \]
      11. metadata-eval90.9%

        \[\leadsto z \cdot \left(t \cdot 0.0625\right) + \left(c - a \cdot \left(b \cdot \color{blue}{0.25}\right)\right) \]
    5. Applied egg-rr90.9%

      \[\leadsto \color{blue}{z \cdot \left(t \cdot 0.0625\right) + \left(c - a \cdot \left(b \cdot 0.25\right)\right)} \]
    6. Taylor expanded in t around inf 82.4%

      \[\leadsto \color{blue}{t \cdot \left(\left(0.0625 \cdot z + \frac{c}{t}\right) - 0.25 \cdot \frac{a \cdot b}{t}\right)} \]
    7. Step-by-step derivation
      1. associate--l+82.4%

        \[\leadsto t \cdot \color{blue}{\left(0.0625 \cdot z + \left(\frac{c}{t} - 0.25 \cdot \frac{a \cdot b}{t}\right)\right)} \]
      2. associate-*r/82.4%

        \[\leadsto t \cdot \left(0.0625 \cdot z + \left(\frac{c}{t} - \color{blue}{\frac{0.25 \cdot \left(a \cdot b\right)}{t}}\right)\right) \]
      3. div-sub87.0%

        \[\leadsto t \cdot \left(0.0625 \cdot z + \color{blue}{\frac{c - 0.25 \cdot \left(a \cdot b\right)}{t}}\right) \]
      4. cancel-sign-sub-inv87.0%

        \[\leadsto t \cdot \left(0.0625 \cdot z + \frac{\color{blue}{c + \left(-0.25\right) \cdot \left(a \cdot b\right)}}{t}\right) \]
      5. metadata-eval87.0%

        \[\leadsto t \cdot \left(0.0625 \cdot z + \frac{c + \color{blue}{-0.25} \cdot \left(a \cdot b\right)}{t}\right) \]
      6. +-commutative87.0%

        \[\leadsto t \cdot \left(0.0625 \cdot z + \frac{\color{blue}{-0.25 \cdot \left(a \cdot b\right) + c}}{t}\right) \]
      7. *-commutative87.0%

        \[\leadsto t \cdot \left(0.0625 \cdot z + \frac{\color{blue}{\left(a \cdot b\right) \cdot -0.25} + c}{t}\right) \]
    8. Simplified87.0%

      \[\leadsto \color{blue}{t \cdot \left(0.0625 \cdot z + \frac{\left(a \cdot b\right) \cdot -0.25 + c}{t}\right)} \]
    9. Taylor expanded in a around inf 90.9%

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

        \[\leadsto \color{blue}{\left(a \cdot b\right) \cdot -0.25} \]
      2. associate-*r*90.9%

        \[\leadsto \color{blue}{a \cdot \left(b \cdot -0.25\right)} \]
      3. *-commutative90.9%

        \[\leadsto a \cdot \color{blue}{\left(-0.25 \cdot b\right)} \]
    11. Simplified90.9%

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

    if -1.9999999999999999e305 < (*.f64 a b) < -4.0000000000000002e206 or -3.99999999999999981e158 < (*.f64 a b) < 1.00000000000000009e106

    1. Initial program 99.0%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in a around 0 92.1%

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

    if -4.0000000000000002e206 < (*.f64 a b) < -3.99999999999999981e158 or 1.00000000000000009e106 < (*.f64 a b)

    1. Initial program 91.1%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in a around inf 77.8%

      \[\leadsto \color{blue}{-0.25 \cdot \left(a \cdot b\right)} + c \]
    4. Step-by-step derivation
      1. *-commutative77.8%

        \[\leadsto \color{blue}{\left(a \cdot b\right) \cdot -0.25} + c \]
      2. *-commutative77.8%

        \[\leadsto \color{blue}{\left(b \cdot a\right)} \cdot -0.25 + c \]
      3. associate-*r*77.8%

        \[\leadsto \color{blue}{b \cdot \left(a \cdot -0.25\right)} + c \]
    5. Simplified77.8%

      \[\leadsto \color{blue}{b \cdot \left(a \cdot -0.25\right)} + c \]
  3. Recombined 3 regimes into one program.
  4. Final simplification89.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot b \leq -2 \cdot 10^{+305}:\\ \;\;\;\;a \cdot \left(b \cdot -0.25\right)\\ \mathbf{elif}\;a \cdot b \leq -4 \cdot 10^{+206} \lor \neg \left(a \cdot b \leq -4 \cdot 10^{+158}\right) \land a \cdot b \leq 10^{+106}:\\ \;\;\;\;c + \left(x \cdot y + 0.0625 \cdot \left(z \cdot t\right)\right)\\ \mathbf{else}:\\ \;\;\;\;c + b \cdot \left(a \cdot -0.25\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 85.9% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := 0.0625 \cdot \left(z \cdot t\right)\\ t_2 := c + \left(x \cdot y + t\_1\right)\\ t_3 := t\_1 - \left(a \cdot b\right) \cdot 0.25\\ \mathbf{if}\;a \cdot b \leq -4 \cdot 10^{+269}:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;a \cdot b \leq -4 \cdot 10^{+206}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;a \cdot b \leq -4 \cdot 10^{+158}:\\ \;\;\;\;c + b \cdot \left(a \cdot -0.25\right)\\ \mathbf{elif}\;a \cdot b \leq 10^{+217}:\\ \;\;\;\;t\_2\\ \mathbf{else}:\\ \;\;\;\;t\_3\\ \end{array} \end{array} \]
(FPCore (x y z t a b c)
 :precision binary64
 (let* ((t_1 (* 0.0625 (* z t)))
        (t_2 (+ c (+ (* x y) t_1)))
        (t_3 (- t_1 (* (* a b) 0.25))))
   (if (<= (* a b) -4e+269)
     t_3
     (if (<= (* a b) -4e+206)
       t_2
       (if (<= (* a b) -4e+158)
         (+ c (* b (* a -0.25)))
         (if (<= (* a b) 1e+217) t_2 t_3))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
	double t_1 = 0.0625 * (z * t);
	double t_2 = c + ((x * y) + t_1);
	double t_3 = t_1 - ((a * b) * 0.25);
	double tmp;
	if ((a * b) <= -4e+269) {
		tmp = t_3;
	} else if ((a * b) <= -4e+206) {
		tmp = t_2;
	} else if ((a * b) <= -4e+158) {
		tmp = c + (b * (a * -0.25));
	} else if ((a * b) <= 1e+217) {
		tmp = t_2;
	} else {
		tmp = t_3;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b, c)
    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), intent (in) :: c
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: tmp
    t_1 = 0.0625d0 * (z * t)
    t_2 = c + ((x * y) + t_1)
    t_3 = t_1 - ((a * b) * 0.25d0)
    if ((a * b) <= (-4d+269)) then
        tmp = t_3
    else if ((a * b) <= (-4d+206)) then
        tmp = t_2
    else if ((a * b) <= (-4d+158)) then
        tmp = c + (b * (a * (-0.25d0)))
    else if ((a * b) <= 1d+217) then
        tmp = t_2
    else
        tmp = t_3
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
	double t_1 = 0.0625 * (z * t);
	double t_2 = c + ((x * y) + t_1);
	double t_3 = t_1 - ((a * b) * 0.25);
	double tmp;
	if ((a * b) <= -4e+269) {
		tmp = t_3;
	} else if ((a * b) <= -4e+206) {
		tmp = t_2;
	} else if ((a * b) <= -4e+158) {
		tmp = c + (b * (a * -0.25));
	} else if ((a * b) <= 1e+217) {
		tmp = t_2;
	} else {
		tmp = t_3;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c):
	t_1 = 0.0625 * (z * t)
	t_2 = c + ((x * y) + t_1)
	t_3 = t_1 - ((a * b) * 0.25)
	tmp = 0
	if (a * b) <= -4e+269:
		tmp = t_3
	elif (a * b) <= -4e+206:
		tmp = t_2
	elif (a * b) <= -4e+158:
		tmp = c + (b * (a * -0.25))
	elif (a * b) <= 1e+217:
		tmp = t_2
	else:
		tmp = t_3
	return tmp
function code(x, y, z, t, a, b, c)
	t_1 = Float64(0.0625 * Float64(z * t))
	t_2 = Float64(c + Float64(Float64(x * y) + t_1))
	t_3 = Float64(t_1 - Float64(Float64(a * b) * 0.25))
	tmp = 0.0
	if (Float64(a * b) <= -4e+269)
		tmp = t_3;
	elseif (Float64(a * b) <= -4e+206)
		tmp = t_2;
	elseif (Float64(a * b) <= -4e+158)
		tmp = Float64(c + Float64(b * Float64(a * -0.25)));
	elseif (Float64(a * b) <= 1e+217)
		tmp = t_2;
	else
		tmp = t_3;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c)
	t_1 = 0.0625 * (z * t);
	t_2 = c + ((x * y) + t_1);
	t_3 = t_1 - ((a * b) * 0.25);
	tmp = 0.0;
	if ((a * b) <= -4e+269)
		tmp = t_3;
	elseif ((a * b) <= -4e+206)
		tmp = t_2;
	elseif ((a * b) <= -4e+158)
		tmp = c + (b * (a * -0.25));
	elseif ((a * b) <= 1e+217)
		tmp = t_2;
	else
		tmp = t_3;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(0.0625 * N[(z * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(c + N[(N[(x * y), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$1 - N[(N[(a * b), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(a * b), $MachinePrecision], -4e+269], t$95$3, If[LessEqual[N[(a * b), $MachinePrecision], -4e+206], t$95$2, If[LessEqual[N[(a * b), $MachinePrecision], -4e+158], N[(c + N[(b * N[(a * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 1e+217], t$95$2, t$95$3]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := 0.0625 \cdot \left(z \cdot t\right)\\
t_2 := c + \left(x \cdot y + t\_1\right)\\
t_3 := t\_1 - \left(a \cdot b\right) \cdot 0.25\\
\mathbf{if}\;a \cdot b \leq -4 \cdot 10^{+269}:\\
\;\;\;\;t\_3\\

\mathbf{elif}\;a \cdot b \leq -4 \cdot 10^{+206}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;a \cdot b \leq -4 \cdot 10^{+158}:\\
\;\;\;\;c + b \cdot \left(a \cdot -0.25\right)\\

\mathbf{elif}\;a \cdot b \leq 10^{+217}:\\
\;\;\;\;t\_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 a b) < -4.0000000000000002e269 or 9.9999999999999996e216 < (*.f64 a b)

    1. Initial program 84.3%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 88.5%

      \[\leadsto \color{blue}{\left(c + 0.0625 \cdot \left(t \cdot z\right)\right) - 0.25 \cdot \left(a \cdot b\right)} \]
    4. Step-by-step derivation
      1. *-commutative88.5%

        \[\leadsto \left(c + 0.0625 \cdot \left(t \cdot z\right)\right) - \color{blue}{\left(a \cdot b\right) \cdot 0.25} \]
      2. +-commutative88.5%

        \[\leadsto \color{blue}{\left(0.0625 \cdot \left(t \cdot z\right) + c\right)} - \left(a \cdot b\right) \cdot 0.25 \]
      3. metadata-eval88.5%

        \[\leadsto \left(0.0625 \cdot \left(t \cdot z\right) + c\right) - \left(a \cdot b\right) \cdot \color{blue}{\frac{1}{4}} \]
      4. div-inv88.5%

        \[\leadsto \left(0.0625 \cdot \left(t \cdot z\right) + c\right) - \color{blue}{\frac{a \cdot b}{4}} \]
      5. associate-*r/88.5%

        \[\leadsto \left(0.0625 \cdot \left(t \cdot z\right) + c\right) - \color{blue}{a \cdot \frac{b}{4}} \]
      6. associate--l+88.5%

        \[\leadsto \color{blue}{0.0625 \cdot \left(t \cdot z\right) + \left(c - a \cdot \frac{b}{4}\right)} \]
      7. *-commutative88.5%

        \[\leadsto \color{blue}{\left(t \cdot z\right) \cdot 0.0625} + \left(c - a \cdot \frac{b}{4}\right) \]
      8. *-commutative88.5%

        \[\leadsto \color{blue}{\left(z \cdot t\right)} \cdot 0.0625 + \left(c - a \cdot \frac{b}{4}\right) \]
      9. associate-*r*90.2%

        \[\leadsto \color{blue}{z \cdot \left(t \cdot 0.0625\right)} + \left(c - a \cdot \frac{b}{4}\right) \]
      10. div-inv90.2%

        \[\leadsto z \cdot \left(t \cdot 0.0625\right) + \left(c - a \cdot \color{blue}{\left(b \cdot \frac{1}{4}\right)}\right) \]
      11. metadata-eval90.2%

        \[\leadsto z \cdot \left(t \cdot 0.0625\right) + \left(c - a \cdot \left(b \cdot \color{blue}{0.25}\right)\right) \]
    5. Applied egg-rr90.2%

      \[\leadsto \color{blue}{z \cdot \left(t \cdot 0.0625\right) + \left(c - a \cdot \left(b \cdot 0.25\right)\right)} \]
    6. Taylor expanded in c around 0 86.5%

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

    if -4.0000000000000002e269 < (*.f64 a b) < -4.0000000000000002e206 or -3.99999999999999981e158 < (*.f64 a b) < 9.9999999999999996e216

    1. Initial program 99.5%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in a around 0 91.0%

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

    if -4.0000000000000002e206 < (*.f64 a b) < -3.99999999999999981e158

    1. Initial program 100.0%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in a around inf 88.9%

      \[\leadsto \color{blue}{-0.25 \cdot \left(a \cdot b\right)} + c \]
    4. Step-by-step derivation
      1. *-commutative88.9%

        \[\leadsto \color{blue}{\left(a \cdot b\right) \cdot -0.25} + c \]
      2. *-commutative88.9%

        \[\leadsto \color{blue}{\left(b \cdot a\right)} \cdot -0.25 + c \]
      3. associate-*r*88.9%

        \[\leadsto \color{blue}{b \cdot \left(a \cdot -0.25\right)} + c \]
    5. Simplified88.9%

      \[\leadsto \color{blue}{b \cdot \left(a \cdot -0.25\right)} + c \]
  3. Recombined 3 regimes into one program.
  4. Final simplification90.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot b \leq -4 \cdot 10^{+269}:\\ \;\;\;\;0.0625 \cdot \left(z \cdot t\right) - \left(a \cdot b\right) \cdot 0.25\\ \mathbf{elif}\;a \cdot b \leq -4 \cdot 10^{+206}:\\ \;\;\;\;c + \left(x \cdot y + 0.0625 \cdot \left(z \cdot t\right)\right)\\ \mathbf{elif}\;a \cdot b \leq -4 \cdot 10^{+158}:\\ \;\;\;\;c + b \cdot \left(a \cdot -0.25\right)\\ \mathbf{elif}\;a \cdot b \leq 10^{+217}:\\ \;\;\;\;c + \left(x \cdot y + 0.0625 \cdot \left(z \cdot t\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.0625 \cdot \left(z \cdot t\right) - \left(a \cdot b\right) \cdot 0.25\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 99.2% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\\ \mathbf{if}\;t\_1 \leq \infty:\\ \;\;\;\;c + t\_1\\ \mathbf{else}:\\ \;\;\;\;t \cdot \left(z \cdot 0.0625 + a \cdot \frac{b \cdot -0.25}{t}\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b c)
 :precision binary64
 (let* ((t_1 (- (+ (* x y) (/ (* z t) 16.0)) (/ (* a b) 4.0))))
   (if (<= t_1 INFINITY)
     (+ c t_1)
     (* t (+ (* z 0.0625) (* a (/ (* b -0.25) t)))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
	double t_1 = ((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0);
	double tmp;
	if (t_1 <= ((double) INFINITY)) {
		tmp = c + t_1;
	} else {
		tmp = t * ((z * 0.0625) + (a * ((b * -0.25) / t)));
	}
	return tmp;
}
public static double code(double x, double y, double z, double t, double a, double b, double c) {
	double t_1 = ((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0);
	double tmp;
	if (t_1 <= Double.POSITIVE_INFINITY) {
		tmp = c + t_1;
	} else {
		tmp = t * ((z * 0.0625) + (a * ((b * -0.25) / t)));
	}
	return tmp;
}
def code(x, y, z, t, a, b, c):
	t_1 = ((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)
	tmp = 0
	if t_1 <= math.inf:
		tmp = c + t_1
	else:
		tmp = t * ((z * 0.0625) + (a * ((b * -0.25) / t)))
	return tmp
function code(x, y, z, t, a, b, c)
	t_1 = Float64(Float64(Float64(x * y) + Float64(Float64(z * t) / 16.0)) - Float64(Float64(a * b) / 4.0))
	tmp = 0.0
	if (t_1 <= Inf)
		tmp = Float64(c + t_1);
	else
		tmp = Float64(t * Float64(Float64(z * 0.0625) + Float64(a * Float64(Float64(b * -0.25) / t))));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c)
	t_1 = ((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0);
	tmp = 0.0;
	if (t_1 <= Inf)
		tmp = c + t_1;
	else
		tmp = t * ((z * 0.0625) + (a * ((b * -0.25) / t)));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(N[(x * y), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] / 16.0), $MachinePrecision]), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] / 4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], N[(c + t$95$1), $MachinePrecision], N[(t * N[(N[(z * 0.0625), $MachinePrecision] + N[(a * N[(N[(b * -0.25), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;c + t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 (+.f64 (*.f64 x y) (/.f64 (*.f64 z t) #s(literal 16 binary64))) (/.f64 (*.f64 a b) #s(literal 4 binary64))) < +inf.0

    1. Initial program 99.6%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing

    if +inf.0 < (-.f64 (+.f64 (*.f64 x y) (/.f64 (*.f64 z t) #s(literal 16 binary64))) (/.f64 (*.f64 a b) #s(literal 4 binary64)))

    1. Initial program 0.0%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 50.0%

      \[\leadsto \color{blue}{\left(c + 0.0625 \cdot \left(t \cdot z\right)\right) - 0.25 \cdot \left(a \cdot b\right)} \]
    4. Step-by-step derivation
      1. *-commutative50.0%

        \[\leadsto \left(c + 0.0625 \cdot \left(t \cdot z\right)\right) - \color{blue}{\left(a \cdot b\right) \cdot 0.25} \]
      2. +-commutative50.0%

        \[\leadsto \color{blue}{\left(0.0625 \cdot \left(t \cdot z\right) + c\right)} - \left(a \cdot b\right) \cdot 0.25 \]
      3. metadata-eval50.0%

        \[\leadsto \left(0.0625 \cdot \left(t \cdot z\right) + c\right) - \left(a \cdot b\right) \cdot \color{blue}{\frac{1}{4}} \]
      4. div-inv50.0%

        \[\leadsto \left(0.0625 \cdot \left(t \cdot z\right) + c\right) - \color{blue}{\frac{a \cdot b}{4}} \]
      5. associate-*r/50.0%

        \[\leadsto \left(0.0625 \cdot \left(t \cdot z\right) + c\right) - \color{blue}{a \cdot \frac{b}{4}} \]
      6. associate--l+50.0%

        \[\leadsto \color{blue}{0.0625 \cdot \left(t \cdot z\right) + \left(c - a \cdot \frac{b}{4}\right)} \]
      7. *-commutative50.0%

        \[\leadsto \color{blue}{\left(t \cdot z\right) \cdot 0.0625} + \left(c - a \cdot \frac{b}{4}\right) \]
      8. *-commutative50.0%

        \[\leadsto \color{blue}{\left(z \cdot t\right)} \cdot 0.0625 + \left(c - a \cdot \frac{b}{4}\right) \]
      9. associate-*r*50.0%

        \[\leadsto \color{blue}{z \cdot \left(t \cdot 0.0625\right)} + \left(c - a \cdot \frac{b}{4}\right) \]
      10. div-inv50.0%

        \[\leadsto z \cdot \left(t \cdot 0.0625\right) + \left(c - a \cdot \color{blue}{\left(b \cdot \frac{1}{4}\right)}\right) \]
      11. metadata-eval50.0%

        \[\leadsto z \cdot \left(t \cdot 0.0625\right) + \left(c - a \cdot \left(b \cdot \color{blue}{0.25}\right)\right) \]
    5. Applied egg-rr50.0%

      \[\leadsto \color{blue}{z \cdot \left(t \cdot 0.0625\right) + \left(c - a \cdot \left(b \cdot 0.25\right)\right)} \]
    6. Taylor expanded in t around inf 62.5%

      \[\leadsto \color{blue}{t \cdot \left(\left(0.0625 \cdot z + \frac{c}{t}\right) - 0.25 \cdot \frac{a \cdot b}{t}\right)} \]
    7. Step-by-step derivation
      1. associate--l+62.5%

        \[\leadsto t \cdot \color{blue}{\left(0.0625 \cdot z + \left(\frac{c}{t} - 0.25 \cdot \frac{a \cdot b}{t}\right)\right)} \]
      2. associate-*r/62.5%

        \[\leadsto t \cdot \left(0.0625 \cdot z + \left(\frac{c}{t} - \color{blue}{\frac{0.25 \cdot \left(a \cdot b\right)}{t}}\right)\right) \]
      3. div-sub62.5%

        \[\leadsto t \cdot \left(0.0625 \cdot z + \color{blue}{\frac{c - 0.25 \cdot \left(a \cdot b\right)}{t}}\right) \]
      4. cancel-sign-sub-inv62.5%

        \[\leadsto t \cdot \left(0.0625 \cdot z + \frac{\color{blue}{c + \left(-0.25\right) \cdot \left(a \cdot b\right)}}{t}\right) \]
      5. metadata-eval62.5%

        \[\leadsto t \cdot \left(0.0625 \cdot z + \frac{c + \color{blue}{-0.25} \cdot \left(a \cdot b\right)}{t}\right) \]
      6. +-commutative62.5%

        \[\leadsto t \cdot \left(0.0625 \cdot z + \frac{\color{blue}{-0.25 \cdot \left(a \cdot b\right) + c}}{t}\right) \]
      7. *-commutative62.5%

        \[\leadsto t \cdot \left(0.0625 \cdot z + \frac{\color{blue}{\left(a \cdot b\right) \cdot -0.25} + c}{t}\right) \]
    8. Simplified62.5%

      \[\leadsto \color{blue}{t \cdot \left(0.0625 \cdot z + \frac{\left(a \cdot b\right) \cdot -0.25 + c}{t}\right)} \]
    9. Taylor expanded in a around inf 62.5%

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

        \[\leadsto t \cdot \left(0.0625 \cdot z + \color{blue}{\frac{-0.25 \cdot \left(a \cdot b\right)}{t}}\right) \]
      2. *-commutative62.5%

        \[\leadsto t \cdot \left(0.0625 \cdot z + \frac{\color{blue}{\left(a \cdot b\right) \cdot -0.25}}{t}\right) \]
      3. associate-*r*62.5%

        \[\leadsto t \cdot \left(0.0625 \cdot z + \frac{\color{blue}{a \cdot \left(b \cdot -0.25\right)}}{t}\right) \]
      4. associate-*r/87.5%

        \[\leadsto t \cdot \left(0.0625 \cdot z + \color{blue}{a \cdot \frac{b \cdot -0.25}{t}}\right) \]
      5. *-commutative87.5%

        \[\leadsto t \cdot \left(0.0625 \cdot z + a \cdot \frac{\color{blue}{-0.25 \cdot b}}{t}\right) \]
    11. Simplified87.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4} \leq \infty:\\ \;\;\;\;c + \left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right)\\ \mathbf{else}:\\ \;\;\;\;t \cdot \left(z \cdot 0.0625 + a \cdot \frac{b \cdot -0.25}{t}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 65.1% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := c + b \cdot \left(a \cdot -0.25\right)\\ t_2 := c + x \cdot y\\ \mathbf{if}\;x \cdot y \leq -7 \cdot 10^{+45}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;x \cdot y \leq 6 \cdot 10^{+25}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \cdot y \leq 8 \cdot 10^{+62}:\\ \;\;\;\;z \cdot \left(t \cdot 0.0625\right)\\ \mathbf{elif}\;x \cdot y \leq 1.06 \cdot 10^{+135}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
(FPCore (x y z t a b c)
 :precision binary64
 (let* ((t_1 (+ c (* b (* a -0.25)))) (t_2 (+ c (* x y))))
   (if (<= (* x y) -7e+45)
     t_2
     (if (<= (* x y) 6e+25)
       t_1
       (if (<= (* x y) 8e+62)
         (* z (* t 0.0625))
         (if (<= (* x y) 1.06e+135) t_1 t_2))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
	double t_1 = c + (b * (a * -0.25));
	double t_2 = c + (x * y);
	double tmp;
	if ((x * y) <= -7e+45) {
		tmp = t_2;
	} else if ((x * y) <= 6e+25) {
		tmp = t_1;
	} else if ((x * y) <= 8e+62) {
		tmp = z * (t * 0.0625);
	} else if ((x * y) <= 1.06e+135) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b, c)
    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), intent (in) :: c
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = c + (b * (a * (-0.25d0)))
    t_2 = c + (x * y)
    if ((x * y) <= (-7d+45)) then
        tmp = t_2
    else if ((x * y) <= 6d+25) then
        tmp = t_1
    else if ((x * y) <= 8d+62) then
        tmp = z * (t * 0.0625d0)
    else if ((x * y) <= 1.06d+135) then
        tmp = t_1
    else
        tmp = t_2
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
	double t_1 = c + (b * (a * -0.25));
	double t_2 = c + (x * y);
	double tmp;
	if ((x * y) <= -7e+45) {
		tmp = t_2;
	} else if ((x * y) <= 6e+25) {
		tmp = t_1;
	} else if ((x * y) <= 8e+62) {
		tmp = z * (t * 0.0625);
	} else if ((x * y) <= 1.06e+135) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c):
	t_1 = c + (b * (a * -0.25))
	t_2 = c + (x * y)
	tmp = 0
	if (x * y) <= -7e+45:
		tmp = t_2
	elif (x * y) <= 6e+25:
		tmp = t_1
	elif (x * y) <= 8e+62:
		tmp = z * (t * 0.0625)
	elif (x * y) <= 1.06e+135:
		tmp = t_1
	else:
		tmp = t_2
	return tmp
function code(x, y, z, t, a, b, c)
	t_1 = Float64(c + Float64(b * Float64(a * -0.25)))
	t_2 = Float64(c + Float64(x * y))
	tmp = 0.0
	if (Float64(x * y) <= -7e+45)
		tmp = t_2;
	elseif (Float64(x * y) <= 6e+25)
		tmp = t_1;
	elseif (Float64(x * y) <= 8e+62)
		tmp = Float64(z * Float64(t * 0.0625));
	elseif (Float64(x * y) <= 1.06e+135)
		tmp = t_1;
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c)
	t_1 = c + (b * (a * -0.25));
	t_2 = c + (x * y);
	tmp = 0.0;
	if ((x * y) <= -7e+45)
		tmp = t_2;
	elseif ((x * y) <= 6e+25)
		tmp = t_1;
	elseif ((x * y) <= 8e+62)
		tmp = z * (t * 0.0625);
	elseif ((x * y) <= 1.06e+135)
		tmp = t_1;
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(c + N[(b * N[(a * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(c + N[(x * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -7e+45], t$95$2, If[LessEqual[N[(x * y), $MachinePrecision], 6e+25], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 8e+62], N[(z * N[(t * 0.0625), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1.06e+135], t$95$1, t$95$2]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := c + b \cdot \left(a \cdot -0.25\right)\\
t_2 := c + x \cdot y\\
\mathbf{if}\;x \cdot y \leq -7 \cdot 10^{+45}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;x \cdot y \leq 6 \cdot 10^{+25}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \cdot y \leq 8 \cdot 10^{+62}:\\
\;\;\;\;z \cdot \left(t \cdot 0.0625\right)\\

\mathbf{elif}\;x \cdot y \leq 1.06 \cdot 10^{+135}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x y) < -7.00000000000000046e45 or 1.06e135 < (*.f64 x y)

    1. Initial program 94.1%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 76.6%

      \[\leadsto \color{blue}{x \cdot y} + c \]

    if -7.00000000000000046e45 < (*.f64 x y) < 6.00000000000000011e25 or 8.00000000000000028e62 < (*.f64 x y) < 1.06e135

    1. Initial program 98.0%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in a around inf 63.4%

      \[\leadsto \color{blue}{-0.25 \cdot \left(a \cdot b\right)} + c \]
    4. Step-by-step derivation
      1. *-commutative63.4%

        \[\leadsto \color{blue}{\left(a \cdot b\right) \cdot -0.25} + c \]
      2. *-commutative63.4%

        \[\leadsto \color{blue}{\left(b \cdot a\right)} \cdot -0.25 + c \]
      3. associate-*r*63.4%

        \[\leadsto \color{blue}{b \cdot \left(a \cdot -0.25\right)} + c \]
    5. Simplified63.4%

      \[\leadsto \color{blue}{b \cdot \left(a \cdot -0.25\right)} + c \]

    if 6.00000000000000011e25 < (*.f64 x y) < 8.00000000000000028e62

    1. Initial program 100.0%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 92.8%

      \[\leadsto \color{blue}{\left(c + 0.0625 \cdot \left(t \cdot z\right)\right) - 0.25 \cdot \left(a \cdot b\right)} \]
    4. Step-by-step derivation
      1. *-commutative92.8%

        \[\leadsto \left(c + 0.0625 \cdot \left(t \cdot z\right)\right) - \color{blue}{\left(a \cdot b\right) \cdot 0.25} \]
      2. +-commutative92.8%

        \[\leadsto \color{blue}{\left(0.0625 \cdot \left(t \cdot z\right) + c\right)} - \left(a \cdot b\right) \cdot 0.25 \]
      3. metadata-eval92.8%

        \[\leadsto \left(0.0625 \cdot \left(t \cdot z\right) + c\right) - \left(a \cdot b\right) \cdot \color{blue}{\frac{1}{4}} \]
      4. div-inv92.8%

        \[\leadsto \left(0.0625 \cdot \left(t \cdot z\right) + c\right) - \color{blue}{\frac{a \cdot b}{4}} \]
      5. associate-*r/92.8%

        \[\leadsto \left(0.0625 \cdot \left(t \cdot z\right) + c\right) - \color{blue}{a \cdot \frac{b}{4}} \]
      6. associate--l+92.8%

        \[\leadsto \color{blue}{0.0625 \cdot \left(t \cdot z\right) + \left(c - a \cdot \frac{b}{4}\right)} \]
      7. *-commutative92.8%

        \[\leadsto \color{blue}{\left(t \cdot z\right) \cdot 0.0625} + \left(c - a \cdot \frac{b}{4}\right) \]
      8. *-commutative92.8%

        \[\leadsto \color{blue}{\left(z \cdot t\right)} \cdot 0.0625 + \left(c - a \cdot \frac{b}{4}\right) \]
      9. associate-*r*92.8%

        \[\leadsto \color{blue}{z \cdot \left(t \cdot 0.0625\right)} + \left(c - a \cdot \frac{b}{4}\right) \]
      10. div-inv92.8%

        \[\leadsto z \cdot \left(t \cdot 0.0625\right) + \left(c - a \cdot \color{blue}{\left(b \cdot \frac{1}{4}\right)}\right) \]
      11. metadata-eval92.8%

        \[\leadsto z \cdot \left(t \cdot 0.0625\right) + \left(c - a \cdot \left(b \cdot \color{blue}{0.25}\right)\right) \]
    5. Applied egg-rr92.8%

      \[\leadsto \color{blue}{z \cdot \left(t \cdot 0.0625\right) + \left(c - a \cdot \left(b \cdot 0.25\right)\right)} \]
    6. Taylor expanded in t around inf 92.6%

      \[\leadsto \color{blue}{t \cdot \left(\left(0.0625 \cdot z + \frac{c}{t}\right) - 0.25 \cdot \frac{a \cdot b}{t}\right)} \]
    7. Step-by-step derivation
      1. associate--l+92.6%

        \[\leadsto t \cdot \color{blue}{\left(0.0625 \cdot z + \left(\frac{c}{t} - 0.25 \cdot \frac{a \cdot b}{t}\right)\right)} \]
      2. associate-*r/92.6%

        \[\leadsto t \cdot \left(0.0625 \cdot z + \left(\frac{c}{t} - \color{blue}{\frac{0.25 \cdot \left(a \cdot b\right)}{t}}\right)\right) \]
      3. div-sub92.6%

        \[\leadsto t \cdot \left(0.0625 \cdot z + \color{blue}{\frac{c - 0.25 \cdot \left(a \cdot b\right)}{t}}\right) \]
      4. cancel-sign-sub-inv92.6%

        \[\leadsto t \cdot \left(0.0625 \cdot z + \frac{\color{blue}{c + \left(-0.25\right) \cdot \left(a \cdot b\right)}}{t}\right) \]
      5. metadata-eval92.6%

        \[\leadsto t \cdot \left(0.0625 \cdot z + \frac{c + \color{blue}{-0.25} \cdot \left(a \cdot b\right)}{t}\right) \]
      6. +-commutative92.6%

        \[\leadsto t \cdot \left(0.0625 \cdot z + \frac{\color{blue}{-0.25 \cdot \left(a \cdot b\right) + c}}{t}\right) \]
      7. *-commutative92.6%

        \[\leadsto t \cdot \left(0.0625 \cdot z + \frac{\color{blue}{\left(a \cdot b\right) \cdot -0.25} + c}{t}\right) \]
    8. Simplified92.6%

      \[\leadsto \color{blue}{t \cdot \left(0.0625 \cdot z + \frac{\left(a \cdot b\right) \cdot -0.25 + c}{t}\right)} \]
    9. Taylor expanded in t around inf 78.8%

      \[\leadsto \color{blue}{0.0625 \cdot \left(t \cdot z\right)} \]
    10. Step-by-step derivation
      1. associate-*r*78.8%

        \[\leadsto \color{blue}{\left(0.0625 \cdot t\right) \cdot z} \]
    11. Simplified78.8%

      \[\leadsto \color{blue}{\left(0.0625 \cdot t\right) \cdot z} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification69.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -7 \cdot 10^{+45}:\\ \;\;\;\;c + x \cdot y\\ \mathbf{elif}\;x \cdot y \leq 6 \cdot 10^{+25}:\\ \;\;\;\;c + b \cdot \left(a \cdot -0.25\right)\\ \mathbf{elif}\;x \cdot y \leq 8 \cdot 10^{+62}:\\ \;\;\;\;z \cdot \left(t \cdot 0.0625\right)\\ \mathbf{elif}\;x \cdot y \leq 1.06 \cdot 10^{+135}:\\ \;\;\;\;c + b \cdot \left(a \cdot -0.25\right)\\ \mathbf{else}:\\ \;\;\;\;c + x \cdot y\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 44.7% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \cdot y \leq -2.2 \cdot 10^{+132}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;x \cdot y \leq -5.6 \cdot 10^{+38}:\\ \;\;\;\;c\\ \mathbf{elif}\;x \cdot y \leq -1.65 \cdot 10^{-12}:\\ \;\;\;\;a \cdot \left(b \cdot -0.25\right)\\ \mathbf{elif}\;x \cdot y \leq 6.6 \cdot 10^{+134}:\\ \;\;\;\;z \cdot \left(t \cdot 0.0625\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \end{array} \]
(FPCore (x y z t a b c)
 :precision binary64
 (if (<= (* x y) -2.2e+132)
   (* x y)
   (if (<= (* x y) -5.6e+38)
     c
     (if (<= (* x y) -1.65e-12)
       (* a (* b -0.25))
       (if (<= (* x y) 6.6e+134) (* z (* t 0.0625)) (* x y))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
	double tmp;
	if ((x * y) <= -2.2e+132) {
		tmp = x * y;
	} else if ((x * y) <= -5.6e+38) {
		tmp = c;
	} else if ((x * y) <= -1.65e-12) {
		tmp = a * (b * -0.25);
	} else if ((x * y) <= 6.6e+134) {
		tmp = z * (t * 0.0625);
	} else {
		tmp = x * y;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b, c)
    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), intent (in) :: c
    real(8) :: tmp
    if ((x * y) <= (-2.2d+132)) then
        tmp = x * y
    else if ((x * y) <= (-5.6d+38)) then
        tmp = c
    else if ((x * y) <= (-1.65d-12)) then
        tmp = a * (b * (-0.25d0))
    else if ((x * y) <= 6.6d+134) then
        tmp = z * (t * 0.0625d0)
    else
        tmp = x * y
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
	double tmp;
	if ((x * y) <= -2.2e+132) {
		tmp = x * y;
	} else if ((x * y) <= -5.6e+38) {
		tmp = c;
	} else if ((x * y) <= -1.65e-12) {
		tmp = a * (b * -0.25);
	} else if ((x * y) <= 6.6e+134) {
		tmp = z * (t * 0.0625);
	} else {
		tmp = x * y;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c):
	tmp = 0
	if (x * y) <= -2.2e+132:
		tmp = x * y
	elif (x * y) <= -5.6e+38:
		tmp = c
	elif (x * y) <= -1.65e-12:
		tmp = a * (b * -0.25)
	elif (x * y) <= 6.6e+134:
		tmp = z * (t * 0.0625)
	else:
		tmp = x * y
	return tmp
function code(x, y, z, t, a, b, c)
	tmp = 0.0
	if (Float64(x * y) <= -2.2e+132)
		tmp = Float64(x * y);
	elseif (Float64(x * y) <= -5.6e+38)
		tmp = c;
	elseif (Float64(x * y) <= -1.65e-12)
		tmp = Float64(a * Float64(b * -0.25));
	elseif (Float64(x * y) <= 6.6e+134)
		tmp = Float64(z * Float64(t * 0.0625));
	else
		tmp = Float64(x * y);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c)
	tmp = 0.0;
	if ((x * y) <= -2.2e+132)
		tmp = x * y;
	elseif ((x * y) <= -5.6e+38)
		tmp = c;
	elseif ((x * y) <= -1.65e-12)
		tmp = a * (b * -0.25);
	elseif ((x * y) <= 6.6e+134)
		tmp = z * (t * 0.0625);
	else
		tmp = x * y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[N[(x * y), $MachinePrecision], -2.2e+132], N[(x * y), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], -5.6e+38], c, If[LessEqual[N[(x * y), $MachinePrecision], -1.65e-12], N[(a * N[(b * -0.25), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 6.6e+134], N[(z * N[(t * 0.0625), $MachinePrecision]), $MachinePrecision], N[(x * y), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -2.2 \cdot 10^{+132}:\\
\;\;\;\;x \cdot y\\

\mathbf{elif}\;x \cdot y \leq -5.6 \cdot 10^{+38}:\\
\;\;\;\;c\\

\mathbf{elif}\;x \cdot y \leq -1.65 \cdot 10^{-12}:\\
\;\;\;\;a \cdot \left(b \cdot -0.25\right)\\

\mathbf{elif}\;x \cdot y \leq 6.6 \cdot 10^{+134}:\\
\;\;\;\;z \cdot \left(t \cdot 0.0625\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 x y) < -2.19999999999999989e132 or 6.6e134 < (*.f64 x y)

    1. Initial program 94.1%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 85.0%

      \[\leadsto \color{blue}{\left(c + x \cdot y\right) - 0.25 \cdot \left(a \cdot b\right)} \]
    4. Taylor expanded in x around inf 85.3%

      \[\leadsto \color{blue}{x \cdot \left(\left(y + \frac{c}{x}\right) - 0.25 \cdot \frac{a \cdot b}{x}\right)} \]
    5. Step-by-step derivation
      1. associate--l+85.3%

        \[\leadsto x \cdot \color{blue}{\left(y + \left(\frac{c}{x} - 0.25 \cdot \frac{a \cdot b}{x}\right)\right)} \]
      2. associate-*r/85.3%

        \[\leadsto x \cdot \left(y + \left(\frac{c}{x} - \color{blue}{\frac{0.25 \cdot \left(a \cdot b\right)}{x}}\right)\right) \]
      3. div-sub85.3%

        \[\leadsto x \cdot \left(y + \color{blue}{\frac{c - 0.25 \cdot \left(a \cdot b\right)}{x}}\right) \]
      4. cancel-sign-sub-inv85.3%

        \[\leadsto x \cdot \left(y + \frac{\color{blue}{c + \left(-0.25\right) \cdot \left(a \cdot b\right)}}{x}\right) \]
      5. metadata-eval85.3%

        \[\leadsto x \cdot \left(y + \frac{c + \color{blue}{-0.25} \cdot \left(a \cdot b\right)}{x}\right) \]
      6. +-commutative85.3%

        \[\leadsto x \cdot \left(y + \frac{\color{blue}{-0.25 \cdot \left(a \cdot b\right) + c}}{x}\right) \]
      7. *-commutative85.3%

        \[\leadsto x \cdot \left(y + \frac{\color{blue}{\left(a \cdot b\right) \cdot -0.25} + c}{x}\right) \]
    6. Simplified85.3%

      \[\leadsto \color{blue}{x \cdot \left(y + \frac{\left(a \cdot b\right) \cdot -0.25 + c}{x}\right)} \]
    7. Taylor expanded in x around inf 76.6%

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

    if -2.19999999999999989e132 < (*.f64 x y) < -5.6e38

    1. Initial program 94.7%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in c around inf 40.4%

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

    if -5.6e38 < (*.f64 x y) < -1.65e-12

    1. Initial program 100.0%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 83.5%

      \[\leadsto \color{blue}{\left(c + 0.0625 \cdot \left(t \cdot z\right)\right) - 0.25 \cdot \left(a \cdot b\right)} \]
    4. Step-by-step derivation
      1. *-commutative83.5%

        \[\leadsto \left(c + 0.0625 \cdot \left(t \cdot z\right)\right) - \color{blue}{\left(a \cdot b\right) \cdot 0.25} \]
      2. +-commutative83.5%

        \[\leadsto \color{blue}{\left(0.0625 \cdot \left(t \cdot z\right) + c\right)} - \left(a \cdot b\right) \cdot 0.25 \]
      3. metadata-eval83.5%

        \[\leadsto \left(0.0625 \cdot \left(t \cdot z\right) + c\right) - \left(a \cdot b\right) \cdot \color{blue}{\frac{1}{4}} \]
      4. div-inv83.5%

        \[\leadsto \left(0.0625 \cdot \left(t \cdot z\right) + c\right) - \color{blue}{\frac{a \cdot b}{4}} \]
      5. associate-*r/83.5%

        \[\leadsto \left(0.0625 \cdot \left(t \cdot z\right) + c\right) - \color{blue}{a \cdot \frac{b}{4}} \]
      6. associate--l+83.5%

        \[\leadsto \color{blue}{0.0625 \cdot \left(t \cdot z\right) + \left(c - a \cdot \frac{b}{4}\right)} \]
      7. *-commutative83.5%

        \[\leadsto \color{blue}{\left(t \cdot z\right) \cdot 0.0625} + \left(c - a \cdot \frac{b}{4}\right) \]
      8. *-commutative83.5%

        \[\leadsto \color{blue}{\left(z \cdot t\right)} \cdot 0.0625 + \left(c - a \cdot \frac{b}{4}\right) \]
      9. associate-*r*83.5%

        \[\leadsto \color{blue}{z \cdot \left(t \cdot 0.0625\right)} + \left(c - a \cdot \frac{b}{4}\right) \]
      10. div-inv83.5%

        \[\leadsto z \cdot \left(t \cdot 0.0625\right) + \left(c - a \cdot \color{blue}{\left(b \cdot \frac{1}{4}\right)}\right) \]
      11. metadata-eval83.5%

        \[\leadsto z \cdot \left(t \cdot 0.0625\right) + \left(c - a \cdot \left(b \cdot \color{blue}{0.25}\right)\right) \]
    5. Applied egg-rr83.5%

      \[\leadsto \color{blue}{z \cdot \left(t \cdot 0.0625\right) + \left(c - a \cdot \left(b \cdot 0.25\right)\right)} \]
    6. Taylor expanded in t around inf 75.1%

      \[\leadsto \color{blue}{t \cdot \left(\left(0.0625 \cdot z + \frac{c}{t}\right) - 0.25 \cdot \frac{a \cdot b}{t}\right)} \]
    7. Step-by-step derivation
      1. associate--l+75.1%

        \[\leadsto t \cdot \color{blue}{\left(0.0625 \cdot z + \left(\frac{c}{t} - 0.25 \cdot \frac{a \cdot b}{t}\right)\right)} \]
      2. associate-*r/75.1%

        \[\leadsto t \cdot \left(0.0625 \cdot z + \left(\frac{c}{t} - \color{blue}{\frac{0.25 \cdot \left(a \cdot b\right)}{t}}\right)\right) \]
      3. div-sub75.1%

        \[\leadsto t \cdot \left(0.0625 \cdot z + \color{blue}{\frac{c - 0.25 \cdot \left(a \cdot b\right)}{t}}\right) \]
      4. cancel-sign-sub-inv75.1%

        \[\leadsto t \cdot \left(0.0625 \cdot z + \frac{\color{blue}{c + \left(-0.25\right) \cdot \left(a \cdot b\right)}}{t}\right) \]
      5. metadata-eval75.1%

        \[\leadsto t \cdot \left(0.0625 \cdot z + \frac{c + \color{blue}{-0.25} \cdot \left(a \cdot b\right)}{t}\right) \]
      6. +-commutative75.1%

        \[\leadsto t \cdot \left(0.0625 \cdot z + \frac{\color{blue}{-0.25 \cdot \left(a \cdot b\right) + c}}{t}\right) \]
      7. *-commutative75.1%

        \[\leadsto t \cdot \left(0.0625 \cdot z + \frac{\color{blue}{\left(a \cdot b\right) \cdot -0.25} + c}{t}\right) \]
    8. Simplified75.1%

      \[\leadsto \color{blue}{t \cdot \left(0.0625 \cdot z + \frac{\left(a \cdot b\right) \cdot -0.25 + c}{t}\right)} \]
    9. Taylor expanded in a around inf 47.2%

      \[\leadsto \color{blue}{-0.25 \cdot \left(a \cdot b\right)} \]
    10. Step-by-step derivation
      1. *-commutative47.2%

        \[\leadsto \color{blue}{\left(a \cdot b\right) \cdot -0.25} \]
      2. associate-*r*47.2%

        \[\leadsto \color{blue}{a \cdot \left(b \cdot -0.25\right)} \]
      3. *-commutative47.2%

        \[\leadsto a \cdot \color{blue}{\left(-0.25 \cdot b\right)} \]
    11. Simplified47.2%

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

    if -1.65e-12 < (*.f64 x y) < 6.6e134

    1. Initial program 98.0%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 96.2%

      \[\leadsto \color{blue}{\left(c + 0.0625 \cdot \left(t \cdot z\right)\right) - 0.25 \cdot \left(a \cdot b\right)} \]
    4. Step-by-step derivation
      1. *-commutative96.2%

        \[\leadsto \left(c + 0.0625 \cdot \left(t \cdot z\right)\right) - \color{blue}{\left(a \cdot b\right) \cdot 0.25} \]
      2. +-commutative96.2%

        \[\leadsto \color{blue}{\left(0.0625 \cdot \left(t \cdot z\right) + c\right)} - \left(a \cdot b\right) \cdot 0.25 \]
      3. metadata-eval96.2%

        \[\leadsto \left(0.0625 \cdot \left(t \cdot z\right) + c\right) - \left(a \cdot b\right) \cdot \color{blue}{\frac{1}{4}} \]
      4. div-inv96.2%

        \[\leadsto \left(0.0625 \cdot \left(t \cdot z\right) + c\right) - \color{blue}{\frac{a \cdot b}{4}} \]
      5. associate-*r/96.2%

        \[\leadsto \left(0.0625 \cdot \left(t \cdot z\right) + c\right) - \color{blue}{a \cdot \frac{b}{4}} \]
      6. associate--l+96.2%

        \[\leadsto \color{blue}{0.0625 \cdot \left(t \cdot z\right) + \left(c - a \cdot \frac{b}{4}\right)} \]
      7. *-commutative96.2%

        \[\leadsto \color{blue}{\left(t \cdot z\right) \cdot 0.0625} + \left(c - a \cdot \frac{b}{4}\right) \]
      8. *-commutative96.2%

        \[\leadsto \color{blue}{\left(z \cdot t\right)} \cdot 0.0625 + \left(c - a \cdot \frac{b}{4}\right) \]
      9. associate-*r*96.7%

        \[\leadsto \color{blue}{z \cdot \left(t \cdot 0.0625\right)} + \left(c - a \cdot \frac{b}{4}\right) \]
      10. div-inv96.7%

        \[\leadsto z \cdot \left(t \cdot 0.0625\right) + \left(c - a \cdot \color{blue}{\left(b \cdot \frac{1}{4}\right)}\right) \]
      11. metadata-eval96.7%

        \[\leadsto z \cdot \left(t \cdot 0.0625\right) + \left(c - a \cdot \left(b \cdot \color{blue}{0.25}\right)\right) \]
    5. Applied egg-rr96.7%

      \[\leadsto \color{blue}{z \cdot \left(t \cdot 0.0625\right) + \left(c - a \cdot \left(b \cdot 0.25\right)\right)} \]
    6. Taylor expanded in t around inf 84.8%

      \[\leadsto \color{blue}{t \cdot \left(\left(0.0625 \cdot z + \frac{c}{t}\right) - 0.25 \cdot \frac{a \cdot b}{t}\right)} \]
    7. Step-by-step derivation
      1. associate--l+84.8%

        \[\leadsto t \cdot \color{blue}{\left(0.0625 \cdot z + \left(\frac{c}{t} - 0.25 \cdot \frac{a \cdot b}{t}\right)\right)} \]
      2. associate-*r/84.8%

        \[\leadsto t \cdot \left(0.0625 \cdot z + \left(\frac{c}{t} - \color{blue}{\frac{0.25 \cdot \left(a \cdot b\right)}{t}}\right)\right) \]
      3. div-sub84.9%

        \[\leadsto t \cdot \left(0.0625 \cdot z + \color{blue}{\frac{c - 0.25 \cdot \left(a \cdot b\right)}{t}}\right) \]
      4. cancel-sign-sub-inv84.9%

        \[\leadsto t \cdot \left(0.0625 \cdot z + \frac{\color{blue}{c + \left(-0.25\right) \cdot \left(a \cdot b\right)}}{t}\right) \]
      5. metadata-eval84.9%

        \[\leadsto t \cdot \left(0.0625 \cdot z + \frac{c + \color{blue}{-0.25} \cdot \left(a \cdot b\right)}{t}\right) \]
      6. +-commutative84.9%

        \[\leadsto t \cdot \left(0.0625 \cdot z + \frac{\color{blue}{-0.25 \cdot \left(a \cdot b\right) + c}}{t}\right) \]
      7. *-commutative84.9%

        \[\leadsto t \cdot \left(0.0625 \cdot z + \frac{\color{blue}{\left(a \cdot b\right) \cdot -0.25} + c}{t}\right) \]
    8. Simplified84.9%

      \[\leadsto \color{blue}{t \cdot \left(0.0625 \cdot z + \frac{\left(a \cdot b\right) \cdot -0.25 + c}{t}\right)} \]
    9. Taylor expanded in t around inf 38.5%

      \[\leadsto \color{blue}{0.0625 \cdot \left(t \cdot z\right)} \]
    10. Step-by-step derivation
      1. associate-*r*38.9%

        \[\leadsto \color{blue}{\left(0.0625 \cdot t\right) \cdot z} \]
    11. Simplified38.9%

      \[\leadsto \color{blue}{\left(0.0625 \cdot t\right) \cdot z} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification51.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -2.2 \cdot 10^{+132}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;x \cdot y \leq -5.6 \cdot 10^{+38}:\\ \;\;\;\;c\\ \mathbf{elif}\;x \cdot y \leq -1.65 \cdot 10^{-12}:\\ \;\;\;\;a \cdot \left(b \cdot -0.25\right)\\ \mathbf{elif}\;x \cdot y \leq 6.6 \cdot 10^{+134}:\\ \;\;\;\;z \cdot \left(t \cdot 0.0625\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 88.8% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \cdot b \leq -1 \cdot 10^{+242}:\\ \;\;\;\;b \cdot \left(0.0625 \cdot \frac{z \cdot t}{b} - a \cdot 0.25\right)\\ \mathbf{elif}\;a \cdot b \leq -4 \cdot 10^{+158} \lor \neg \left(a \cdot b \leq 2 \cdot 10^{-23}\right):\\ \;\;\;\;\left(c + x \cdot y\right) - \left(a \cdot b\right) \cdot 0.25\\ \mathbf{else}:\\ \;\;\;\;c + \left(x \cdot y + 0.0625 \cdot \left(z \cdot t\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b c)
 :precision binary64
 (if (<= (* a b) -1e+242)
   (* b (- (* 0.0625 (/ (* z t) b)) (* a 0.25)))
   (if (or (<= (* a b) -4e+158) (not (<= (* a b) 2e-23)))
     (- (+ c (* x y)) (* (* a b) 0.25))
     (+ c (+ (* x y) (* 0.0625 (* z t)))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
	double tmp;
	if ((a * b) <= -1e+242) {
		tmp = b * ((0.0625 * ((z * t) / b)) - (a * 0.25));
	} else if (((a * b) <= -4e+158) || !((a * b) <= 2e-23)) {
		tmp = (c + (x * y)) - ((a * b) * 0.25);
	} else {
		tmp = c + ((x * y) + (0.0625 * (z * t)));
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b, c)
    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), intent (in) :: c
    real(8) :: tmp
    if ((a * b) <= (-1d+242)) then
        tmp = b * ((0.0625d0 * ((z * t) / b)) - (a * 0.25d0))
    else if (((a * b) <= (-4d+158)) .or. (.not. ((a * b) <= 2d-23))) then
        tmp = (c + (x * y)) - ((a * b) * 0.25d0)
    else
        tmp = c + ((x * y) + (0.0625d0 * (z * t)))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
	double tmp;
	if ((a * b) <= -1e+242) {
		tmp = b * ((0.0625 * ((z * t) / b)) - (a * 0.25));
	} else if (((a * b) <= -4e+158) || !((a * b) <= 2e-23)) {
		tmp = (c + (x * y)) - ((a * b) * 0.25);
	} else {
		tmp = c + ((x * y) + (0.0625 * (z * t)));
	}
	return tmp;
}
def code(x, y, z, t, a, b, c):
	tmp = 0
	if (a * b) <= -1e+242:
		tmp = b * ((0.0625 * ((z * t) / b)) - (a * 0.25))
	elif ((a * b) <= -4e+158) or not ((a * b) <= 2e-23):
		tmp = (c + (x * y)) - ((a * b) * 0.25)
	else:
		tmp = c + ((x * y) + (0.0625 * (z * t)))
	return tmp
function code(x, y, z, t, a, b, c)
	tmp = 0.0
	if (Float64(a * b) <= -1e+242)
		tmp = Float64(b * Float64(Float64(0.0625 * Float64(Float64(z * t) / b)) - Float64(a * 0.25)));
	elseif ((Float64(a * b) <= -4e+158) || !(Float64(a * b) <= 2e-23))
		tmp = Float64(Float64(c + Float64(x * y)) - Float64(Float64(a * b) * 0.25));
	else
		tmp = Float64(c + Float64(Float64(x * y) + Float64(0.0625 * Float64(z * t))));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c)
	tmp = 0.0;
	if ((a * b) <= -1e+242)
		tmp = b * ((0.0625 * ((z * t) / b)) - (a * 0.25));
	elseif (((a * b) <= -4e+158) || ~(((a * b) <= 2e-23)))
		tmp = (c + (x * y)) - ((a * b) * 0.25);
	else
		tmp = c + ((x * y) + (0.0625 * (z * t)));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[N[(a * b), $MachinePrecision], -1e+242], N[(b * N[(N[(0.0625 * N[(N[(z * t), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision] - N[(a * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[N[(a * b), $MachinePrecision], -4e+158], N[Not[LessEqual[N[(a * b), $MachinePrecision], 2e-23]], $MachinePrecision]], N[(N[(c + N[(x * y), $MachinePrecision]), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision], N[(c + N[(N[(x * y), $MachinePrecision] + N[(0.0625 * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -1 \cdot 10^{+242}:\\
\;\;\;\;b \cdot \left(0.0625 \cdot \frac{z \cdot t}{b} - a \cdot 0.25\right)\\

\mathbf{elif}\;a \cdot b \leq -4 \cdot 10^{+158} \lor \neg \left(a \cdot b \leq 2 \cdot 10^{-23}\right):\\
\;\;\;\;\left(c + x \cdot y\right) - \left(a \cdot b\right) \cdot 0.25\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 a b) < -1.00000000000000005e242

    1. Initial program 88.6%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 86.1%

      \[\leadsto \color{blue}{\left(c + 0.0625 \cdot \left(t \cdot z\right)\right) - 0.25 \cdot \left(a \cdot b\right)} \]
    4. Step-by-step derivation
      1. *-commutative86.1%

        \[\leadsto \left(c + 0.0625 \cdot \left(t \cdot z\right)\right) - \color{blue}{\left(a \cdot b\right) \cdot 0.25} \]
      2. +-commutative86.1%

        \[\leadsto \color{blue}{\left(0.0625 \cdot \left(t \cdot z\right) + c\right)} - \left(a \cdot b\right) \cdot 0.25 \]
      3. metadata-eval86.1%

        \[\leadsto \left(0.0625 \cdot \left(t \cdot z\right) + c\right) - \left(a \cdot b\right) \cdot \color{blue}{\frac{1}{4}} \]
      4. div-inv86.1%

        \[\leadsto \left(0.0625 \cdot \left(t \cdot z\right) + c\right) - \color{blue}{\frac{a \cdot b}{4}} \]
      5. associate-*r/86.1%

        \[\leadsto \left(0.0625 \cdot \left(t \cdot z\right) + c\right) - \color{blue}{a \cdot \frac{b}{4}} \]
      6. associate--l+86.1%

        \[\leadsto \color{blue}{0.0625 \cdot \left(t \cdot z\right) + \left(c - a \cdot \frac{b}{4}\right)} \]
      7. *-commutative86.1%

        \[\leadsto \color{blue}{\left(t \cdot z\right) \cdot 0.0625} + \left(c - a \cdot \frac{b}{4}\right) \]
      8. *-commutative86.1%

        \[\leadsto \color{blue}{\left(z \cdot t\right)} \cdot 0.0625 + \left(c - a \cdot \frac{b}{4}\right) \]
      9. associate-*r*88.5%

        \[\leadsto \color{blue}{z \cdot \left(t \cdot 0.0625\right)} + \left(c - a \cdot \frac{b}{4}\right) \]
      10. div-inv88.5%

        \[\leadsto z \cdot \left(t \cdot 0.0625\right) + \left(c - a \cdot \color{blue}{\left(b \cdot \frac{1}{4}\right)}\right) \]
      11. metadata-eval88.5%

        \[\leadsto z \cdot \left(t \cdot 0.0625\right) + \left(c - a \cdot \left(b \cdot \color{blue}{0.25}\right)\right) \]
    5. Applied egg-rr88.5%

      \[\leadsto \color{blue}{z \cdot \left(t \cdot 0.0625\right) + \left(c - a \cdot \left(b \cdot 0.25\right)\right)} \]
    6. Taylor expanded in c around 0 83.1%

      \[\leadsto \color{blue}{0.0625 \cdot \left(t \cdot z\right) - 0.25 \cdot \left(a \cdot b\right)} \]
    7. Taylor expanded in b around inf 89.0%

      \[\leadsto \color{blue}{b \cdot \left(0.0625 \cdot \frac{t \cdot z}{b} - 0.25 \cdot a\right)} \]

    if -1.00000000000000005e242 < (*.f64 a b) < -3.99999999999999981e158 or 1.99999999999999992e-23 < (*.f64 a b)

    1. Initial program 94.4%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 85.1%

      \[\leadsto \color{blue}{\left(c + x \cdot y\right) - 0.25 \cdot \left(a \cdot b\right)} \]

    if -3.99999999999999981e158 < (*.f64 a b) < 1.99999999999999992e-23

    1. Initial program 99.3%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in a around 0 95.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot b \leq -1 \cdot 10^{+242}:\\ \;\;\;\;b \cdot \left(0.0625 \cdot \frac{z \cdot t}{b} - a \cdot 0.25\right)\\ \mathbf{elif}\;a \cdot b \leq -4 \cdot 10^{+158} \lor \neg \left(a \cdot b \leq 2 \cdot 10^{-23}\right):\\ \;\;\;\;\left(c + x \cdot y\right) - \left(a \cdot b\right) \cdot 0.25\\ \mathbf{else}:\\ \;\;\;\;c + \left(x \cdot y + 0.0625 \cdot \left(z \cdot t\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 89.8% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -5 \cdot 10^{+46} \lor \neg \left(x \cdot y \leq 5 \cdot 10^{+134}\right):\\
\;\;\;\;c + \left(x \cdot y + 0.0625 \cdot \left(z \cdot t\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x y) < -5.0000000000000002e46 or 4.99999999999999981e134 < (*.f64 x y)

    1. Initial program 94.1%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in a around 0 86.5%

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

    if -5.0000000000000002e46 < (*.f64 x y) < 4.99999999999999981e134

    1. Initial program 98.1%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 95.3%

      \[\leadsto \color{blue}{\left(c + 0.0625 \cdot \left(t \cdot z\right)\right) - 0.25 \cdot \left(a \cdot b\right)} \]
    4. Step-by-step derivation
      1. *-commutative95.3%

        \[\leadsto \left(c + 0.0625 \cdot \left(t \cdot z\right)\right) - \color{blue}{\left(a \cdot b\right) \cdot 0.25} \]
      2. +-commutative95.3%

        \[\leadsto \color{blue}{\left(0.0625 \cdot \left(t \cdot z\right) + c\right)} - \left(a \cdot b\right) \cdot 0.25 \]
      3. metadata-eval95.3%

        \[\leadsto \left(0.0625 \cdot \left(t \cdot z\right) + c\right) - \left(a \cdot b\right) \cdot \color{blue}{\frac{1}{4}} \]
      4. div-inv95.3%

        \[\leadsto \left(0.0625 \cdot \left(t \cdot z\right) + c\right) - \color{blue}{\frac{a \cdot b}{4}} \]
      5. associate-*r/95.3%

        \[\leadsto \left(0.0625 \cdot \left(t \cdot z\right) + c\right) - \color{blue}{a \cdot \frac{b}{4}} \]
      6. associate--l+95.3%

        \[\leadsto \color{blue}{0.0625 \cdot \left(t \cdot z\right) + \left(c - a \cdot \frac{b}{4}\right)} \]
      7. *-commutative95.3%

        \[\leadsto \color{blue}{\left(t \cdot z\right) \cdot 0.0625} + \left(c - a \cdot \frac{b}{4}\right) \]
      8. *-commutative95.3%

        \[\leadsto \color{blue}{\left(z \cdot t\right)} \cdot 0.0625 + \left(c - a \cdot \frac{b}{4}\right) \]
      9. associate-*r*95.8%

        \[\leadsto \color{blue}{z \cdot \left(t \cdot 0.0625\right)} + \left(c - a \cdot \frac{b}{4}\right) \]
      10. div-inv95.8%

        \[\leadsto z \cdot \left(t \cdot 0.0625\right) + \left(c - a \cdot \color{blue}{\left(b \cdot \frac{1}{4}\right)}\right) \]
      11. metadata-eval95.8%

        \[\leadsto z \cdot \left(t \cdot 0.0625\right) + \left(c - a \cdot \left(b \cdot \color{blue}{0.25}\right)\right) \]
    5. Applied egg-rr95.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -5 \cdot 10^{+46} \lor \neg \left(x \cdot y \leq 5 \cdot 10^{+134}\right):\\ \;\;\;\;c + \left(x \cdot y + 0.0625 \cdot \left(z \cdot t\right)\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(t \cdot 0.0625\right) + \left(c - a \cdot \left(b \cdot 0.25\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 54.7% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := c + x \cdot y\\ t_2 := a \cdot \left(b \cdot -0.25\right)\\ \mathbf{if}\;a \leq -1.7 \cdot 10^{+188}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;a \leq -380:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;a \leq -1.6 \cdot 10^{-12}:\\ \;\;\;\;z \cdot \left(t \cdot 0.0625\right)\\ \mathbf{elif}\;a \leq 4.5 \cdot 10^{+23}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
(FPCore (x y z t a b c)
 :precision binary64
 (let* ((t_1 (+ c (* x y))) (t_2 (* a (* b -0.25))))
   (if (<= a -1.7e+188)
     t_2
     (if (<= a -380.0)
       t_1
       (if (<= a -1.6e-12) (* z (* t 0.0625)) (if (<= a 4.5e+23) t_1 t_2))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
	double t_1 = c + (x * y);
	double t_2 = a * (b * -0.25);
	double tmp;
	if (a <= -1.7e+188) {
		tmp = t_2;
	} else if (a <= -380.0) {
		tmp = t_1;
	} else if (a <= -1.6e-12) {
		tmp = z * (t * 0.0625);
	} else if (a <= 4.5e+23) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b, c)
    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), intent (in) :: c
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = c + (x * y)
    t_2 = a * (b * (-0.25d0))
    if (a <= (-1.7d+188)) then
        tmp = t_2
    else if (a <= (-380.0d0)) then
        tmp = t_1
    else if (a <= (-1.6d-12)) then
        tmp = z * (t * 0.0625d0)
    else if (a <= 4.5d+23) then
        tmp = t_1
    else
        tmp = t_2
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
	double t_1 = c + (x * y);
	double t_2 = a * (b * -0.25);
	double tmp;
	if (a <= -1.7e+188) {
		tmp = t_2;
	} else if (a <= -380.0) {
		tmp = t_1;
	} else if (a <= -1.6e-12) {
		tmp = z * (t * 0.0625);
	} else if (a <= 4.5e+23) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c):
	t_1 = c + (x * y)
	t_2 = a * (b * -0.25)
	tmp = 0
	if a <= -1.7e+188:
		tmp = t_2
	elif a <= -380.0:
		tmp = t_1
	elif a <= -1.6e-12:
		tmp = z * (t * 0.0625)
	elif a <= 4.5e+23:
		tmp = t_1
	else:
		tmp = t_2
	return tmp
function code(x, y, z, t, a, b, c)
	t_1 = Float64(c + Float64(x * y))
	t_2 = Float64(a * Float64(b * -0.25))
	tmp = 0.0
	if (a <= -1.7e+188)
		tmp = t_2;
	elseif (a <= -380.0)
		tmp = t_1;
	elseif (a <= -1.6e-12)
		tmp = Float64(z * Float64(t * 0.0625));
	elseif (a <= 4.5e+23)
		tmp = t_1;
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c)
	t_1 = c + (x * y);
	t_2 = a * (b * -0.25);
	tmp = 0.0;
	if (a <= -1.7e+188)
		tmp = t_2;
	elseif (a <= -380.0)
		tmp = t_1;
	elseif (a <= -1.6e-12)
		tmp = z * (t * 0.0625);
	elseif (a <= 4.5e+23)
		tmp = t_1;
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(c + N[(x * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(a * N[(b * -0.25), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -1.7e+188], t$95$2, If[LessEqual[a, -380.0], t$95$1, If[LessEqual[a, -1.6e-12], N[(z * N[(t * 0.0625), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 4.5e+23], t$95$1, t$95$2]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := c + x \cdot y\\
t_2 := a \cdot \left(b \cdot -0.25\right)\\
\mathbf{if}\;a \leq -1.7 \cdot 10^{+188}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;a \leq -380:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;a \leq -1.6 \cdot 10^{-12}:\\
\;\;\;\;z \cdot \left(t \cdot 0.0625\right)\\

\mathbf{elif}\;a \leq 4.5 \cdot 10^{+23}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if a < -1.69999999999999998e188 or 4.49999999999999979e23 < a

    1. Initial program 94.3%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 80.4%

      \[\leadsto \color{blue}{\left(c + 0.0625 \cdot \left(t \cdot z\right)\right) - 0.25 \cdot \left(a \cdot b\right)} \]
    4. Step-by-step derivation
      1. *-commutative80.4%

        \[\leadsto \left(c + 0.0625 \cdot \left(t \cdot z\right)\right) - \color{blue}{\left(a \cdot b\right) \cdot 0.25} \]
      2. +-commutative80.4%

        \[\leadsto \color{blue}{\left(0.0625 \cdot \left(t \cdot z\right) + c\right)} - \left(a \cdot b\right) \cdot 0.25 \]
      3. metadata-eval80.4%

        \[\leadsto \left(0.0625 \cdot \left(t \cdot z\right) + c\right) - \left(a \cdot b\right) \cdot \color{blue}{\frac{1}{4}} \]
      4. div-inv80.4%

        \[\leadsto \left(0.0625 \cdot \left(t \cdot z\right) + c\right) - \color{blue}{\frac{a \cdot b}{4}} \]
      5. associate-*r/80.4%

        \[\leadsto \left(0.0625 \cdot \left(t \cdot z\right) + c\right) - \color{blue}{a \cdot \frac{b}{4}} \]
      6. associate--l+80.4%

        \[\leadsto \color{blue}{0.0625 \cdot \left(t \cdot z\right) + \left(c - a \cdot \frac{b}{4}\right)} \]
      7. *-commutative80.4%

        \[\leadsto \color{blue}{\left(t \cdot z\right) \cdot 0.0625} + \left(c - a \cdot \frac{b}{4}\right) \]
      8. *-commutative80.4%

        \[\leadsto \color{blue}{\left(z \cdot t\right)} \cdot 0.0625 + \left(c - a \cdot \frac{b}{4}\right) \]
      9. associate-*r*80.4%

        \[\leadsto \color{blue}{z \cdot \left(t \cdot 0.0625\right)} + \left(c - a \cdot \frac{b}{4}\right) \]
      10. div-inv80.4%

        \[\leadsto z \cdot \left(t \cdot 0.0625\right) + \left(c - a \cdot \color{blue}{\left(b \cdot \frac{1}{4}\right)}\right) \]
      11. metadata-eval80.4%

        \[\leadsto z \cdot \left(t \cdot 0.0625\right) + \left(c - a \cdot \left(b \cdot \color{blue}{0.25}\right)\right) \]
    5. Applied egg-rr80.4%

      \[\leadsto \color{blue}{z \cdot \left(t \cdot 0.0625\right) + \left(c - a \cdot \left(b \cdot 0.25\right)\right)} \]
    6. Taylor expanded in t around inf 71.0%

      \[\leadsto \color{blue}{t \cdot \left(\left(0.0625 \cdot z + \frac{c}{t}\right) - 0.25 \cdot \frac{a \cdot b}{t}\right)} \]
    7. Step-by-step derivation
      1. associate--l+71.0%

        \[\leadsto t \cdot \color{blue}{\left(0.0625 \cdot z + \left(\frac{c}{t} - 0.25 \cdot \frac{a \cdot b}{t}\right)\right)} \]
      2. associate-*r/71.0%

        \[\leadsto t \cdot \left(0.0625 \cdot z + \left(\frac{c}{t} - \color{blue}{\frac{0.25 \cdot \left(a \cdot b\right)}{t}}\right)\right) \]
      3. div-sub72.2%

        \[\leadsto t \cdot \left(0.0625 \cdot z + \color{blue}{\frac{c - 0.25 \cdot \left(a \cdot b\right)}{t}}\right) \]
      4. cancel-sign-sub-inv72.2%

        \[\leadsto t \cdot \left(0.0625 \cdot z + \frac{\color{blue}{c + \left(-0.25\right) \cdot \left(a \cdot b\right)}}{t}\right) \]
      5. metadata-eval72.2%

        \[\leadsto t \cdot \left(0.0625 \cdot z + \frac{c + \color{blue}{-0.25} \cdot \left(a \cdot b\right)}{t}\right) \]
      6. +-commutative72.2%

        \[\leadsto t \cdot \left(0.0625 \cdot z + \frac{\color{blue}{-0.25 \cdot \left(a \cdot b\right) + c}}{t}\right) \]
      7. *-commutative72.2%

        \[\leadsto t \cdot \left(0.0625 \cdot z + \frac{\color{blue}{\left(a \cdot b\right) \cdot -0.25} + c}{t}\right) \]
    8. Simplified72.2%

      \[\leadsto \color{blue}{t \cdot \left(0.0625 \cdot z + \frac{\left(a \cdot b\right) \cdot -0.25 + c}{t}\right)} \]
    9. Taylor expanded in a around inf 50.6%

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

        \[\leadsto \color{blue}{\left(a \cdot b\right) \cdot -0.25} \]
      2. associate-*r*50.6%

        \[\leadsto \color{blue}{a \cdot \left(b \cdot -0.25\right)} \]
      3. *-commutative50.6%

        \[\leadsto a \cdot \color{blue}{\left(-0.25 \cdot b\right)} \]
    11. Simplified50.6%

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

    if -1.69999999999999998e188 < a < -380 or -1.6e-12 < a < 4.49999999999999979e23

    1. Initial program 97.7%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 59.2%

      \[\leadsto \color{blue}{x \cdot y} + c \]

    if -380 < a < -1.6e-12

    1. Initial program 100.0%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 100.0%

      \[\leadsto \color{blue}{\left(c + 0.0625 \cdot \left(t \cdot z\right)\right) - 0.25 \cdot \left(a \cdot b\right)} \]
    4. Step-by-step derivation
      1. *-commutative100.0%

        \[\leadsto \left(c + 0.0625 \cdot \left(t \cdot z\right)\right) - \color{blue}{\left(a \cdot b\right) \cdot 0.25} \]
      2. +-commutative100.0%

        \[\leadsto \color{blue}{\left(0.0625 \cdot \left(t \cdot z\right) + c\right)} - \left(a \cdot b\right) \cdot 0.25 \]
      3. metadata-eval100.0%

        \[\leadsto \left(0.0625 \cdot \left(t \cdot z\right) + c\right) - \left(a \cdot b\right) \cdot \color{blue}{\frac{1}{4}} \]
      4. div-inv100.0%

        \[\leadsto \left(0.0625 \cdot \left(t \cdot z\right) + c\right) - \color{blue}{\frac{a \cdot b}{4}} \]
      5. associate-*r/100.0%

        \[\leadsto \left(0.0625 \cdot \left(t \cdot z\right) + c\right) - \color{blue}{a \cdot \frac{b}{4}} \]
      6. associate--l+100.0%

        \[\leadsto \color{blue}{0.0625 \cdot \left(t \cdot z\right) + \left(c - a \cdot \frac{b}{4}\right)} \]
      7. *-commutative100.0%

        \[\leadsto \color{blue}{\left(t \cdot z\right) \cdot 0.0625} + \left(c - a \cdot \frac{b}{4}\right) \]
      8. *-commutative100.0%

        \[\leadsto \color{blue}{\left(z \cdot t\right)} \cdot 0.0625 + \left(c - a \cdot \frac{b}{4}\right) \]
      9. associate-*r*100.0%

        \[\leadsto \color{blue}{z \cdot \left(t \cdot 0.0625\right)} + \left(c - a \cdot \frac{b}{4}\right) \]
      10. div-inv100.0%

        \[\leadsto z \cdot \left(t \cdot 0.0625\right) + \left(c - a \cdot \color{blue}{\left(b \cdot \frac{1}{4}\right)}\right) \]
      11. metadata-eval100.0%

        \[\leadsto z \cdot \left(t \cdot 0.0625\right) + \left(c - a \cdot \left(b \cdot \color{blue}{0.25}\right)\right) \]
    5. Applied egg-rr100.0%

      \[\leadsto \color{blue}{z \cdot \left(t \cdot 0.0625\right) + \left(c - a \cdot \left(b \cdot 0.25\right)\right)} \]
    6. Taylor expanded in t around inf 100.0%

      \[\leadsto \color{blue}{t \cdot \left(\left(0.0625 \cdot z + \frac{c}{t}\right) - 0.25 \cdot \frac{a \cdot b}{t}\right)} \]
    7. Step-by-step derivation
      1. associate--l+100.0%

        \[\leadsto t \cdot \color{blue}{\left(0.0625 \cdot z + \left(\frac{c}{t} - 0.25 \cdot \frac{a \cdot b}{t}\right)\right)} \]
      2. associate-*r/100.0%

        \[\leadsto t \cdot \left(0.0625 \cdot z + \left(\frac{c}{t} - \color{blue}{\frac{0.25 \cdot \left(a \cdot b\right)}{t}}\right)\right) \]
      3. div-sub100.0%

        \[\leadsto t \cdot \left(0.0625 \cdot z + \color{blue}{\frac{c - 0.25 \cdot \left(a \cdot b\right)}{t}}\right) \]
      4. cancel-sign-sub-inv100.0%

        \[\leadsto t \cdot \left(0.0625 \cdot z + \frac{\color{blue}{c + \left(-0.25\right) \cdot \left(a \cdot b\right)}}{t}\right) \]
      5. metadata-eval100.0%

        \[\leadsto t \cdot \left(0.0625 \cdot z + \frac{c + \color{blue}{-0.25} \cdot \left(a \cdot b\right)}{t}\right) \]
      6. +-commutative100.0%

        \[\leadsto t \cdot \left(0.0625 \cdot z + \frac{\color{blue}{-0.25 \cdot \left(a \cdot b\right) + c}}{t}\right) \]
      7. *-commutative100.0%

        \[\leadsto t \cdot \left(0.0625 \cdot z + \frac{\color{blue}{\left(a \cdot b\right) \cdot -0.25} + c}{t}\right) \]
    8. Simplified100.0%

      \[\leadsto \color{blue}{t \cdot \left(0.0625 \cdot z + \frac{\left(a \cdot b\right) \cdot -0.25 + c}{t}\right)} \]
    9. Taylor expanded in t around inf 100.0%

      \[\leadsto \color{blue}{0.0625 \cdot \left(t \cdot z\right)} \]
    10. Step-by-step derivation
      1. associate-*r*100.0%

        \[\leadsto \color{blue}{\left(0.0625 \cdot t\right) \cdot z} \]
    11. Simplified100.0%

      \[\leadsto \color{blue}{\left(0.0625 \cdot t\right) \cdot z} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification56.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -1.7 \cdot 10^{+188}:\\ \;\;\;\;a \cdot \left(b \cdot -0.25\right)\\ \mathbf{elif}\;a \leq -380:\\ \;\;\;\;c + x \cdot y\\ \mathbf{elif}\;a \leq -1.6 \cdot 10^{-12}:\\ \;\;\;\;z \cdot \left(t \cdot 0.0625\right)\\ \mathbf{elif}\;a \leq 4.5 \cdot 10^{+23}:\\ \;\;\;\;c + x \cdot y\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(b \cdot -0.25\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 66.8% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -4 \cdot 10^{+116} \lor \neg \left(x \cdot y \leq 10^{+103}\right):\\
\;\;\;\;x \cdot \left(y + -0.25 \cdot \frac{a \cdot b}{x}\right)\\

\mathbf{else}:\\
\;\;\;\;c + t \cdot \left(z \cdot 0.0625\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x y) < -4.00000000000000006e116 or 1e103 < (*.f64 x y)

    1. Initial program 94.7%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 85.5%

      \[\leadsto \color{blue}{\left(c + x \cdot y\right) - 0.25 \cdot \left(a \cdot b\right)} \]
    4. Taylor expanded in x around inf 83.8%

      \[\leadsto \color{blue}{x \cdot \left(\left(y + \frac{c}{x}\right) - 0.25 \cdot \frac{a \cdot b}{x}\right)} \]
    5. Step-by-step derivation
      1. associate--l+83.8%

        \[\leadsto x \cdot \color{blue}{\left(y + \left(\frac{c}{x} - 0.25 \cdot \frac{a \cdot b}{x}\right)\right)} \]
      2. associate-*r/83.8%

        \[\leadsto x \cdot \left(y + \left(\frac{c}{x} - \color{blue}{\frac{0.25 \cdot \left(a \cdot b\right)}{x}}\right)\right) \]
      3. div-sub83.8%

        \[\leadsto x \cdot \left(y + \color{blue}{\frac{c - 0.25 \cdot \left(a \cdot b\right)}{x}}\right) \]
      4. cancel-sign-sub-inv83.8%

        \[\leadsto x \cdot \left(y + \frac{\color{blue}{c + \left(-0.25\right) \cdot \left(a \cdot b\right)}}{x}\right) \]
      5. metadata-eval83.8%

        \[\leadsto x \cdot \left(y + \frac{c + \color{blue}{-0.25} \cdot \left(a \cdot b\right)}{x}\right) \]
      6. +-commutative83.8%

        \[\leadsto x \cdot \left(y + \frac{\color{blue}{-0.25 \cdot \left(a \cdot b\right) + c}}{x}\right) \]
      7. *-commutative83.8%

        \[\leadsto x \cdot \left(y + \frac{\color{blue}{\left(a \cdot b\right) \cdot -0.25} + c}{x}\right) \]
    6. Simplified83.8%

      \[\leadsto \color{blue}{x \cdot \left(y + \frac{\left(a \cdot b\right) \cdot -0.25 + c}{x}\right)} \]
    7. Taylor expanded in c around 0 80.1%

      \[\leadsto \color{blue}{x \cdot \left(y + -0.25 \cdot \frac{a \cdot b}{x}\right)} \]

    if -4.00000000000000006e116 < (*.f64 x y) < 1e103

    1. Initial program 97.6%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf 67.3%

      \[\leadsto \color{blue}{0.0625 \cdot \left(t \cdot z\right)} + c \]
    4. Step-by-step derivation
      1. associate-*r*67.6%

        \[\leadsto \color{blue}{\left(0.0625 \cdot t\right) \cdot z} + c \]
      2. *-commutative67.6%

        \[\leadsto \color{blue}{\left(t \cdot 0.0625\right)} \cdot z + c \]
      3. associate-*r*67.6%

        \[\leadsto \color{blue}{t \cdot \left(0.0625 \cdot z\right)} + c \]
    5. Simplified67.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -4 \cdot 10^{+116} \lor \neg \left(x \cdot y \leq 10^{+103}\right):\\ \;\;\;\;x \cdot \left(y + -0.25 \cdot \frac{a \cdot b}{x}\right)\\ \mathbf{else}:\\ \;\;\;\;c + t \cdot \left(z \cdot 0.0625\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 14: 88.8% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -4 \cdot 10^{+158} \lor \neg \left(a \cdot b \leq 2 \cdot 10^{-23}\right):\\
\;\;\;\;\left(c + x \cdot y\right) - \left(a \cdot b\right) \cdot 0.25\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 a b) < -3.99999999999999981e158 or 1.99999999999999992e-23 < (*.f64 a b)

    1. Initial program 92.6%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 81.5%

      \[\leadsto \color{blue}{\left(c + x \cdot y\right) - 0.25 \cdot \left(a \cdot b\right)} \]

    if -3.99999999999999981e158 < (*.f64 a b) < 1.99999999999999992e-23

    1. Initial program 99.3%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in a around 0 95.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot b \leq -4 \cdot 10^{+158} \lor \neg \left(a \cdot b \leq 2 \cdot 10^{-23}\right):\\ \;\;\;\;\left(c + x \cdot y\right) - \left(a \cdot b\right) \cdot 0.25\\ \mathbf{else}:\\ \;\;\;\;c + \left(x \cdot y + 0.0625 \cdot \left(z \cdot t\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 15: 65.5% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -4 \cdot 10^{+116} \lor \neg \left(x \cdot y \leq 5 \cdot 10^{+134}\right):\\
\;\;\;\;c + x \cdot y\\

\mathbf{else}:\\
\;\;\;\;c + t \cdot \left(z \cdot 0.0625\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x y) < -4.00000000000000006e116 or 4.99999999999999981e134 < (*.f64 x y)

    1. Initial program 94.5%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 78.6%

      \[\leadsto \color{blue}{x \cdot y} + c \]

    if -4.00000000000000006e116 < (*.f64 x y) < 4.99999999999999981e134

    1. Initial program 97.6%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf 66.3%

      \[\leadsto \color{blue}{0.0625 \cdot \left(t \cdot z\right)} + c \]
    4. Step-by-step derivation
      1. associate-*r*66.6%

        \[\leadsto \color{blue}{\left(0.0625 \cdot t\right) \cdot z} + c \]
      2. *-commutative66.6%

        \[\leadsto \color{blue}{\left(t \cdot 0.0625\right)} \cdot z + c \]
      3. associate-*r*66.6%

        \[\leadsto \color{blue}{t \cdot \left(0.0625 \cdot z\right)} + c \]
    5. Simplified66.6%

      \[\leadsto \color{blue}{t \cdot \left(0.0625 \cdot z\right)} + c \]
  3. Recombined 2 regimes into one program.
  4. Final simplification70.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -4 \cdot 10^{+116} \lor \neg \left(x \cdot y \leq 5 \cdot 10^{+134}\right):\\ \;\;\;\;c + x \cdot y\\ \mathbf{else}:\\ \;\;\;\;c + t \cdot \left(z \cdot 0.0625\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 16: 41.8% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1.9 \cdot 10^{+132} \lor \neg \left(x \cdot y \leq 1.45 \cdot 10^{+100}\right):\\
\;\;\;\;x \cdot y\\

\mathbf{else}:\\
\;\;\;\;c\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x y) < -1.90000000000000003e132 or 1.45e100 < (*.f64 x y)

    1. Initial program 94.4%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 83.6%

      \[\leadsto \color{blue}{\left(c + x \cdot y\right) - 0.25 \cdot \left(a \cdot b\right)} \]
    4. Taylor expanded in x around inf 83.9%

      \[\leadsto \color{blue}{x \cdot \left(\left(y + \frac{c}{x}\right) - 0.25 \cdot \frac{a \cdot b}{x}\right)} \]
    5. Step-by-step derivation
      1. associate--l+83.9%

        \[\leadsto x \cdot \color{blue}{\left(y + \left(\frac{c}{x} - 0.25 \cdot \frac{a \cdot b}{x}\right)\right)} \]
      2. associate-*r/83.9%

        \[\leadsto x \cdot \left(y + \left(\frac{c}{x} - \color{blue}{\frac{0.25 \cdot \left(a \cdot b\right)}{x}}\right)\right) \]
      3. div-sub83.9%

        \[\leadsto x \cdot \left(y + \color{blue}{\frac{c - 0.25 \cdot \left(a \cdot b\right)}{x}}\right) \]
      4. cancel-sign-sub-inv83.9%

        \[\leadsto x \cdot \left(y + \frac{\color{blue}{c + \left(-0.25\right) \cdot \left(a \cdot b\right)}}{x}\right) \]
      5. metadata-eval83.9%

        \[\leadsto x \cdot \left(y + \frac{c + \color{blue}{-0.25} \cdot \left(a \cdot b\right)}{x}\right) \]
      6. +-commutative83.9%

        \[\leadsto x \cdot \left(y + \frac{\color{blue}{-0.25 \cdot \left(a \cdot b\right) + c}}{x}\right) \]
      7. *-commutative83.9%

        \[\leadsto x \cdot \left(y + \frac{\color{blue}{\left(a \cdot b\right) \cdot -0.25} + c}{x}\right) \]
    6. Simplified83.9%

      \[\leadsto \color{blue}{x \cdot \left(y + \frac{\left(a \cdot b\right) \cdot -0.25 + c}{x}\right)} \]
    7. Taylor expanded in x around inf 72.4%

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

    if -1.90000000000000003e132 < (*.f64 x y) < 1.45e100

    1. Initial program 97.7%

      \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
    2. Add Preprocessing
    3. Taylor expanded in c around inf 32.0%

      \[\leadsto \color{blue}{c} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification46.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -1.9 \cdot 10^{+132} \lor \neg \left(x \cdot y \leq 1.45 \cdot 10^{+100}\right):\\ \;\;\;\;x \cdot y\\ \mathbf{else}:\\ \;\;\;\;c\\ \end{array} \]
  5. Add Preprocessing

Alternative 17: 22.1% accurate, 17.0× speedup?

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

\\
c
\end{array}
Derivation
  1. Initial program 96.5%

    \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
  2. Add Preprocessing
  3. Taylor expanded in c around inf 22.3%

    \[\leadsto \color{blue}{c} \]
  4. Final simplification22.3%

    \[\leadsto c \]
  5. Add Preprocessing

Reproduce

?
herbie shell --seed 2024076 
(FPCore (x y z t a b c)
  :name "Diagrams.Solve.Polynomial:quartForm  from diagrams-solve-0.1, C"
  :precision binary64
  (+ (- (+ (* x y) (/ (* z t) 16.0)) (/ (* a b) 4.0)) c))