Linear.V4:$cdot from linear-1.19.1.3, C

Percentage Accurate: 95.6% → 97.0%
Time: 15.9s
Alternatives: 11
Speedup: 0.5×

Specification

?
\[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
(FPCore (x y z t a b c i)
  :precision binary64
  (+ (+ (+ (* x y) (* z t)) (* a b)) (* c i)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	return (((x * y) + (z * t)) + (a * b)) + (c * i);
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y, z, t, a, b, c, i)
use fmin_fmax_functions
    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), intent (in) :: i
    code = (((x * y) + (z * t)) + (a * b)) + (c * i)
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	return (((x * y) + (z * t)) + (a * b)) + (c * i);
}
def code(x, y, z, t, a, b, c, i):
	return (((x * y) + (z * t)) + (a * b)) + (c * i)
function code(x, y, z, t, a, b, c, i)
	return Float64(Float64(Float64(Float64(x * y) + Float64(z * t)) + Float64(a * b)) + Float64(c * i))
end
function tmp = code(x, y, z, t, a, b, c, i)
	tmp = (((x * y) + (z * t)) + (a * b)) + (c * i);
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]
\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i

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 11 alternatives:

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

Initial Program: 95.6% accurate, 1.0× speedup?

\[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
(FPCore (x y z t a b c i)
  :precision binary64
  (+ (+ (+ (* x y) (* z t)) (* a b)) (* c i)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	return (((x * y) + (z * t)) + (a * b)) + (c * i);
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y, z, t, a, b, c, i)
use fmin_fmax_functions
    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), intent (in) :: i
    code = (((x * y) + (z * t)) + (a * b)) + (c * i)
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	return (((x * y) + (z * t)) + (a * b)) + (c * i);
}
def code(x, y, z, t, a, b, c, i):
	return (((x * y) + (z * t)) + (a * b)) + (c * i)
function code(x, y, z, t, a, b, c, i)
	return Float64(Float64(Float64(Float64(x * y) + Float64(z * t)) + Float64(a * b)) + Float64(c * i))
end
function tmp = code(x, y, z, t, a, b, c, i)
	tmp = (((x * y) + (z * t)) + (a * b)) + (c * i);
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]
\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i

Alternative 1: 97.0% accurate, 0.5× speedup?

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

\mathbf{else}:\\
\;\;\;\;c \cdot i + t \cdot z\\


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

    1. Initial program 95.6%

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

    if +inf.0 < (+.f64 (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) (*.f64 c i))

    1. Initial program 95.6%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Taylor expanded in a around 0

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

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

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

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

        \[\leadsto c \cdot i + \left(t \cdot z + \color{blue}{x} \cdot y\right) \]
      5. lower-*.f6474.0%

        \[\leadsto c \cdot i + \left(t \cdot z + x \cdot \color{blue}{y}\right) \]
    4. Applied rewrites74.0%

      \[\leadsto \color{blue}{c \cdot i + \left(t \cdot z + x \cdot y\right)} \]
    5. Taylor expanded in x around 0

      \[\leadsto c \cdot i + t \cdot \color{blue}{z} \]
    6. Step-by-step derivation
      1. lower-*.f6451.6%

        \[\leadsto c \cdot i + t \cdot z \]
    7. Applied rewrites51.6%

      \[\leadsto c \cdot i + t \cdot \color{blue}{z} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 2: 87.2% accurate, 0.7× speedup?

\[\begin{array}{l} \mathbf{if}\;z \cdot t \leq -10000000000000000155594161294668430242682013969210614333697705804308337811647557032649853899150474476762062808678400:\\ \;\;\;\;\left(t \cdot z + a \cdot b\right) + c \cdot i\\ \mathbf{elif}\;z \cdot t \leq 10000000000:\\ \;\;\;\;\left(a \cdot b + x \cdot y\right) + c \cdot i\\ \mathbf{else}:\\ \;\;\;\;c \cdot i + \left(t \cdot z + x \cdot y\right)\\ \end{array} \]
(FPCore (x y z t a b c i)
  :precision binary64
  (if (<=
     (* z t)
     -10000000000000000155594161294668430242682013969210614333697705804308337811647557032649853899150474476762062808678400)
  (+ (+ (* t z) (* a b)) (* c i))
  (if (<= (* z t) 10000000000)
    (+ (+ (* a b) (* x y)) (* c i))
    (+ (* c i) (+ (* t z) (* x y))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double tmp;
	if ((z * t) <= -1e+115) {
		tmp = ((t * z) + (a * b)) + (c * i);
	} else if ((z * t) <= 10000000000.0) {
		tmp = ((a * b) + (x * y)) + (c * i);
	} else {
		tmp = (c * i) + ((t * z) + (x * y));
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y, z, t, a, b, c, i)
use fmin_fmax_functions
    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), intent (in) :: i
    real(8) :: tmp
    if ((z * t) <= (-1d+115)) then
        tmp = ((t * z) + (a * b)) + (c * i)
    else if ((z * t) <= 10000000000.0d0) then
        tmp = ((a * b) + (x * y)) + (c * i)
    else
        tmp = (c * i) + ((t * z) + (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 i) {
	double tmp;
	if ((z * t) <= -1e+115) {
		tmp = ((t * z) + (a * b)) + (c * i);
	} else if ((z * t) <= 10000000000.0) {
		tmp = ((a * b) + (x * y)) + (c * i);
	} else {
		tmp = (c * i) + ((t * z) + (x * y));
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	tmp = 0
	if (z * t) <= -1e+115:
		tmp = ((t * z) + (a * b)) + (c * i)
	elif (z * t) <= 10000000000.0:
		tmp = ((a * b) + (x * y)) + (c * i)
	else:
		tmp = (c * i) + ((t * z) + (x * y))
	return tmp
function code(x, y, z, t, a, b, c, i)
	tmp = 0.0
	if (Float64(z * t) <= -1e+115)
		tmp = Float64(Float64(Float64(t * z) + Float64(a * b)) + Float64(c * i));
	elseif (Float64(z * t) <= 10000000000.0)
		tmp = Float64(Float64(Float64(a * b) + Float64(x * y)) + Float64(c * i));
	else
		tmp = Float64(Float64(c * i) + Float64(Float64(t * z) + Float64(x * y)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i)
	tmp = 0.0;
	if ((z * t) <= -1e+115)
		tmp = ((t * z) + (a * b)) + (c * i);
	elseif ((z * t) <= 10000000000.0)
		tmp = ((a * b) + (x * y)) + (c * i);
	else
		tmp = (c * i) + ((t * z) + (x * y));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(z * t), $MachinePrecision], -10000000000000000155594161294668430242682013969210614333697705804308337811647557032649853899150474476762062808678400], N[(N[(N[(t * z), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 10000000000], N[(N[(N[(a * b), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision], N[(N[(c * i), $MachinePrecision] + N[(N[(t * z), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -10000000000000000155594161294668430242682013969210614333697705804308337811647557032649853899150474476762062808678400:\\
\;\;\;\;\left(t \cdot z + a \cdot b\right) + c \cdot i\\

\mathbf{elif}\;z \cdot t \leq 10000000000:\\
\;\;\;\;\left(a \cdot b + x \cdot y\right) + c \cdot i\\

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


\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 z t) < -1e115

    1. Initial program 95.6%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Taylor expanded in x around 0

      \[\leadsto \left(\color{blue}{t \cdot z} + a \cdot b\right) + c \cdot i \]
    3. Step-by-step derivation
      1. lower-*.f6474.0%

        \[\leadsto \left(t \cdot \color{blue}{z} + a \cdot b\right) + c \cdot i \]
    4. Applied rewrites74.0%

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

    if -1e115 < (*.f64 z t) < 1e10

    1. Initial program 95.6%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Taylor expanded in z around 0

      \[\leadsto \color{blue}{\left(a \cdot b + x \cdot y\right)} + c \cdot i \]
    3. Step-by-step derivation
      1. lower-+.f64N/A

        \[\leadsto \left(a \cdot b + \color{blue}{x \cdot y}\right) + c \cdot i \]
      2. lower-*.f64N/A

        \[\leadsto \left(a \cdot b + \color{blue}{x} \cdot y\right) + c \cdot i \]
      3. lower-*.f6474.0%

        \[\leadsto \left(a \cdot b + x \cdot \color{blue}{y}\right) + c \cdot i \]
    4. Applied rewrites74.0%

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

    if 1e10 < (*.f64 z t)

    1. Initial program 95.6%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Taylor expanded in a around 0

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

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

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

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

        \[\leadsto c \cdot i + \left(t \cdot z + \color{blue}{x} \cdot y\right) \]
      5. lower-*.f6474.0%

        \[\leadsto c \cdot i + \left(t \cdot z + x \cdot \color{blue}{y}\right) \]
    4. Applied rewrites74.0%

      \[\leadsto \color{blue}{c \cdot i + \left(t \cdot z + x \cdot y\right)} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 3: 86.9% accurate, 0.7× speedup?

\[\begin{array}{l} t_1 := c \cdot i + \left(t \cdot z + x \cdot y\right)\\ \mathbf{if}\;z \cdot t \leq -10000000000000000155594161294668430242682013969210614333697705804308337811647557032649853899150474476762062808678400:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \cdot t \leq 10000000000:\\ \;\;\;\;\left(a \cdot b + x \cdot y\right) + c \cdot i\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \]
(FPCore (x y z t a b c i)
  :precision binary64
  (let* ((t_1 (+ (* c i) (+ (* t z) (* x y)))))
  (if (<=
       (* z t)
       -10000000000000000155594161294668430242682013969210614333697705804308337811647557032649853899150474476762062808678400)
    t_1
    (if (<= (* z t) 10000000000)
      (+ (+ (* a b) (* x y)) (* c i))
      t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = (c * i) + ((t * z) + (x * y));
	double tmp;
	if ((z * t) <= -1e+115) {
		tmp = t_1;
	} else if ((z * t) <= 10000000000.0) {
		tmp = ((a * b) + (x * y)) + (c * i);
	} else {
		tmp = t_1;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y, z, t, a, b, c, i)
use fmin_fmax_functions
    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), intent (in) :: i
    real(8) :: t_1
    real(8) :: tmp
    t_1 = (c * i) + ((t * z) + (x * y))
    if ((z * t) <= (-1d+115)) then
        tmp = t_1
    else if ((z * t) <= 10000000000.0d0) then
        tmp = ((a * b) + (x * y)) + (c * i)
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = (c * i) + ((t * z) + (x * y));
	double tmp;
	if ((z * t) <= -1e+115) {
		tmp = t_1;
	} else if ((z * t) <= 10000000000.0) {
		tmp = ((a * b) + (x * y)) + (c * i);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	t_1 = (c * i) + ((t * z) + (x * y))
	tmp = 0
	if (z * t) <= -1e+115:
		tmp = t_1
	elif (z * t) <= 10000000000.0:
		tmp = ((a * b) + (x * y)) + (c * i)
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a, b, c, i)
	t_1 = Float64(Float64(c * i) + Float64(Float64(t * z) + Float64(x * y)))
	tmp = 0.0
	if (Float64(z * t) <= -1e+115)
		tmp = t_1;
	elseif (Float64(z * t) <= 10000000000.0)
		tmp = Float64(Float64(Float64(a * b) + Float64(x * y)) + Float64(c * i));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i)
	t_1 = (c * i) + ((t * z) + (x * y));
	tmp = 0.0;
	if ((z * t) <= -1e+115)
		tmp = t_1;
	elseif ((z * t) <= 10000000000.0)
		tmp = ((a * b) + (x * y)) + (c * i);
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(c * i), $MachinePrecision] + N[(N[(t * z), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], -10000000000000000155594161294668430242682013969210614333697705804308337811647557032649853899150474476762062808678400], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], 10000000000], N[(N[(N[(a * b), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := c \cdot i + \left(t \cdot z + x \cdot y\right)\\
\mathbf{if}\;z \cdot t \leq -10000000000000000155594161294668430242682013969210614333697705804308337811647557032649853899150474476762062808678400:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \cdot t \leq 10000000000:\\
\;\;\;\;\left(a \cdot b + x \cdot y\right) + c \cdot i\\

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


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 z t) < -1e115 or 1e10 < (*.f64 z t)

    1. Initial program 95.6%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Taylor expanded in a around 0

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

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

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

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

        \[\leadsto c \cdot i + \left(t \cdot z + \color{blue}{x} \cdot y\right) \]
      5. lower-*.f6474.0%

        \[\leadsto c \cdot i + \left(t \cdot z + x \cdot \color{blue}{y}\right) \]
    4. Applied rewrites74.0%

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

    if -1e115 < (*.f64 z t) < 1e10

    1. Initial program 95.6%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Taylor expanded in z around 0

      \[\leadsto \color{blue}{\left(a \cdot b + x \cdot y\right)} + c \cdot i \]
    3. Step-by-step derivation
      1. lower-+.f64N/A

        \[\leadsto \left(a \cdot b + \color{blue}{x \cdot y}\right) + c \cdot i \]
      2. lower-*.f64N/A

        \[\leadsto \left(a \cdot b + \color{blue}{x} \cdot y\right) + c \cdot i \]
      3. lower-*.f6474.0%

        \[\leadsto \left(a \cdot b + x \cdot \color{blue}{y}\right) + c \cdot i \]
    4. Applied rewrites74.0%

      \[\leadsto \color{blue}{\left(a \cdot b + x \cdot y\right)} + c \cdot i \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 4: 81.5% accurate, 0.5× speedup?

\[\begin{array}{l} t_1 := c \cdot i + \left(t \cdot z + x \cdot y\right)\\ t_2 := x \cdot y + z \cdot t\\ \mathbf{if}\;t\_2 \leq -999999999999999926539781176481198923508803215199467887262646419780362305536:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 \leq 2000000000000000000:\\ \;\;\;\;a \cdot b + c \cdot i\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \]
(FPCore (x y z t a b c i)
  :precision binary64
  (let* ((t_1 (+ (* c i) (+ (* t z) (* x y))))
       (t_2 (+ (* x y) (* z t))))
  (if (<=
       t_2
       -999999999999999926539781176481198923508803215199467887262646419780362305536)
    t_1
    (if (<= t_2 2000000000000000000) (+ (* a b) (* c i)) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = (c * i) + ((t * z) + (x * y));
	double t_2 = (x * y) + (z * t);
	double tmp;
	if (t_2 <= -1e+75) {
		tmp = t_1;
	} else if (t_2 <= 2e+18) {
		tmp = (a * b) + (c * i);
	} else {
		tmp = t_1;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y, z, t, a, b, c, i)
use fmin_fmax_functions
    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), intent (in) :: i
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = (c * i) + ((t * z) + (x * y))
    t_2 = (x * y) + (z * t)
    if (t_2 <= (-1d+75)) then
        tmp = t_1
    else if (t_2 <= 2d+18) then
        tmp = (a * b) + (c * i)
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = (c * i) + ((t * z) + (x * y));
	double t_2 = (x * y) + (z * t);
	double tmp;
	if (t_2 <= -1e+75) {
		tmp = t_1;
	} else if (t_2 <= 2e+18) {
		tmp = (a * b) + (c * i);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	t_1 = (c * i) + ((t * z) + (x * y))
	t_2 = (x * y) + (z * t)
	tmp = 0
	if t_2 <= -1e+75:
		tmp = t_1
	elif t_2 <= 2e+18:
		tmp = (a * b) + (c * i)
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a, b, c, i)
	t_1 = Float64(Float64(c * i) + Float64(Float64(t * z) + Float64(x * y)))
	t_2 = Float64(Float64(x * y) + Float64(z * t))
	tmp = 0.0
	if (t_2 <= -1e+75)
		tmp = t_1;
	elseif (t_2 <= 2e+18)
		tmp = Float64(Float64(a * b) + Float64(c * i));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i)
	t_1 = (c * i) + ((t * z) + (x * y));
	t_2 = (x * y) + (z * t);
	tmp = 0.0;
	if (t_2 <= -1e+75)
		tmp = t_1;
	elseif (t_2 <= 2e+18)
		tmp = (a * b) + (c * i);
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(c * i), $MachinePrecision] + N[(N[(t * z), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -999999999999999926539781176481198923508803215199467887262646419780362305536], t$95$1, If[LessEqual[t$95$2, 2000000000000000000], N[(N[(a * b), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
t_1 := c \cdot i + \left(t \cdot z + x \cdot y\right)\\
t_2 := x \cdot y + z \cdot t\\
\mathbf{if}\;t\_2 \leq -999999999999999926539781176481198923508803215199467887262646419780362305536:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_2 \leq 2000000000000000000:\\
\;\;\;\;a \cdot b + c \cdot i\\

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


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (+.f64 (*.f64 x y) (*.f64 z t)) < -9.9999999999999993e74 or 2e18 < (+.f64 (*.f64 x y) (*.f64 z t))

    1. Initial program 95.6%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Taylor expanded in a around 0

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

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

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

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

        \[\leadsto c \cdot i + \left(t \cdot z + \color{blue}{x} \cdot y\right) \]
      5. lower-*.f6474.0%

        \[\leadsto c \cdot i + \left(t \cdot z + x \cdot \color{blue}{y}\right) \]
    4. Applied rewrites74.0%

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

    if -9.9999999999999993e74 < (+.f64 (*.f64 x y) (*.f64 z t)) < 2e18

    1. Initial program 95.6%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Taylor expanded in z around 0

      \[\leadsto \color{blue}{\left(a \cdot b + x \cdot y\right)} + c \cdot i \]
    3. Step-by-step derivation
      1. lower-+.f64N/A

        \[\leadsto \left(a \cdot b + \color{blue}{x \cdot y}\right) + c \cdot i \]
      2. lower-*.f64N/A

        \[\leadsto \left(a \cdot b + \color{blue}{x} \cdot y\right) + c \cdot i \]
      3. lower-*.f6474.0%

        \[\leadsto \left(a \cdot b + x \cdot \color{blue}{y}\right) + c \cdot i \]
    4. Applied rewrites74.0%

      \[\leadsto \color{blue}{\left(a \cdot b + x \cdot y\right)} + c \cdot i \]
    5. Taylor expanded in x around 0

      \[\leadsto a \cdot \color{blue}{b} + c \cdot i \]
    6. Step-by-step derivation
      1. lower-*.f6451.6%

        \[\leadsto a \cdot b + c \cdot i \]
    7. Applied rewrites51.6%

      \[\leadsto a \cdot \color{blue}{b} + c \cdot i \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 5: 66.4% accurate, 0.8× speedup?

\[\begin{array}{l} t_1 := c \cdot i + t \cdot z\\ \mathbf{if}\;z \cdot t \leq -999999999999999967336168804116691273849533185806555472917961779471295845921727862608739868455469056:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \cdot t \leq 4000000000000000000000:\\ \;\;\;\;a \cdot b + c \cdot i\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \]
(FPCore (x y z t a b c i)
  :precision binary64
  (let* ((t_1 (+ (* c i) (* t z))))
  (if (<=
       (* z t)
       -999999999999999967336168804116691273849533185806555472917961779471295845921727862608739868455469056)
    t_1
    (if (<= (* z t) 4000000000000000000000) (+ (* a b) (* c i)) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = (c * i) + (t * z);
	double tmp;
	if ((z * t) <= -1e+99) {
		tmp = t_1;
	} else if ((z * t) <= 4e+21) {
		tmp = (a * b) + (c * i);
	} else {
		tmp = t_1;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y, z, t, a, b, c, i)
use fmin_fmax_functions
    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), intent (in) :: i
    real(8) :: t_1
    real(8) :: tmp
    t_1 = (c * i) + (t * z)
    if ((z * t) <= (-1d+99)) then
        tmp = t_1
    else if ((z * t) <= 4d+21) then
        tmp = (a * b) + (c * i)
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = (c * i) + (t * z);
	double tmp;
	if ((z * t) <= -1e+99) {
		tmp = t_1;
	} else if ((z * t) <= 4e+21) {
		tmp = (a * b) + (c * i);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	t_1 = (c * i) + (t * z)
	tmp = 0
	if (z * t) <= -1e+99:
		tmp = t_1
	elif (z * t) <= 4e+21:
		tmp = (a * b) + (c * i)
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a, b, c, i)
	t_1 = Float64(Float64(c * i) + Float64(t * z))
	tmp = 0.0
	if (Float64(z * t) <= -1e+99)
		tmp = t_1;
	elseif (Float64(z * t) <= 4e+21)
		tmp = Float64(Float64(a * b) + Float64(c * i));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i)
	t_1 = (c * i) + (t * z);
	tmp = 0.0;
	if ((z * t) <= -1e+99)
		tmp = t_1;
	elseif ((z * t) <= 4e+21)
		tmp = (a * b) + (c * i);
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(c * i), $MachinePrecision] + N[(t * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], -999999999999999967336168804116691273849533185806555472917961779471295845921727862608739868455469056], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], 4000000000000000000000], N[(N[(a * b), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := c \cdot i + t \cdot z\\
\mathbf{if}\;z \cdot t \leq -999999999999999967336168804116691273849533185806555472917961779471295845921727862608739868455469056:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \cdot t \leq 4000000000000000000000:\\
\;\;\;\;a \cdot b + c \cdot i\\

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


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 z t) < -9.9999999999999997e98 or 4e21 < (*.f64 z t)

    1. Initial program 95.6%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Taylor expanded in a around 0

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

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

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

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

        \[\leadsto c \cdot i + \left(t \cdot z + \color{blue}{x} \cdot y\right) \]
      5. lower-*.f6474.0%

        \[\leadsto c \cdot i + \left(t \cdot z + x \cdot \color{blue}{y}\right) \]
    4. Applied rewrites74.0%

      \[\leadsto \color{blue}{c \cdot i + \left(t \cdot z + x \cdot y\right)} \]
    5. Taylor expanded in x around 0

      \[\leadsto c \cdot i + t \cdot \color{blue}{z} \]
    6. Step-by-step derivation
      1. lower-*.f6451.6%

        \[\leadsto c \cdot i + t \cdot z \]
    7. Applied rewrites51.6%

      \[\leadsto c \cdot i + t \cdot \color{blue}{z} \]

    if -9.9999999999999997e98 < (*.f64 z t) < 4e21

    1. Initial program 95.6%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Taylor expanded in z around 0

      \[\leadsto \color{blue}{\left(a \cdot b + x \cdot y\right)} + c \cdot i \]
    3. Step-by-step derivation
      1. lower-+.f64N/A

        \[\leadsto \left(a \cdot b + \color{blue}{x \cdot y}\right) + c \cdot i \]
      2. lower-*.f64N/A

        \[\leadsto \left(a \cdot b + \color{blue}{x} \cdot y\right) + c \cdot i \]
      3. lower-*.f6474.0%

        \[\leadsto \left(a \cdot b + x \cdot \color{blue}{y}\right) + c \cdot i \]
    4. Applied rewrites74.0%

      \[\leadsto \color{blue}{\left(a \cdot b + x \cdot y\right)} + c \cdot i \]
    5. Taylor expanded in x around 0

      \[\leadsto a \cdot \color{blue}{b} + c \cdot i \]
    6. Step-by-step derivation
      1. lower-*.f6451.6%

        \[\leadsto a \cdot b + c \cdot i \]
    7. Applied rewrites51.6%

      \[\leadsto a \cdot \color{blue}{b} + c \cdot i \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 6: 65.7% accurate, 0.8× speedup?

\[\begin{array}{l} t_1 := c \cdot i + x \cdot y\\ \mathbf{if}\;x \cdot y \leq -20000000000000000746818674942919779438786551508983640762055460820756010161342994202757226742842252830104798058684384018432:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \cdot y \leq 500000000000000021688648487309593036645146662475969655895886894668058406444840555470661877760:\\ \;\;\;\;c \cdot i + t \cdot z\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \]
(FPCore (x y z t a b c i)
  :precision binary64
  (let* ((t_1 (+ (* c i) (* x y))))
  (if (<=
       (* x y)
       -20000000000000000746818674942919779438786551508983640762055460820756010161342994202757226742842252830104798058684384018432)
    t_1
    (if (<=
         (* x y)
         500000000000000021688648487309593036645146662475969655895886894668058406444840555470661877760)
      (+ (* c i) (* t z))
      t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = (c * i) + (x * y);
	double tmp;
	if ((x * y) <= -2e+121) {
		tmp = t_1;
	} else if ((x * y) <= 5e+92) {
		tmp = (c * i) + (t * z);
	} else {
		tmp = t_1;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y, z, t, a, b, c, i)
use fmin_fmax_functions
    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), intent (in) :: i
    real(8) :: t_1
    real(8) :: tmp
    t_1 = (c * i) + (x * y)
    if ((x * y) <= (-2d+121)) then
        tmp = t_1
    else if ((x * y) <= 5d+92) then
        tmp = (c * i) + (t * z)
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = (c * i) + (x * y);
	double tmp;
	if ((x * y) <= -2e+121) {
		tmp = t_1;
	} else if ((x * y) <= 5e+92) {
		tmp = (c * i) + (t * z);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	t_1 = (c * i) + (x * y)
	tmp = 0
	if (x * y) <= -2e+121:
		tmp = t_1
	elif (x * y) <= 5e+92:
		tmp = (c * i) + (t * z)
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a, b, c, i)
	t_1 = Float64(Float64(c * i) + Float64(x * y))
	tmp = 0.0
	if (Float64(x * y) <= -2e+121)
		tmp = t_1;
	elseif (Float64(x * y) <= 5e+92)
		tmp = Float64(Float64(c * i) + Float64(t * z));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i)
	t_1 = (c * i) + (x * y);
	tmp = 0.0;
	if ((x * y) <= -2e+121)
		tmp = t_1;
	elseif ((x * y) <= 5e+92)
		tmp = (c * i) + (t * z);
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(c * i), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -20000000000000000746818674942919779438786551508983640762055460820756010161342994202757226742842252830104798058684384018432], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 500000000000000021688648487309593036645146662475969655895886894668058406444840555470661877760], N[(N[(c * i), $MachinePrecision] + N[(t * z), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := c \cdot i + x \cdot y\\
\mathbf{if}\;x \cdot y \leq -20000000000000000746818674942919779438786551508983640762055460820756010161342994202757226742842252830104798058684384018432:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \cdot y \leq 500000000000000021688648487309593036645146662475969655895886894668058406444840555470661877760:\\
\;\;\;\;c \cdot i + t \cdot z\\

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


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

    1. Initial program 95.6%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Taylor expanded in a around 0

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

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

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

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

        \[\leadsto c \cdot i + \left(t \cdot z + \color{blue}{x} \cdot y\right) \]
      5. lower-*.f6474.0%

        \[\leadsto c \cdot i + \left(t \cdot z + x \cdot \color{blue}{y}\right) \]
    4. Applied rewrites74.0%

      \[\leadsto \color{blue}{c \cdot i + \left(t \cdot z + x \cdot y\right)} \]
    5. Taylor expanded in z around 0

      \[\leadsto c \cdot i + \color{blue}{x \cdot y} \]
    6. Step-by-step derivation
      1. lower-+.f64N/A

        \[\leadsto c \cdot i + x \cdot \color{blue}{y} \]
      2. lower-*.f64N/A

        \[\leadsto c \cdot i + x \cdot y \]
      3. lower-*.f6451.6%

        \[\leadsto c \cdot i + x \cdot y \]
    7. Applied rewrites51.6%

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

    if -2.0000000000000001e121 < (*.f64 x y) < 5.0000000000000002e92

    1. Initial program 95.6%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Taylor expanded in a around 0

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

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

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

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

        \[\leadsto c \cdot i + \left(t \cdot z + \color{blue}{x} \cdot y\right) \]
      5. lower-*.f6474.0%

        \[\leadsto c \cdot i + \left(t \cdot z + x \cdot \color{blue}{y}\right) \]
    4. Applied rewrites74.0%

      \[\leadsto \color{blue}{c \cdot i + \left(t \cdot z + x \cdot y\right)} \]
    5. Taylor expanded in x around 0

      \[\leadsto c \cdot i + t \cdot \color{blue}{z} \]
    6. Step-by-step derivation
      1. lower-*.f6451.6%

        \[\leadsto c \cdot i + t \cdot z \]
    7. Applied rewrites51.6%

      \[\leadsto c \cdot i + t \cdot \color{blue}{z} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 7: 62.4% accurate, 0.8× speedup?

\[\begin{array}{l} \mathbf{if}\;z \cdot t \leq -4000000000000000396608112211993636047680809368650861178353581203006168799918134949639116303462911015707277439406485982346309347056090621591337191498862248353306677366521117116231777349377083535451521648143853612748964240337695861270954300912430284275712:\\ \;\;\;\;t \cdot z\\ \mathbf{elif}\;z \cdot t \leq 10000000000000000466018071748206975684050858099493768614209804580186827813230862995727677122141957123210339765959854898653172616660068980913606220974926434405874301273673162218994872058950552383264597357715602427843549593600:\\ \;\;\;\;c \cdot i + x \cdot y\\ \mathbf{else}:\\ \;\;\;\;t \cdot z\\ \end{array} \]
(FPCore (x y z t a b c i)
  :precision binary64
  (if (<=
     (* z t)
     -4000000000000000396608112211993636047680809368650861178353581203006168799918134949639116303462911015707277439406485982346309347056090621591337191498862248353306677366521117116231777349377083535451521648143853612748964240337695861270954300912430284275712)
  (* t z)
  (if (<=
       (* z t)
       10000000000000000466018071748206975684050858099493768614209804580186827813230862995727677122141957123210339765959854898653172616660068980913606220974926434405874301273673162218994872058950552383264597357715602427843549593600)
    (+ (* c i) (* x y))
    (* t z))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double tmp;
	if ((z * t) <= -4e+252) {
		tmp = t * z;
	} else if ((z * t) <= 1e+223) {
		tmp = (c * i) + (x * y);
	} else {
		tmp = t * z;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y, z, t, a, b, c, i)
use fmin_fmax_functions
    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), intent (in) :: i
    real(8) :: tmp
    if ((z * t) <= (-4d+252)) then
        tmp = t * z
    else if ((z * t) <= 1d+223) then
        tmp = (c * i) + (x * y)
    else
        tmp = t * z
    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 i) {
	double tmp;
	if ((z * t) <= -4e+252) {
		tmp = t * z;
	} else if ((z * t) <= 1e+223) {
		tmp = (c * i) + (x * y);
	} else {
		tmp = t * z;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	tmp = 0
	if (z * t) <= -4e+252:
		tmp = t * z
	elif (z * t) <= 1e+223:
		tmp = (c * i) + (x * y)
	else:
		tmp = t * z
	return tmp
function code(x, y, z, t, a, b, c, i)
	tmp = 0.0
	if (Float64(z * t) <= -4e+252)
		tmp = Float64(t * z);
	elseif (Float64(z * t) <= 1e+223)
		tmp = Float64(Float64(c * i) + Float64(x * y));
	else
		tmp = Float64(t * z);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i)
	tmp = 0.0;
	if ((z * t) <= -4e+252)
		tmp = t * z;
	elseif ((z * t) <= 1e+223)
		tmp = (c * i) + (x * y);
	else
		tmp = t * z;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(z * t), $MachinePrecision], -4000000000000000396608112211993636047680809368650861178353581203006168799918134949639116303462911015707277439406485982346309347056090621591337191498862248353306677366521117116231777349377083535451521648143853612748964240337695861270954300912430284275712], N[(t * z), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 10000000000000000466018071748206975684050858099493768614209804580186827813230862995727677122141957123210339765959854898653172616660068980913606220974926434405874301273673162218994872058950552383264597357715602427843549593600], N[(N[(c * i), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision], N[(t * z), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -4000000000000000396608112211993636047680809368650861178353581203006168799918134949639116303462911015707277439406485982346309347056090621591337191498862248353306677366521117116231777349377083535451521648143853612748964240337695861270954300912430284275712:\\
\;\;\;\;t \cdot z\\

\mathbf{elif}\;z \cdot t \leq 10000000000000000466018071748206975684050858099493768614209804580186827813230862995727677122141957123210339765959854898653172616660068980913606220974926434405874301273673162218994872058950552383264597357715602427843549593600:\\
\;\;\;\;c \cdot i + x \cdot y\\

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


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 z t) < -4.0000000000000004e252 or 1e223 < (*.f64 z t)

    1. Initial program 95.6%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Taylor expanded in a around 0

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

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

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

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

        \[\leadsto c \cdot i + \left(t \cdot z + \color{blue}{x} \cdot y\right) \]
      5. lower-*.f6474.0%

        \[\leadsto c \cdot i + \left(t \cdot z + x \cdot \color{blue}{y}\right) \]
    4. Applied rewrites74.0%

      \[\leadsto \color{blue}{c \cdot i + \left(t \cdot z + x \cdot y\right)} \]
    5. Taylor expanded in z around 0

      \[\leadsto c \cdot i + \color{blue}{x \cdot y} \]
    6. Step-by-step derivation
      1. lower-+.f64N/A

        \[\leadsto c \cdot i + x \cdot \color{blue}{y} \]
      2. lower-*.f64N/A

        \[\leadsto c \cdot i + x \cdot y \]
      3. lower-*.f6451.6%

        \[\leadsto c \cdot i + x \cdot y \]
    7. Applied rewrites51.6%

      \[\leadsto c \cdot i + \color{blue}{x \cdot y} \]
    8. Taylor expanded in x around 0

      \[\leadsto c \cdot i \]
    9. Step-by-step derivation
      1. lower-*.f6428.0%

        \[\leadsto c \cdot i \]
    10. Applied rewrites28.0%

      \[\leadsto c \cdot i \]
    11. Taylor expanded in z around inf

      \[\leadsto t \cdot \color{blue}{z} \]
    12. Step-by-step derivation
      1. lower-*.f6427.2%

        \[\leadsto t \cdot z \]
    13. Applied rewrites27.2%

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

    if -4.0000000000000004e252 < (*.f64 z t) < 1e223

    1. Initial program 95.6%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Taylor expanded in a around 0

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

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

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

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

        \[\leadsto c \cdot i + \left(t \cdot z + \color{blue}{x} \cdot y\right) \]
      5. lower-*.f6474.0%

        \[\leadsto c \cdot i + \left(t \cdot z + x \cdot \color{blue}{y}\right) \]
    4. Applied rewrites74.0%

      \[\leadsto \color{blue}{c \cdot i + \left(t \cdot z + x \cdot y\right)} \]
    5. Taylor expanded in z around 0

      \[\leadsto c \cdot i + \color{blue}{x \cdot y} \]
    6. Step-by-step derivation
      1. lower-+.f64N/A

        \[\leadsto c \cdot i + x \cdot \color{blue}{y} \]
      2. lower-*.f64N/A

        \[\leadsto c \cdot i + x \cdot y \]
      3. lower-*.f6451.6%

        \[\leadsto c \cdot i + x \cdot y \]
    7. Applied rewrites51.6%

      \[\leadsto c \cdot i + \color{blue}{x \cdot y} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 8: 43.3% accurate, 0.5× speedup?

\[\begin{array}{l} \mathbf{if}\;c \cdot i \leq -999999999999999998217443564185241415988928868759412500436543339729940401905904649497115766142268560009777175966751665376232210432:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;c \cdot i \leq \frac{-253}{25300281663413827294061918339864663381194581220517764794612669753428792445999418361495047962679640561898384733039601488923726092173224184608376674992592313740189678034570795170558363467761652042654970959809093133570250935428086587327262919456144944542601257064044846194041676826903812816523290938580750782913463467636686848}:\\ \;\;\;\;t \cdot z\\ \mathbf{elif}\;c \cdot i \leq \frac{5255931591500769}{583992399055640987986069965529637289586333248927815671114136642291107221402710705472756839848623539171666215625420084135768154204336056063776340648924443416096255318318113913610607896607565283328}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;c \cdot i \leq \frac{5981525981032121}{166153499473114484112975882535043072}:\\ \;\;\;\;-\left(-y\right) \cdot x\\ \mathbf{elif}\;c \cdot i \leq 1299999999999999967733223573514609746608608365174467094904635413122985441295687860405609026104539524614751916574900224:\\ \;\;\;\;a \cdot b\\ \mathbf{else}:\\ \;\;\;\;c \cdot i\\ \end{array} \]
(FPCore (x y z t a b c i)
  :precision binary64
  (if (<=
     (* c i)
     -999999999999999998217443564185241415988928868759412500436543339729940401905904649497115766142268560009777175966751665376232210432)
  (* c i)
  (if (<=
       (* c i)
       -253/25300281663413827294061918339864663381194581220517764794612669753428792445999418361495047962679640561898384733039601488923726092173224184608376674992592313740189678034570795170558363467761652042654970959809093133570250935428086587327262919456144944542601257064044846194041676826903812816523290938580750782913463467636686848)
    (* t z)
    (if (<=
         (* c i)
         5255931591500769/583992399055640987986069965529637289586333248927815671114136642291107221402710705472756839848623539171666215625420084135768154204336056063776340648924443416096255318318113913610607896607565283328)
      (* a b)
      (if (<=
           (* c i)
           5981525981032121/166153499473114484112975882535043072)
        (- (* (- y) x))
        (if (<=
             (* c i)
             1299999999999999967733223573514609746608608365174467094904635413122985441295687860405609026104539524614751916574900224)
          (* a b)
          (* c i)))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double tmp;
	if ((c * i) <= -1e+129) {
		tmp = c * i;
	} else if ((c * i) <= -1e-320) {
		tmp = t * z;
	} else if ((c * i) <= 9e-180) {
		tmp = a * b;
	} else if ((c * i) <= 3.6e-20) {
		tmp = -(-y * x);
	} else if ((c * i) <= 1.3e+117) {
		tmp = a * b;
	} else {
		tmp = c * i;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y, z, t, a, b, c, i)
use fmin_fmax_functions
    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), intent (in) :: i
    real(8) :: tmp
    if ((c * i) <= (-1d+129)) then
        tmp = c * i
    else if ((c * i) <= (-1d-320)) then
        tmp = t * z
    else if ((c * i) <= 9d-180) then
        tmp = a * b
    else if ((c * i) <= 3.6d-20) then
        tmp = -(-y * x)
    else if ((c * i) <= 1.3d+117) then
        tmp = a * b
    else
        tmp = c * i
    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 i) {
	double tmp;
	if ((c * i) <= -1e+129) {
		tmp = c * i;
	} else if ((c * i) <= -1e-320) {
		tmp = t * z;
	} else if ((c * i) <= 9e-180) {
		tmp = a * b;
	} else if ((c * i) <= 3.6e-20) {
		tmp = -(-y * x);
	} else if ((c * i) <= 1.3e+117) {
		tmp = a * b;
	} else {
		tmp = c * i;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	tmp = 0
	if (c * i) <= -1e+129:
		tmp = c * i
	elif (c * i) <= -1e-320:
		tmp = t * z
	elif (c * i) <= 9e-180:
		tmp = a * b
	elif (c * i) <= 3.6e-20:
		tmp = -(-y * x)
	elif (c * i) <= 1.3e+117:
		tmp = a * b
	else:
		tmp = c * i
	return tmp
function code(x, y, z, t, a, b, c, i)
	tmp = 0.0
	if (Float64(c * i) <= -1e+129)
		tmp = Float64(c * i);
	elseif (Float64(c * i) <= -1e-320)
		tmp = Float64(t * z);
	elseif (Float64(c * i) <= 9e-180)
		tmp = Float64(a * b);
	elseif (Float64(c * i) <= 3.6e-20)
		tmp = Float64(-Float64(Float64(-y) * x));
	elseif (Float64(c * i) <= 1.3e+117)
		tmp = Float64(a * b);
	else
		tmp = Float64(c * i);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i)
	tmp = 0.0;
	if ((c * i) <= -1e+129)
		tmp = c * i;
	elseif ((c * i) <= -1e-320)
		tmp = t * z;
	elseif ((c * i) <= 9e-180)
		tmp = a * b;
	elseif ((c * i) <= 3.6e-20)
		tmp = -(-y * x);
	elseif ((c * i) <= 1.3e+117)
		tmp = a * b;
	else
		tmp = c * i;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(c * i), $MachinePrecision], -999999999999999998217443564185241415988928868759412500436543339729940401905904649497115766142268560009777175966751665376232210432], N[(c * i), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], -253/25300281663413827294061918339864663381194581220517764794612669753428792445999418361495047962679640561898384733039601488923726092173224184608376674992592313740189678034570795170558363467761652042654970959809093133570250935428086587327262919456144944542601257064044846194041676826903812816523290938580750782913463467636686848], N[(t * z), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 5255931591500769/583992399055640987986069965529637289586333248927815671114136642291107221402710705472756839848623539171666215625420084135768154204336056063776340648924443416096255318318113913610607896607565283328], N[(a * b), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 5981525981032121/166153499473114484112975882535043072], (-N[((-y) * x), $MachinePrecision]), If[LessEqual[N[(c * i), $MachinePrecision], 1299999999999999967733223573514609746608608365174467094904635413122985441295687860405609026104539524614751916574900224], N[(a * b), $MachinePrecision], N[(c * i), $MachinePrecision]]]]]]
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -999999999999999998217443564185241415988928868759412500436543339729940401905904649497115766142268560009777175966751665376232210432:\\
\;\;\;\;c \cdot i\\

\mathbf{elif}\;c \cdot i \leq \frac{-253}{25300281663413827294061918339864663381194581220517764794612669753428792445999418361495047962679640561898384733039601488923726092173224184608376674992592313740189678034570795170558363467761652042654970959809093133570250935428086587327262919456144944542601257064044846194041676826903812816523290938580750782913463467636686848}:\\
\;\;\;\;t \cdot z\\

\mathbf{elif}\;c \cdot i \leq \frac{5255931591500769}{583992399055640987986069965529637289586333248927815671114136642291107221402710705472756839848623539171666215625420084135768154204336056063776340648924443416096255318318113913610607896607565283328}:\\
\;\;\;\;a \cdot b\\

\mathbf{elif}\;c \cdot i \leq \frac{5981525981032121}{166153499473114484112975882535043072}:\\
\;\;\;\;-\left(-y\right) \cdot x\\

\mathbf{elif}\;c \cdot i \leq 1299999999999999967733223573514609746608608365174467094904635413122985441295687860405609026104539524614751916574900224:\\
\;\;\;\;a \cdot b\\

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


\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 c i) < -1e129 or 1.3e117 < (*.f64 c i)

    1. Initial program 95.6%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Taylor expanded in a around 0

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

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

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

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

        \[\leadsto c \cdot i + \left(t \cdot z + \color{blue}{x} \cdot y\right) \]
      5. lower-*.f6474.0%

        \[\leadsto c \cdot i + \left(t \cdot z + x \cdot \color{blue}{y}\right) \]
    4. Applied rewrites74.0%

      \[\leadsto \color{blue}{c \cdot i + \left(t \cdot z + x \cdot y\right)} \]
    5. Taylor expanded in z around 0

      \[\leadsto c \cdot i + \color{blue}{x \cdot y} \]
    6. Step-by-step derivation
      1. lower-+.f64N/A

        \[\leadsto c \cdot i + x \cdot \color{blue}{y} \]
      2. lower-*.f64N/A

        \[\leadsto c \cdot i + x \cdot y \]
      3. lower-*.f6451.6%

        \[\leadsto c \cdot i + x \cdot y \]
    7. Applied rewrites51.6%

      \[\leadsto c \cdot i + \color{blue}{x \cdot y} \]
    8. Taylor expanded in x around 0

      \[\leadsto c \cdot i \]
    9. Step-by-step derivation
      1. lower-*.f6428.0%

        \[\leadsto c \cdot i \]
    10. Applied rewrites28.0%

      \[\leadsto c \cdot i \]

    if -1e129 < (*.f64 c i) < -9.9998886718268301e-321

    1. Initial program 95.6%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Taylor expanded in a around 0

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

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

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

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

        \[\leadsto c \cdot i + \left(t \cdot z + \color{blue}{x} \cdot y\right) \]
      5. lower-*.f6474.0%

        \[\leadsto c \cdot i + \left(t \cdot z + x \cdot \color{blue}{y}\right) \]
    4. Applied rewrites74.0%

      \[\leadsto \color{blue}{c \cdot i + \left(t \cdot z + x \cdot y\right)} \]
    5. Taylor expanded in z around 0

      \[\leadsto c \cdot i + \color{blue}{x \cdot y} \]
    6. Step-by-step derivation
      1. lower-+.f64N/A

        \[\leadsto c \cdot i + x \cdot \color{blue}{y} \]
      2. lower-*.f64N/A

        \[\leadsto c \cdot i + x \cdot y \]
      3. lower-*.f6451.6%

        \[\leadsto c \cdot i + x \cdot y \]
    7. Applied rewrites51.6%

      \[\leadsto c \cdot i + \color{blue}{x \cdot y} \]
    8. Taylor expanded in x around 0

      \[\leadsto c \cdot i \]
    9. Step-by-step derivation
      1. lower-*.f6428.0%

        \[\leadsto c \cdot i \]
    10. Applied rewrites28.0%

      \[\leadsto c \cdot i \]
    11. Taylor expanded in z around inf

      \[\leadsto t \cdot \color{blue}{z} \]
    12. Step-by-step derivation
      1. lower-*.f6427.2%

        \[\leadsto t \cdot z \]
    13. Applied rewrites27.2%

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

    if -9.9998886718268301e-321 < (*.f64 c i) < 9.0000000000000002e-180 or 3.5999999999999997e-20 < (*.f64 c i) < 1.3e117

    1. Initial program 95.6%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Taylor expanded in a around 0

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

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

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

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

        \[\leadsto c \cdot i + \left(t \cdot z + \color{blue}{x} \cdot y\right) \]
      5. lower-*.f6474.0%

        \[\leadsto c \cdot i + \left(t \cdot z + x \cdot \color{blue}{y}\right) \]
    4. Applied rewrites74.0%

      \[\leadsto \color{blue}{c \cdot i + \left(t \cdot z + x \cdot y\right)} \]
    5. Taylor expanded in z around 0

      \[\leadsto c \cdot i + \color{blue}{x \cdot y} \]
    6. Step-by-step derivation
      1. lower-+.f64N/A

        \[\leadsto c \cdot i + x \cdot \color{blue}{y} \]
      2. lower-*.f64N/A

        \[\leadsto c \cdot i + x \cdot y \]
      3. lower-*.f6451.6%

        \[\leadsto c \cdot i + x \cdot y \]
    7. Applied rewrites51.6%

      \[\leadsto c \cdot i + \color{blue}{x \cdot y} \]
    8. Taylor expanded in x around 0

      \[\leadsto c \cdot i \]
    9. Step-by-step derivation
      1. lower-*.f6428.0%

        \[\leadsto c \cdot i \]
    10. Applied rewrites28.0%

      \[\leadsto c \cdot i \]
    11. Taylor expanded in a around inf

      \[\leadsto \color{blue}{a \cdot b} \]
    12. Step-by-step derivation
      1. lower-*.f6427.4%

        \[\leadsto a \cdot \color{blue}{b} \]
    13. Applied rewrites27.4%

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

    if 9.0000000000000002e-180 < (*.f64 c i) < 3.5999999999999997e-20

    1. Initial program 95.6%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Taylor expanded in i around -inf

      \[\leadsto \color{blue}{-1 \cdot \left(i \cdot \left(-1 \cdot c + -1 \cdot \frac{a \cdot b + \left(t \cdot z + x \cdot y\right)}{i}\right)\right)} \]
    3. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto -1 \cdot \color{blue}{\left(i \cdot \left(-1 \cdot c + -1 \cdot \frac{a \cdot b + \left(t \cdot z + x \cdot y\right)}{i}\right)\right)} \]
      2. lower-*.f64N/A

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

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

        \[\leadsto -1 \cdot \left(i \cdot \left(-1 \cdot c + \color{blue}{-1} \cdot \frac{a \cdot b + \left(t \cdot z + x \cdot y\right)}{i}\right)\right) \]
      5. lower-*.f64N/A

        \[\leadsto -1 \cdot \left(i \cdot \left(-1 \cdot c + -1 \cdot \color{blue}{\frac{a \cdot b + \left(t \cdot z + x \cdot y\right)}{i}}\right)\right) \]
      6. lower-/.f64N/A

        \[\leadsto -1 \cdot \left(i \cdot \left(-1 \cdot c + -1 \cdot \frac{a \cdot b + \left(t \cdot z + x \cdot y\right)}{\color{blue}{i}}\right)\right) \]
      7. lower-+.f64N/A

        \[\leadsto -1 \cdot \left(i \cdot \left(-1 \cdot c + -1 \cdot \frac{a \cdot b + \left(t \cdot z + x \cdot y\right)}{i}\right)\right) \]
      8. lower-*.f64N/A

        \[\leadsto -1 \cdot \left(i \cdot \left(-1 \cdot c + -1 \cdot \frac{a \cdot b + \left(t \cdot z + x \cdot y\right)}{i}\right)\right) \]
      9. lower-+.f64N/A

        \[\leadsto -1 \cdot \left(i \cdot \left(-1 \cdot c + -1 \cdot \frac{a \cdot b + \left(t \cdot z + x \cdot y\right)}{i}\right)\right) \]
      10. lower-*.f64N/A

        \[\leadsto -1 \cdot \left(i \cdot \left(-1 \cdot c + -1 \cdot \frac{a \cdot b + \left(t \cdot z + x \cdot y\right)}{i}\right)\right) \]
      11. lower-*.f6483.7%

        \[\leadsto -1 \cdot \left(i \cdot \left(-1 \cdot c + -1 \cdot \frac{a \cdot b + \left(t \cdot z + x \cdot y\right)}{i}\right)\right) \]
    4. Applied rewrites83.7%

      \[\leadsto \color{blue}{-1 \cdot \left(i \cdot \left(-1 \cdot c + -1 \cdot \frac{a \cdot b + \left(t \cdot z + x \cdot y\right)}{i}\right)\right)} \]
    5. Taylor expanded in a around inf

      \[\leadsto -1 \cdot \left(-1 \cdot \color{blue}{\left(a \cdot b\right)}\right) \]
    6. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto -1 \cdot \left(-1 \cdot \left(a \cdot \color{blue}{b}\right)\right) \]
      2. lower-*.f6427.4%

        \[\leadsto -1 \cdot \left(-1 \cdot \left(a \cdot b\right)\right) \]
    7. Applied rewrites27.4%

      \[\leadsto -1 \cdot \left(-1 \cdot \color{blue}{\left(a \cdot b\right)}\right) \]
    8. Taylor expanded in x around inf

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

        \[\leadsto -1 \cdot \left(-1 \cdot \left(x \cdot \color{blue}{y}\right)\right) \]
      2. lower-*.f6427.2%

        \[\leadsto -1 \cdot \left(-1 \cdot \left(x \cdot y\right)\right) \]
    10. Applied rewrites27.2%

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

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

        \[\leadsto \mathsf{neg}\left(-1 \cdot \left(x \cdot y\right)\right) \]
      3. lower-neg.f6427.2%

        \[\leadsto --1 \cdot \left(x \cdot y\right) \]
      4. lift-*.f64N/A

        \[\leadsto --1 \cdot \left(x \cdot y\right) \]
      5. lift-*.f64N/A

        \[\leadsto --1 \cdot \left(x \cdot y\right) \]
      6. mul-1-negN/A

        \[\leadsto -\left(\mathsf{neg}\left(x \cdot y\right)\right) \]
      7. *-commutativeN/A

        \[\leadsto -\left(\mathsf{neg}\left(y \cdot x\right)\right) \]
      8. distribute-lft-neg-inN/A

        \[\leadsto -\left(\mathsf{neg}\left(y\right)\right) \cdot x \]
      9. lower-*.f64N/A

        \[\leadsto -\left(\mathsf{neg}\left(y\right)\right) \cdot x \]
      10. lower-neg.f6427.2%

        \[\leadsto -\left(-y\right) \cdot x \]
    12. Applied rewrites27.2%

      \[\leadsto -\left(-y\right) \cdot x \]
  3. Recombined 4 regimes into one program.
  4. Add Preprocessing

Alternative 9: 43.3% accurate, 0.8× speedup?

\[\begin{array}{l} \mathbf{if}\;c \cdot i \leq -999999999999999998217443564185241415988928868759412500436543339729940401905904649497115766142268560009777175966751665376232210432:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;c \cdot i \leq \frac{4530655075725799}{730750818665451459101842416358141509827966271488}:\\ \;\;\;\;t \cdot z\\ \mathbf{elif}\;c \cdot i \leq 1299999999999999967733223573514609746608608365174467094904635413122985441295687860405609026104539524614751916574900224:\\ \;\;\;\;a \cdot b\\ \mathbf{else}:\\ \;\;\;\;c \cdot i\\ \end{array} \]
(FPCore (x y z t a b c i)
  :precision binary64
  (if (<=
     (* c i)
     -999999999999999998217443564185241415988928868759412500436543339729940401905904649497115766142268560009777175966751665376232210432)
  (* c i)
  (if (<=
       (* c i)
       4530655075725799/730750818665451459101842416358141509827966271488)
    (* t z)
    (if (<=
         (* c i)
         1299999999999999967733223573514609746608608365174467094904635413122985441295687860405609026104539524614751916574900224)
      (* a b)
      (* c i)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double tmp;
	if ((c * i) <= -1e+129) {
		tmp = c * i;
	} else if ((c * i) <= 6.2e-33) {
		tmp = t * z;
	} else if ((c * i) <= 1.3e+117) {
		tmp = a * b;
	} else {
		tmp = c * i;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y, z, t, a, b, c, i)
use fmin_fmax_functions
    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), intent (in) :: i
    real(8) :: tmp
    if ((c * i) <= (-1d+129)) then
        tmp = c * i
    else if ((c * i) <= 6.2d-33) then
        tmp = t * z
    else if ((c * i) <= 1.3d+117) then
        tmp = a * b
    else
        tmp = c * i
    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 i) {
	double tmp;
	if ((c * i) <= -1e+129) {
		tmp = c * i;
	} else if ((c * i) <= 6.2e-33) {
		tmp = t * z;
	} else if ((c * i) <= 1.3e+117) {
		tmp = a * b;
	} else {
		tmp = c * i;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	tmp = 0
	if (c * i) <= -1e+129:
		tmp = c * i
	elif (c * i) <= 6.2e-33:
		tmp = t * z
	elif (c * i) <= 1.3e+117:
		tmp = a * b
	else:
		tmp = c * i
	return tmp
function code(x, y, z, t, a, b, c, i)
	tmp = 0.0
	if (Float64(c * i) <= -1e+129)
		tmp = Float64(c * i);
	elseif (Float64(c * i) <= 6.2e-33)
		tmp = Float64(t * z);
	elseif (Float64(c * i) <= 1.3e+117)
		tmp = Float64(a * b);
	else
		tmp = Float64(c * i);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i)
	tmp = 0.0;
	if ((c * i) <= -1e+129)
		tmp = c * i;
	elseif ((c * i) <= 6.2e-33)
		tmp = t * z;
	elseif ((c * i) <= 1.3e+117)
		tmp = a * b;
	else
		tmp = c * i;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(c * i), $MachinePrecision], -999999999999999998217443564185241415988928868759412500436543339729940401905904649497115766142268560009777175966751665376232210432], N[(c * i), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 4530655075725799/730750818665451459101842416358141509827966271488], N[(t * z), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 1299999999999999967733223573514609746608608365174467094904635413122985441295687860405609026104539524614751916574900224], N[(a * b), $MachinePrecision], N[(c * i), $MachinePrecision]]]]
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -999999999999999998217443564185241415988928868759412500436543339729940401905904649497115766142268560009777175966751665376232210432:\\
\;\;\;\;c \cdot i\\

\mathbf{elif}\;c \cdot i \leq \frac{4530655075725799}{730750818665451459101842416358141509827966271488}:\\
\;\;\;\;t \cdot z\\

\mathbf{elif}\;c \cdot i \leq 1299999999999999967733223573514609746608608365174467094904635413122985441295687860405609026104539524614751916574900224:\\
\;\;\;\;a \cdot b\\

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


\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 c i) < -1e129 or 1.3e117 < (*.f64 c i)

    1. Initial program 95.6%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Taylor expanded in a around 0

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

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

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

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

        \[\leadsto c \cdot i + \left(t \cdot z + \color{blue}{x} \cdot y\right) \]
      5. lower-*.f6474.0%

        \[\leadsto c \cdot i + \left(t \cdot z + x \cdot \color{blue}{y}\right) \]
    4. Applied rewrites74.0%

      \[\leadsto \color{blue}{c \cdot i + \left(t \cdot z + x \cdot y\right)} \]
    5. Taylor expanded in z around 0

      \[\leadsto c \cdot i + \color{blue}{x \cdot y} \]
    6. Step-by-step derivation
      1. lower-+.f64N/A

        \[\leadsto c \cdot i + x \cdot \color{blue}{y} \]
      2. lower-*.f64N/A

        \[\leadsto c \cdot i + x \cdot y \]
      3. lower-*.f6451.6%

        \[\leadsto c \cdot i + x \cdot y \]
    7. Applied rewrites51.6%

      \[\leadsto c \cdot i + \color{blue}{x \cdot y} \]
    8. Taylor expanded in x around 0

      \[\leadsto c \cdot i \]
    9. Step-by-step derivation
      1. lower-*.f6428.0%

        \[\leadsto c \cdot i \]
    10. Applied rewrites28.0%

      \[\leadsto c \cdot i \]

    if -1e129 < (*.f64 c i) < 6.1999999999999999e-33

    1. Initial program 95.6%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Taylor expanded in a around 0

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

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

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

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

        \[\leadsto c \cdot i + \left(t \cdot z + \color{blue}{x} \cdot y\right) \]
      5. lower-*.f6474.0%

        \[\leadsto c \cdot i + \left(t \cdot z + x \cdot \color{blue}{y}\right) \]
    4. Applied rewrites74.0%

      \[\leadsto \color{blue}{c \cdot i + \left(t \cdot z + x \cdot y\right)} \]
    5. Taylor expanded in z around 0

      \[\leadsto c \cdot i + \color{blue}{x \cdot y} \]
    6. Step-by-step derivation
      1. lower-+.f64N/A

        \[\leadsto c \cdot i + x \cdot \color{blue}{y} \]
      2. lower-*.f64N/A

        \[\leadsto c \cdot i + x \cdot y \]
      3. lower-*.f6451.6%

        \[\leadsto c \cdot i + x \cdot y \]
    7. Applied rewrites51.6%

      \[\leadsto c \cdot i + \color{blue}{x \cdot y} \]
    8. Taylor expanded in x around 0

      \[\leadsto c \cdot i \]
    9. Step-by-step derivation
      1. lower-*.f6428.0%

        \[\leadsto c \cdot i \]
    10. Applied rewrites28.0%

      \[\leadsto c \cdot i \]
    11. Taylor expanded in z around inf

      \[\leadsto t \cdot \color{blue}{z} \]
    12. Step-by-step derivation
      1. lower-*.f6427.2%

        \[\leadsto t \cdot z \]
    13. Applied rewrites27.2%

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

    if 6.1999999999999999e-33 < (*.f64 c i) < 1.3e117

    1. Initial program 95.6%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Taylor expanded in a around 0

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

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

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

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

        \[\leadsto c \cdot i + \left(t \cdot z + \color{blue}{x} \cdot y\right) \]
      5. lower-*.f6474.0%

        \[\leadsto c \cdot i + \left(t \cdot z + x \cdot \color{blue}{y}\right) \]
    4. Applied rewrites74.0%

      \[\leadsto \color{blue}{c \cdot i + \left(t \cdot z + x \cdot y\right)} \]
    5. Taylor expanded in z around 0

      \[\leadsto c \cdot i + \color{blue}{x \cdot y} \]
    6. Step-by-step derivation
      1. lower-+.f64N/A

        \[\leadsto c \cdot i + x \cdot \color{blue}{y} \]
      2. lower-*.f64N/A

        \[\leadsto c \cdot i + x \cdot y \]
      3. lower-*.f6451.6%

        \[\leadsto c \cdot i + x \cdot y \]
    7. Applied rewrites51.6%

      \[\leadsto c \cdot i + \color{blue}{x \cdot y} \]
    8. Taylor expanded in x around 0

      \[\leadsto c \cdot i \]
    9. Step-by-step derivation
      1. lower-*.f6428.0%

        \[\leadsto c \cdot i \]
    10. Applied rewrites28.0%

      \[\leadsto c \cdot i \]
    11. Taylor expanded in a around inf

      \[\leadsto \color{blue}{a \cdot b} \]
    12. Step-by-step derivation
      1. lower-*.f6427.4%

        \[\leadsto a \cdot \color{blue}{b} \]
    13. Applied rewrites27.4%

      \[\leadsto \color{blue}{a \cdot b} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 10: 42.8% accurate, 1.1× speedup?

\[\begin{array}{l} \mathbf{if}\;c \cdot i \leq -999999999999999998217443564185241415988928868759412500436543339729940401905904649497115766142268560009777175966751665376232210432:\\ \;\;\;\;c \cdot i\\ \mathbf{elif}\;c \cdot i \leq 10500000000000000641853867875909401765417069805170575562727212711936:\\ \;\;\;\;t \cdot z\\ \mathbf{else}:\\ \;\;\;\;c \cdot i\\ \end{array} \]
(FPCore (x y z t a b c i)
  :precision binary64
  (if (<=
     (* c i)
     -999999999999999998217443564185241415988928868759412500436543339729940401905904649497115766142268560009777175966751665376232210432)
  (* c i)
  (if (<=
       (* c i)
       10500000000000000641853867875909401765417069805170575562727212711936)
    (* t z)
    (* c i))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double tmp;
	if ((c * i) <= -1e+129) {
		tmp = c * i;
	} else if ((c * i) <= 1.05e+67) {
		tmp = t * z;
	} else {
		tmp = c * i;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y, z, t, a, b, c, i)
use fmin_fmax_functions
    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), intent (in) :: i
    real(8) :: tmp
    if ((c * i) <= (-1d+129)) then
        tmp = c * i
    else if ((c * i) <= 1.05d+67) then
        tmp = t * z
    else
        tmp = c * i
    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 i) {
	double tmp;
	if ((c * i) <= -1e+129) {
		tmp = c * i;
	} else if ((c * i) <= 1.05e+67) {
		tmp = t * z;
	} else {
		tmp = c * i;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	tmp = 0
	if (c * i) <= -1e+129:
		tmp = c * i
	elif (c * i) <= 1.05e+67:
		tmp = t * z
	else:
		tmp = c * i
	return tmp
function code(x, y, z, t, a, b, c, i)
	tmp = 0.0
	if (Float64(c * i) <= -1e+129)
		tmp = Float64(c * i);
	elseif (Float64(c * i) <= 1.05e+67)
		tmp = Float64(t * z);
	else
		tmp = Float64(c * i);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i)
	tmp = 0.0;
	if ((c * i) <= -1e+129)
		tmp = c * i;
	elseif ((c * i) <= 1.05e+67)
		tmp = t * z;
	else
		tmp = c * i;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(c * i), $MachinePrecision], -999999999999999998217443564185241415988928868759412500436543339729940401905904649497115766142268560009777175966751665376232210432], N[(c * i), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 10500000000000000641853867875909401765417069805170575562727212711936], N[(t * z), $MachinePrecision], N[(c * i), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -999999999999999998217443564185241415988928868759412500436543339729940401905904649497115766142268560009777175966751665376232210432:\\
\;\;\;\;c \cdot i\\

\mathbf{elif}\;c \cdot i \leq 10500000000000000641853867875909401765417069805170575562727212711936:\\
\;\;\;\;t \cdot z\\

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


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 c i) < -1e129 or 1.0500000000000001e67 < (*.f64 c i)

    1. Initial program 95.6%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Taylor expanded in a around 0

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

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

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

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

        \[\leadsto c \cdot i + \left(t \cdot z + \color{blue}{x} \cdot y\right) \]
      5. lower-*.f6474.0%

        \[\leadsto c \cdot i + \left(t \cdot z + x \cdot \color{blue}{y}\right) \]
    4. Applied rewrites74.0%

      \[\leadsto \color{blue}{c \cdot i + \left(t \cdot z + x \cdot y\right)} \]
    5. Taylor expanded in z around 0

      \[\leadsto c \cdot i + \color{blue}{x \cdot y} \]
    6. Step-by-step derivation
      1. lower-+.f64N/A

        \[\leadsto c \cdot i + x \cdot \color{blue}{y} \]
      2. lower-*.f64N/A

        \[\leadsto c \cdot i + x \cdot y \]
      3. lower-*.f6451.6%

        \[\leadsto c \cdot i + x \cdot y \]
    7. Applied rewrites51.6%

      \[\leadsto c \cdot i + \color{blue}{x \cdot y} \]
    8. Taylor expanded in x around 0

      \[\leadsto c \cdot i \]
    9. Step-by-step derivation
      1. lower-*.f6428.0%

        \[\leadsto c \cdot i \]
    10. Applied rewrites28.0%

      \[\leadsto c \cdot i \]

    if -1e129 < (*.f64 c i) < 1.0500000000000001e67

    1. Initial program 95.6%

      \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
    2. Taylor expanded in a around 0

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

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

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

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

        \[\leadsto c \cdot i + \left(t \cdot z + \color{blue}{x} \cdot y\right) \]
      5. lower-*.f6474.0%

        \[\leadsto c \cdot i + \left(t \cdot z + x \cdot \color{blue}{y}\right) \]
    4. Applied rewrites74.0%

      \[\leadsto \color{blue}{c \cdot i + \left(t \cdot z + x \cdot y\right)} \]
    5. Taylor expanded in z around 0

      \[\leadsto c \cdot i + \color{blue}{x \cdot y} \]
    6. Step-by-step derivation
      1. lower-+.f64N/A

        \[\leadsto c \cdot i + x \cdot \color{blue}{y} \]
      2. lower-*.f64N/A

        \[\leadsto c \cdot i + x \cdot y \]
      3. lower-*.f6451.6%

        \[\leadsto c \cdot i + x \cdot y \]
    7. Applied rewrites51.6%

      \[\leadsto c \cdot i + \color{blue}{x \cdot y} \]
    8. Taylor expanded in x around 0

      \[\leadsto c \cdot i \]
    9. Step-by-step derivation
      1. lower-*.f6428.0%

        \[\leadsto c \cdot i \]
    10. Applied rewrites28.0%

      \[\leadsto c \cdot i \]
    11. Taylor expanded in z around inf

      \[\leadsto t \cdot \color{blue}{z} \]
    12. Step-by-step derivation
      1. lower-*.f6427.2%

        \[\leadsto t \cdot z \]
    13. Applied rewrites27.2%

      \[\leadsto t \cdot \color{blue}{z} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 11: 28.0% accurate, 5.0× speedup?

\[c \cdot i \]
(FPCore (x y z t a b c i)
  :precision binary64
  (* c i))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	return c * i;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y, z, t, a, b, c, i)
use fmin_fmax_functions
    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), intent (in) :: i
    code = c * i
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	return c * i;
}
def code(x, y, z, t, a, b, c, i):
	return c * i
function code(x, y, z, t, a, b, c, i)
	return Float64(c * i)
end
function tmp = code(x, y, z, t, a, b, c, i)
	tmp = c * i;
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(c * i), $MachinePrecision]
c \cdot i
Derivation
  1. Initial program 95.6%

    \[\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \]
  2. Taylor expanded in a around 0

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

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

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

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

      \[\leadsto c \cdot i + \left(t \cdot z + \color{blue}{x} \cdot y\right) \]
    5. lower-*.f6474.0%

      \[\leadsto c \cdot i + \left(t \cdot z + x \cdot \color{blue}{y}\right) \]
  4. Applied rewrites74.0%

    \[\leadsto \color{blue}{c \cdot i + \left(t \cdot z + x \cdot y\right)} \]
  5. Taylor expanded in z around 0

    \[\leadsto c \cdot i + \color{blue}{x \cdot y} \]
  6. Step-by-step derivation
    1. lower-+.f64N/A

      \[\leadsto c \cdot i + x \cdot \color{blue}{y} \]
    2. lower-*.f64N/A

      \[\leadsto c \cdot i + x \cdot y \]
    3. lower-*.f6451.6%

      \[\leadsto c \cdot i + x \cdot y \]
  7. Applied rewrites51.6%

    \[\leadsto c \cdot i + \color{blue}{x \cdot y} \]
  8. Taylor expanded in x around 0

    \[\leadsto c \cdot i \]
  9. Step-by-step derivation
    1. lower-*.f6428.0%

      \[\leadsto c \cdot i \]
  10. Applied rewrites28.0%

    \[\leadsto c \cdot i \]
  11. Add Preprocessing

Reproduce

?
herbie shell --seed 2025271 -o generate:evaluate
(FPCore (x y z t a b c i)
  :name "Linear.V4:$cdot from linear-1.19.1.3, C"
  :precision binary64
  (+ (+ (+ (* x y) (* z t)) (* a b)) (* c i)))