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

Percentage Accurate: 96.0% → 97.4%
Time: 4.1s
Alternatives: 10
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 10 alternatives:

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

Initial Program: 96.0% 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.4% 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 + x \cdot y\\ \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) (* x y)))))
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) + (x * y);
	}
	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) + (x * y);
	}
	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) + (x * y)
	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(x * y));
	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) + (x * y);
	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[(x * y), $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 + x \cdot y\\


\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 96.0%

      \[\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 96.0%

      \[\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-*.f6473.9%

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

      \[\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.1%

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

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

Alternative 2: 87.1% accurate, 0.7× speedup?

\[\begin{array}{l} \mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+63}:\\ \;\;\;\;c \cdot i + \left(t \cdot z + x \cdot y\right)\\ \mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{-68}:\\ \;\;\;\;\left(t \cdot z + a \cdot b\right) + c \cdot i\\ \mathbf{else}:\\ \;\;\;\;\left(a \cdot b + x \cdot y\right) + c \cdot i\\ \end{array} \]
(FPCore (x y z t a b c i)
  :precision binary64
  (if (<= (* x y) -2e+63)
  (+ (* c i) (+ (* t z) (* x y)))
  (if (<= (* x y) 2e-68)
    (+ (+ (* t z) (* a b)) (* c i))
    (+ (+ (* a b) (* x y)) (* c i)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double tmp;
	if ((x * y) <= -2e+63) {
		tmp = (c * i) + ((t * z) + (x * y));
	} else if ((x * y) <= 2e-68) {
		tmp = ((t * z) + (a * b)) + (c * i);
	} else {
		tmp = ((a * b) + (x * y)) + (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 ((x * y) <= (-2d+63)) then
        tmp = (c * i) + ((t * z) + (x * y))
    else if ((x * y) <= 2d-68) then
        tmp = ((t * z) + (a * b)) + (c * i)
    else
        tmp = ((a * b) + (x * y)) + (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 ((x * y) <= -2e+63) {
		tmp = (c * i) + ((t * z) + (x * y));
	} else if ((x * y) <= 2e-68) {
		tmp = ((t * z) + (a * b)) + (c * i);
	} else {
		tmp = ((a * b) + (x * y)) + (c * i);
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	tmp = 0
	if (x * y) <= -2e+63:
		tmp = (c * i) + ((t * z) + (x * y))
	elif (x * y) <= 2e-68:
		tmp = ((t * z) + (a * b)) + (c * i)
	else:
		tmp = ((a * b) + (x * y)) + (c * i)
	return tmp
function code(x, y, z, t, a, b, c, i)
	tmp = 0.0
	if (Float64(x * y) <= -2e+63)
		tmp = Float64(Float64(c * i) + Float64(Float64(t * z) + Float64(x * y)));
	elseif (Float64(x * y) <= 2e-68)
		tmp = Float64(Float64(Float64(t * z) + Float64(a * b)) + Float64(c * i));
	else
		tmp = Float64(Float64(Float64(a * b) + Float64(x * y)) + Float64(c * i));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i)
	tmp = 0.0;
	if ((x * y) <= -2e+63)
		tmp = (c * i) + ((t * z) + (x * y));
	elseif ((x * y) <= 2e-68)
		tmp = ((t * z) + (a * b)) + (c * i);
	else
		tmp = ((a * b) + (x * y)) + (c * i);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(x * y), $MachinePrecision], -2e+63], N[(N[(c * i), $MachinePrecision] + N[(N[(t * z), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e-68], N[(N[(N[(t * z), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision], N[(N[(N[(a * b), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+63}:\\
\;\;\;\;c \cdot i + \left(t \cdot z + x \cdot y\right)\\

\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{-68}:\\
\;\;\;\;\left(t \cdot z + a \cdot b\right) + c \cdot i\\

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


\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x y) < -2.0000000000000001e63

    1. Initial program 96.0%

      \[\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-*.f6473.9%

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

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

    if -2.0000000000000001e63 < (*.f64 x y) < 2.0000000000000001e-68

    1. Initial program 96.0%

      \[\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.1%

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

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

    if 2.0000000000000001e-68 < (*.f64 x y)

    1. Initial program 96.0%

      \[\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 3 regimes into one program.
  4. Add Preprocessing

Alternative 3: 86.9% accurate, 0.7× speedup?

\[\begin{array}{l} t_1 := \left(a \cdot b + x \cdot y\right) + c \cdot i\\ \mathbf{if}\;a \cdot b \leq -3.9 \cdot 10^{+207}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;a \cdot b \leq 7.2 \cdot 10^{+18}:\\ \;\;\;\;c \cdot i + \left(t \cdot z + x \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \]
(FPCore (x y z t a b c i)
  :precision binary64
  (let* ((t_1 (+ (+ (* a b) (* x y)) (* c i))))
  (if (<= (* a b) -3.9e+207)
    t_1
    (if (<= (* a b) 7.2e+18) (+ (* c i) (+ (* t z) (* x y))) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = ((a * b) + (x * y)) + (c * i);
	double tmp;
	if ((a * b) <= -3.9e+207) {
		tmp = t_1;
	} else if ((a * b) <= 7.2e+18) {
		tmp = (c * i) + ((t * z) + (x * y));
	} 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 = ((a * b) + (x * y)) + (c * i)
    if ((a * b) <= (-3.9d+207)) then
        tmp = t_1
    else if ((a * b) <= 7.2d+18) then
        tmp = (c * i) + ((t * z) + (x * y))
    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 = ((a * b) + (x * y)) + (c * i);
	double tmp;
	if ((a * b) <= -3.9e+207) {
		tmp = t_1;
	} else if ((a * b) <= 7.2e+18) {
		tmp = (c * i) + ((t * z) + (x * y));
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	t_1 = ((a * b) + (x * y)) + (c * i)
	tmp = 0
	if (a * b) <= -3.9e+207:
		tmp = t_1
	elif (a * b) <= 7.2e+18:
		tmp = (c * i) + ((t * z) + (x * y))
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a, b, c, i)
	t_1 = Float64(Float64(Float64(a * b) + Float64(x * y)) + Float64(c * i))
	tmp = 0.0
	if (Float64(a * b) <= -3.9e+207)
		tmp = t_1;
	elseif (Float64(a * b) <= 7.2e+18)
		tmp = Float64(Float64(c * i) + Float64(Float64(t * z) + Float64(x * y)));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i)
	t_1 = ((a * b) + (x * y)) + (c * i);
	tmp = 0.0;
	if ((a * b) <= -3.9e+207)
		tmp = t_1;
	elseif ((a * b) <= 7.2e+18)
		tmp = (c * i) + ((t * z) + (x * y));
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(N[(a * b), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(a * b), $MachinePrecision], -3.9e+207], t$95$1, If[LessEqual[N[(a * b), $MachinePrecision], 7.2e+18], N[(N[(c * i), $MachinePrecision] + N[(N[(t * z), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \left(a \cdot b + x \cdot y\right) + c \cdot i\\
\mathbf{if}\;a \cdot b \leq -3.9 \cdot 10^{+207}:\\
\;\;\;\;t\_1\\

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

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


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 a b) < -3.8999999999999997e207 or 7.2e18 < (*.f64 a b)

    1. Initial program 96.0%

      \[\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 -3.8999999999999997e207 < (*.f64 a b) < 7.2e18

    1. Initial program 96.0%

      \[\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-*.f6473.9%

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

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

Alternative 4: 83.4% accurate, 0.7× speedup?

\[\begin{array}{l} t_1 := a \cdot b + c \cdot i\\ \mathbf{if}\;a \cdot b \leq -3.9 \cdot 10^{+207}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;a \cdot b \leq 2.3 \cdot 10^{+25}:\\ \;\;\;\;c \cdot i + \left(t \cdot z + x \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \]
(FPCore (x y z t a b c i)
  :precision binary64
  (let* ((t_1 (+ (* a b) (* c i))))
  (if (<= (* a b) -3.9e+207)
    t_1
    (if (<= (* a b) 2.3e+25) (+ (* c i) (+ (* t z) (* x y))) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = (a * b) + (c * i);
	double tmp;
	if ((a * b) <= -3.9e+207) {
		tmp = t_1;
	} else if ((a * b) <= 2.3e+25) {
		tmp = (c * i) + ((t * z) + (x * y));
	} 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 = (a * b) + (c * i)
    if ((a * b) <= (-3.9d+207)) then
        tmp = t_1
    else if ((a * b) <= 2.3d+25) then
        tmp = (c * i) + ((t * z) + (x * y))
    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 = (a * b) + (c * i);
	double tmp;
	if ((a * b) <= -3.9e+207) {
		tmp = t_1;
	} else if ((a * b) <= 2.3e+25) {
		tmp = (c * i) + ((t * z) + (x * y));
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	t_1 = (a * b) + (c * i)
	tmp = 0
	if (a * b) <= -3.9e+207:
		tmp = t_1
	elif (a * b) <= 2.3e+25:
		tmp = (c * i) + ((t * z) + (x * y))
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a, b, c, i)
	t_1 = Float64(Float64(a * b) + Float64(c * i))
	tmp = 0.0
	if (Float64(a * b) <= -3.9e+207)
		tmp = t_1;
	elseif (Float64(a * b) <= 2.3e+25)
		tmp = Float64(Float64(c * i) + Float64(Float64(t * z) + Float64(x * y)));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i)
	t_1 = (a * b) + (c * i);
	tmp = 0.0;
	if ((a * b) <= -3.9e+207)
		tmp = t_1;
	elseif ((a * b) <= 2.3e+25)
		tmp = (c * i) + ((t * z) + (x * y));
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(a * b), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(a * b), $MachinePrecision], -3.9e+207], t$95$1, If[LessEqual[N[(a * b), $MachinePrecision], 2.3e+25], N[(N[(c * i), $MachinePrecision] + N[(N[(t * z), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := a \cdot b + c \cdot i\\
\mathbf{if}\;a \cdot b \leq -3.9 \cdot 10^{+207}:\\
\;\;\;\;t\_1\\

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

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


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 a b) < -3.8999999999999997e207 or 2.2999999999999998e25 < (*.f64 a b)

    1. Initial program 96.0%

      \[\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.2%

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

      \[\leadsto a \cdot \color{blue}{b} + c \cdot i \]

    if -3.8999999999999997e207 < (*.f64 a b) < 2.2999999999999998e25

    1. Initial program 96.0%

      \[\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-*.f6473.9%

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

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

Alternative 5: 65.8% accurate, 0.6× speedup?

\[\begin{array}{l} t_1 := c \cdot i + x \cdot y\\ \mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+159}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \cdot y \leq -1 \cdot 10^{-36}:\\ \;\;\;\;c \cdot i + t \cdot z\\ \mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+79}:\\ \;\;\;\;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) (* x y))))
  (if (<= (* x y) -2e+159)
    t_1
    (if (<= (* x y) -1e-36)
      (+ (* c i) (* t z))
      (if (<= (* x y) 2e+79) (+ (* 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) + (x * y);
	double tmp;
	if ((x * y) <= -2e+159) {
		tmp = t_1;
	} else if ((x * y) <= -1e-36) {
		tmp = (c * i) + (t * z);
	} else if ((x * y) <= 2e+79) {
		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) + (x * y)
    if ((x * y) <= (-2d+159)) then
        tmp = t_1
    else if ((x * y) <= (-1d-36)) then
        tmp = (c * i) + (t * z)
    else if ((x * y) <= 2d+79) 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) + (x * y);
	double tmp;
	if ((x * y) <= -2e+159) {
		tmp = t_1;
	} else if ((x * y) <= -1e-36) {
		tmp = (c * i) + (t * z);
	} else if ((x * y) <= 2e+79) {
		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) + (x * y)
	tmp = 0
	if (x * y) <= -2e+159:
		tmp = t_1
	elif (x * y) <= -1e-36:
		tmp = (c * i) + (t * z)
	elif (x * y) <= 2e+79:
		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(x * y))
	tmp = 0.0
	if (Float64(x * y) <= -2e+159)
		tmp = t_1;
	elseif (Float64(x * y) <= -1e-36)
		tmp = Float64(Float64(c * i) + Float64(t * z));
	elseif (Float64(x * y) <= 2e+79)
		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) + (x * y);
	tmp = 0.0;
	if ((x * y) <= -2e+159)
		tmp = t_1;
	elseif ((x * y) <= -1e-36)
		tmp = (c * i) + (t * z);
	elseif ((x * y) <= 2e+79)
		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[(x * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -2e+159], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], -1e-36], N[(N[(c * i), $MachinePrecision] + N[(t * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e+79], N[(N[(a * b), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
t_1 := c \cdot i + x \cdot y\\
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+159}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \cdot y \leq -1 \cdot 10^{-36}:\\
\;\;\;\;c \cdot i + t \cdot z\\

\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+79}:\\
\;\;\;\;a \cdot b + c \cdot i\\

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


\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x y) < -1.9999999999999999e159 or 1.9999999999999999e79 < (*.f64 x y)

    1. Initial program 96.0%

      \[\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-*.f6473.9%

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

      \[\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.1%

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

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

    if -1.9999999999999999e159 < (*.f64 x y) < -9.9999999999999994e-37

    1. Initial program 96.0%

      \[\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-*.f6473.9%

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

      \[\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.1%

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

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

    if -9.9999999999999994e-37 < (*.f64 x y) < 1.9999999999999999e79

    1. Initial program 96.0%

      \[\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.2%

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

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

Alternative 6: 64.7% accurate, 0.8× speedup?

\[\begin{array}{l} t_1 := c \cdot i + x \cdot y\\ \mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+159}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \cdot y \leq 10^{-41}:\\ \;\;\;\;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) -2e+159)
    t_1
    (if (<= (* x y) 1e-41) (+ (* 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+159) {
		tmp = t_1;
	} else if ((x * y) <= 1e-41) {
		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+159)) then
        tmp = t_1
    else if ((x * y) <= 1d-41) 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+159) {
		tmp = t_1;
	} else if ((x * y) <= 1e-41) {
		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+159:
		tmp = t_1
	elif (x * y) <= 1e-41:
		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+159)
		tmp = t_1;
	elseif (Float64(x * y) <= 1e-41)
		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+159)
		tmp = t_1;
	elseif ((x * y) <= 1e-41)
		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], -2e+159], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 1e-41], 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 -2 \cdot 10^{+159}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \cdot y \leq 10^{-41}:\\
\;\;\;\;c \cdot i + t \cdot z\\

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


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x y) < -1.9999999999999999e159 or 1e-41 < (*.f64 x y)

    1. Initial program 96.0%

      \[\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-*.f6473.9%

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

      \[\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.1%

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

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

    if -1.9999999999999999e159 < (*.f64 x y) < 1e-41

    1. Initial program 96.0%

      \[\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-*.f6473.9%

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

      \[\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.1%

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

      \[\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} t_1 := -\left(-t\right) \cdot z\\ \mathbf{if}\;z \cdot t \leq -2 \cdot 10^{+75}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \cdot t \leq 10^{+190}:\\ \;\;\;\;c \cdot i + x \cdot y\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \]
(FPCore (x y z t a b c i)
  :precision binary64
  (let* ((t_1 (- (* (- t) z))))
  (if (<= (* z t) -2e+75)
    t_1
    (if (<= (* z t) 1e+190) (+ (* c i) (* x y)) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = -(-t * z);
	double tmp;
	if ((z * t) <= -2e+75) {
		tmp = t_1;
	} else if ((z * t) <= 1e+190) {
		tmp = (c * i) + (x * y);
	} 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 = -(-t * z)
    if ((z * t) <= (-2d+75)) then
        tmp = t_1
    else if ((z * t) <= 1d+190) then
        tmp = (c * i) + (x * y)
    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 = -(-t * z);
	double tmp;
	if ((z * t) <= -2e+75) {
		tmp = t_1;
	} else if ((z * t) <= 1e+190) {
		tmp = (c * i) + (x * y);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	t_1 = -(-t * z)
	tmp = 0
	if (z * t) <= -2e+75:
		tmp = t_1
	elif (z * t) <= 1e+190:
		tmp = (c * i) + (x * y)
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a, b, c, i)
	t_1 = Float64(-Float64(Float64(-t) * z))
	tmp = 0.0
	if (Float64(z * t) <= -2e+75)
		tmp = t_1;
	elseif (Float64(z * t) <= 1e+190)
		tmp = Float64(Float64(c * i) + Float64(x * y));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i)
	t_1 = -(-t * z);
	tmp = 0.0;
	if ((z * t) <= -2e+75)
		tmp = t_1;
	elseif ((z * t) <= 1e+190)
		tmp = (c * i) + (x * y);
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = (-N[((-t) * z), $MachinePrecision])}, If[LessEqual[N[(z * t), $MachinePrecision], -2e+75], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], 1e+190], N[(N[(c * i), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := -\left(-t\right) \cdot z\\
\mathbf{if}\;z \cdot t \leq -2 \cdot 10^{+75}:\\
\;\;\;\;t\_1\\

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

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


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 z t) < -1.9999999999999999e75 or 1.0000000000000001e190 < (*.f64 z t)

    1. Initial program 96.0%

      \[\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.4%

        \[\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.4%

      \[\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 z around inf

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

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

        \[\leadsto -1 \cdot \left(-1 \cdot \left(t \cdot z\right)\right) \]
    7. Applied rewrites27.7%

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

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

        \[\leadsto \mathsf{neg}\left(-1 \cdot \left(t \cdot z\right)\right) \]
      3. lower-neg.f6427.7%

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

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

        \[\leadsto --1 \cdot \left(t \cdot z\right) \]
      6. associate-*r*N/A

        \[\leadsto -\left(-1 \cdot t\right) \cdot z \]
      7. lower-*.f64N/A

        \[\leadsto -\left(-1 \cdot t\right) \cdot z \]
      8. mul-1-negN/A

        \[\leadsto -\left(\mathsf{neg}\left(t\right)\right) \cdot z \]
      9. lower-neg.f6427.7%

        \[\leadsto -\left(-t\right) \cdot z \]
    9. Applied rewrites27.7%

      \[\leadsto -\left(-t\right) \cdot z \]

    if -1.9999999999999999e75 < (*.f64 z t) < 1.0000000000000001e190

    1. Initial program 96.0%

      \[\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-*.f6473.9%

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

      \[\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.1%

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

      \[\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.7× speedup?

\[\begin{array}{l} t_1 := -\left(-t\right) \cdot z\\ \mathbf{if}\;z \cdot t \leq -2 \cdot 10^{+64}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \cdot t \leq -4 \cdot 10^{-133}:\\ \;\;\;\;-\left(-y\right) \cdot x\\ \mathbf{elif}\;z \cdot t \leq 10^{+104}:\\ \;\;\;\;c \cdot i\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \]
(FPCore (x y z t a b c i)
  :precision binary64
  (let* ((t_1 (- (* (- t) z))))
  (if (<= (* z t) -2e+64)
    t_1
    (if (<= (* z t) -4e-133)
      (- (* (- y) x))
      (if (<= (* z t) 1e+104) (* 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 = -(-t * z);
	double tmp;
	if ((z * t) <= -2e+64) {
		tmp = t_1;
	} else if ((z * t) <= -4e-133) {
		tmp = -(-y * x);
	} else if ((z * t) <= 1e+104) {
		tmp = 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 = -(-t * z)
    if ((z * t) <= (-2d+64)) then
        tmp = t_1
    else if ((z * t) <= (-4d-133)) then
        tmp = -(-y * x)
    else if ((z * t) <= 1d+104) then
        tmp = 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 = -(-t * z);
	double tmp;
	if ((z * t) <= -2e+64) {
		tmp = t_1;
	} else if ((z * t) <= -4e-133) {
		tmp = -(-y * x);
	} else if ((z * t) <= 1e+104) {
		tmp = c * i;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	t_1 = -(-t * z)
	tmp = 0
	if (z * t) <= -2e+64:
		tmp = t_1
	elif (z * t) <= -4e-133:
		tmp = -(-y * x)
	elif (z * t) <= 1e+104:
		tmp = c * i
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a, b, c, i)
	t_1 = Float64(-Float64(Float64(-t) * z))
	tmp = 0.0
	if (Float64(z * t) <= -2e+64)
		tmp = t_1;
	elseif (Float64(z * t) <= -4e-133)
		tmp = Float64(-Float64(Float64(-y) * x));
	elseif (Float64(z * t) <= 1e+104)
		tmp = 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 = -(-t * z);
	tmp = 0.0;
	if ((z * t) <= -2e+64)
		tmp = t_1;
	elseif ((z * t) <= -4e-133)
		tmp = -(-y * x);
	elseif ((z * t) <= 1e+104)
		tmp = 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[((-t) * z), $MachinePrecision])}, If[LessEqual[N[(z * t), $MachinePrecision], -2e+64], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], -4e-133], (-N[((-y) * x), $MachinePrecision]), If[LessEqual[N[(z * t), $MachinePrecision], 1e+104], N[(c * i), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
t_1 := -\left(-t\right) \cdot z\\
\mathbf{if}\;z \cdot t \leq -2 \cdot 10^{+64}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;z \cdot t \leq 10^{+104}:\\
\;\;\;\;c \cdot i\\

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


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

    1. Initial program 96.0%

      \[\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.4%

        \[\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.4%

      \[\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 z around inf

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

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

        \[\leadsto -1 \cdot \left(-1 \cdot \left(t \cdot z\right)\right) \]
    7. Applied rewrites27.7%

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

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

        \[\leadsto \mathsf{neg}\left(-1 \cdot \left(t \cdot z\right)\right) \]
      3. lower-neg.f6427.7%

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

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

        \[\leadsto --1 \cdot \left(t \cdot z\right) \]
      6. associate-*r*N/A

        \[\leadsto -\left(-1 \cdot t\right) \cdot z \]
      7. lower-*.f64N/A

        \[\leadsto -\left(-1 \cdot t\right) \cdot z \]
      8. mul-1-negN/A

        \[\leadsto -\left(\mathsf{neg}\left(t\right)\right) \cdot z \]
      9. lower-neg.f6427.7%

        \[\leadsto -\left(-t\right) \cdot z \]
    9. Applied rewrites27.7%

      \[\leadsto -\left(-t\right) \cdot z \]

    if -2e64 < (*.f64 z t) < -4.0000000000000003e-133

    1. Initial program 96.0%

      \[\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.4%

        \[\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.4%

      \[\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. Step-by-step derivation
      1. lift-*.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) \]
      2. mul-1-negN/A

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

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

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

        \[\leadsto -1 \cdot \left(i \cdot \left(-1 \cdot c + \left(\mathsf{neg}\left(\frac{a \cdot b + \left(t \cdot z + x \cdot y\right)}{i}\right)\right)\right)\right) \]
      6. +-commutativeN/A

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

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

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

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

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

        \[\leadsto -1 \cdot \left(i \cdot \left(-1 \cdot c + \left(\mathsf{neg}\left(\frac{\left(x \cdot y + z \cdot t\right) + a \cdot b}{i}\right)\right)\right)\right) \]
      12. distribute-neg-frac2N/A

        \[\leadsto -1 \cdot \left(i \cdot \left(-1 \cdot c + \frac{\left(x \cdot y + z \cdot t\right) + a \cdot b}{\color{blue}{\mathsf{neg}\left(i\right)}}\right)\right) \]
      13. mult-flipN/A

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

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

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

      \[\leadsto -1 \cdot \left(-1 \cdot \color{blue}{\left(x \cdot y\right)}\right) \]
    8. 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.3%

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

      \[\leadsto -1 \cdot \left(-1 \cdot \color{blue}{\left(x \cdot y\right)}\right) \]
    10. 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.3%

        \[\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-outN/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.3%

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

      \[\leadsto -\left(-y\right) \cdot x \]

    if -4.0000000000000003e-133 < (*.f64 z t) < 1e104

    1. Initial program 96.0%

      \[\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-*.f6473.9%

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

      \[\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.1%

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

      \[\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-*.f6427.1%

        \[\leadsto c \cdot i \]
    10. Applied rewrites27.1%

      \[\leadsto c \cdot i \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 9: 43.1% accurate, 0.9× speedup?

\[\begin{array}{l} t_1 := -\left(-t\right) \cdot z\\ \mathbf{if}\;z \cdot t \leq -2 \cdot 10^{+75}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \cdot t \leq 10^{+104}:\\ \;\;\;\;c \cdot i\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \]
(FPCore (x y z t a b c i)
  :precision binary64
  (let* ((t_1 (- (* (- t) z))))
  (if (<= (* z t) -2e+75) t_1 (if (<= (* z t) 1e+104) (* 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 = -(-t * z);
	double tmp;
	if ((z * t) <= -2e+75) {
		tmp = t_1;
	} else if ((z * t) <= 1e+104) {
		tmp = 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 = -(-t * z)
    if ((z * t) <= (-2d+75)) then
        tmp = t_1
    else if ((z * t) <= 1d+104) then
        tmp = 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 = -(-t * z);
	double tmp;
	if ((z * t) <= -2e+75) {
		tmp = t_1;
	} else if ((z * t) <= 1e+104) {
		tmp = c * i;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	t_1 = -(-t * z)
	tmp = 0
	if (z * t) <= -2e+75:
		tmp = t_1
	elif (z * t) <= 1e+104:
		tmp = c * i
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a, b, c, i)
	t_1 = Float64(-Float64(Float64(-t) * z))
	tmp = 0.0
	if (Float64(z * t) <= -2e+75)
		tmp = t_1;
	elseif (Float64(z * t) <= 1e+104)
		tmp = 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 = -(-t * z);
	tmp = 0.0;
	if ((z * t) <= -2e+75)
		tmp = t_1;
	elseif ((z * t) <= 1e+104)
		tmp = 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[((-t) * z), $MachinePrecision])}, If[LessEqual[N[(z * t), $MachinePrecision], -2e+75], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], 1e+104], N[(c * i), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := -\left(-t\right) \cdot z\\
\mathbf{if}\;z \cdot t \leq -2 \cdot 10^{+75}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \cdot t \leq 10^{+104}:\\
\;\;\;\;c \cdot i\\

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


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

    1. Initial program 96.0%

      \[\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.4%

        \[\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.4%

      \[\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 z around inf

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

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

        \[\leadsto -1 \cdot \left(-1 \cdot \left(t \cdot z\right)\right) \]
    7. Applied rewrites27.7%

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

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

        \[\leadsto \mathsf{neg}\left(-1 \cdot \left(t \cdot z\right)\right) \]
      3. lower-neg.f6427.7%

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

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

        \[\leadsto --1 \cdot \left(t \cdot z\right) \]
      6. associate-*r*N/A

        \[\leadsto -\left(-1 \cdot t\right) \cdot z \]
      7. lower-*.f64N/A

        \[\leadsto -\left(-1 \cdot t\right) \cdot z \]
      8. mul-1-negN/A

        \[\leadsto -\left(\mathsf{neg}\left(t\right)\right) \cdot z \]
      9. lower-neg.f6427.7%

        \[\leadsto -\left(-t\right) \cdot z \]
    9. Applied rewrites27.7%

      \[\leadsto -\left(-t\right) \cdot z \]

    if -1.9999999999999999e75 < (*.f64 z t) < 1e104

    1. Initial program 96.0%

      \[\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-*.f6473.9%

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

      \[\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.1%

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

      \[\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-*.f6427.1%

        \[\leadsto c \cdot i \]
    10. Applied rewrites27.1%

      \[\leadsto c \cdot i \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 10: 27.1% 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 96.0%

    \[\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-*.f6473.9%

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

    \[\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.1%

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

    \[\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-*.f6427.1%

      \[\leadsto c \cdot i \]
  10. Applied rewrites27.1%

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

Reproduce

?
herbie shell --seed 2025258 
(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)))