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

Percentage Accurate: 94.9% → 98.5%
Time: 4.8s
Alternatives: 15
Speedup: 0.4×

Specification

?
\[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
(FPCore (x y z t a b)
 :precision binary64
 (+ (- (* x 2.0) (* (* (* y 9.0) z) t)) (* (* a 27.0) b)))
double code(double x, double y, double z, double t, double a, double b) {
	return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b);
}
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)
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
    code = ((x * 2.0d0) - (((y * 9.0d0) * z) * t)) + ((a * 27.0d0) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b);
}
def code(x, y, z, t, a, b):
	return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b)
function code(x, y, z, t, a, b)
	return Float64(Float64(Float64(x * 2.0) - Float64(Float64(Float64(y * 9.0) * z) * t)) + Float64(Float64(a * 27.0) * b))
end
function tmp = code(x, y, z, t, a, b)
	tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b);
end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x * 2.0), $MachinePrecision] - N[(N[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b

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 15 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: 94.9% accurate, 1.0× speedup?

\[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
(FPCore (x y z t a b)
 :precision binary64
 (+ (- (* x 2.0) (* (* (* y 9.0) z) t)) (* (* a 27.0) b)))
double code(double x, double y, double z, double t, double a, double b) {
	return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b);
}
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)
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
    code = ((x * 2.0d0) - (((y * 9.0d0) * z) * t)) + ((a * 27.0d0) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b);
}
def code(x, y, z, t, a, b):
	return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b)
function code(x, y, z, t, a, b)
	return Float64(Float64(Float64(x * 2.0) - Float64(Float64(Float64(y * 9.0) * z) * t)) + Float64(Float64(a * 27.0) * b))
end
function tmp = code(x, y, z, t, a, b)
	tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b);
end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x * 2.0), $MachinePrecision] - N[(N[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b

Alternative 1: 98.5% accurate, 0.4× speedup?

\[\begin{array}{l} t_1 := \mathsf{max}\left(z, \mathsf{max}\left(y, t\right)\right)\\ t_2 := \mathsf{min}\left(z, \mathsf{max}\left(y, t\right)\right)\\ \mathbf{if}\;\left(\mathsf{min}\left(y, t\right) \cdot 9\right) \cdot t\_2 \leq 5 \cdot 10^{+307}:\\ \;\;\;\;\mathsf{fma}\left(-9 \cdot \left(t\_2 \cdot \mathsf{min}\left(y, t\right)\right), t\_1, \mathsf{fma}\left(b \cdot a, 27, x + x\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(a \cdot 27, b, \left(\left(\mathsf{min}\left(y, t\right) \cdot t\_1\right) \cdot -9\right) \cdot t\_2\right)\\ \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (fmax z (fmax y t))) (t_2 (fmin z (fmax y t))))
   (if (<= (* (* (fmin y t) 9.0) t_2) 5e+307)
     (fma (* -9.0 (* t_2 (fmin y t))) t_1 (fma (* b a) 27.0 (+ x x)))
     (fma (* a 27.0) b (* (* (* (fmin y t) t_1) -9.0) t_2)))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = fmax(z, fmax(y, t));
	double t_2 = fmin(z, fmax(y, t));
	double tmp;
	if (((fmin(y, t) * 9.0) * t_2) <= 5e+307) {
		tmp = fma((-9.0 * (t_2 * fmin(y, t))), t_1, fma((b * a), 27.0, (x + x)));
	} else {
		tmp = fma((a * 27.0), b, (((fmin(y, t) * t_1) * -9.0) * t_2));
	}
	return tmp;
}
function code(x, y, z, t, a, b)
	t_1 = fmax(z, fmax(y, t))
	t_2 = fmin(z, fmax(y, t))
	tmp = 0.0
	if (Float64(Float64(fmin(y, t) * 9.0) * t_2) <= 5e+307)
		tmp = fma(Float64(-9.0 * Float64(t_2 * fmin(y, t))), t_1, fma(Float64(b * a), 27.0, Float64(x + x)));
	else
		tmp = fma(Float64(a * 27.0), b, Float64(Float64(Float64(fmin(y, t) * t_1) * -9.0) * t_2));
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[Max[z, N[Max[y, t], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Min[z, N[Max[y, t], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[(N[Min[y, t], $MachinePrecision] * 9.0), $MachinePrecision] * t$95$2), $MachinePrecision], 5e+307], N[(N[(-9.0 * N[(t$95$2 * N[Min[y, t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1 + N[(N[(b * a), $MachinePrecision] * 27.0 + N[(x + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a * 27.0), $MachinePrecision] * b + N[(N[(N[(N[Min[y, t], $MachinePrecision] * t$95$1), $MachinePrecision] * -9.0), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_1 := \mathsf{max}\left(z, \mathsf{max}\left(y, t\right)\right)\\
t_2 := \mathsf{min}\left(z, \mathsf{max}\left(y, t\right)\right)\\
\mathbf{if}\;\left(\mathsf{min}\left(y, t\right) \cdot 9\right) \cdot t\_2 \leq 5 \cdot 10^{+307}:\\
\;\;\;\;\mathsf{fma}\left(-9 \cdot \left(t\_2 \cdot \mathsf{min}\left(y, t\right)\right), t\_1, \mathsf{fma}\left(b \cdot a, 27, x + x\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a \cdot 27, b, \left(\left(\mathsf{min}\left(y, t\right) \cdot t\_1\right) \cdot -9\right) \cdot t\_2\right)\\


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (*.f64 y #s(literal 9 binary64)) z) < 5e307

    1. Initial program 94.9%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Step-by-step derivation
      1. lift-+.f64N/A

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

        \[\leadsto \color{blue}{\left(a \cdot 27\right) \cdot b + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)} \]
      3. lift--.f64N/A

        \[\leadsto \left(a \cdot 27\right) \cdot b + \color{blue}{\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)} \]
      4. lift-*.f64N/A

        \[\leadsto \left(a \cdot 27\right) \cdot b + \left(x \cdot 2 - \color{blue}{\left(\left(y \cdot 9\right) \cdot z\right) \cdot t}\right) \]
      5. fp-cancel-sub-sign-invN/A

        \[\leadsto \left(a \cdot 27\right) \cdot b + \color{blue}{\left(x \cdot 2 + \left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t\right)} \]
      6. associate-+r+N/A

        \[\leadsto \color{blue}{\left(\left(a \cdot 27\right) \cdot b + x \cdot 2\right) + \left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t} \]
      7. +-commutativeN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t + \left(\left(a \cdot 27\right) \cdot b + x \cdot 2\right)} \]
      8. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right), t, \left(a \cdot 27\right) \cdot b + x \cdot 2\right)} \]
      9. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(\color{blue}{\left(y \cdot 9\right) \cdot z}\right), t, \left(a \cdot 27\right) \cdot b + x \cdot 2\right) \]
      10. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(\color{blue}{\left(y \cdot 9\right)} \cdot z\right), t, \left(a \cdot 27\right) \cdot b + x \cdot 2\right) \]
      11. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(\color{blue}{\left(9 \cdot y\right)} \cdot z\right), t, \left(a \cdot 27\right) \cdot b + x \cdot 2\right) \]
      12. associate-*l*N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(\color{blue}{9 \cdot \left(y \cdot z\right)}\right), t, \left(a \cdot 27\right) \cdot b + x \cdot 2\right) \]
      13. distribute-lft-neg-inN/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\mathsf{neg}\left(9\right)\right) \cdot \left(y \cdot z\right)}, t, \left(a \cdot 27\right) \cdot b + x \cdot 2\right) \]
      14. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\left(\mathsf{neg}\left(9\right)\right) \cdot \color{blue}{\left(z \cdot y\right)}, t, \left(a \cdot 27\right) \cdot b + x \cdot 2\right) \]
      15. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\mathsf{neg}\left(9\right)\right) \cdot \left(z \cdot y\right)}, t, \left(a \cdot 27\right) \cdot b + x \cdot 2\right) \]
      16. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{-9} \cdot \left(z \cdot y\right), t, \left(a \cdot 27\right) \cdot b + x \cdot 2\right) \]
      17. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(-9 \cdot \color{blue}{\left(z \cdot y\right)}, t, \left(a \cdot 27\right) \cdot b + x \cdot 2\right) \]
      18. add-flipN/A

        \[\leadsto \mathsf{fma}\left(-9 \cdot \left(z \cdot y\right), t, \color{blue}{\left(a \cdot 27\right) \cdot b - \left(\mathsf{neg}\left(x \cdot 2\right)\right)}\right) \]
      19. sub-flipN/A

        \[\leadsto \mathsf{fma}\left(-9 \cdot \left(z \cdot y\right), t, \color{blue}{\left(a \cdot 27\right) \cdot b + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x \cdot 2\right)\right)\right)\right)}\right) \]
    3. Applied rewrites95.2%

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

    if 5e307 < (*.f64 (*.f64 y #s(literal 9 binary64)) z)

    1. Initial program 94.9%

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

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

        \[\leadsto -9 \cdot \color{blue}{\left(t \cdot \left(y \cdot z\right)\right)} + \left(a \cdot 27\right) \cdot b \]
      2. lower-*.f64N/A

        \[\leadsto -9 \cdot \left(t \cdot \color{blue}{\left(y \cdot z\right)}\right) + \left(a \cdot 27\right) \cdot b \]
      3. lower-*.f6465.8

        \[\leadsto -9 \cdot \left(t \cdot \left(y \cdot \color{blue}{z}\right)\right) + \left(a \cdot 27\right) \cdot b \]
    4. Applied rewrites65.8%

      \[\leadsto \color{blue}{-9 \cdot \left(t \cdot \left(y \cdot z\right)\right)} + \left(a \cdot 27\right) \cdot b \]
    5. Step-by-step derivation
      1. lift-+.f64N/A

        \[\leadsto \color{blue}{-9 \cdot \left(t \cdot \left(y \cdot z\right)\right) + \left(a \cdot 27\right) \cdot b} \]
      2. +-commutativeN/A

        \[\leadsto \color{blue}{\left(a \cdot 27\right) \cdot b + -9 \cdot \left(t \cdot \left(y \cdot z\right)\right)} \]
      3. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(a \cdot 27\right) \cdot b} + -9 \cdot \left(t \cdot \left(y \cdot z\right)\right) \]
      4. lower-fma.f6466.7

        \[\leadsto \color{blue}{\mathsf{fma}\left(a \cdot 27, b, -9 \cdot \left(t \cdot \left(y \cdot z\right)\right)\right)} \]
      5. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(a \cdot 27, b, -9 \cdot \color{blue}{\left(t \cdot \left(y \cdot z\right)\right)}\right) \]
      6. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(a \cdot 27, b, -9 \cdot \left(t \cdot \color{blue}{\left(y \cdot z\right)}\right)\right) \]
      7. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(a \cdot 27, b, -9 \cdot \left(t \cdot \left(y \cdot \color{blue}{z}\right)\right)\right) \]
      8. associate-*r*N/A

        \[\leadsto \mathsf{fma}\left(a \cdot 27, b, -9 \cdot \left(\left(t \cdot y\right) \cdot \color{blue}{z}\right)\right) \]
      9. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(a \cdot 27, b, -9 \cdot \left(\left(t \cdot y\right) \cdot z\right)\right) \]
      10. associate-*l*N/A

        \[\leadsto \mathsf{fma}\left(a \cdot 27, b, \left(-9 \cdot \left(t \cdot y\right)\right) \cdot \color{blue}{z}\right) \]
      11. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(a \cdot 27, b, \left(-9 \cdot \left(t \cdot y\right)\right) \cdot z\right) \]
      12. lower-*.f6466.6

        \[\leadsto \mathsf{fma}\left(a \cdot 27, b, \left(-9 \cdot \left(t \cdot y\right)\right) \cdot \color{blue}{z}\right) \]
      13. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(a \cdot 27, b, \left(-9 \cdot \left(t \cdot y\right)\right) \cdot z\right) \]
      14. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(a \cdot 27, b, \left(\left(t \cdot y\right) \cdot -9\right) \cdot z\right) \]
      15. lower-*.f6466.6

        \[\leadsto \mathsf{fma}\left(a \cdot 27, b, \left(\left(t \cdot y\right) \cdot -9\right) \cdot z\right) \]
      16. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(a \cdot 27, b, \left(\left(t \cdot y\right) \cdot -9\right) \cdot z\right) \]
      17. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(a \cdot 27, b, \left(\left(y \cdot t\right) \cdot -9\right) \cdot z\right) \]
      18. lower-*.f6466.6

        \[\leadsto \mathsf{fma}\left(a \cdot 27, b, \left(\left(y \cdot t\right) \cdot -9\right) \cdot z\right) \]
    6. Applied rewrites66.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(a \cdot 27, b, \left(\left(y \cdot t\right) \cdot -9\right) \cdot z\right)} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 2: 98.4% accurate, 0.4× speedup?

\[\begin{array}{l} t_1 := \mathsf{max}\left(\mathsf{min}\left(y, z\right), t\right)\\ t_2 := \mathsf{min}\left(\mathsf{max}\left(y, z\right), t\_1\right)\\ t_3 := \mathsf{max}\left(\mathsf{max}\left(y, z\right), t\_1\right)\\ t_4 := \mathsf{min}\left(\mathsf{min}\left(y, z\right), t\right)\\ \mathbf{if}\;t\_4 \leq -1 \cdot 10^{-70}:\\ \;\;\;\;\mathsf{fma}\left(\left(t\_2 \cdot t\_3\right) \cdot -9, t\_4, \mathsf{fma}\left(a \cdot b, 27, x\right)\right) + x\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(t\_2, t\_4 \cdot \left(-9 \cdot t\_3\right), \mathsf{fma}\left(27, b \cdot a, x\right)\right) + x\\ \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (fmax (fmin y z) t))
        (t_2 (fmin (fmax y z) t_1))
        (t_3 (fmax (fmax y z) t_1))
        (t_4 (fmin (fmin y z) t)))
   (if (<= t_4 -1e-70)
     (+ (fma (* (* t_2 t_3) -9.0) t_4 (fma (* a b) 27.0 x)) x)
     (+ (fma t_2 (* t_4 (* -9.0 t_3)) (fma 27.0 (* b a) x)) x))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = fmax(fmin(y, z), t);
	double t_2 = fmin(fmax(y, z), t_1);
	double t_3 = fmax(fmax(y, z), t_1);
	double t_4 = fmin(fmin(y, z), t);
	double tmp;
	if (t_4 <= -1e-70) {
		tmp = fma(((t_2 * t_3) * -9.0), t_4, fma((a * b), 27.0, x)) + x;
	} else {
		tmp = fma(t_2, (t_4 * (-9.0 * t_3)), fma(27.0, (b * a), x)) + x;
	}
	return tmp;
}
function code(x, y, z, t, a, b)
	t_1 = fmax(fmin(y, z), t)
	t_2 = fmin(fmax(y, z), t_1)
	t_3 = fmax(fmax(y, z), t_1)
	t_4 = fmin(fmin(y, z), t)
	tmp = 0.0
	if (t_4 <= -1e-70)
		tmp = Float64(fma(Float64(Float64(t_2 * t_3) * -9.0), t_4, fma(Float64(a * b), 27.0, x)) + x);
	else
		tmp = Float64(fma(t_2, Float64(t_4 * Float64(-9.0 * t_3)), fma(27.0, Float64(b * a), x)) + x);
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[Max[N[Min[y, z], $MachinePrecision], t], $MachinePrecision]}, Block[{t$95$2 = N[Min[N[Max[y, z], $MachinePrecision], t$95$1], $MachinePrecision]}, Block[{t$95$3 = N[Max[N[Max[y, z], $MachinePrecision], t$95$1], $MachinePrecision]}, Block[{t$95$4 = N[Min[N[Min[y, z], $MachinePrecision], t], $MachinePrecision]}, If[LessEqual[t$95$4, -1e-70], N[(N[(N[(N[(t$95$2 * t$95$3), $MachinePrecision] * -9.0), $MachinePrecision] * t$95$4 + N[(N[(a * b), $MachinePrecision] * 27.0 + x), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(N[(t$95$2 * N[(t$95$4 * N[(-9.0 * t$95$3), $MachinePrecision]), $MachinePrecision] + N[(27.0 * N[(b * a), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]]]]]]
\begin{array}{l}
t_1 := \mathsf{max}\left(\mathsf{min}\left(y, z\right), t\right)\\
t_2 := \mathsf{min}\left(\mathsf{max}\left(y, z\right), t\_1\right)\\
t_3 := \mathsf{max}\left(\mathsf{max}\left(y, z\right), t\_1\right)\\
t_4 := \mathsf{min}\left(\mathsf{min}\left(y, z\right), t\right)\\
\mathbf{if}\;t\_4 \leq -1 \cdot 10^{-70}:\\
\;\;\;\;\mathsf{fma}\left(\left(t\_2 \cdot t\_3\right) \cdot -9, t\_4, \mathsf{fma}\left(a \cdot b, 27, x\right)\right) + x\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_2, t\_4 \cdot \left(-9 \cdot t\_3\right), \mathsf{fma}\left(27, b \cdot a, x\right)\right) + x\\


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -9.99999999999999996e-71

    1. Initial program 94.9%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Step-by-step derivation
      1. lift-+.f64N/A

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

        \[\leadsto \color{blue}{\left(a \cdot 27\right) \cdot b + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)} \]
      3. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(a \cdot 27\right) \cdot b} + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      4. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(a \cdot 27\right)} \cdot b + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      5. associate-*l*N/A

        \[\leadsto \color{blue}{a \cdot \left(27 \cdot b\right)} + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      6. *-commutativeN/A

        \[\leadsto \color{blue}{\left(27 \cdot b\right) \cdot a} + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      7. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(27 \cdot b, a, x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)} \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{b \cdot 27}, a, x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      9. lower-*.f6495.7

        \[\leadsto \mathsf{fma}\left(\color{blue}{b \cdot 27}, a, x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      10. lift--.f64N/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t}\right) \]
      11. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, x \cdot 2 - \color{blue}{\left(\left(y \cdot 9\right) \cdot z\right) \cdot t}\right) \]
      12. fp-cancel-sub-sign-invN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{x \cdot 2 + \left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t}\right) \]
      13. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t + x \cdot 2}\right) \]
      14. add-flipN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t - \left(\mathsf{neg}\left(x \cdot 2\right)\right)}\right) \]
      15. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t - \left(\mathsf{neg}\left(\color{blue}{x \cdot 2}\right)\right)\right) \]
      16. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t - \color{blue}{x \cdot \left(\mathsf{neg}\left(2\right)\right)}\right) \]
      17. fp-cancel-sub-sign-invN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t + \left(\mathsf{neg}\left(x\right)\right) \cdot \left(\mathsf{neg}\left(2\right)\right)}\right) \]
    3. Applied rewrites95.7%

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

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

    if -9.99999999999999996e-71 < y

    1. Initial program 94.9%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Step-by-step derivation
      1. lift-+.f64N/A

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

        \[\leadsto \color{blue}{\left(a \cdot 27\right) \cdot b + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)} \]
      3. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(a \cdot 27\right) \cdot b} + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      4. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(a \cdot 27\right)} \cdot b + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      5. associate-*l*N/A

        \[\leadsto \color{blue}{a \cdot \left(27 \cdot b\right)} + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      6. *-commutativeN/A

        \[\leadsto \color{blue}{\left(27 \cdot b\right) \cdot a} + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      7. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(27 \cdot b, a, x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)} \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{b \cdot 27}, a, x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      9. lower-*.f6495.7

        \[\leadsto \mathsf{fma}\left(\color{blue}{b \cdot 27}, a, x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      10. lift--.f64N/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t}\right) \]
      11. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, x \cdot 2 - \color{blue}{\left(\left(y \cdot 9\right) \cdot z\right) \cdot t}\right) \]
      12. fp-cancel-sub-sign-invN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{x \cdot 2 + \left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t}\right) \]
      13. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t + x \cdot 2}\right) \]
      14. add-flipN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t - \left(\mathsf{neg}\left(x \cdot 2\right)\right)}\right) \]
      15. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t - \left(\mathsf{neg}\left(\color{blue}{x \cdot 2}\right)\right)\right) \]
      16. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t - \color{blue}{x \cdot \left(\mathsf{neg}\left(2\right)\right)}\right) \]
      17. fp-cancel-sub-sign-invN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t + \left(\mathsf{neg}\left(x\right)\right) \cdot \left(\mathsf{neg}\left(2\right)\right)}\right) \]
    3. Applied rewrites95.7%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\left(z \cdot t\right) \cdot -9, y, \mathsf{fma}\left(a \cdot b, 27, x\right)\right) + x} \]
    5. Step-by-step derivation
      1. lift-fma.f64N/A

        \[\leadsto \color{blue}{\left(\left(\left(z \cdot t\right) \cdot -9\right) \cdot y + \mathsf{fma}\left(a \cdot b, 27, x\right)\right)} + x \]
      2. add-flipN/A

        \[\leadsto \color{blue}{\left(\left(\left(z \cdot t\right) \cdot -9\right) \cdot y - \left(\mathsf{neg}\left(\mathsf{fma}\left(a \cdot b, 27, x\right)\right)\right)\right)} + x \]
      3. sub-flipN/A

        \[\leadsto \color{blue}{\left(\left(\left(z \cdot t\right) \cdot -9\right) \cdot y + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\mathsf{fma}\left(a \cdot b, 27, x\right)\right)\right)\right)\right)\right)} + x \]
      4. *-commutativeN/A

        \[\leadsto \left(\color{blue}{y \cdot \left(\left(z \cdot t\right) \cdot -9\right)} + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\mathsf{fma}\left(a \cdot b, 27, x\right)\right)\right)\right)\right)\right) + x \]
      5. lift-*.f64N/A

        \[\leadsto \left(y \cdot \color{blue}{\left(\left(z \cdot t\right) \cdot -9\right)} + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\mathsf{fma}\left(a \cdot b, 27, x\right)\right)\right)\right)\right)\right) + x \]
      6. lift-*.f64N/A

        \[\leadsto \left(y \cdot \left(\color{blue}{\left(z \cdot t\right)} \cdot -9\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\mathsf{fma}\left(a \cdot b, 27, x\right)\right)\right)\right)\right)\right) + x \]
      7. associate-*l*N/A

        \[\leadsto \left(y \cdot \color{blue}{\left(z \cdot \left(t \cdot -9\right)\right)} + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\mathsf{fma}\left(a \cdot b, 27, x\right)\right)\right)\right)\right)\right) + x \]
      8. associate-*l*N/A

        \[\leadsto \left(\color{blue}{\left(y \cdot z\right) \cdot \left(t \cdot -9\right)} + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\mathsf{fma}\left(a \cdot b, 27, x\right)\right)\right)\right)\right)\right) + x \]
      9. *-commutativeN/A

        \[\leadsto \left(\color{blue}{\left(z \cdot y\right)} \cdot \left(t \cdot -9\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\mathsf{fma}\left(a \cdot b, 27, x\right)\right)\right)\right)\right)\right) + x \]
      10. associate-*l*N/A

        \[\leadsto \left(\color{blue}{z \cdot \left(y \cdot \left(t \cdot -9\right)\right)} + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\mathsf{fma}\left(a \cdot b, 27, x\right)\right)\right)\right)\right)\right) + x \]
      11. lift-fma.f64N/A

        \[\leadsto \left(z \cdot \left(y \cdot \left(t \cdot -9\right)\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\left(\left(a \cdot b\right) \cdot 27 + x\right)}\right)\right)\right)\right)\right) + x \]
      12. add-flipN/A

        \[\leadsto \left(z \cdot \left(y \cdot \left(t \cdot -9\right)\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\left(\left(a \cdot b\right) \cdot 27 - \left(\mathsf{neg}\left(x\right)\right)\right)}\right)\right)\right)\right)\right) + x \]
      13. *-commutativeN/A

        \[\leadsto \left(z \cdot \left(y \cdot \left(t \cdot -9\right)\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left(\color{blue}{27 \cdot \left(a \cdot b\right)} - \left(\mathsf{neg}\left(x\right)\right)\right)\right)\right)\right)\right)\right) + x \]
      14. lift-*.f64N/A

        \[\leadsto \left(z \cdot \left(y \cdot \left(t \cdot -9\right)\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left(\color{blue}{27 \cdot \left(a \cdot b\right)} - \left(\mathsf{neg}\left(x\right)\right)\right)\right)\right)\right)\right)\right) + x \]
      15. sub-negateN/A

        \[\leadsto \left(z \cdot \left(y \cdot \left(t \cdot -9\right)\right) + \left(\mathsf{neg}\left(\color{blue}{\left(\left(\mathsf{neg}\left(x\right)\right) - 27 \cdot \left(a \cdot b\right)\right)}\right)\right)\right) + x \]
      16. sub-negate-revN/A

        \[\leadsto \left(z \cdot \left(y \cdot \left(t \cdot -9\right)\right) + \color{blue}{\left(27 \cdot \left(a \cdot b\right) - \left(\mathsf{neg}\left(x\right)\right)\right)}\right) + x \]
      17. lift-*.f64N/A

        \[\leadsto \left(z \cdot \left(y \cdot \left(t \cdot -9\right)\right) + \left(\color{blue}{27 \cdot \left(a \cdot b\right)} - \left(\mathsf{neg}\left(x\right)\right)\right)\right) + x \]
      18. *-commutativeN/A

        \[\leadsto \left(z \cdot \left(y \cdot \left(t \cdot -9\right)\right) + \left(\color{blue}{\left(a \cdot b\right) \cdot 27} - \left(\mathsf{neg}\left(x\right)\right)\right)\right) + x \]
      19. add-flipN/A

        \[\leadsto \left(z \cdot \left(y \cdot \left(t \cdot -9\right)\right) + \color{blue}{\left(\left(a \cdot b\right) \cdot 27 + x\right)}\right) + x \]
      20. lift-fma.f64N/A

        \[\leadsto \left(z \cdot \left(y \cdot \left(t \cdot -9\right)\right) + \color{blue}{\mathsf{fma}\left(a \cdot b, 27, x\right)}\right) + x \]
      21. lower-fma.f64N/A

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(z, y \cdot \left(-9 \cdot t\right), \mathsf{fma}\left(27, b \cdot a, x\right)\right)} + x \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 3: 98.3% accurate, 0.3× speedup?

\[\begin{array}{l} t_1 := \mathsf{min}\left(\mathsf{min}\left(y, z\right), t\right)\\ t_2 := \mathsf{max}\left(\mathsf{min}\left(y, z\right), t\right)\\ t_3 := \mathsf{max}\left(\mathsf{max}\left(y, z\right), t\_2\right)\\ t_4 := \mathsf{min}\left(\mathsf{max}\left(y, z\right), t\_2\right)\\ \mathbf{if}\;t\_4 \leq 10^{+18}:\\ \;\;\;\;\mathsf{fma}\left(\left(t\_4 \cdot t\_3\right) \cdot -9, t\_1, \mathsf{fma}\left(a \cdot b, 27, x\right)\right) + x\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-9 \cdot \left(t\_3 \cdot t\_1\right), t\_4, \mathsf{fma}\left(b \cdot a, 27, x + x\right)\right)\\ \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (fmin (fmin y z) t))
        (t_2 (fmax (fmin y z) t))
        (t_3 (fmax (fmax y z) t_2))
        (t_4 (fmin (fmax y z) t_2)))
   (if (<= t_4 1e+18)
     (+ (fma (* (* t_4 t_3) -9.0) t_1 (fma (* a b) 27.0 x)) x)
     (fma (* -9.0 (* t_3 t_1)) t_4 (fma (* b a) 27.0 (+ x x))))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = fmin(fmin(y, z), t);
	double t_2 = fmax(fmin(y, z), t);
	double t_3 = fmax(fmax(y, z), t_2);
	double t_4 = fmin(fmax(y, z), t_2);
	double tmp;
	if (t_4 <= 1e+18) {
		tmp = fma(((t_4 * t_3) * -9.0), t_1, fma((a * b), 27.0, x)) + x;
	} else {
		tmp = fma((-9.0 * (t_3 * t_1)), t_4, fma((b * a), 27.0, (x + x)));
	}
	return tmp;
}
function code(x, y, z, t, a, b)
	t_1 = fmin(fmin(y, z), t)
	t_2 = fmax(fmin(y, z), t)
	t_3 = fmax(fmax(y, z), t_2)
	t_4 = fmin(fmax(y, z), t_2)
	tmp = 0.0
	if (t_4 <= 1e+18)
		tmp = Float64(fma(Float64(Float64(t_4 * t_3) * -9.0), t_1, fma(Float64(a * b), 27.0, x)) + x);
	else
		tmp = fma(Float64(-9.0 * Float64(t_3 * t_1)), t_4, fma(Float64(b * a), 27.0, Float64(x + x)));
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[Min[N[Min[y, z], $MachinePrecision], t], $MachinePrecision]}, Block[{t$95$2 = N[Max[N[Min[y, z], $MachinePrecision], t], $MachinePrecision]}, Block[{t$95$3 = N[Max[N[Max[y, z], $MachinePrecision], t$95$2], $MachinePrecision]}, Block[{t$95$4 = N[Min[N[Max[y, z], $MachinePrecision], t$95$2], $MachinePrecision]}, If[LessEqual[t$95$4, 1e+18], N[(N[(N[(N[(t$95$4 * t$95$3), $MachinePrecision] * -9.0), $MachinePrecision] * t$95$1 + N[(N[(a * b), $MachinePrecision] * 27.0 + x), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(N[(-9.0 * N[(t$95$3 * t$95$1), $MachinePrecision]), $MachinePrecision] * t$95$4 + N[(N[(b * a), $MachinePrecision] * 27.0 + N[(x + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
t_1 := \mathsf{min}\left(\mathsf{min}\left(y, z\right), t\right)\\
t_2 := \mathsf{max}\left(\mathsf{min}\left(y, z\right), t\right)\\
t_3 := \mathsf{max}\left(\mathsf{max}\left(y, z\right), t\_2\right)\\
t_4 := \mathsf{min}\left(\mathsf{max}\left(y, z\right), t\_2\right)\\
\mathbf{if}\;t\_4 \leq 10^{+18}:\\
\;\;\;\;\mathsf{fma}\left(\left(t\_4 \cdot t\_3\right) \cdot -9, t\_1, \mathsf{fma}\left(a \cdot b, 27, x\right)\right) + x\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-9 \cdot \left(t\_3 \cdot t\_1\right), t\_4, \mathsf{fma}\left(b \cdot a, 27, x + x\right)\right)\\


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 1e18

    1. Initial program 94.9%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Step-by-step derivation
      1. lift-+.f64N/A

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

        \[\leadsto \color{blue}{\left(a \cdot 27\right) \cdot b + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)} \]
      3. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(a \cdot 27\right) \cdot b} + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      4. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(a \cdot 27\right)} \cdot b + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      5. associate-*l*N/A

        \[\leadsto \color{blue}{a \cdot \left(27 \cdot b\right)} + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      6. *-commutativeN/A

        \[\leadsto \color{blue}{\left(27 \cdot b\right) \cdot a} + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      7. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(27 \cdot b, a, x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)} \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{b \cdot 27}, a, x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      9. lower-*.f6495.7

        \[\leadsto \mathsf{fma}\left(\color{blue}{b \cdot 27}, a, x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      10. lift--.f64N/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t}\right) \]
      11. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, x \cdot 2 - \color{blue}{\left(\left(y \cdot 9\right) \cdot z\right) \cdot t}\right) \]
      12. fp-cancel-sub-sign-invN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{x \cdot 2 + \left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t}\right) \]
      13. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t + x \cdot 2}\right) \]
      14. add-flipN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t - \left(\mathsf{neg}\left(x \cdot 2\right)\right)}\right) \]
      15. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t - \left(\mathsf{neg}\left(\color{blue}{x \cdot 2}\right)\right)\right) \]
      16. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t - \color{blue}{x \cdot \left(\mathsf{neg}\left(2\right)\right)}\right) \]
      17. fp-cancel-sub-sign-invN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t + \left(\mathsf{neg}\left(x\right)\right) \cdot \left(\mathsf{neg}\left(2\right)\right)}\right) \]
    3. Applied rewrites95.7%

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

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

    if 1e18 < z

    1. Initial program 94.9%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Step-by-step derivation
      1. lift-+.f64N/A

        \[\leadsto \color{blue}{\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b} \]
      2. lift-*.f64N/A

        \[\leadsto \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \color{blue}{\left(a \cdot 27\right) \cdot b} \]
      3. lift-*.f64N/A

        \[\leadsto \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \color{blue}{\left(a \cdot 27\right)} \cdot b \]
      4. associate-*l*N/A

        \[\leadsto \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \color{blue}{a \cdot \left(27 \cdot b\right)} \]
      5. fp-cancel-sign-sub-invN/A

        \[\leadsto \color{blue}{\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) - \left(\mathsf{neg}\left(a\right)\right) \cdot \left(27 \cdot b\right)} \]
      6. lift--.f64N/A

        \[\leadsto \color{blue}{\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)} - \left(\mathsf{neg}\left(a\right)\right) \cdot \left(27 \cdot b\right) \]
      7. lift-*.f64N/A

        \[\leadsto \left(x \cdot 2 - \color{blue}{\left(\left(y \cdot 9\right) \cdot z\right) \cdot t}\right) - \left(\mathsf{neg}\left(a\right)\right) \cdot \left(27 \cdot b\right) \]
      8. fp-cancel-sub-sign-invN/A

        \[\leadsto \color{blue}{\left(x \cdot 2 + \left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t\right)} - \left(\mathsf{neg}\left(a\right)\right) \cdot \left(27 \cdot b\right) \]
      9. +-commutativeN/A

        \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t + x \cdot 2\right)} - \left(\mathsf{neg}\left(a\right)\right) \cdot \left(27 \cdot b\right) \]
      10. associate-*l*N/A

        \[\leadsto \left(\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t + x \cdot 2\right) - \color{blue}{\left(\left(\mathsf{neg}\left(a\right)\right) \cdot 27\right) \cdot b} \]
      11. distribute-lft-neg-inN/A

        \[\leadsto \left(\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t + x \cdot 2\right) - \color{blue}{\left(\mathsf{neg}\left(a \cdot 27\right)\right)} \cdot b \]
      12. lift-*.f64N/A

        \[\leadsto \left(\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t + x \cdot 2\right) - \left(\mathsf{neg}\left(\color{blue}{a \cdot 27}\right)\right) \cdot b \]
      13. associate--l+N/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t + \left(x \cdot 2 - \left(\mathsf{neg}\left(a \cdot 27\right)\right) \cdot b\right)} \]
      14. *-commutativeN/A

        \[\leadsto \color{blue}{t \cdot \left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right)} + \left(x \cdot 2 - \left(\mathsf{neg}\left(a \cdot 27\right)\right) \cdot b\right) \]
      15. lift-*.f64N/A

        \[\leadsto t \cdot \left(\mathsf{neg}\left(\color{blue}{\left(y \cdot 9\right) \cdot z}\right)\right) + \left(x \cdot 2 - \left(\mathsf{neg}\left(a \cdot 27\right)\right) \cdot b\right) \]
      16. distribute-rgt-neg-inN/A

        \[\leadsto t \cdot \color{blue}{\left(\left(y \cdot 9\right) \cdot \left(\mathsf{neg}\left(z\right)\right)\right)} + \left(x \cdot 2 - \left(\mathsf{neg}\left(a \cdot 27\right)\right) \cdot b\right) \]
      17. associate-*r*N/A

        \[\leadsto \color{blue}{\left(t \cdot \left(y \cdot 9\right)\right) \cdot \left(\mathsf{neg}\left(z\right)\right)} + \left(x \cdot 2 - \left(\mathsf{neg}\left(a \cdot 27\right)\right) \cdot b\right) \]
      18. distribute-rgt-neg-inN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(t \cdot \left(y \cdot 9\right)\right) \cdot z\right)\right)} + \left(x \cdot 2 - \left(\mathsf{neg}\left(a \cdot 27\right)\right) \cdot b\right) \]
      19. distribute-lft-neg-inN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(t \cdot \left(y \cdot 9\right)\right)\right) \cdot z} + \left(x \cdot 2 - \left(\mathsf{neg}\left(a \cdot 27\right)\right) \cdot b\right) \]
    3. Applied rewrites95.1%

      \[\leadsto \color{blue}{\mathsf{fma}\left(-9 \cdot \left(t \cdot y\right), z, \mathsf{fma}\left(b \cdot a, 27, x + x\right)\right)} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 4: 98.1% accurate, 0.4× speedup?

\[\begin{array}{l} t_1 := \mathsf{max}\left(\mathsf{min}\left(y, z\right), t\right)\\ t_2 := \mathsf{min}\left(\mathsf{max}\left(y, z\right), t\_1\right)\\ t_3 := \mathsf{min}\left(\mathsf{min}\left(y, z\right), t\right)\\ t_4 := \mathsf{max}\left(\mathsf{max}\left(y, z\right), t\_1\right)\\ \mathbf{if}\;t\_3 \leq -1 \cdot 10^{-70}:\\ \;\;\;\;\mathsf{fma}\left(b \cdot a, 27, \mathsf{fma}\left(-9 \cdot \left(t\_4 \cdot t\_2\right), t\_3, x\right)\right) + x\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(t\_2, t\_3 \cdot \left(-9 \cdot t\_4\right), \mathsf{fma}\left(27, b \cdot a, x\right)\right) + x\\ \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (fmax (fmin y z) t))
        (t_2 (fmin (fmax y z) t_1))
        (t_3 (fmin (fmin y z) t))
        (t_4 (fmax (fmax y z) t_1)))
   (if (<= t_3 -1e-70)
     (+ (fma (* b a) 27.0 (fma (* -9.0 (* t_4 t_2)) t_3 x)) x)
     (+ (fma t_2 (* t_3 (* -9.0 t_4)) (fma 27.0 (* b a) x)) x))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = fmax(fmin(y, z), t);
	double t_2 = fmin(fmax(y, z), t_1);
	double t_3 = fmin(fmin(y, z), t);
	double t_4 = fmax(fmax(y, z), t_1);
	double tmp;
	if (t_3 <= -1e-70) {
		tmp = fma((b * a), 27.0, fma((-9.0 * (t_4 * t_2)), t_3, x)) + x;
	} else {
		tmp = fma(t_2, (t_3 * (-9.0 * t_4)), fma(27.0, (b * a), x)) + x;
	}
	return tmp;
}
function code(x, y, z, t, a, b)
	t_1 = fmax(fmin(y, z), t)
	t_2 = fmin(fmax(y, z), t_1)
	t_3 = fmin(fmin(y, z), t)
	t_4 = fmax(fmax(y, z), t_1)
	tmp = 0.0
	if (t_3 <= -1e-70)
		tmp = Float64(fma(Float64(b * a), 27.0, fma(Float64(-9.0 * Float64(t_4 * t_2)), t_3, x)) + x);
	else
		tmp = Float64(fma(t_2, Float64(t_3 * Float64(-9.0 * t_4)), fma(27.0, Float64(b * a), x)) + x);
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[Max[N[Min[y, z], $MachinePrecision], t], $MachinePrecision]}, Block[{t$95$2 = N[Min[N[Max[y, z], $MachinePrecision], t$95$1], $MachinePrecision]}, Block[{t$95$3 = N[Min[N[Min[y, z], $MachinePrecision], t], $MachinePrecision]}, Block[{t$95$4 = N[Max[N[Max[y, z], $MachinePrecision], t$95$1], $MachinePrecision]}, If[LessEqual[t$95$3, -1e-70], N[(N[(N[(b * a), $MachinePrecision] * 27.0 + N[(N[(-9.0 * N[(t$95$4 * t$95$2), $MachinePrecision]), $MachinePrecision] * t$95$3 + x), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(N[(t$95$2 * N[(t$95$3 * N[(-9.0 * t$95$4), $MachinePrecision]), $MachinePrecision] + N[(27.0 * N[(b * a), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]]]]]]
\begin{array}{l}
t_1 := \mathsf{max}\left(\mathsf{min}\left(y, z\right), t\right)\\
t_2 := \mathsf{min}\left(\mathsf{max}\left(y, z\right), t\_1\right)\\
t_3 := \mathsf{min}\left(\mathsf{min}\left(y, z\right), t\right)\\
t_4 := \mathsf{max}\left(\mathsf{max}\left(y, z\right), t\_1\right)\\
\mathbf{if}\;t\_3 \leq -1 \cdot 10^{-70}:\\
\;\;\;\;\mathsf{fma}\left(b \cdot a, 27, \mathsf{fma}\left(-9 \cdot \left(t\_4 \cdot t\_2\right), t\_3, x\right)\right) + x\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_2, t\_3 \cdot \left(-9 \cdot t\_4\right), \mathsf{fma}\left(27, b \cdot a, x\right)\right) + x\\


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -9.99999999999999996e-71

    1. Initial program 94.9%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Step-by-step derivation
      1. lift-+.f64N/A

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

        \[\leadsto \color{blue}{\left(a \cdot 27\right) \cdot b + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)} \]
      3. lift--.f64N/A

        \[\leadsto \left(a \cdot 27\right) \cdot b + \color{blue}{\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)} \]
      4. lift-*.f64N/A

        \[\leadsto \left(a \cdot 27\right) \cdot b + \left(x \cdot 2 - \color{blue}{\left(\left(y \cdot 9\right) \cdot z\right) \cdot t}\right) \]
      5. fp-cancel-sub-sign-invN/A

        \[\leadsto \left(a \cdot 27\right) \cdot b + \color{blue}{\left(x \cdot 2 + \left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t\right)} \]
      6. +-commutativeN/A

        \[\leadsto \left(a \cdot 27\right) \cdot b + \color{blue}{\left(\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t + x \cdot 2\right)} \]
      7. lift-*.f64N/A

        \[\leadsto \left(a \cdot 27\right) \cdot b + \left(\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t + \color{blue}{x \cdot 2}\right) \]
      8. *-commutativeN/A

        \[\leadsto \left(a \cdot 27\right) \cdot b + \left(\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t + \color{blue}{2 \cdot x}\right) \]
      9. count-2-revN/A

        \[\leadsto \left(a \cdot 27\right) \cdot b + \left(\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t + \color{blue}{\left(x + x\right)}\right) \]
      10. associate-+r+N/A

        \[\leadsto \left(a \cdot 27\right) \cdot b + \color{blue}{\left(\left(\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t + x\right) + x\right)} \]
      11. associate-+r+N/A

        \[\leadsto \color{blue}{\left(\left(a \cdot 27\right) \cdot b + \left(\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t + x\right)\right) + x} \]
      12. lower-+.f64N/A

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

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

    if -9.99999999999999996e-71 < y

    1. Initial program 94.9%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Step-by-step derivation
      1. lift-+.f64N/A

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

        \[\leadsto \color{blue}{\left(a \cdot 27\right) \cdot b + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)} \]
      3. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(a \cdot 27\right) \cdot b} + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      4. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(a \cdot 27\right)} \cdot b + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      5. associate-*l*N/A

        \[\leadsto \color{blue}{a \cdot \left(27 \cdot b\right)} + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      6. *-commutativeN/A

        \[\leadsto \color{blue}{\left(27 \cdot b\right) \cdot a} + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      7. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(27 \cdot b, a, x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)} \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{b \cdot 27}, a, x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      9. lower-*.f6495.7

        \[\leadsto \mathsf{fma}\left(\color{blue}{b \cdot 27}, a, x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      10. lift--.f64N/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t}\right) \]
      11. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, x \cdot 2 - \color{blue}{\left(\left(y \cdot 9\right) \cdot z\right) \cdot t}\right) \]
      12. fp-cancel-sub-sign-invN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{x \cdot 2 + \left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t}\right) \]
      13. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t + x \cdot 2}\right) \]
      14. add-flipN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t - \left(\mathsf{neg}\left(x \cdot 2\right)\right)}\right) \]
      15. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t - \left(\mathsf{neg}\left(\color{blue}{x \cdot 2}\right)\right)\right) \]
      16. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t - \color{blue}{x \cdot \left(\mathsf{neg}\left(2\right)\right)}\right) \]
      17. fp-cancel-sub-sign-invN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t + \left(\mathsf{neg}\left(x\right)\right) \cdot \left(\mathsf{neg}\left(2\right)\right)}\right) \]
    3. Applied rewrites95.7%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\left(z \cdot t\right) \cdot -9, y, \mathsf{fma}\left(a \cdot b, 27, x\right)\right) + x} \]
    5. Step-by-step derivation
      1. lift-fma.f64N/A

        \[\leadsto \color{blue}{\left(\left(\left(z \cdot t\right) \cdot -9\right) \cdot y + \mathsf{fma}\left(a \cdot b, 27, x\right)\right)} + x \]
      2. add-flipN/A

        \[\leadsto \color{blue}{\left(\left(\left(z \cdot t\right) \cdot -9\right) \cdot y - \left(\mathsf{neg}\left(\mathsf{fma}\left(a \cdot b, 27, x\right)\right)\right)\right)} + x \]
      3. sub-flipN/A

        \[\leadsto \color{blue}{\left(\left(\left(z \cdot t\right) \cdot -9\right) \cdot y + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\mathsf{fma}\left(a \cdot b, 27, x\right)\right)\right)\right)\right)\right)} + x \]
      4. *-commutativeN/A

        \[\leadsto \left(\color{blue}{y \cdot \left(\left(z \cdot t\right) \cdot -9\right)} + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\mathsf{fma}\left(a \cdot b, 27, x\right)\right)\right)\right)\right)\right) + x \]
      5. lift-*.f64N/A

        \[\leadsto \left(y \cdot \color{blue}{\left(\left(z \cdot t\right) \cdot -9\right)} + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\mathsf{fma}\left(a \cdot b, 27, x\right)\right)\right)\right)\right)\right) + x \]
      6. lift-*.f64N/A

        \[\leadsto \left(y \cdot \left(\color{blue}{\left(z \cdot t\right)} \cdot -9\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\mathsf{fma}\left(a \cdot b, 27, x\right)\right)\right)\right)\right)\right) + x \]
      7. associate-*l*N/A

        \[\leadsto \left(y \cdot \color{blue}{\left(z \cdot \left(t \cdot -9\right)\right)} + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\mathsf{fma}\left(a \cdot b, 27, x\right)\right)\right)\right)\right)\right) + x \]
      8. associate-*l*N/A

        \[\leadsto \left(\color{blue}{\left(y \cdot z\right) \cdot \left(t \cdot -9\right)} + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\mathsf{fma}\left(a \cdot b, 27, x\right)\right)\right)\right)\right)\right) + x \]
      9. *-commutativeN/A

        \[\leadsto \left(\color{blue}{\left(z \cdot y\right)} \cdot \left(t \cdot -9\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\mathsf{fma}\left(a \cdot b, 27, x\right)\right)\right)\right)\right)\right) + x \]
      10. associate-*l*N/A

        \[\leadsto \left(\color{blue}{z \cdot \left(y \cdot \left(t \cdot -9\right)\right)} + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\mathsf{fma}\left(a \cdot b, 27, x\right)\right)\right)\right)\right)\right) + x \]
      11. lift-fma.f64N/A

        \[\leadsto \left(z \cdot \left(y \cdot \left(t \cdot -9\right)\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\left(\left(a \cdot b\right) \cdot 27 + x\right)}\right)\right)\right)\right)\right) + x \]
      12. add-flipN/A

        \[\leadsto \left(z \cdot \left(y \cdot \left(t \cdot -9\right)\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\left(\left(a \cdot b\right) \cdot 27 - \left(\mathsf{neg}\left(x\right)\right)\right)}\right)\right)\right)\right)\right) + x \]
      13. *-commutativeN/A

        \[\leadsto \left(z \cdot \left(y \cdot \left(t \cdot -9\right)\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left(\color{blue}{27 \cdot \left(a \cdot b\right)} - \left(\mathsf{neg}\left(x\right)\right)\right)\right)\right)\right)\right)\right) + x \]
      14. lift-*.f64N/A

        \[\leadsto \left(z \cdot \left(y \cdot \left(t \cdot -9\right)\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left(\color{blue}{27 \cdot \left(a \cdot b\right)} - \left(\mathsf{neg}\left(x\right)\right)\right)\right)\right)\right)\right)\right) + x \]
      15. sub-negateN/A

        \[\leadsto \left(z \cdot \left(y \cdot \left(t \cdot -9\right)\right) + \left(\mathsf{neg}\left(\color{blue}{\left(\left(\mathsf{neg}\left(x\right)\right) - 27 \cdot \left(a \cdot b\right)\right)}\right)\right)\right) + x \]
      16. sub-negate-revN/A

        \[\leadsto \left(z \cdot \left(y \cdot \left(t \cdot -9\right)\right) + \color{blue}{\left(27 \cdot \left(a \cdot b\right) - \left(\mathsf{neg}\left(x\right)\right)\right)}\right) + x \]
      17. lift-*.f64N/A

        \[\leadsto \left(z \cdot \left(y \cdot \left(t \cdot -9\right)\right) + \left(\color{blue}{27 \cdot \left(a \cdot b\right)} - \left(\mathsf{neg}\left(x\right)\right)\right)\right) + x \]
      18. *-commutativeN/A

        \[\leadsto \left(z \cdot \left(y \cdot \left(t \cdot -9\right)\right) + \left(\color{blue}{\left(a \cdot b\right) \cdot 27} - \left(\mathsf{neg}\left(x\right)\right)\right)\right) + x \]
      19. add-flipN/A

        \[\leadsto \left(z \cdot \left(y \cdot \left(t \cdot -9\right)\right) + \color{blue}{\left(\left(a \cdot b\right) \cdot 27 + x\right)}\right) + x \]
      20. lift-fma.f64N/A

        \[\leadsto \left(z \cdot \left(y \cdot \left(t \cdot -9\right)\right) + \color{blue}{\mathsf{fma}\left(a \cdot b, 27, x\right)}\right) + x \]
      21. lower-fma.f64N/A

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(z, y \cdot \left(-9 \cdot t\right), \mathsf{fma}\left(27, b \cdot a, x\right)\right)} + x \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 5: 93.4% accurate, 0.5× speedup?

\[\begin{array}{l} t_1 := \mathsf{max}\left(\mathsf{max}\left(y, z\right), t\right)\\ t_2 := \mathsf{max}\left(a, b\right) \cdot \mathsf{min}\left(a, b\right)\\ t_3 := \mathsf{min}\left(\mathsf{max}\left(y, z\right), t\right)\\ \mathbf{if}\;\mathsf{max}\left(a, b\right) \leq 6.2 \cdot 10^{+249}:\\ \;\;\;\;\mathsf{fma}\left(t\_3, \mathsf{min}\left(y, z\right) \cdot \left(-9 \cdot t\_1\right), \mathsf{fma}\left(27, t\_2, x\right)\right) + x\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{min}\left(y, z\right) \cdot -9, t\_1 \cdot t\_3, 27 \cdot t\_2\right)\\ \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (fmax (fmax y z) t))
        (t_2 (* (fmax a b) (fmin a b)))
        (t_3 (fmin (fmax y z) t)))
   (if (<= (fmax a b) 6.2e+249)
     (+ (fma t_3 (* (fmin y z) (* -9.0 t_1)) (fma 27.0 t_2 x)) x)
     (fma (* (fmin y z) -9.0) (* t_1 t_3) (* 27.0 t_2)))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = fmax(fmax(y, z), t);
	double t_2 = fmax(a, b) * fmin(a, b);
	double t_3 = fmin(fmax(y, z), t);
	double tmp;
	if (fmax(a, b) <= 6.2e+249) {
		tmp = fma(t_3, (fmin(y, z) * (-9.0 * t_1)), fma(27.0, t_2, x)) + x;
	} else {
		tmp = fma((fmin(y, z) * -9.0), (t_1 * t_3), (27.0 * t_2));
	}
	return tmp;
}
function code(x, y, z, t, a, b)
	t_1 = fmax(fmax(y, z), t)
	t_2 = Float64(fmax(a, b) * fmin(a, b))
	t_3 = fmin(fmax(y, z), t)
	tmp = 0.0
	if (fmax(a, b) <= 6.2e+249)
		tmp = Float64(fma(t_3, Float64(fmin(y, z) * Float64(-9.0 * t_1)), fma(27.0, t_2, x)) + x);
	else
		tmp = fma(Float64(fmin(y, z) * -9.0), Float64(t_1 * t_3), Float64(27.0 * t_2));
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[Max[N[Max[y, z], $MachinePrecision], t], $MachinePrecision]}, Block[{t$95$2 = N[(N[Max[a, b], $MachinePrecision] * N[Min[a, b], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Min[N[Max[y, z], $MachinePrecision], t], $MachinePrecision]}, If[LessEqual[N[Max[a, b], $MachinePrecision], 6.2e+249], N[(N[(t$95$3 * N[(N[Min[y, z], $MachinePrecision] * N[(-9.0 * t$95$1), $MachinePrecision]), $MachinePrecision] + N[(27.0 * t$95$2 + x), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(N[(N[Min[y, z], $MachinePrecision] * -9.0), $MachinePrecision] * N[(t$95$1 * t$95$3), $MachinePrecision] + N[(27.0 * t$95$2), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
t_1 := \mathsf{max}\left(\mathsf{max}\left(y, z\right), t\right)\\
t_2 := \mathsf{max}\left(a, b\right) \cdot \mathsf{min}\left(a, b\right)\\
t_3 := \mathsf{min}\left(\mathsf{max}\left(y, z\right), t\right)\\
\mathbf{if}\;\mathsf{max}\left(a, b\right) \leq 6.2 \cdot 10^{+249}:\\
\;\;\;\;\mathsf{fma}\left(t\_3, \mathsf{min}\left(y, z\right) \cdot \left(-9 \cdot t\_1\right), \mathsf{fma}\left(27, t\_2, x\right)\right) + x\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{min}\left(y, z\right) \cdot -9, t\_1 \cdot t\_3, 27 \cdot t\_2\right)\\


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < 6.20000000000000031e249

    1. Initial program 94.9%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Step-by-step derivation
      1. lift-+.f64N/A

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

        \[\leadsto \color{blue}{\left(a \cdot 27\right) \cdot b + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)} \]
      3. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(a \cdot 27\right) \cdot b} + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      4. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(a \cdot 27\right)} \cdot b + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      5. associate-*l*N/A

        \[\leadsto \color{blue}{a \cdot \left(27 \cdot b\right)} + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      6. *-commutativeN/A

        \[\leadsto \color{blue}{\left(27 \cdot b\right) \cdot a} + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      7. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(27 \cdot b, a, x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)} \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{b \cdot 27}, a, x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      9. lower-*.f6495.7

        \[\leadsto \mathsf{fma}\left(\color{blue}{b \cdot 27}, a, x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      10. lift--.f64N/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t}\right) \]
      11. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, x \cdot 2 - \color{blue}{\left(\left(y \cdot 9\right) \cdot z\right) \cdot t}\right) \]
      12. fp-cancel-sub-sign-invN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{x \cdot 2 + \left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t}\right) \]
      13. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t + x \cdot 2}\right) \]
      14. add-flipN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t - \left(\mathsf{neg}\left(x \cdot 2\right)\right)}\right) \]
      15. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t - \left(\mathsf{neg}\left(\color{blue}{x \cdot 2}\right)\right)\right) \]
      16. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t - \color{blue}{x \cdot \left(\mathsf{neg}\left(2\right)\right)}\right) \]
      17. fp-cancel-sub-sign-invN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t + \left(\mathsf{neg}\left(x\right)\right) \cdot \left(\mathsf{neg}\left(2\right)\right)}\right) \]
    3. Applied rewrites95.7%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\left(z \cdot t\right) \cdot -9, y, \mathsf{fma}\left(a \cdot b, 27, x\right)\right) + x} \]
    5. Step-by-step derivation
      1. lift-fma.f64N/A

        \[\leadsto \color{blue}{\left(\left(\left(z \cdot t\right) \cdot -9\right) \cdot y + \mathsf{fma}\left(a \cdot b, 27, x\right)\right)} + x \]
      2. add-flipN/A

        \[\leadsto \color{blue}{\left(\left(\left(z \cdot t\right) \cdot -9\right) \cdot y - \left(\mathsf{neg}\left(\mathsf{fma}\left(a \cdot b, 27, x\right)\right)\right)\right)} + x \]
      3. sub-flipN/A

        \[\leadsto \color{blue}{\left(\left(\left(z \cdot t\right) \cdot -9\right) \cdot y + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\mathsf{fma}\left(a \cdot b, 27, x\right)\right)\right)\right)\right)\right)} + x \]
      4. *-commutativeN/A

        \[\leadsto \left(\color{blue}{y \cdot \left(\left(z \cdot t\right) \cdot -9\right)} + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\mathsf{fma}\left(a \cdot b, 27, x\right)\right)\right)\right)\right)\right) + x \]
      5. lift-*.f64N/A

        \[\leadsto \left(y \cdot \color{blue}{\left(\left(z \cdot t\right) \cdot -9\right)} + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\mathsf{fma}\left(a \cdot b, 27, x\right)\right)\right)\right)\right)\right) + x \]
      6. lift-*.f64N/A

        \[\leadsto \left(y \cdot \left(\color{blue}{\left(z \cdot t\right)} \cdot -9\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\mathsf{fma}\left(a \cdot b, 27, x\right)\right)\right)\right)\right)\right) + x \]
      7. associate-*l*N/A

        \[\leadsto \left(y \cdot \color{blue}{\left(z \cdot \left(t \cdot -9\right)\right)} + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\mathsf{fma}\left(a \cdot b, 27, x\right)\right)\right)\right)\right)\right) + x \]
      8. associate-*l*N/A

        \[\leadsto \left(\color{blue}{\left(y \cdot z\right) \cdot \left(t \cdot -9\right)} + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\mathsf{fma}\left(a \cdot b, 27, x\right)\right)\right)\right)\right)\right) + x \]
      9. *-commutativeN/A

        \[\leadsto \left(\color{blue}{\left(z \cdot y\right)} \cdot \left(t \cdot -9\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\mathsf{fma}\left(a \cdot b, 27, x\right)\right)\right)\right)\right)\right) + x \]
      10. associate-*l*N/A

        \[\leadsto \left(\color{blue}{z \cdot \left(y \cdot \left(t \cdot -9\right)\right)} + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\mathsf{fma}\left(a \cdot b, 27, x\right)\right)\right)\right)\right)\right) + x \]
      11. lift-fma.f64N/A

        \[\leadsto \left(z \cdot \left(y \cdot \left(t \cdot -9\right)\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\left(\left(a \cdot b\right) \cdot 27 + x\right)}\right)\right)\right)\right)\right) + x \]
      12. add-flipN/A

        \[\leadsto \left(z \cdot \left(y \cdot \left(t \cdot -9\right)\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\left(\left(a \cdot b\right) \cdot 27 - \left(\mathsf{neg}\left(x\right)\right)\right)}\right)\right)\right)\right)\right) + x \]
      13. *-commutativeN/A

        \[\leadsto \left(z \cdot \left(y \cdot \left(t \cdot -9\right)\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left(\color{blue}{27 \cdot \left(a \cdot b\right)} - \left(\mathsf{neg}\left(x\right)\right)\right)\right)\right)\right)\right)\right) + x \]
      14. lift-*.f64N/A

        \[\leadsto \left(z \cdot \left(y \cdot \left(t \cdot -9\right)\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left(\color{blue}{27 \cdot \left(a \cdot b\right)} - \left(\mathsf{neg}\left(x\right)\right)\right)\right)\right)\right)\right)\right) + x \]
      15. sub-negateN/A

        \[\leadsto \left(z \cdot \left(y \cdot \left(t \cdot -9\right)\right) + \left(\mathsf{neg}\left(\color{blue}{\left(\left(\mathsf{neg}\left(x\right)\right) - 27 \cdot \left(a \cdot b\right)\right)}\right)\right)\right) + x \]
      16. sub-negate-revN/A

        \[\leadsto \left(z \cdot \left(y \cdot \left(t \cdot -9\right)\right) + \color{blue}{\left(27 \cdot \left(a \cdot b\right) - \left(\mathsf{neg}\left(x\right)\right)\right)}\right) + x \]
      17. lift-*.f64N/A

        \[\leadsto \left(z \cdot \left(y \cdot \left(t \cdot -9\right)\right) + \left(\color{blue}{27 \cdot \left(a \cdot b\right)} - \left(\mathsf{neg}\left(x\right)\right)\right)\right) + x \]
      18. *-commutativeN/A

        \[\leadsto \left(z \cdot \left(y \cdot \left(t \cdot -9\right)\right) + \left(\color{blue}{\left(a \cdot b\right) \cdot 27} - \left(\mathsf{neg}\left(x\right)\right)\right)\right) + x \]
      19. add-flipN/A

        \[\leadsto \left(z \cdot \left(y \cdot \left(t \cdot -9\right)\right) + \color{blue}{\left(\left(a \cdot b\right) \cdot 27 + x\right)}\right) + x \]
      20. lift-fma.f64N/A

        \[\leadsto \left(z \cdot \left(y \cdot \left(t \cdot -9\right)\right) + \color{blue}{\mathsf{fma}\left(a \cdot b, 27, x\right)}\right) + x \]
      21. lower-fma.f64N/A

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

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

    if 6.20000000000000031e249 < b

    1. Initial program 94.9%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Step-by-step derivation
      1. lift-+.f64N/A

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

        \[\leadsto \color{blue}{\left(a \cdot 27\right) \cdot b + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)} \]
      3. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(a \cdot 27\right) \cdot b} + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      4. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(a \cdot 27\right)} \cdot b + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      5. associate-*l*N/A

        \[\leadsto \color{blue}{a \cdot \left(27 \cdot b\right)} + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      6. *-commutativeN/A

        \[\leadsto \color{blue}{\left(27 \cdot b\right) \cdot a} + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      7. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(27 \cdot b, a, x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)} \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{b \cdot 27}, a, x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      9. lower-*.f6495.7

        \[\leadsto \mathsf{fma}\left(\color{blue}{b \cdot 27}, a, x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      10. lift--.f64N/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t}\right) \]
      11. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, x \cdot 2 - \color{blue}{\left(\left(y \cdot 9\right) \cdot z\right) \cdot t}\right) \]
      12. fp-cancel-sub-sign-invN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{x \cdot 2 + \left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t}\right) \]
      13. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t + x \cdot 2}\right) \]
      14. add-flipN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t - \left(\mathsf{neg}\left(x \cdot 2\right)\right)}\right) \]
      15. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t - \left(\mathsf{neg}\left(\color{blue}{x \cdot 2}\right)\right)\right) \]
      16. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t - \color{blue}{x \cdot \left(\mathsf{neg}\left(2\right)\right)}\right) \]
      17. fp-cancel-sub-sign-invN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t + \left(\mathsf{neg}\left(x\right)\right) \cdot \left(\mathsf{neg}\left(2\right)\right)}\right) \]
    3. Applied rewrites95.7%

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

      \[\leadsto \color{blue}{-9 \cdot \left(t \cdot \left(y \cdot z\right)\right) + 27 \cdot \left(a \cdot b\right)} \]
    5. Step-by-step derivation
      1. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(-9, \color{blue}{t \cdot \left(y \cdot z\right)}, 27 \cdot \left(a \cdot b\right)\right) \]
      2. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(-9, t \cdot \color{blue}{\left(y \cdot z\right)}, 27 \cdot \left(a \cdot b\right)\right) \]
      3. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(-9, t \cdot \left(y \cdot \color{blue}{z}\right), 27 \cdot \left(a \cdot b\right)\right) \]
      4. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(-9, t \cdot \left(y \cdot z\right), 27 \cdot \left(a \cdot b\right)\right) \]
      5. lower-*.f6465.9

        \[\leadsto \mathsf{fma}\left(-9, t \cdot \left(y \cdot z\right), 27 \cdot \left(a \cdot b\right)\right) \]
    6. Applied rewrites65.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(-9, t \cdot \left(y \cdot z\right), 27 \cdot \left(a \cdot b\right)\right)} \]
    7. Step-by-step derivation
      1. lift-fma.f64N/A

        \[\leadsto -9 \cdot \left(t \cdot \left(y \cdot z\right)\right) + \color{blue}{27 \cdot \left(a \cdot b\right)} \]
      2. lift-*.f64N/A

        \[\leadsto -9 \cdot \left(t \cdot \left(y \cdot z\right)\right) + 27 \cdot \left(a \cdot b\right) \]
      3. associate-*r*N/A

        \[\leadsto \left(-9 \cdot t\right) \cdot \left(y \cdot z\right) + \color{blue}{27} \cdot \left(a \cdot b\right) \]
      4. *-commutativeN/A

        \[\leadsto \left(t \cdot -9\right) \cdot \left(y \cdot z\right) + 27 \cdot \left(a \cdot b\right) \]
      5. *-commutativeN/A

        \[\leadsto \left(y \cdot z\right) \cdot \left(t \cdot -9\right) + \color{blue}{27} \cdot \left(a \cdot b\right) \]
      6. lift-*.f64N/A

        \[\leadsto \left(y \cdot z\right) \cdot \left(t \cdot -9\right) + 27 \cdot \left(a \cdot b\right) \]
      7. associate-*l*N/A

        \[\leadsto y \cdot \left(z \cdot \left(t \cdot -9\right)\right) + \color{blue}{27} \cdot \left(a \cdot b\right) \]
      8. associate-*l*N/A

        \[\leadsto y \cdot \left(\left(z \cdot t\right) \cdot -9\right) + 27 \cdot \left(a \cdot b\right) \]
      9. lift-*.f64N/A

        \[\leadsto y \cdot \left(\left(z \cdot t\right) \cdot -9\right) + 27 \cdot \left(a \cdot b\right) \]
      10. *-commutativeN/A

        \[\leadsto y \cdot \left(-9 \cdot \left(z \cdot t\right)\right) + 27 \cdot \left(a \cdot b\right) \]
      11. associate-*r*N/A

        \[\leadsto \left(y \cdot -9\right) \cdot \left(z \cdot t\right) + \color{blue}{27} \cdot \left(a \cdot b\right) \]
      12. *-commutativeN/A

        \[\leadsto \left(-9 \cdot y\right) \cdot \left(z \cdot t\right) + 27 \cdot \left(a \cdot b\right) \]
      13. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(-9 \cdot y, \color{blue}{z \cdot t}, 27 \cdot \left(a \cdot b\right)\right) \]
      14. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(y \cdot -9, \color{blue}{z} \cdot t, 27 \cdot \left(a \cdot b\right)\right) \]
      15. lower-*.f6466.0

        \[\leadsto \mathsf{fma}\left(y \cdot -9, \color{blue}{z} \cdot t, 27 \cdot \left(a \cdot b\right)\right) \]
      16. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(y \cdot -9, z \cdot \color{blue}{t}, 27 \cdot \left(a \cdot b\right)\right) \]
      17. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(y \cdot -9, t \cdot \color{blue}{z}, 27 \cdot \left(a \cdot b\right)\right) \]
      18. lower-*.f6466.0

        \[\leadsto \mathsf{fma}\left(y \cdot -9, t \cdot \color{blue}{z}, 27 \cdot \left(a \cdot b\right)\right) \]
      19. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(y \cdot -9, t \cdot z, 27 \cdot \left(a \cdot b\right)\right) \]
      20. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(y \cdot -9, t \cdot z, 27 \cdot \left(b \cdot a\right)\right) \]
      21. lower-*.f6466.0

        \[\leadsto \mathsf{fma}\left(y \cdot -9, t \cdot z, 27 \cdot \left(b \cdot a\right)\right) \]
    8. Applied rewrites66.0%

      \[\leadsto \mathsf{fma}\left(y \cdot -9, \color{blue}{t \cdot z}, 27 \cdot \left(b \cdot a\right)\right) \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 6: 83.2% accurate, 0.6× speedup?

\[\begin{array}{l} t_1 := \mathsf{min}\left(z, \mathsf{max}\left(y, t\right)\right)\\ t_2 := \mathsf{max}\left(z, \mathsf{max}\left(y, t\right)\right)\\ \mathbf{if}\;x \leq -2.6 \cdot 10^{+47}:\\ \;\;\;\;\mathsf{fma}\left(-9, t\_2 \cdot \left(\mathsf{min}\left(y, t\right) \cdot t\_1\right), 2 \cdot x\right)\\ \mathbf{elif}\;x \leq 5.6 \cdot 10^{+102}:\\ \;\;\;\;\mathsf{fma}\left(\left(\mathsf{min}\left(y, t\right) \cdot -9\right) \cdot t\_1, t\_2, 27 \cdot \left(b \cdot a\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left(-t\_2\right) \cdot \left(9 \cdot t\_1\right), \mathsf{min}\left(y, t\right), x\right) + x\\ \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (fmin z (fmax y t))) (t_2 (fmax z (fmax y t))))
   (if (<= x -2.6e+47)
     (fma -9.0 (* t_2 (* (fmin y t) t_1)) (* 2.0 x))
     (if (<= x 5.6e+102)
       (fma (* (* (fmin y t) -9.0) t_1) t_2 (* 27.0 (* b a)))
       (+ (fma (* (- t_2) (* 9.0 t_1)) (fmin y t) x) x)))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = fmin(z, fmax(y, t));
	double t_2 = fmax(z, fmax(y, t));
	double tmp;
	if (x <= -2.6e+47) {
		tmp = fma(-9.0, (t_2 * (fmin(y, t) * t_1)), (2.0 * x));
	} else if (x <= 5.6e+102) {
		tmp = fma(((fmin(y, t) * -9.0) * t_1), t_2, (27.0 * (b * a)));
	} else {
		tmp = fma((-t_2 * (9.0 * t_1)), fmin(y, t), x) + x;
	}
	return tmp;
}
function code(x, y, z, t, a, b)
	t_1 = fmin(z, fmax(y, t))
	t_2 = fmax(z, fmax(y, t))
	tmp = 0.0
	if (x <= -2.6e+47)
		tmp = fma(-9.0, Float64(t_2 * Float64(fmin(y, t) * t_1)), Float64(2.0 * x));
	elseif (x <= 5.6e+102)
		tmp = fma(Float64(Float64(fmin(y, t) * -9.0) * t_1), t_2, Float64(27.0 * Float64(b * a)));
	else
		tmp = Float64(fma(Float64(Float64(-t_2) * Float64(9.0 * t_1)), fmin(y, t), x) + x);
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[Min[z, N[Max[y, t], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Max[z, N[Max[y, t], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -2.6e+47], N[(-9.0 * N[(t$95$2 * N[(N[Min[y, t], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision] + N[(2.0 * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 5.6e+102], N[(N[(N[(N[Min[y, t], $MachinePrecision] * -9.0), $MachinePrecision] * t$95$1), $MachinePrecision] * t$95$2 + N[(27.0 * N[(b * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[((-t$95$2) * N[(9.0 * t$95$1), $MachinePrecision]), $MachinePrecision] * N[Min[y, t], $MachinePrecision] + x), $MachinePrecision] + x), $MachinePrecision]]]]]
\begin{array}{l}
t_1 := \mathsf{min}\left(z, \mathsf{max}\left(y, t\right)\right)\\
t_2 := \mathsf{max}\left(z, \mathsf{max}\left(y, t\right)\right)\\
\mathbf{if}\;x \leq -2.6 \cdot 10^{+47}:\\
\;\;\;\;\mathsf{fma}\left(-9, t\_2 \cdot \left(\mathsf{min}\left(y, t\right) \cdot t\_1\right), 2 \cdot x\right)\\

\mathbf{elif}\;x \leq 5.6 \cdot 10^{+102}:\\
\;\;\;\;\mathsf{fma}\left(\left(\mathsf{min}\left(y, t\right) \cdot -9\right) \cdot t\_1, t\_2, 27 \cdot \left(b \cdot a\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(-t\_2\right) \cdot \left(9 \cdot t\_1\right), \mathsf{min}\left(y, t\right), x\right) + x\\


\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -2.60000000000000003e47

    1. Initial program 94.9%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Step-by-step derivation
      1. lift-+.f64N/A

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

        \[\leadsto \color{blue}{\left(a \cdot 27\right) \cdot b + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)} \]
      3. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(a \cdot 27\right) \cdot b} + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      4. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(a \cdot 27\right)} \cdot b + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      5. associate-*l*N/A

        \[\leadsto \color{blue}{a \cdot \left(27 \cdot b\right)} + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      6. *-commutativeN/A

        \[\leadsto \color{blue}{\left(27 \cdot b\right) \cdot a} + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      7. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(27 \cdot b, a, x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)} \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{b \cdot 27}, a, x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      9. lower-*.f6495.7

        \[\leadsto \mathsf{fma}\left(\color{blue}{b \cdot 27}, a, x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      10. lift--.f64N/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t}\right) \]
      11. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, x \cdot 2 - \color{blue}{\left(\left(y \cdot 9\right) \cdot z\right) \cdot t}\right) \]
      12. fp-cancel-sub-sign-invN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{x \cdot 2 + \left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t}\right) \]
      13. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t + x \cdot 2}\right) \]
      14. add-flipN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t - \left(\mathsf{neg}\left(x \cdot 2\right)\right)}\right) \]
      15. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t - \left(\mathsf{neg}\left(\color{blue}{x \cdot 2}\right)\right)\right) \]
      16. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t - \color{blue}{x \cdot \left(\mathsf{neg}\left(2\right)\right)}\right) \]
      17. fp-cancel-sub-sign-invN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t + \left(\mathsf{neg}\left(x\right)\right) \cdot \left(\mathsf{neg}\left(2\right)\right)}\right) \]
    3. Applied rewrites95.7%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\left(z \cdot t\right) \cdot -9, y, \mathsf{fma}\left(a \cdot b, 27, x\right)\right) + x} \]
    5. Step-by-step derivation
      1. lift-fma.f64N/A

        \[\leadsto \color{blue}{\left(\left(\left(z \cdot t\right) \cdot -9\right) \cdot y + \mathsf{fma}\left(a \cdot b, 27, x\right)\right)} + x \]
      2. add-flipN/A

        \[\leadsto \color{blue}{\left(\left(\left(z \cdot t\right) \cdot -9\right) \cdot y - \left(\mathsf{neg}\left(\mathsf{fma}\left(a \cdot b, 27, x\right)\right)\right)\right)} + x \]
      3. sub-flipN/A

        \[\leadsto \color{blue}{\left(\left(\left(z \cdot t\right) \cdot -9\right) \cdot y + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\mathsf{fma}\left(a \cdot b, 27, x\right)\right)\right)\right)\right)\right)} + x \]
      4. *-commutativeN/A

        \[\leadsto \left(\color{blue}{y \cdot \left(\left(z \cdot t\right) \cdot -9\right)} + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\mathsf{fma}\left(a \cdot b, 27, x\right)\right)\right)\right)\right)\right) + x \]
      5. lift-*.f64N/A

        \[\leadsto \left(y \cdot \color{blue}{\left(\left(z \cdot t\right) \cdot -9\right)} + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\mathsf{fma}\left(a \cdot b, 27, x\right)\right)\right)\right)\right)\right) + x \]
      6. lift-*.f64N/A

        \[\leadsto \left(y \cdot \left(\color{blue}{\left(z \cdot t\right)} \cdot -9\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\mathsf{fma}\left(a \cdot b, 27, x\right)\right)\right)\right)\right)\right) + x \]
      7. associate-*l*N/A

        \[\leadsto \left(y \cdot \color{blue}{\left(z \cdot \left(t \cdot -9\right)\right)} + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\mathsf{fma}\left(a \cdot b, 27, x\right)\right)\right)\right)\right)\right) + x \]
      8. associate-*l*N/A

        \[\leadsto \left(\color{blue}{\left(y \cdot z\right) \cdot \left(t \cdot -9\right)} + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\mathsf{fma}\left(a \cdot b, 27, x\right)\right)\right)\right)\right)\right) + x \]
      9. *-commutativeN/A

        \[\leadsto \left(\color{blue}{\left(z \cdot y\right)} \cdot \left(t \cdot -9\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\mathsf{fma}\left(a \cdot b, 27, x\right)\right)\right)\right)\right)\right) + x \]
      10. associate-*l*N/A

        \[\leadsto \left(\color{blue}{z \cdot \left(y \cdot \left(t \cdot -9\right)\right)} + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\mathsf{fma}\left(a \cdot b, 27, x\right)\right)\right)\right)\right)\right) + x \]
      11. lift-fma.f64N/A

        \[\leadsto \left(z \cdot \left(y \cdot \left(t \cdot -9\right)\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\left(\left(a \cdot b\right) \cdot 27 + x\right)}\right)\right)\right)\right)\right) + x \]
      12. add-flipN/A

        \[\leadsto \left(z \cdot \left(y \cdot \left(t \cdot -9\right)\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\left(\left(a \cdot b\right) \cdot 27 - \left(\mathsf{neg}\left(x\right)\right)\right)}\right)\right)\right)\right)\right) + x \]
      13. *-commutativeN/A

        \[\leadsto \left(z \cdot \left(y \cdot \left(t \cdot -9\right)\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left(\color{blue}{27 \cdot \left(a \cdot b\right)} - \left(\mathsf{neg}\left(x\right)\right)\right)\right)\right)\right)\right)\right) + x \]
      14. lift-*.f64N/A

        \[\leadsto \left(z \cdot \left(y \cdot \left(t \cdot -9\right)\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left(\color{blue}{27 \cdot \left(a \cdot b\right)} - \left(\mathsf{neg}\left(x\right)\right)\right)\right)\right)\right)\right)\right) + x \]
      15. sub-negateN/A

        \[\leadsto \left(z \cdot \left(y \cdot \left(t \cdot -9\right)\right) + \left(\mathsf{neg}\left(\color{blue}{\left(\left(\mathsf{neg}\left(x\right)\right) - 27 \cdot \left(a \cdot b\right)\right)}\right)\right)\right) + x \]
      16. sub-negate-revN/A

        \[\leadsto \left(z \cdot \left(y \cdot \left(t \cdot -9\right)\right) + \color{blue}{\left(27 \cdot \left(a \cdot b\right) - \left(\mathsf{neg}\left(x\right)\right)\right)}\right) + x \]
      17. lift-*.f64N/A

        \[\leadsto \left(z \cdot \left(y \cdot \left(t \cdot -9\right)\right) + \left(\color{blue}{27 \cdot \left(a \cdot b\right)} - \left(\mathsf{neg}\left(x\right)\right)\right)\right) + x \]
      18. *-commutativeN/A

        \[\leadsto \left(z \cdot \left(y \cdot \left(t \cdot -9\right)\right) + \left(\color{blue}{\left(a \cdot b\right) \cdot 27} - \left(\mathsf{neg}\left(x\right)\right)\right)\right) + x \]
      19. add-flipN/A

        \[\leadsto \left(z \cdot \left(y \cdot \left(t \cdot -9\right)\right) + \color{blue}{\left(\left(a \cdot b\right) \cdot 27 + x\right)}\right) + x \]
      20. lift-fma.f64N/A

        \[\leadsto \left(z \cdot \left(y \cdot \left(t \cdot -9\right)\right) + \color{blue}{\mathsf{fma}\left(a \cdot b, 27, x\right)}\right) + x \]
      21. lower-fma.f64N/A

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(-9, t \cdot \left(y \cdot z\right), 2 \cdot x\right) \]
    9. Applied rewrites64.1%

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

    if -2.60000000000000003e47 < x < 5.60000000000000037e102

    1. Initial program 94.9%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Step-by-step derivation
      1. lift-+.f64N/A

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

        \[\leadsto \color{blue}{\left(a \cdot 27\right) \cdot b + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)} \]
      3. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(a \cdot 27\right) \cdot b} + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      4. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(a \cdot 27\right)} \cdot b + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      5. associate-*l*N/A

        \[\leadsto \color{blue}{a \cdot \left(27 \cdot b\right)} + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      6. *-commutativeN/A

        \[\leadsto \color{blue}{\left(27 \cdot b\right) \cdot a} + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      7. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(27 \cdot b, a, x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)} \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{b \cdot 27}, a, x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      9. lower-*.f6495.7

        \[\leadsto \mathsf{fma}\left(\color{blue}{b \cdot 27}, a, x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      10. lift--.f64N/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t}\right) \]
      11. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, x \cdot 2 - \color{blue}{\left(\left(y \cdot 9\right) \cdot z\right) \cdot t}\right) \]
      12. fp-cancel-sub-sign-invN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{x \cdot 2 + \left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t}\right) \]
      13. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t + x \cdot 2}\right) \]
      14. add-flipN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t - \left(\mathsf{neg}\left(x \cdot 2\right)\right)}\right) \]
      15. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t - \left(\mathsf{neg}\left(\color{blue}{x \cdot 2}\right)\right)\right) \]
      16. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t - \color{blue}{x \cdot \left(\mathsf{neg}\left(2\right)\right)}\right) \]
      17. fp-cancel-sub-sign-invN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t + \left(\mathsf{neg}\left(x\right)\right) \cdot \left(\mathsf{neg}\left(2\right)\right)}\right) \]
    3. Applied rewrites95.7%

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

      \[\leadsto \color{blue}{-9 \cdot \left(t \cdot \left(y \cdot z\right)\right) + 27 \cdot \left(a \cdot b\right)} \]
    5. Step-by-step derivation
      1. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(-9, \color{blue}{t \cdot \left(y \cdot z\right)}, 27 \cdot \left(a \cdot b\right)\right) \]
      2. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(-9, t \cdot \color{blue}{\left(y \cdot z\right)}, 27 \cdot \left(a \cdot b\right)\right) \]
      3. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(-9, t \cdot \left(y \cdot \color{blue}{z}\right), 27 \cdot \left(a \cdot b\right)\right) \]
      4. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(-9, t \cdot \left(y \cdot z\right), 27 \cdot \left(a \cdot b\right)\right) \]
      5. lower-*.f6465.9

        \[\leadsto \mathsf{fma}\left(-9, t \cdot \left(y \cdot z\right), 27 \cdot \left(a \cdot b\right)\right) \]
    6. Applied rewrites65.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(-9, t \cdot \left(y \cdot z\right), 27 \cdot \left(a \cdot b\right)\right)} \]
    7. Applied rewrites66.1%

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

    if 5.60000000000000037e102 < x

    1. Initial program 94.9%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Step-by-step derivation
      1. lift-+.f64N/A

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

        \[\leadsto \color{blue}{\left(a \cdot 27\right) \cdot b + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)} \]
      3. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(a \cdot 27\right) \cdot b} + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      4. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(a \cdot 27\right)} \cdot b + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      5. associate-*l*N/A

        \[\leadsto \color{blue}{a \cdot \left(27 \cdot b\right)} + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      6. *-commutativeN/A

        \[\leadsto \color{blue}{\left(27 \cdot b\right) \cdot a} + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      7. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(27 \cdot b, a, x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)} \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{b \cdot 27}, a, x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      9. lower-*.f6495.7

        \[\leadsto \mathsf{fma}\left(\color{blue}{b \cdot 27}, a, x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      10. lift--.f64N/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t}\right) \]
      11. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, x \cdot 2 - \color{blue}{\left(\left(y \cdot 9\right) \cdot z\right) \cdot t}\right) \]
      12. fp-cancel-sub-sign-invN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{x \cdot 2 + \left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t}\right) \]
      13. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t + x \cdot 2}\right) \]
      14. add-flipN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t - \left(\mathsf{neg}\left(x \cdot 2\right)\right)}\right) \]
      15. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t - \left(\mathsf{neg}\left(\color{blue}{x \cdot 2}\right)\right)\right) \]
      16. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t - \color{blue}{x \cdot \left(\mathsf{neg}\left(2\right)\right)}\right) \]
      17. fp-cancel-sub-sign-invN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t + \left(\mathsf{neg}\left(x\right)\right) \cdot \left(\mathsf{neg}\left(2\right)\right)}\right) \]
    3. Applied rewrites95.7%

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

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

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

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

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

        \[\leadsto \left(x + -9 \cdot \left(t \cdot \color{blue}{\left(y \cdot z\right)}\right)\right) + x \]
      4. lower-*.f6464.1

        \[\leadsto \left(x + -9 \cdot \left(t \cdot \left(y \cdot \color{blue}{z}\right)\right)\right) + x \]
    7. Applied rewrites64.1%

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

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

        \[\leadsto \left(-9 \cdot \left(t \cdot \left(y \cdot z\right)\right) + \color{blue}{x}\right) + x \]
      3. add-flipN/A

        \[\leadsto \left(-9 \cdot \left(t \cdot \left(y \cdot z\right)\right) - \color{blue}{\left(\mathsf{neg}\left(x\right)\right)}\right) + x \]
      4. lift-*.f64N/A

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

        \[\leadsto \left(\left(t \cdot \left(y \cdot z\right)\right) \cdot -9 - \left(\mathsf{neg}\left(\color{blue}{x}\right)\right)\right) + x \]
      6. lift-*.f64N/A

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

        \[\leadsto \left(\left(\left(y \cdot z\right) \cdot t\right) \cdot -9 - \left(\mathsf{neg}\left(x\right)\right)\right) + x \]
      8. lift-*.f64N/A

        \[\leadsto \left(\left(\left(y \cdot z\right) \cdot t\right) \cdot -9 - \left(\mathsf{neg}\left(x\right)\right)\right) + x \]
      9. associate-*l*N/A

        \[\leadsto \left(\left(y \cdot \left(z \cdot t\right)\right) \cdot -9 - \left(\mathsf{neg}\left(x\right)\right)\right) + x \]
      10. associate-*r*N/A

        \[\leadsto \left(y \cdot \left(\left(z \cdot t\right) \cdot -9\right) - \left(\mathsf{neg}\left(\color{blue}{x}\right)\right)\right) + x \]
      11. *-commutativeN/A

        \[\leadsto \left(\left(\left(z \cdot t\right) \cdot -9\right) \cdot y - \left(\mathsf{neg}\left(\color{blue}{x}\right)\right)\right) + x \]
      12. sub-flipN/A

        \[\leadsto \left(\left(\left(z \cdot t\right) \cdot -9\right) \cdot y + \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right)}\right) + x \]
      13. associate-*l*N/A

        \[\leadsto \left(\left(z \cdot t\right) \cdot \left(-9 \cdot y\right) + \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(x\right)\right)}\right)\right)\right) + x \]
      14. *-commutativeN/A

        \[\leadsto \left(\left(z \cdot t\right) \cdot \left(y \cdot -9\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right)\right) + x \]
      15. metadata-evalN/A

        \[\leadsto \left(\left(z \cdot t\right) \cdot \left(y \cdot \left(\mathsf{neg}\left(9\right)\right)\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right)\right) + x \]
      16. distribute-rgt-neg-outN/A

        \[\leadsto \left(\left(z \cdot t\right) \cdot \left(\mathsf{neg}\left(y \cdot 9\right)\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right)\right) + x \]
      17. distribute-rgt-neg-inN/A

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

        \[\leadsto \left(\left(\mathsf{neg}\left(z \cdot t\right)\right) \cdot \left(y \cdot 9\right) + \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(x\right)\right)}\right)\right)\right) + x \]
      19. *-commutativeN/A

        \[\leadsto \left(\left(\mathsf{neg}\left(t \cdot z\right)\right) \cdot \left(y \cdot 9\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right)\right) + x \]
      20. distribute-lft-neg-inN/A

        \[\leadsto \left(\left(\left(\mathsf{neg}\left(t\right)\right) \cdot z\right) \cdot \left(y \cdot 9\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{x}\right)\right)\right)\right)\right) + x \]
      21. associate-*r*N/A

        \[\leadsto \left(\left(\mathsf{neg}\left(t\right)\right) \cdot \left(z \cdot \left(y \cdot 9\right)\right) + \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(x\right)\right)}\right)\right)\right) + x \]
      22. *-commutativeN/A

        \[\leadsto \left(\left(\mathsf{neg}\left(t\right)\right) \cdot \left(\left(y \cdot 9\right) \cdot z\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right)\right) + x \]
      23. associate-*l*N/A

        \[\leadsto \left(\left(\mathsf{neg}\left(t\right)\right) \cdot \left(y \cdot \left(9 \cdot z\right)\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right)\right) + x \]
      24. *-commutativeN/A

        \[\leadsto \left(\left(\mathsf{neg}\left(t\right)\right) \cdot \left(\left(9 \cdot z\right) \cdot y\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right)\right) + x \]
      25. associate-*r*N/A

        \[\leadsto \left(\left(\left(\mathsf{neg}\left(t\right)\right) \cdot \left(9 \cdot z\right)\right) \cdot y + \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(x\right)\right)}\right)\right)\right) + x \]
      26. remove-double-negN/A

        \[\leadsto \left(\left(\left(\mathsf{neg}\left(t\right)\right) \cdot \left(9 \cdot z\right)\right) \cdot y + x\right) + x \]
    9. Applied rewrites63.9%

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

Alternative 7: 82.5% accurate, 0.6× speedup?

\[\begin{array}{l} t_1 := \mathsf{min}\left(z, \mathsf{max}\left(y, t\right)\right)\\ t_2 := \mathsf{max}\left(z, \mathsf{max}\left(y, t\right)\right)\\ t_3 := t\_2 \cdot \left(\mathsf{min}\left(y, t\right) \cdot t\_1\right)\\ \mathbf{if}\;x \leq -2.6 \cdot 10^{+47}:\\ \;\;\;\;\mathsf{fma}\left(-9, t\_3, 2 \cdot x\right)\\ \mathbf{elif}\;x \leq 5.6 \cdot 10^{+102}:\\ \;\;\;\;\mathsf{fma}\left(-9, t\_3, 27 \cdot \left(a \cdot b\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left(-t\_2\right) \cdot \left(9 \cdot t\_1\right), \mathsf{min}\left(y, t\right), x\right) + x\\ \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (fmin z (fmax y t)))
        (t_2 (fmax z (fmax y t)))
        (t_3 (* t_2 (* (fmin y t) t_1))))
   (if (<= x -2.6e+47)
     (fma -9.0 t_3 (* 2.0 x))
     (if (<= x 5.6e+102)
       (fma -9.0 t_3 (* 27.0 (* a b)))
       (+ (fma (* (- t_2) (* 9.0 t_1)) (fmin y t) x) x)))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = fmin(z, fmax(y, t));
	double t_2 = fmax(z, fmax(y, t));
	double t_3 = t_2 * (fmin(y, t) * t_1);
	double tmp;
	if (x <= -2.6e+47) {
		tmp = fma(-9.0, t_3, (2.0 * x));
	} else if (x <= 5.6e+102) {
		tmp = fma(-9.0, t_3, (27.0 * (a * b)));
	} else {
		tmp = fma((-t_2 * (9.0 * t_1)), fmin(y, t), x) + x;
	}
	return tmp;
}
function code(x, y, z, t, a, b)
	t_1 = fmin(z, fmax(y, t))
	t_2 = fmax(z, fmax(y, t))
	t_3 = Float64(t_2 * Float64(fmin(y, t) * t_1))
	tmp = 0.0
	if (x <= -2.6e+47)
		tmp = fma(-9.0, t_3, Float64(2.0 * x));
	elseif (x <= 5.6e+102)
		tmp = fma(-9.0, t_3, Float64(27.0 * Float64(a * b)));
	else
		tmp = Float64(fma(Float64(Float64(-t_2) * Float64(9.0 * t_1)), fmin(y, t), x) + x);
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[Min[z, N[Max[y, t], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Max[z, N[Max[y, t], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 * N[(N[Min[y, t], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.6e+47], N[(-9.0 * t$95$3 + N[(2.0 * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 5.6e+102], N[(-9.0 * t$95$3 + N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[((-t$95$2) * N[(9.0 * t$95$1), $MachinePrecision]), $MachinePrecision] * N[Min[y, t], $MachinePrecision] + x), $MachinePrecision] + x), $MachinePrecision]]]]]]
\begin{array}{l}
t_1 := \mathsf{min}\left(z, \mathsf{max}\left(y, t\right)\right)\\
t_2 := \mathsf{max}\left(z, \mathsf{max}\left(y, t\right)\right)\\
t_3 := t\_2 \cdot \left(\mathsf{min}\left(y, t\right) \cdot t\_1\right)\\
\mathbf{if}\;x \leq -2.6 \cdot 10^{+47}:\\
\;\;\;\;\mathsf{fma}\left(-9, t\_3, 2 \cdot x\right)\\

\mathbf{elif}\;x \leq 5.6 \cdot 10^{+102}:\\
\;\;\;\;\mathsf{fma}\left(-9, t\_3, 27 \cdot \left(a \cdot b\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(-t\_2\right) \cdot \left(9 \cdot t\_1\right), \mathsf{min}\left(y, t\right), x\right) + x\\


\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -2.60000000000000003e47

    1. Initial program 94.9%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Step-by-step derivation
      1. lift-+.f64N/A

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

        \[\leadsto \color{blue}{\left(a \cdot 27\right) \cdot b + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)} \]
      3. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(a \cdot 27\right) \cdot b} + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      4. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(a \cdot 27\right)} \cdot b + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      5. associate-*l*N/A

        \[\leadsto \color{blue}{a \cdot \left(27 \cdot b\right)} + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      6. *-commutativeN/A

        \[\leadsto \color{blue}{\left(27 \cdot b\right) \cdot a} + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      7. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(27 \cdot b, a, x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)} \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{b \cdot 27}, a, x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      9. lower-*.f6495.7

        \[\leadsto \mathsf{fma}\left(\color{blue}{b \cdot 27}, a, x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      10. lift--.f64N/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t}\right) \]
      11. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, x \cdot 2 - \color{blue}{\left(\left(y \cdot 9\right) \cdot z\right) \cdot t}\right) \]
      12. fp-cancel-sub-sign-invN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{x \cdot 2 + \left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t}\right) \]
      13. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t + x \cdot 2}\right) \]
      14. add-flipN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t - \left(\mathsf{neg}\left(x \cdot 2\right)\right)}\right) \]
      15. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t - \left(\mathsf{neg}\left(\color{blue}{x \cdot 2}\right)\right)\right) \]
      16. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t - \color{blue}{x \cdot \left(\mathsf{neg}\left(2\right)\right)}\right) \]
      17. fp-cancel-sub-sign-invN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t + \left(\mathsf{neg}\left(x\right)\right) \cdot \left(\mathsf{neg}\left(2\right)\right)}\right) \]
    3. Applied rewrites95.7%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\left(z \cdot t\right) \cdot -9, y, \mathsf{fma}\left(a \cdot b, 27, x\right)\right) + x} \]
    5. Step-by-step derivation
      1. lift-fma.f64N/A

        \[\leadsto \color{blue}{\left(\left(\left(z \cdot t\right) \cdot -9\right) \cdot y + \mathsf{fma}\left(a \cdot b, 27, x\right)\right)} + x \]
      2. add-flipN/A

        \[\leadsto \color{blue}{\left(\left(\left(z \cdot t\right) \cdot -9\right) \cdot y - \left(\mathsf{neg}\left(\mathsf{fma}\left(a \cdot b, 27, x\right)\right)\right)\right)} + x \]
      3. sub-flipN/A

        \[\leadsto \color{blue}{\left(\left(\left(z \cdot t\right) \cdot -9\right) \cdot y + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\mathsf{fma}\left(a \cdot b, 27, x\right)\right)\right)\right)\right)\right)} + x \]
      4. *-commutativeN/A

        \[\leadsto \left(\color{blue}{y \cdot \left(\left(z \cdot t\right) \cdot -9\right)} + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\mathsf{fma}\left(a \cdot b, 27, x\right)\right)\right)\right)\right)\right) + x \]
      5. lift-*.f64N/A

        \[\leadsto \left(y \cdot \color{blue}{\left(\left(z \cdot t\right) \cdot -9\right)} + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\mathsf{fma}\left(a \cdot b, 27, x\right)\right)\right)\right)\right)\right) + x \]
      6. lift-*.f64N/A

        \[\leadsto \left(y \cdot \left(\color{blue}{\left(z \cdot t\right)} \cdot -9\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\mathsf{fma}\left(a \cdot b, 27, x\right)\right)\right)\right)\right)\right) + x \]
      7. associate-*l*N/A

        \[\leadsto \left(y \cdot \color{blue}{\left(z \cdot \left(t \cdot -9\right)\right)} + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\mathsf{fma}\left(a \cdot b, 27, x\right)\right)\right)\right)\right)\right) + x \]
      8. associate-*l*N/A

        \[\leadsto \left(\color{blue}{\left(y \cdot z\right) \cdot \left(t \cdot -9\right)} + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\mathsf{fma}\left(a \cdot b, 27, x\right)\right)\right)\right)\right)\right) + x \]
      9. *-commutativeN/A

        \[\leadsto \left(\color{blue}{\left(z \cdot y\right)} \cdot \left(t \cdot -9\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\mathsf{fma}\left(a \cdot b, 27, x\right)\right)\right)\right)\right)\right) + x \]
      10. associate-*l*N/A

        \[\leadsto \left(\color{blue}{z \cdot \left(y \cdot \left(t \cdot -9\right)\right)} + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\mathsf{fma}\left(a \cdot b, 27, x\right)\right)\right)\right)\right)\right) + x \]
      11. lift-fma.f64N/A

        \[\leadsto \left(z \cdot \left(y \cdot \left(t \cdot -9\right)\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\left(\left(a \cdot b\right) \cdot 27 + x\right)}\right)\right)\right)\right)\right) + x \]
      12. add-flipN/A

        \[\leadsto \left(z \cdot \left(y \cdot \left(t \cdot -9\right)\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\left(\left(a \cdot b\right) \cdot 27 - \left(\mathsf{neg}\left(x\right)\right)\right)}\right)\right)\right)\right)\right) + x \]
      13. *-commutativeN/A

        \[\leadsto \left(z \cdot \left(y \cdot \left(t \cdot -9\right)\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left(\color{blue}{27 \cdot \left(a \cdot b\right)} - \left(\mathsf{neg}\left(x\right)\right)\right)\right)\right)\right)\right)\right) + x \]
      14. lift-*.f64N/A

        \[\leadsto \left(z \cdot \left(y \cdot \left(t \cdot -9\right)\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left(\color{blue}{27 \cdot \left(a \cdot b\right)} - \left(\mathsf{neg}\left(x\right)\right)\right)\right)\right)\right)\right)\right) + x \]
      15. sub-negateN/A

        \[\leadsto \left(z \cdot \left(y \cdot \left(t \cdot -9\right)\right) + \left(\mathsf{neg}\left(\color{blue}{\left(\left(\mathsf{neg}\left(x\right)\right) - 27 \cdot \left(a \cdot b\right)\right)}\right)\right)\right) + x \]
      16. sub-negate-revN/A

        \[\leadsto \left(z \cdot \left(y \cdot \left(t \cdot -9\right)\right) + \color{blue}{\left(27 \cdot \left(a \cdot b\right) - \left(\mathsf{neg}\left(x\right)\right)\right)}\right) + x \]
      17. lift-*.f64N/A

        \[\leadsto \left(z \cdot \left(y \cdot \left(t \cdot -9\right)\right) + \left(\color{blue}{27 \cdot \left(a \cdot b\right)} - \left(\mathsf{neg}\left(x\right)\right)\right)\right) + x \]
      18. *-commutativeN/A

        \[\leadsto \left(z \cdot \left(y \cdot \left(t \cdot -9\right)\right) + \left(\color{blue}{\left(a \cdot b\right) \cdot 27} - \left(\mathsf{neg}\left(x\right)\right)\right)\right) + x \]
      19. add-flipN/A

        \[\leadsto \left(z \cdot \left(y \cdot \left(t \cdot -9\right)\right) + \color{blue}{\left(\left(a \cdot b\right) \cdot 27 + x\right)}\right) + x \]
      20. lift-fma.f64N/A

        \[\leadsto \left(z \cdot \left(y \cdot \left(t \cdot -9\right)\right) + \color{blue}{\mathsf{fma}\left(a \cdot b, 27, x\right)}\right) + x \]
      21. lower-fma.f64N/A

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(-9, t \cdot \left(y \cdot z\right), 2 \cdot x\right) \]
    9. Applied rewrites64.1%

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

    if -2.60000000000000003e47 < x < 5.60000000000000037e102

    1. Initial program 94.9%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Step-by-step derivation
      1. lift-+.f64N/A

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

        \[\leadsto \color{blue}{\left(a \cdot 27\right) \cdot b + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)} \]
      3. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(a \cdot 27\right) \cdot b} + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      4. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(a \cdot 27\right)} \cdot b + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      5. associate-*l*N/A

        \[\leadsto \color{blue}{a \cdot \left(27 \cdot b\right)} + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      6. *-commutativeN/A

        \[\leadsto \color{blue}{\left(27 \cdot b\right) \cdot a} + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      7. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(27 \cdot b, a, x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)} \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{b \cdot 27}, a, x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      9. lower-*.f6495.7

        \[\leadsto \mathsf{fma}\left(\color{blue}{b \cdot 27}, a, x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      10. lift--.f64N/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t}\right) \]
      11. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, x \cdot 2 - \color{blue}{\left(\left(y \cdot 9\right) \cdot z\right) \cdot t}\right) \]
      12. fp-cancel-sub-sign-invN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{x \cdot 2 + \left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t}\right) \]
      13. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t + x \cdot 2}\right) \]
      14. add-flipN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t - \left(\mathsf{neg}\left(x \cdot 2\right)\right)}\right) \]
      15. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t - \left(\mathsf{neg}\left(\color{blue}{x \cdot 2}\right)\right)\right) \]
      16. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t - \color{blue}{x \cdot \left(\mathsf{neg}\left(2\right)\right)}\right) \]
      17. fp-cancel-sub-sign-invN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t + \left(\mathsf{neg}\left(x\right)\right) \cdot \left(\mathsf{neg}\left(2\right)\right)}\right) \]
    3. Applied rewrites95.7%

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

      \[\leadsto \color{blue}{-9 \cdot \left(t \cdot \left(y \cdot z\right)\right) + 27 \cdot \left(a \cdot b\right)} \]
    5. Step-by-step derivation
      1. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(-9, \color{blue}{t \cdot \left(y \cdot z\right)}, 27 \cdot \left(a \cdot b\right)\right) \]
      2. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(-9, t \cdot \color{blue}{\left(y \cdot z\right)}, 27 \cdot \left(a \cdot b\right)\right) \]
      3. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(-9, t \cdot \left(y \cdot \color{blue}{z}\right), 27 \cdot \left(a \cdot b\right)\right) \]
      4. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(-9, t \cdot \left(y \cdot z\right), 27 \cdot \left(a \cdot b\right)\right) \]
      5. lower-*.f6465.9

        \[\leadsto \mathsf{fma}\left(-9, t \cdot \left(y \cdot z\right), 27 \cdot \left(a \cdot b\right)\right) \]
    6. Applied rewrites65.9%

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

    if 5.60000000000000037e102 < x

    1. Initial program 94.9%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Step-by-step derivation
      1. lift-+.f64N/A

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

        \[\leadsto \color{blue}{\left(a \cdot 27\right) \cdot b + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)} \]
      3. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(a \cdot 27\right) \cdot b} + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      4. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(a \cdot 27\right)} \cdot b + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      5. associate-*l*N/A

        \[\leadsto \color{blue}{a \cdot \left(27 \cdot b\right)} + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      6. *-commutativeN/A

        \[\leadsto \color{blue}{\left(27 \cdot b\right) \cdot a} + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      7. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(27 \cdot b, a, x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)} \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{b \cdot 27}, a, x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      9. lower-*.f6495.7

        \[\leadsto \mathsf{fma}\left(\color{blue}{b \cdot 27}, a, x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      10. lift--.f64N/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t}\right) \]
      11. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, x \cdot 2 - \color{blue}{\left(\left(y \cdot 9\right) \cdot z\right) \cdot t}\right) \]
      12. fp-cancel-sub-sign-invN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{x \cdot 2 + \left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t}\right) \]
      13. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t + x \cdot 2}\right) \]
      14. add-flipN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t - \left(\mathsf{neg}\left(x \cdot 2\right)\right)}\right) \]
      15. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t - \left(\mathsf{neg}\left(\color{blue}{x \cdot 2}\right)\right)\right) \]
      16. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t - \color{blue}{x \cdot \left(\mathsf{neg}\left(2\right)\right)}\right) \]
      17. fp-cancel-sub-sign-invN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t + \left(\mathsf{neg}\left(x\right)\right) \cdot \left(\mathsf{neg}\left(2\right)\right)}\right) \]
    3. Applied rewrites95.7%

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

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

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

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

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

        \[\leadsto \left(x + -9 \cdot \left(t \cdot \color{blue}{\left(y \cdot z\right)}\right)\right) + x \]
      4. lower-*.f6464.1

        \[\leadsto \left(x + -9 \cdot \left(t \cdot \left(y \cdot \color{blue}{z}\right)\right)\right) + x \]
    7. Applied rewrites64.1%

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

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

        \[\leadsto \left(-9 \cdot \left(t \cdot \left(y \cdot z\right)\right) + \color{blue}{x}\right) + x \]
      3. add-flipN/A

        \[\leadsto \left(-9 \cdot \left(t \cdot \left(y \cdot z\right)\right) - \color{blue}{\left(\mathsf{neg}\left(x\right)\right)}\right) + x \]
      4. lift-*.f64N/A

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

        \[\leadsto \left(\left(t \cdot \left(y \cdot z\right)\right) \cdot -9 - \left(\mathsf{neg}\left(\color{blue}{x}\right)\right)\right) + x \]
      6. lift-*.f64N/A

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

        \[\leadsto \left(\left(\left(y \cdot z\right) \cdot t\right) \cdot -9 - \left(\mathsf{neg}\left(x\right)\right)\right) + x \]
      8. lift-*.f64N/A

        \[\leadsto \left(\left(\left(y \cdot z\right) \cdot t\right) \cdot -9 - \left(\mathsf{neg}\left(x\right)\right)\right) + x \]
      9. associate-*l*N/A

        \[\leadsto \left(\left(y \cdot \left(z \cdot t\right)\right) \cdot -9 - \left(\mathsf{neg}\left(x\right)\right)\right) + x \]
      10. associate-*r*N/A

        \[\leadsto \left(y \cdot \left(\left(z \cdot t\right) \cdot -9\right) - \left(\mathsf{neg}\left(\color{blue}{x}\right)\right)\right) + x \]
      11. *-commutativeN/A

        \[\leadsto \left(\left(\left(z \cdot t\right) \cdot -9\right) \cdot y - \left(\mathsf{neg}\left(\color{blue}{x}\right)\right)\right) + x \]
      12. sub-flipN/A

        \[\leadsto \left(\left(\left(z \cdot t\right) \cdot -9\right) \cdot y + \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right)}\right) + x \]
      13. associate-*l*N/A

        \[\leadsto \left(\left(z \cdot t\right) \cdot \left(-9 \cdot y\right) + \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(x\right)\right)}\right)\right)\right) + x \]
      14. *-commutativeN/A

        \[\leadsto \left(\left(z \cdot t\right) \cdot \left(y \cdot -9\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right)\right) + x \]
      15. metadata-evalN/A

        \[\leadsto \left(\left(z \cdot t\right) \cdot \left(y \cdot \left(\mathsf{neg}\left(9\right)\right)\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right)\right) + x \]
      16. distribute-rgt-neg-outN/A

        \[\leadsto \left(\left(z \cdot t\right) \cdot \left(\mathsf{neg}\left(y \cdot 9\right)\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right)\right) + x \]
      17. distribute-rgt-neg-inN/A

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

        \[\leadsto \left(\left(\mathsf{neg}\left(z \cdot t\right)\right) \cdot \left(y \cdot 9\right) + \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(x\right)\right)}\right)\right)\right) + x \]
      19. *-commutativeN/A

        \[\leadsto \left(\left(\mathsf{neg}\left(t \cdot z\right)\right) \cdot \left(y \cdot 9\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right)\right) + x \]
      20. distribute-lft-neg-inN/A

        \[\leadsto \left(\left(\left(\mathsf{neg}\left(t\right)\right) \cdot z\right) \cdot \left(y \cdot 9\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{x}\right)\right)\right)\right)\right) + x \]
      21. associate-*r*N/A

        \[\leadsto \left(\left(\mathsf{neg}\left(t\right)\right) \cdot \left(z \cdot \left(y \cdot 9\right)\right) + \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(x\right)\right)}\right)\right)\right) + x \]
      22. *-commutativeN/A

        \[\leadsto \left(\left(\mathsf{neg}\left(t\right)\right) \cdot \left(\left(y \cdot 9\right) \cdot z\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right)\right) + x \]
      23. associate-*l*N/A

        \[\leadsto \left(\left(\mathsf{neg}\left(t\right)\right) \cdot \left(y \cdot \left(9 \cdot z\right)\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right)\right) + x \]
      24. *-commutativeN/A

        \[\leadsto \left(\left(\mathsf{neg}\left(t\right)\right) \cdot \left(\left(9 \cdot z\right) \cdot y\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right)\right) + x \]
      25. associate-*r*N/A

        \[\leadsto \left(\left(\left(\mathsf{neg}\left(t\right)\right) \cdot \left(9 \cdot z\right)\right) \cdot y + \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(x\right)\right)}\right)\right)\right) + x \]
      26. remove-double-negN/A

        \[\leadsto \left(\left(\left(\mathsf{neg}\left(t\right)\right) \cdot \left(9 \cdot z\right)\right) \cdot y + x\right) + x \]
    9. Applied rewrites63.9%

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

Alternative 8: 80.6% accurate, 0.4× speedup?

\[\begin{array}{l} t_1 := \mathsf{min}\left(a, b\right) \cdot 27\\ t_2 := t\_1 \cdot \mathsf{max}\left(a, b\right)\\ \mathbf{if}\;t\_2 \leq -1 \cdot 10^{+16}:\\ \;\;\;\;\mathsf{fma}\left(t\_1, \mathsf{max}\left(a, b\right), x + x\right)\\ \mathbf{elif}\;t\_2 \leq 10^{+91}:\\ \;\;\;\;\mathsf{fma}\left(\left(-9 \cdot \mathsf{min}\left(y, z\right)\right) \cdot \mathsf{min}\left(\mathsf{max}\left(y, z\right), t\right), \mathsf{max}\left(\mathsf{max}\left(y, z\right), t\right), x\right) + x\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{min}\left(a, b\right) \cdot \mathsf{max}\left(a, b\right), 27, x + x\right)\\ \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (* (fmin a b) 27.0)) (t_2 (* t_1 (fmax a b))))
   (if (<= t_2 -1e+16)
     (fma t_1 (fmax a b) (+ x x))
     (if (<= t_2 1e+91)
       (+
        (fma (* (* -9.0 (fmin y z)) (fmin (fmax y z) t)) (fmax (fmax y z) t) x)
        x)
       (fma (* (fmin a b) (fmax a b)) 27.0 (+ x x))))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = fmin(a, b) * 27.0;
	double t_2 = t_1 * fmax(a, b);
	double tmp;
	if (t_2 <= -1e+16) {
		tmp = fma(t_1, fmax(a, b), (x + x));
	} else if (t_2 <= 1e+91) {
		tmp = fma(((-9.0 * fmin(y, z)) * fmin(fmax(y, z), t)), fmax(fmax(y, z), t), x) + x;
	} else {
		tmp = fma((fmin(a, b) * fmax(a, b)), 27.0, (x + x));
	}
	return tmp;
}
function code(x, y, z, t, a, b)
	t_1 = Float64(fmin(a, b) * 27.0)
	t_2 = Float64(t_1 * fmax(a, b))
	tmp = 0.0
	if (t_2 <= -1e+16)
		tmp = fma(t_1, fmax(a, b), Float64(x + x));
	elseif (t_2 <= 1e+91)
		tmp = Float64(fma(Float64(Float64(-9.0 * fmin(y, z)) * fmin(fmax(y, z), t)), fmax(fmax(y, z), t), x) + x);
	else
		tmp = fma(Float64(fmin(a, b) * fmax(a, b)), 27.0, Float64(x + x));
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[Min[a, b], $MachinePrecision] * 27.0), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * N[Max[a, b], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1e+16], N[(t$95$1 * N[Max[a, b], $MachinePrecision] + N[(x + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1e+91], N[(N[(N[(N[(-9.0 * N[Min[y, z], $MachinePrecision]), $MachinePrecision] * N[Min[N[Max[y, z], $MachinePrecision], t], $MachinePrecision]), $MachinePrecision] * N[Max[N[Max[y, z], $MachinePrecision], t], $MachinePrecision] + x), $MachinePrecision] + x), $MachinePrecision], N[(N[(N[Min[a, b], $MachinePrecision] * N[Max[a, b], $MachinePrecision]), $MachinePrecision] * 27.0 + N[(x + x), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
t_1 := \mathsf{min}\left(a, b\right) \cdot 27\\
t_2 := t\_1 \cdot \mathsf{max}\left(a, b\right)\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{+16}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, \mathsf{max}\left(a, b\right), x + x\right)\\

\mathbf{elif}\;t\_2 \leq 10^{+91}:\\
\;\;\;\;\mathsf{fma}\left(\left(-9 \cdot \mathsf{min}\left(y, z\right)\right) \cdot \mathsf{min}\left(\mathsf{max}\left(y, z\right), t\right), \mathsf{max}\left(\mathsf{max}\left(y, z\right), t\right), x\right) + x\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{min}\left(a, b\right) \cdot \mathsf{max}\left(a, b\right), 27, x + x\right)\\


\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (*.f64 a #s(literal 27 binary64)) b) < -1e16

    1. Initial program 94.9%

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

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

        \[\leadsto \mathsf{fma}\left(2, \color{blue}{x}, 27 \cdot \left(a \cdot b\right)\right) \]
      2. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(2, x, 27 \cdot \left(a \cdot b\right)\right) \]
      3. lower-*.f6465.0

        \[\leadsto \mathsf{fma}\left(2, x, 27 \cdot \left(a \cdot b\right)\right) \]
    4. Applied rewrites65.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(2, x, 27 \cdot \left(a \cdot b\right)\right)} \]
    5. Step-by-step derivation
      1. lift-fma.f64N/A

        \[\leadsto 2 \cdot x + \color{blue}{27 \cdot \left(a \cdot b\right)} \]
      2. count-2-revN/A

        \[\leadsto \left(x + x\right) + \color{blue}{27} \cdot \left(a \cdot b\right) \]
      3. lift-+.f64N/A

        \[\leadsto \left(x + x\right) + \color{blue}{27} \cdot \left(a \cdot b\right) \]
      4. +-commutativeN/A

        \[\leadsto 27 \cdot \left(a \cdot b\right) + \color{blue}{\left(x + x\right)} \]
      5. lift-*.f64N/A

        \[\leadsto 27 \cdot \left(a \cdot b\right) + \left(\color{blue}{x} + x\right) \]
      6. lift-*.f64N/A

        \[\leadsto 27 \cdot \left(a \cdot b\right) + \left(x + x\right) \]
      7. *-commutativeN/A

        \[\leadsto 27 \cdot \left(b \cdot a\right) + \left(x + x\right) \]
      8. lift-*.f64N/A

        \[\leadsto 27 \cdot \left(b \cdot a\right) + \left(x + x\right) \]
      9. *-commutativeN/A

        \[\leadsto \left(b \cdot a\right) \cdot 27 + \left(\color{blue}{x} + x\right) \]
      10. lift-*.f64N/A

        \[\leadsto \left(b \cdot a\right) \cdot 27 + \left(x + x\right) \]
      11. associate-*l*N/A

        \[\leadsto b \cdot \left(a \cdot 27\right) + \left(\color{blue}{x} + x\right) \]
      12. lift-*.f64N/A

        \[\leadsto b \cdot \left(a \cdot 27\right) + \left(x + x\right) \]
      13. *-commutativeN/A

        \[\leadsto \left(a \cdot 27\right) \cdot b + \left(\color{blue}{x} + x\right) \]
      14. lower-fma.f6464.9

        \[\leadsto \mathsf{fma}\left(a \cdot 27, \color{blue}{b}, x + x\right) \]
    6. Applied rewrites64.9%

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

    if -1e16 < (*.f64 (*.f64 a #s(literal 27 binary64)) b) < 1.00000000000000008e91

    1. Initial program 94.9%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Step-by-step derivation
      1. lift-+.f64N/A

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

        \[\leadsto \color{blue}{\left(a \cdot 27\right) \cdot b + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)} \]
      3. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(a \cdot 27\right) \cdot b} + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      4. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(a \cdot 27\right)} \cdot b + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      5. associate-*l*N/A

        \[\leadsto \color{blue}{a \cdot \left(27 \cdot b\right)} + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      6. *-commutativeN/A

        \[\leadsto \color{blue}{\left(27 \cdot b\right) \cdot a} + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      7. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(27 \cdot b, a, x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)} \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{b \cdot 27}, a, x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      9. lower-*.f6495.7

        \[\leadsto \mathsf{fma}\left(\color{blue}{b \cdot 27}, a, x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      10. lift--.f64N/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t}\right) \]
      11. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, x \cdot 2 - \color{blue}{\left(\left(y \cdot 9\right) \cdot z\right) \cdot t}\right) \]
      12. fp-cancel-sub-sign-invN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{x \cdot 2 + \left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t}\right) \]
      13. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t + x \cdot 2}\right) \]
      14. add-flipN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t - \left(\mathsf{neg}\left(x \cdot 2\right)\right)}\right) \]
      15. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t - \left(\mathsf{neg}\left(\color{blue}{x \cdot 2}\right)\right)\right) \]
      16. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t - \color{blue}{x \cdot \left(\mathsf{neg}\left(2\right)\right)}\right) \]
      17. fp-cancel-sub-sign-invN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t + \left(\mathsf{neg}\left(x\right)\right) \cdot \left(\mathsf{neg}\left(2\right)\right)}\right) \]
    3. Applied rewrites95.7%

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

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

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

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

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

        \[\leadsto \left(x + -9 \cdot \left(t \cdot \color{blue}{\left(y \cdot z\right)}\right)\right) + x \]
      4. lower-*.f6464.1

        \[\leadsto \left(x + -9 \cdot \left(t \cdot \left(y \cdot \color{blue}{z}\right)\right)\right) + x \]
    7. Applied rewrites64.1%

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

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

        \[\leadsto \left(-9 \cdot \left(t \cdot \left(y \cdot z\right)\right) + \color{blue}{x}\right) + x \]
      3. add-flipN/A

        \[\leadsto \left(-9 \cdot \left(t \cdot \left(y \cdot z\right)\right) - \color{blue}{\left(\mathsf{neg}\left(x\right)\right)}\right) + x \]
      4. lift-*.f64N/A

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

        \[\leadsto \left(\left(t \cdot \left(y \cdot z\right)\right) \cdot -9 - \left(\mathsf{neg}\left(\color{blue}{x}\right)\right)\right) + x \]
      6. lift-*.f64N/A

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

        \[\leadsto \left(\left(\left(y \cdot z\right) \cdot t\right) \cdot -9 - \left(\mathsf{neg}\left(x\right)\right)\right) + x \]
      8. lift-*.f64N/A

        \[\leadsto \left(\left(\left(y \cdot z\right) \cdot t\right) \cdot -9 - \left(\mathsf{neg}\left(x\right)\right)\right) + x \]
      9. associate-*l*N/A

        \[\leadsto \left(\left(y \cdot \left(z \cdot t\right)\right) \cdot -9 - \left(\mathsf{neg}\left(x\right)\right)\right) + x \]
      10. associate-*r*N/A

        \[\leadsto \left(y \cdot \left(\left(z \cdot t\right) \cdot -9\right) - \left(\mathsf{neg}\left(\color{blue}{x}\right)\right)\right) + x \]
      11. *-commutativeN/A

        \[\leadsto \left(\left(\left(z \cdot t\right) \cdot -9\right) \cdot y - \left(\mathsf{neg}\left(\color{blue}{x}\right)\right)\right) + x \]
      12. sub-flipN/A

        \[\leadsto \left(\left(\left(z \cdot t\right) \cdot -9\right) \cdot y + \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right)}\right) + x \]
      13. *-commutativeN/A

        \[\leadsto \left(y \cdot \left(\left(z \cdot t\right) \cdot -9\right) + \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(x\right)\right)}\right)\right)\right) + x \]
      14. *-commutativeN/A

        \[\leadsto \left(y \cdot \left(-9 \cdot \left(z \cdot t\right)\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right)\right) + x \]
      15. associate-*l*N/A

        \[\leadsto \left(\left(y \cdot -9\right) \cdot \left(z \cdot t\right) + \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(x\right)\right)}\right)\right)\right) + x \]
      16. lift-*.f64N/A

        \[\leadsto \left(\left(y \cdot -9\right) \cdot \left(z \cdot t\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{x}\right)\right)\right)\right)\right) + x \]
      17. associate-*l*N/A

        \[\leadsto \left(\left(\left(y \cdot -9\right) \cdot z\right) \cdot t + \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(x\right)\right)}\right)\right)\right) + x \]
      18. lift-*.f64N/A

        \[\leadsto \left(\left(\left(y \cdot -9\right) \cdot z\right) \cdot t + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{x}\right)\right)\right)\right)\right) + x \]
      19. remove-double-negN/A

        \[\leadsto \left(\left(\left(y \cdot -9\right) \cdot z\right) \cdot t + x\right) + x \]
      20. lower-fma.f6464.0

        \[\leadsto \mathsf{fma}\left(\left(y \cdot -9\right) \cdot z, \color{blue}{t}, x\right) + x \]
      21. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(y \cdot -9\right) \cdot z, t, x\right) + x \]
      22. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\left(-9 \cdot y\right) \cdot z, t, x\right) + x \]
      23. lower-*.f6464.0

        \[\leadsto \mathsf{fma}\left(\left(-9 \cdot y\right) \cdot z, t, x\right) + x \]
    9. Applied rewrites64.0%

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

    if 1.00000000000000008e91 < (*.f64 (*.f64 a #s(literal 27 binary64)) b)

    1. Initial program 94.9%

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

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

        \[\leadsto \mathsf{fma}\left(2, \color{blue}{x}, 27 \cdot \left(a \cdot b\right)\right) \]
      2. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(2, x, 27 \cdot \left(a \cdot b\right)\right) \]
      3. lower-*.f6465.0

        \[\leadsto \mathsf{fma}\left(2, x, 27 \cdot \left(a \cdot b\right)\right) \]
    4. Applied rewrites65.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(2, x, 27 \cdot \left(a \cdot b\right)\right)} \]
    5. Step-by-step derivation
      1. lift-fma.f64N/A

        \[\leadsto 2 \cdot x + \color{blue}{27 \cdot \left(a \cdot b\right)} \]
      2. count-2-revN/A

        \[\leadsto \left(x + x\right) + \color{blue}{27} \cdot \left(a \cdot b\right) \]
      3. lift-+.f64N/A

        \[\leadsto \left(x + x\right) + \color{blue}{27} \cdot \left(a \cdot b\right) \]
      4. +-commutativeN/A

        \[\leadsto 27 \cdot \left(a \cdot b\right) + \color{blue}{\left(x + x\right)} \]
      5. lift-*.f64N/A

        \[\leadsto 27 \cdot \left(a \cdot b\right) + \left(\color{blue}{x} + x\right) \]
      6. lift-*.f64N/A

        \[\leadsto 27 \cdot \left(a \cdot b\right) + \left(x + x\right) \]
      7. *-commutativeN/A

        \[\leadsto 27 \cdot \left(b \cdot a\right) + \left(x + x\right) \]
      8. lift-*.f64N/A

        \[\leadsto 27 \cdot \left(b \cdot a\right) + \left(x + x\right) \]
      9. *-commutativeN/A

        \[\leadsto \left(b \cdot a\right) \cdot 27 + \left(\color{blue}{x} + x\right) \]
      10. lift-*.f64N/A

        \[\leadsto \left(b \cdot a\right) \cdot 27 + \left(x + x\right) \]
      11. associate-*l*N/A

        \[\leadsto b \cdot \left(a \cdot 27\right) + \left(\color{blue}{x} + x\right) \]
      12. lift-*.f64N/A

        \[\leadsto b \cdot \left(a \cdot 27\right) + \left(x + x\right) \]
      13. *-commutativeN/A

        \[\leadsto \left(a \cdot 27\right) \cdot b + \left(\color{blue}{x} + x\right) \]
      14. lift-*.f64N/A

        \[\leadsto \left(a \cdot 27\right) \cdot b + \left(x + x\right) \]
      15. associate-*l*N/A

        \[\leadsto a \cdot \left(27 \cdot b\right) + \left(\color{blue}{x} + x\right) \]
      16. *-commutativeN/A

        \[\leadsto a \cdot \left(b \cdot 27\right) + \left(x + x\right) \]
      17. lift-*.f64N/A

        \[\leadsto a \cdot \left(b \cdot 27\right) + \left(x + x\right) \]
      18. *-commutativeN/A

        \[\leadsto \left(b \cdot 27\right) \cdot a + \left(\color{blue}{x} + x\right) \]
      19. lower-fma.f6464.9

        \[\leadsto \mathsf{fma}\left(b \cdot 27, \color{blue}{a}, x + x\right) \]
      20. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, x + x\right) \]
      21. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(27 \cdot b, a, x + x\right) \]
      22. lower-*.f6464.9

        \[\leadsto \mathsf{fma}\left(27 \cdot b, a, x + x\right) \]
    6. Applied rewrites64.9%

      \[\leadsto \mathsf{fma}\left(27 \cdot b, \color{blue}{a}, x + x\right) \]
    7. Step-by-step derivation
      1. lift-fma.f64N/A

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

        \[\leadsto \left(27 \cdot b\right) \cdot a + \left(x + x\right) \]
      3. associate-*l*N/A

        \[\leadsto 27 \cdot \left(b \cdot a\right) + \left(\color{blue}{x} + x\right) \]
      4. lift-*.f64N/A

        \[\leadsto 27 \cdot \left(b \cdot a\right) + \left(x + x\right) \]
      5. lift-*.f64N/A

        \[\leadsto 27 \cdot \left(b \cdot a\right) + \left(\color{blue}{x} + x\right) \]
      6. lift-+.f64N/A

        \[\leadsto 27 \cdot \left(b \cdot a\right) + \left(x + \color{blue}{x}\right) \]
      7. count-2-revN/A

        \[\leadsto 27 \cdot \left(b \cdot a\right) + 2 \cdot \color{blue}{x} \]
      8. *-commutativeN/A

        \[\leadsto 27 \cdot \left(b \cdot a\right) + x \cdot \color{blue}{2} \]
      9. fp-cancel-sign-sub-invN/A

        \[\leadsto 27 \cdot \left(b \cdot a\right) - \color{blue}{\left(\mathsf{neg}\left(x\right)\right) \cdot 2} \]
      10. distribute-lft-neg-inN/A

        \[\leadsto 27 \cdot \left(b \cdot a\right) - \left(\mathsf{neg}\left(x \cdot 2\right)\right) \]
      11. distribute-rgt-neg-inN/A

        \[\leadsto 27 \cdot \left(b \cdot a\right) - x \cdot \color{blue}{\left(\mathsf{neg}\left(2\right)\right)} \]
      12. fp-cancel-sub-sign-invN/A

        \[\leadsto 27 \cdot \left(b \cdot a\right) + \color{blue}{\left(\mathsf{neg}\left(x\right)\right) \cdot \left(\mathsf{neg}\left(2\right)\right)} \]
      13. lift-*.f64N/A

        \[\leadsto 27 \cdot \left(b \cdot a\right) + \color{blue}{\left(\mathsf{neg}\left(x\right)\right)} \cdot \left(\mathsf{neg}\left(2\right)\right) \]
      14. *-commutativeN/A

        \[\leadsto \left(b \cdot a\right) \cdot 27 + \color{blue}{\left(\mathsf{neg}\left(x\right)\right)} \cdot \left(\mathsf{neg}\left(2\right)\right) \]
      15. distribute-rgt-neg-inN/A

        \[\leadsto \left(b \cdot a\right) \cdot 27 + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right) \cdot 2\right)\right) \]
      16. distribute-lft-neg-inN/A

        \[\leadsto \left(b \cdot a\right) \cdot 27 + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x \cdot 2\right)\right)\right)\right) \]
      17. remove-double-negN/A

        \[\leadsto \left(b \cdot a\right) \cdot 27 + x \cdot \color{blue}{2} \]
      18. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(b \cdot a, \color{blue}{27}, x \cdot 2\right) \]
      19. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b \cdot a, 27, x \cdot 2\right) \]
      20. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(a \cdot b, 27, x \cdot 2\right) \]
      21. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(a \cdot b, 27, x \cdot 2\right) \]
      22. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(a \cdot b, 27, 2 \cdot x\right) \]
      23. count-2-revN/A

        \[\leadsto \mathsf{fma}\left(a \cdot b, 27, x + x\right) \]
      24. lift-+.f6465.0

        \[\leadsto \mathsf{fma}\left(a \cdot b, 27, x + x\right) \]
    8. Applied rewrites65.0%

      \[\leadsto \mathsf{fma}\left(a \cdot b, \color{blue}{27}, x + x\right) \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 9: 80.0% accurate, 0.3× speedup?

\[\begin{array}{l} t_1 := \mathsf{max}\left(\mathsf{min}\left(y, z\right), t\right)\\ t_2 := \mathsf{min}\left(\mathsf{max}\left(y, z\right), t\_1\right)\\ t_3 := \mathsf{fma}\left(\mathsf{max}\left(\mathsf{max}\left(y, z\right), t\_1\right) \cdot \mathsf{min}\left(\mathsf{min}\left(y, z\right), t\right), -9 \cdot t\_2, x\right) + x\\ \mathbf{if}\;t\_2 \leq -1.25 \cdot 10^{-24}:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;t\_2 \leq 62000000:\\ \;\;\;\;\mathsf{fma}\left(27 \cdot b, a, x + x\right)\\ \mathbf{else}:\\ \;\;\;\;t\_3\\ \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (fmax (fmin y z) t))
        (t_2 (fmin (fmax y z) t_1))
        (t_3
         (+
          (fma (* (fmax (fmax y z) t_1) (fmin (fmin y z) t)) (* -9.0 t_2) x)
          x)))
   (if (<= t_2 -1.25e-24)
     t_3
     (if (<= t_2 62000000.0) (fma (* 27.0 b) a (+ x x)) t_3))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = fmax(fmin(y, z), t);
	double t_2 = fmin(fmax(y, z), t_1);
	double t_3 = fma((fmax(fmax(y, z), t_1) * fmin(fmin(y, z), t)), (-9.0 * t_2), x) + x;
	double tmp;
	if (t_2 <= -1.25e-24) {
		tmp = t_3;
	} else if (t_2 <= 62000000.0) {
		tmp = fma((27.0 * b), a, (x + x));
	} else {
		tmp = t_3;
	}
	return tmp;
}
function code(x, y, z, t, a, b)
	t_1 = fmax(fmin(y, z), t)
	t_2 = fmin(fmax(y, z), t_1)
	t_3 = Float64(fma(Float64(fmax(fmax(y, z), t_1) * fmin(fmin(y, z), t)), Float64(-9.0 * t_2), x) + x)
	tmp = 0.0
	if (t_2 <= -1.25e-24)
		tmp = t_3;
	elseif (t_2 <= 62000000.0)
		tmp = fma(Float64(27.0 * b), a, Float64(x + x));
	else
		tmp = t_3;
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[Max[N[Min[y, z], $MachinePrecision], t], $MachinePrecision]}, Block[{t$95$2 = N[Min[N[Max[y, z], $MachinePrecision], t$95$1], $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(N[Max[N[Max[y, z], $MachinePrecision], t$95$1], $MachinePrecision] * N[Min[N[Min[y, z], $MachinePrecision], t], $MachinePrecision]), $MachinePrecision] * N[(-9.0 * t$95$2), $MachinePrecision] + x), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[t$95$2, -1.25e-24], t$95$3, If[LessEqual[t$95$2, 62000000.0], N[(N[(27.0 * b), $MachinePrecision] * a + N[(x + x), $MachinePrecision]), $MachinePrecision], t$95$3]]]]]
\begin{array}{l}
t_1 := \mathsf{max}\left(\mathsf{min}\left(y, z\right), t\right)\\
t_2 := \mathsf{min}\left(\mathsf{max}\left(y, z\right), t\_1\right)\\
t_3 := \mathsf{fma}\left(\mathsf{max}\left(\mathsf{max}\left(y, z\right), t\_1\right) \cdot \mathsf{min}\left(\mathsf{min}\left(y, z\right), t\right), -9 \cdot t\_2, x\right) + x\\
\mathbf{if}\;t\_2 \leq -1.25 \cdot 10^{-24}:\\
\;\;\;\;t\_3\\

\mathbf{elif}\;t\_2 \leq 62000000:\\
\;\;\;\;\mathsf{fma}\left(27 \cdot b, a, x + x\right)\\

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


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.24999999999999995e-24 or 6.2e7 < z

    1. Initial program 94.9%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Step-by-step derivation
      1. lift-+.f64N/A

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

        \[\leadsto \color{blue}{\left(a \cdot 27\right) \cdot b + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)} \]
      3. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(a \cdot 27\right) \cdot b} + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      4. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(a \cdot 27\right)} \cdot b + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      5. associate-*l*N/A

        \[\leadsto \color{blue}{a \cdot \left(27 \cdot b\right)} + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      6. *-commutativeN/A

        \[\leadsto \color{blue}{\left(27 \cdot b\right) \cdot a} + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      7. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(27 \cdot b, a, x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)} \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{b \cdot 27}, a, x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      9. lower-*.f6495.7

        \[\leadsto \mathsf{fma}\left(\color{blue}{b \cdot 27}, a, x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      10. lift--.f64N/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t}\right) \]
      11. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, x \cdot 2 - \color{blue}{\left(\left(y \cdot 9\right) \cdot z\right) \cdot t}\right) \]
      12. fp-cancel-sub-sign-invN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{x \cdot 2 + \left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t}\right) \]
      13. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t + x \cdot 2}\right) \]
      14. add-flipN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t - \left(\mathsf{neg}\left(x \cdot 2\right)\right)}\right) \]
      15. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t - \left(\mathsf{neg}\left(\color{blue}{x \cdot 2}\right)\right)\right) \]
      16. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t - \color{blue}{x \cdot \left(\mathsf{neg}\left(2\right)\right)}\right) \]
      17. fp-cancel-sub-sign-invN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t + \left(\mathsf{neg}\left(x\right)\right) \cdot \left(\mathsf{neg}\left(2\right)\right)}\right) \]
    3. Applied rewrites95.7%

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

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

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

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

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

        \[\leadsto \left(x + -9 \cdot \left(t \cdot \color{blue}{\left(y \cdot z\right)}\right)\right) + x \]
      4. lower-*.f6464.1

        \[\leadsto \left(x + -9 \cdot \left(t \cdot \left(y \cdot \color{blue}{z}\right)\right)\right) + x \]
    7. Applied rewrites64.1%

      \[\leadsto \color{blue}{\left(x + -9 \cdot \left(t \cdot \left(y \cdot z\right)\right)\right)} + x \]
    8. Step-by-step derivation
      1. Applied rewrites63.8%

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

      if -1.24999999999999995e-24 < z < 6.2e7

      1. Initial program 94.9%

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

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

          \[\leadsto \mathsf{fma}\left(2, \color{blue}{x}, 27 \cdot \left(a \cdot b\right)\right) \]
        2. lower-*.f64N/A

          \[\leadsto \mathsf{fma}\left(2, x, 27 \cdot \left(a \cdot b\right)\right) \]
        3. lower-*.f6465.0

          \[\leadsto \mathsf{fma}\left(2, x, 27 \cdot \left(a \cdot b\right)\right) \]
      4. Applied rewrites65.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(2, x, 27 \cdot \left(a \cdot b\right)\right)} \]
      5. Step-by-step derivation
        1. lift-fma.f64N/A

          \[\leadsto 2 \cdot x + \color{blue}{27 \cdot \left(a \cdot b\right)} \]
        2. count-2-revN/A

          \[\leadsto \left(x + x\right) + \color{blue}{27} \cdot \left(a \cdot b\right) \]
        3. lift-+.f64N/A

          \[\leadsto \left(x + x\right) + \color{blue}{27} \cdot \left(a \cdot b\right) \]
        4. +-commutativeN/A

          \[\leadsto 27 \cdot \left(a \cdot b\right) + \color{blue}{\left(x + x\right)} \]
        5. lift-*.f64N/A

          \[\leadsto 27 \cdot \left(a \cdot b\right) + \left(\color{blue}{x} + x\right) \]
        6. lift-*.f64N/A

          \[\leadsto 27 \cdot \left(a \cdot b\right) + \left(x + x\right) \]
        7. *-commutativeN/A

          \[\leadsto 27 \cdot \left(b \cdot a\right) + \left(x + x\right) \]
        8. lift-*.f64N/A

          \[\leadsto 27 \cdot \left(b \cdot a\right) + \left(x + x\right) \]
        9. *-commutativeN/A

          \[\leadsto \left(b \cdot a\right) \cdot 27 + \left(\color{blue}{x} + x\right) \]
        10. lift-*.f64N/A

          \[\leadsto \left(b \cdot a\right) \cdot 27 + \left(x + x\right) \]
        11. associate-*l*N/A

          \[\leadsto b \cdot \left(a \cdot 27\right) + \left(\color{blue}{x} + x\right) \]
        12. lift-*.f64N/A

          \[\leadsto b \cdot \left(a \cdot 27\right) + \left(x + x\right) \]
        13. *-commutativeN/A

          \[\leadsto \left(a \cdot 27\right) \cdot b + \left(\color{blue}{x} + x\right) \]
        14. lift-*.f64N/A

          \[\leadsto \left(a \cdot 27\right) \cdot b + \left(x + x\right) \]
        15. associate-*l*N/A

          \[\leadsto a \cdot \left(27 \cdot b\right) + \left(\color{blue}{x} + x\right) \]
        16. *-commutativeN/A

          \[\leadsto a \cdot \left(b \cdot 27\right) + \left(x + x\right) \]
        17. lift-*.f64N/A

          \[\leadsto a \cdot \left(b \cdot 27\right) + \left(x + x\right) \]
        18. *-commutativeN/A

          \[\leadsto \left(b \cdot 27\right) \cdot a + \left(\color{blue}{x} + x\right) \]
        19. lower-fma.f6464.9

          \[\leadsto \mathsf{fma}\left(b \cdot 27, \color{blue}{a}, x + x\right) \]
        20. lift-*.f64N/A

          \[\leadsto \mathsf{fma}\left(b \cdot 27, a, x + x\right) \]
        21. *-commutativeN/A

          \[\leadsto \mathsf{fma}\left(27 \cdot b, a, x + x\right) \]
        22. lower-*.f6464.9

          \[\leadsto \mathsf{fma}\left(27 \cdot b, a, x + x\right) \]
      6. Applied rewrites64.9%

        \[\leadsto \mathsf{fma}\left(27 \cdot b, \color{blue}{a}, x + x\right) \]
    9. Recombined 2 regimes into one program.
    10. Add Preprocessing

    Alternative 10: 79.8% accurate, 0.3× speedup?

    \[\begin{array}{l} t_1 := \mathsf{max}\left(z, \mathsf{max}\left(y, t\right)\right)\\ t_2 := \mathsf{min}\left(z, \mathsf{max}\left(y, t\right)\right)\\ t_3 := -9 \cdot \left(t\_1 \cdot \left(\mathsf{min}\left(y, t\right) \cdot t\_2\right)\right) + x\\ t_4 := \left(\left(\mathsf{min}\left(y, t\right) \cdot 9\right) \cdot t\_2\right) \cdot t\_1\\ \mathbf{if}\;t\_4 \leq -5 \cdot 10^{+97}:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;t\_4 \leq 10^{+225}:\\ \;\;\;\;\mathsf{fma}\left(a \cdot b, 27, x + x\right)\\ \mathbf{else}:\\ \;\;\;\;t\_3\\ \end{array} \]
    (FPCore (x y z t a b)
     :precision binary64
     (let* ((t_1 (fmax z (fmax y t)))
            (t_2 (fmin z (fmax y t)))
            (t_3 (+ (* -9.0 (* t_1 (* (fmin y t) t_2))) x))
            (t_4 (* (* (* (fmin y t) 9.0) t_2) t_1)))
       (if (<= t_4 -5e+97)
         t_3
         (if (<= t_4 1e+225) (fma (* a b) 27.0 (+ x x)) t_3))))
    double code(double x, double y, double z, double t, double a, double b) {
    	double t_1 = fmax(z, fmax(y, t));
    	double t_2 = fmin(z, fmax(y, t));
    	double t_3 = (-9.0 * (t_1 * (fmin(y, t) * t_2))) + x;
    	double t_4 = ((fmin(y, t) * 9.0) * t_2) * t_1;
    	double tmp;
    	if (t_4 <= -5e+97) {
    		tmp = t_3;
    	} else if (t_4 <= 1e+225) {
    		tmp = fma((a * b), 27.0, (x + x));
    	} else {
    		tmp = t_3;
    	}
    	return tmp;
    }
    
    function code(x, y, z, t, a, b)
    	t_1 = fmax(z, fmax(y, t))
    	t_2 = fmin(z, fmax(y, t))
    	t_3 = Float64(Float64(-9.0 * Float64(t_1 * Float64(fmin(y, t) * t_2))) + x)
    	t_4 = Float64(Float64(Float64(fmin(y, t) * 9.0) * t_2) * t_1)
    	tmp = 0.0
    	if (t_4 <= -5e+97)
    		tmp = t_3;
    	elseif (t_4 <= 1e+225)
    		tmp = fma(Float64(a * b), 27.0, Float64(x + x));
    	else
    		tmp = t_3;
    	end
    	return tmp
    end
    
    code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[Max[z, N[Max[y, t], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Min[z, N[Max[y, t], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(N[(-9.0 * N[(t$95$1 * N[(N[Min[y, t], $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, Block[{t$95$4 = N[(N[(N[(N[Min[y, t], $MachinePrecision] * 9.0), $MachinePrecision] * t$95$2), $MachinePrecision] * t$95$1), $MachinePrecision]}, If[LessEqual[t$95$4, -5e+97], t$95$3, If[LessEqual[t$95$4, 1e+225], N[(N[(a * b), $MachinePrecision] * 27.0 + N[(x + x), $MachinePrecision]), $MachinePrecision], t$95$3]]]]]]
    
    \begin{array}{l}
    t_1 := \mathsf{max}\left(z, \mathsf{max}\left(y, t\right)\right)\\
    t_2 := \mathsf{min}\left(z, \mathsf{max}\left(y, t\right)\right)\\
    t_3 := -9 \cdot \left(t\_1 \cdot \left(\mathsf{min}\left(y, t\right) \cdot t\_2\right)\right) + x\\
    t_4 := \left(\left(\mathsf{min}\left(y, t\right) \cdot 9\right) \cdot t\_2\right) \cdot t\_1\\
    \mathbf{if}\;t\_4 \leq -5 \cdot 10^{+97}:\\
    \;\;\;\;t\_3\\
    
    \mathbf{elif}\;t\_4 \leq 10^{+225}:\\
    \;\;\;\;\mathsf{fma}\left(a \cdot b, 27, x + x\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_3\\
    
    
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < -4.99999999999999999e97 or 9.99999999999999928e224 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t)

      1. Initial program 94.9%

        \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      2. Step-by-step derivation
        1. lift-+.f64N/A

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

          \[\leadsto \color{blue}{\left(a \cdot 27\right) \cdot b + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)} \]
        3. lift-*.f64N/A

          \[\leadsto \color{blue}{\left(a \cdot 27\right) \cdot b} + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
        4. lift-*.f64N/A

          \[\leadsto \color{blue}{\left(a \cdot 27\right)} \cdot b + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
        5. associate-*l*N/A

          \[\leadsto \color{blue}{a \cdot \left(27 \cdot b\right)} + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
        6. *-commutativeN/A

          \[\leadsto \color{blue}{\left(27 \cdot b\right) \cdot a} + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
        7. lower-fma.f64N/A

          \[\leadsto \color{blue}{\mathsf{fma}\left(27 \cdot b, a, x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)} \]
        8. *-commutativeN/A

          \[\leadsto \mathsf{fma}\left(\color{blue}{b \cdot 27}, a, x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
        9. lower-*.f6495.7

          \[\leadsto \mathsf{fma}\left(\color{blue}{b \cdot 27}, a, x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
        10. lift--.f64N/A

          \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t}\right) \]
        11. lift-*.f64N/A

          \[\leadsto \mathsf{fma}\left(b \cdot 27, a, x \cdot 2 - \color{blue}{\left(\left(y \cdot 9\right) \cdot z\right) \cdot t}\right) \]
        12. fp-cancel-sub-sign-invN/A

          \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{x \cdot 2 + \left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t}\right) \]
        13. +-commutativeN/A

          \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t + x \cdot 2}\right) \]
        14. add-flipN/A

          \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t - \left(\mathsf{neg}\left(x \cdot 2\right)\right)}\right) \]
        15. lift-*.f64N/A

          \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t - \left(\mathsf{neg}\left(\color{blue}{x \cdot 2}\right)\right)\right) \]
        16. distribute-rgt-neg-inN/A

          \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t - \color{blue}{x \cdot \left(\mathsf{neg}\left(2\right)\right)}\right) \]
        17. fp-cancel-sub-sign-invN/A

          \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t + \left(\mathsf{neg}\left(x\right)\right) \cdot \left(\mathsf{neg}\left(2\right)\right)}\right) \]
      3. Applied rewrites95.7%

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

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

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

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

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

          \[\leadsto \left(x + -9 \cdot \left(t \cdot \color{blue}{\left(y \cdot z\right)}\right)\right) + x \]
        4. lower-*.f6464.1

          \[\leadsto \left(x + -9 \cdot \left(t \cdot \left(y \cdot \color{blue}{z}\right)\right)\right) + x \]
      7. Applied rewrites64.1%

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

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

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

          \[\leadsto -9 \cdot \left(t \cdot \left(y \cdot \color{blue}{z}\right)\right) + x \]
        3. lower-*.f6440.3

          \[\leadsto -9 \cdot \left(t \cdot \left(y \cdot z\right)\right) + x \]
      10. Applied rewrites40.3%

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

      if -4.99999999999999999e97 < (*.f64 (*.f64 (*.f64 y #s(literal 9 binary64)) z) t) < 9.99999999999999928e224

      1. Initial program 94.9%

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

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

          \[\leadsto \mathsf{fma}\left(2, \color{blue}{x}, 27 \cdot \left(a \cdot b\right)\right) \]
        2. lower-*.f64N/A

          \[\leadsto \mathsf{fma}\left(2, x, 27 \cdot \left(a \cdot b\right)\right) \]
        3. lower-*.f6465.0

          \[\leadsto \mathsf{fma}\left(2, x, 27 \cdot \left(a \cdot b\right)\right) \]
      4. Applied rewrites65.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(2, x, 27 \cdot \left(a \cdot b\right)\right)} \]
      5. Step-by-step derivation
        1. lift-fma.f64N/A

          \[\leadsto 2 \cdot x + \color{blue}{27 \cdot \left(a \cdot b\right)} \]
        2. count-2-revN/A

          \[\leadsto \left(x + x\right) + \color{blue}{27} \cdot \left(a \cdot b\right) \]
        3. lift-+.f64N/A

          \[\leadsto \left(x + x\right) + \color{blue}{27} \cdot \left(a \cdot b\right) \]
        4. +-commutativeN/A

          \[\leadsto 27 \cdot \left(a \cdot b\right) + \color{blue}{\left(x + x\right)} \]
        5. lift-*.f64N/A

          \[\leadsto 27 \cdot \left(a \cdot b\right) + \left(\color{blue}{x} + x\right) \]
        6. lift-*.f64N/A

          \[\leadsto 27 \cdot \left(a \cdot b\right) + \left(x + x\right) \]
        7. *-commutativeN/A

          \[\leadsto 27 \cdot \left(b \cdot a\right) + \left(x + x\right) \]
        8. lift-*.f64N/A

          \[\leadsto 27 \cdot \left(b \cdot a\right) + \left(x + x\right) \]
        9. *-commutativeN/A

          \[\leadsto \left(b \cdot a\right) \cdot 27 + \left(\color{blue}{x} + x\right) \]
        10. lift-*.f64N/A

          \[\leadsto \left(b \cdot a\right) \cdot 27 + \left(x + x\right) \]
        11. associate-*l*N/A

          \[\leadsto b \cdot \left(a \cdot 27\right) + \left(\color{blue}{x} + x\right) \]
        12. lift-*.f64N/A

          \[\leadsto b \cdot \left(a \cdot 27\right) + \left(x + x\right) \]
        13. *-commutativeN/A

          \[\leadsto \left(a \cdot 27\right) \cdot b + \left(\color{blue}{x} + x\right) \]
        14. lift-*.f64N/A

          \[\leadsto \left(a \cdot 27\right) \cdot b + \left(x + x\right) \]
        15. associate-*l*N/A

          \[\leadsto a \cdot \left(27 \cdot b\right) + \left(\color{blue}{x} + x\right) \]
        16. *-commutativeN/A

          \[\leadsto a \cdot \left(b \cdot 27\right) + \left(x + x\right) \]
        17. lift-*.f64N/A

          \[\leadsto a \cdot \left(b \cdot 27\right) + \left(x + x\right) \]
        18. *-commutativeN/A

          \[\leadsto \left(b \cdot 27\right) \cdot a + \left(\color{blue}{x} + x\right) \]
        19. lower-fma.f6464.9

          \[\leadsto \mathsf{fma}\left(b \cdot 27, \color{blue}{a}, x + x\right) \]
        20. lift-*.f64N/A

          \[\leadsto \mathsf{fma}\left(b \cdot 27, a, x + x\right) \]
        21. *-commutativeN/A

          \[\leadsto \mathsf{fma}\left(27 \cdot b, a, x + x\right) \]
        22. lower-*.f6464.9

          \[\leadsto \mathsf{fma}\left(27 \cdot b, a, x + x\right) \]
      6. Applied rewrites64.9%

        \[\leadsto \mathsf{fma}\left(27 \cdot b, \color{blue}{a}, x + x\right) \]
      7. Step-by-step derivation
        1. lift-fma.f64N/A

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

          \[\leadsto \left(27 \cdot b\right) \cdot a + \left(x + x\right) \]
        3. associate-*l*N/A

          \[\leadsto 27 \cdot \left(b \cdot a\right) + \left(\color{blue}{x} + x\right) \]
        4. lift-*.f64N/A

          \[\leadsto 27 \cdot \left(b \cdot a\right) + \left(x + x\right) \]
        5. lift-*.f64N/A

          \[\leadsto 27 \cdot \left(b \cdot a\right) + \left(\color{blue}{x} + x\right) \]
        6. lift-+.f64N/A

          \[\leadsto 27 \cdot \left(b \cdot a\right) + \left(x + \color{blue}{x}\right) \]
        7. count-2-revN/A

          \[\leadsto 27 \cdot \left(b \cdot a\right) + 2 \cdot \color{blue}{x} \]
        8. *-commutativeN/A

          \[\leadsto 27 \cdot \left(b \cdot a\right) + x \cdot \color{blue}{2} \]
        9. fp-cancel-sign-sub-invN/A

          \[\leadsto 27 \cdot \left(b \cdot a\right) - \color{blue}{\left(\mathsf{neg}\left(x\right)\right) \cdot 2} \]
        10. distribute-lft-neg-inN/A

          \[\leadsto 27 \cdot \left(b \cdot a\right) - \left(\mathsf{neg}\left(x \cdot 2\right)\right) \]
        11. distribute-rgt-neg-inN/A

          \[\leadsto 27 \cdot \left(b \cdot a\right) - x \cdot \color{blue}{\left(\mathsf{neg}\left(2\right)\right)} \]
        12. fp-cancel-sub-sign-invN/A

          \[\leadsto 27 \cdot \left(b \cdot a\right) + \color{blue}{\left(\mathsf{neg}\left(x\right)\right) \cdot \left(\mathsf{neg}\left(2\right)\right)} \]
        13. lift-*.f64N/A

          \[\leadsto 27 \cdot \left(b \cdot a\right) + \color{blue}{\left(\mathsf{neg}\left(x\right)\right)} \cdot \left(\mathsf{neg}\left(2\right)\right) \]
        14. *-commutativeN/A

          \[\leadsto \left(b \cdot a\right) \cdot 27 + \color{blue}{\left(\mathsf{neg}\left(x\right)\right)} \cdot \left(\mathsf{neg}\left(2\right)\right) \]
        15. distribute-rgt-neg-inN/A

          \[\leadsto \left(b \cdot a\right) \cdot 27 + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right) \cdot 2\right)\right) \]
        16. distribute-lft-neg-inN/A

          \[\leadsto \left(b \cdot a\right) \cdot 27 + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x \cdot 2\right)\right)\right)\right) \]
        17. remove-double-negN/A

          \[\leadsto \left(b \cdot a\right) \cdot 27 + x \cdot \color{blue}{2} \]
        18. lower-fma.f64N/A

          \[\leadsto \mathsf{fma}\left(b \cdot a, \color{blue}{27}, x \cdot 2\right) \]
        19. lift-*.f64N/A

          \[\leadsto \mathsf{fma}\left(b \cdot a, 27, x \cdot 2\right) \]
        20. *-commutativeN/A

          \[\leadsto \mathsf{fma}\left(a \cdot b, 27, x \cdot 2\right) \]
        21. lower-*.f64N/A

          \[\leadsto \mathsf{fma}\left(a \cdot b, 27, x \cdot 2\right) \]
        22. *-commutativeN/A

          \[\leadsto \mathsf{fma}\left(a \cdot b, 27, 2 \cdot x\right) \]
        23. count-2-revN/A

          \[\leadsto \mathsf{fma}\left(a \cdot b, 27, x + x\right) \]
        24. lift-+.f6465.0

          \[\leadsto \mathsf{fma}\left(a \cdot b, 27, x + x\right) \]
      8. Applied rewrites65.0%

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

    Alternative 11: 65.0% accurate, 2.1× speedup?

    \[\mathsf{fma}\left(a \cdot b, 27, x + x\right) \]
    (FPCore (x y z t a b) :precision binary64 (fma (* a b) 27.0 (+ x x)))
    double code(double x, double y, double z, double t, double a, double b) {
    	return fma((a * b), 27.0, (x + x));
    }
    
    function code(x, y, z, t, a, b)
    	return fma(Float64(a * b), 27.0, Float64(x + x))
    end
    
    code[x_, y_, z_, t_, a_, b_] := N[(N[(a * b), $MachinePrecision] * 27.0 + N[(x + x), $MachinePrecision]), $MachinePrecision]
    
    \mathsf{fma}\left(a \cdot b, 27, x + x\right)
    
    Derivation
    1. Initial program 94.9%

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

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

        \[\leadsto \mathsf{fma}\left(2, \color{blue}{x}, 27 \cdot \left(a \cdot b\right)\right) \]
      2. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(2, x, 27 \cdot \left(a \cdot b\right)\right) \]
      3. lower-*.f6465.0

        \[\leadsto \mathsf{fma}\left(2, x, 27 \cdot \left(a \cdot b\right)\right) \]
    4. Applied rewrites65.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(2, x, 27 \cdot \left(a \cdot b\right)\right)} \]
    5. Step-by-step derivation
      1. lift-fma.f64N/A

        \[\leadsto 2 \cdot x + \color{blue}{27 \cdot \left(a \cdot b\right)} \]
      2. count-2-revN/A

        \[\leadsto \left(x + x\right) + \color{blue}{27} \cdot \left(a \cdot b\right) \]
      3. lift-+.f64N/A

        \[\leadsto \left(x + x\right) + \color{blue}{27} \cdot \left(a \cdot b\right) \]
      4. +-commutativeN/A

        \[\leadsto 27 \cdot \left(a \cdot b\right) + \color{blue}{\left(x + x\right)} \]
      5. lift-*.f64N/A

        \[\leadsto 27 \cdot \left(a \cdot b\right) + \left(\color{blue}{x} + x\right) \]
      6. lift-*.f64N/A

        \[\leadsto 27 \cdot \left(a \cdot b\right) + \left(x + x\right) \]
      7. *-commutativeN/A

        \[\leadsto 27 \cdot \left(b \cdot a\right) + \left(x + x\right) \]
      8. lift-*.f64N/A

        \[\leadsto 27 \cdot \left(b \cdot a\right) + \left(x + x\right) \]
      9. *-commutativeN/A

        \[\leadsto \left(b \cdot a\right) \cdot 27 + \left(\color{blue}{x} + x\right) \]
      10. lift-*.f64N/A

        \[\leadsto \left(b \cdot a\right) \cdot 27 + \left(x + x\right) \]
      11. associate-*l*N/A

        \[\leadsto b \cdot \left(a \cdot 27\right) + \left(\color{blue}{x} + x\right) \]
      12. lift-*.f64N/A

        \[\leadsto b \cdot \left(a \cdot 27\right) + \left(x + x\right) \]
      13. *-commutativeN/A

        \[\leadsto \left(a \cdot 27\right) \cdot b + \left(\color{blue}{x} + x\right) \]
      14. lift-*.f64N/A

        \[\leadsto \left(a \cdot 27\right) \cdot b + \left(x + x\right) \]
      15. associate-*l*N/A

        \[\leadsto a \cdot \left(27 \cdot b\right) + \left(\color{blue}{x} + x\right) \]
      16. *-commutativeN/A

        \[\leadsto a \cdot \left(b \cdot 27\right) + \left(x + x\right) \]
      17. lift-*.f64N/A

        \[\leadsto a \cdot \left(b \cdot 27\right) + \left(x + x\right) \]
      18. *-commutativeN/A

        \[\leadsto \left(b \cdot 27\right) \cdot a + \left(\color{blue}{x} + x\right) \]
      19. lower-fma.f6464.9

        \[\leadsto \mathsf{fma}\left(b \cdot 27, \color{blue}{a}, x + x\right) \]
      20. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, x + x\right) \]
      21. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(27 \cdot b, a, x + x\right) \]
      22. lower-*.f6464.9

        \[\leadsto \mathsf{fma}\left(27 \cdot b, a, x + x\right) \]
    6. Applied rewrites64.9%

      \[\leadsto \mathsf{fma}\left(27 \cdot b, \color{blue}{a}, x + x\right) \]
    7. Step-by-step derivation
      1. lift-fma.f64N/A

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

        \[\leadsto \left(27 \cdot b\right) \cdot a + \left(x + x\right) \]
      3. associate-*l*N/A

        \[\leadsto 27 \cdot \left(b \cdot a\right) + \left(\color{blue}{x} + x\right) \]
      4. lift-*.f64N/A

        \[\leadsto 27 \cdot \left(b \cdot a\right) + \left(x + x\right) \]
      5. lift-*.f64N/A

        \[\leadsto 27 \cdot \left(b \cdot a\right) + \left(\color{blue}{x} + x\right) \]
      6. lift-+.f64N/A

        \[\leadsto 27 \cdot \left(b \cdot a\right) + \left(x + \color{blue}{x}\right) \]
      7. count-2-revN/A

        \[\leadsto 27 \cdot \left(b \cdot a\right) + 2 \cdot \color{blue}{x} \]
      8. *-commutativeN/A

        \[\leadsto 27 \cdot \left(b \cdot a\right) + x \cdot \color{blue}{2} \]
      9. fp-cancel-sign-sub-invN/A

        \[\leadsto 27 \cdot \left(b \cdot a\right) - \color{blue}{\left(\mathsf{neg}\left(x\right)\right) \cdot 2} \]
      10. distribute-lft-neg-inN/A

        \[\leadsto 27 \cdot \left(b \cdot a\right) - \left(\mathsf{neg}\left(x \cdot 2\right)\right) \]
      11. distribute-rgt-neg-inN/A

        \[\leadsto 27 \cdot \left(b \cdot a\right) - x \cdot \color{blue}{\left(\mathsf{neg}\left(2\right)\right)} \]
      12. fp-cancel-sub-sign-invN/A

        \[\leadsto 27 \cdot \left(b \cdot a\right) + \color{blue}{\left(\mathsf{neg}\left(x\right)\right) \cdot \left(\mathsf{neg}\left(2\right)\right)} \]
      13. lift-*.f64N/A

        \[\leadsto 27 \cdot \left(b \cdot a\right) + \color{blue}{\left(\mathsf{neg}\left(x\right)\right)} \cdot \left(\mathsf{neg}\left(2\right)\right) \]
      14. *-commutativeN/A

        \[\leadsto \left(b \cdot a\right) \cdot 27 + \color{blue}{\left(\mathsf{neg}\left(x\right)\right)} \cdot \left(\mathsf{neg}\left(2\right)\right) \]
      15. distribute-rgt-neg-inN/A

        \[\leadsto \left(b \cdot a\right) \cdot 27 + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right) \cdot 2\right)\right) \]
      16. distribute-lft-neg-inN/A

        \[\leadsto \left(b \cdot a\right) \cdot 27 + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x \cdot 2\right)\right)\right)\right) \]
      17. remove-double-negN/A

        \[\leadsto \left(b \cdot a\right) \cdot 27 + x \cdot \color{blue}{2} \]
      18. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(b \cdot a, \color{blue}{27}, x \cdot 2\right) \]
      19. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b \cdot a, 27, x \cdot 2\right) \]
      20. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(a \cdot b, 27, x \cdot 2\right) \]
      21. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(a \cdot b, 27, x \cdot 2\right) \]
      22. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(a \cdot b, 27, 2 \cdot x\right) \]
      23. count-2-revN/A

        \[\leadsto \mathsf{fma}\left(a \cdot b, 27, x + x\right) \]
      24. lift-+.f6465.0

        \[\leadsto \mathsf{fma}\left(a \cdot b, 27, x + x\right) \]
    8. Applied rewrites65.0%

      \[\leadsto \mathsf{fma}\left(a \cdot b, \color{blue}{27}, x + x\right) \]
    9. Add Preprocessing

    Alternative 12: 64.9% accurate, 2.1× speedup?

    \[\mathsf{fma}\left(27 \cdot b, a, x + x\right) \]
    (FPCore (x y z t a b) :precision binary64 (fma (* 27.0 b) a (+ x x)))
    double code(double x, double y, double z, double t, double a, double b) {
    	return fma((27.0 * b), a, (x + x));
    }
    
    function code(x, y, z, t, a, b)
    	return fma(Float64(27.0 * b), a, Float64(x + x))
    end
    
    code[x_, y_, z_, t_, a_, b_] := N[(N[(27.0 * b), $MachinePrecision] * a + N[(x + x), $MachinePrecision]), $MachinePrecision]
    
    \mathsf{fma}\left(27 \cdot b, a, x + x\right)
    
    Derivation
    1. Initial program 94.9%

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

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

        \[\leadsto \mathsf{fma}\left(2, \color{blue}{x}, 27 \cdot \left(a \cdot b\right)\right) \]
      2. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(2, x, 27 \cdot \left(a \cdot b\right)\right) \]
      3. lower-*.f6465.0

        \[\leadsto \mathsf{fma}\left(2, x, 27 \cdot \left(a \cdot b\right)\right) \]
    4. Applied rewrites65.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(2, x, 27 \cdot \left(a \cdot b\right)\right)} \]
    5. Step-by-step derivation
      1. lift-fma.f64N/A

        \[\leadsto 2 \cdot x + \color{blue}{27 \cdot \left(a \cdot b\right)} \]
      2. count-2-revN/A

        \[\leadsto \left(x + x\right) + \color{blue}{27} \cdot \left(a \cdot b\right) \]
      3. lift-+.f64N/A

        \[\leadsto \left(x + x\right) + \color{blue}{27} \cdot \left(a \cdot b\right) \]
      4. +-commutativeN/A

        \[\leadsto 27 \cdot \left(a \cdot b\right) + \color{blue}{\left(x + x\right)} \]
      5. lift-*.f64N/A

        \[\leadsto 27 \cdot \left(a \cdot b\right) + \left(\color{blue}{x} + x\right) \]
      6. lift-*.f64N/A

        \[\leadsto 27 \cdot \left(a \cdot b\right) + \left(x + x\right) \]
      7. *-commutativeN/A

        \[\leadsto 27 \cdot \left(b \cdot a\right) + \left(x + x\right) \]
      8. lift-*.f64N/A

        \[\leadsto 27 \cdot \left(b \cdot a\right) + \left(x + x\right) \]
      9. *-commutativeN/A

        \[\leadsto \left(b \cdot a\right) \cdot 27 + \left(\color{blue}{x} + x\right) \]
      10. lift-*.f64N/A

        \[\leadsto \left(b \cdot a\right) \cdot 27 + \left(x + x\right) \]
      11. associate-*l*N/A

        \[\leadsto b \cdot \left(a \cdot 27\right) + \left(\color{blue}{x} + x\right) \]
      12. lift-*.f64N/A

        \[\leadsto b \cdot \left(a \cdot 27\right) + \left(x + x\right) \]
      13. *-commutativeN/A

        \[\leadsto \left(a \cdot 27\right) \cdot b + \left(\color{blue}{x} + x\right) \]
      14. lift-*.f64N/A

        \[\leadsto \left(a \cdot 27\right) \cdot b + \left(x + x\right) \]
      15. associate-*l*N/A

        \[\leadsto a \cdot \left(27 \cdot b\right) + \left(\color{blue}{x} + x\right) \]
      16. *-commutativeN/A

        \[\leadsto a \cdot \left(b \cdot 27\right) + \left(x + x\right) \]
      17. lift-*.f64N/A

        \[\leadsto a \cdot \left(b \cdot 27\right) + \left(x + x\right) \]
      18. *-commutativeN/A

        \[\leadsto \left(b \cdot 27\right) \cdot a + \left(\color{blue}{x} + x\right) \]
      19. lower-fma.f6464.9

        \[\leadsto \mathsf{fma}\left(b \cdot 27, \color{blue}{a}, x + x\right) \]
      20. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, x + x\right) \]
      21. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(27 \cdot b, a, x + x\right) \]
      22. lower-*.f6464.9

        \[\leadsto \mathsf{fma}\left(27 \cdot b, a, x + x\right) \]
    6. Applied rewrites64.9%

      \[\leadsto \mathsf{fma}\left(27 \cdot b, \color{blue}{a}, x + x\right) \]
    7. Add Preprocessing

    Alternative 13: 54.0% accurate, 0.5× speedup?

    \[\begin{array}{l} t_1 := \left(\mathsf{min}\left(a, b\right) \cdot 27\right) \cdot \mathsf{max}\left(a, b\right)\\ \mathbf{if}\;t\_1 \leq -4 \cdot 10^{+56}:\\ \;\;\;\;\left(27 \cdot \mathsf{min}\left(a, b\right)\right) \cdot \mathsf{max}\left(a, b\right)\\ \mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+34}:\\ \;\;\;\;x + x\\ \mathbf{else}:\\ \;\;\;\;27 \cdot \left(\mathsf{min}\left(a, b\right) \cdot \mathsf{max}\left(a, b\right)\right)\\ \end{array} \]
    (FPCore (x y z t a b)
     :precision binary64
     (let* ((t_1 (* (* (fmin a b) 27.0) (fmax a b))))
       (if (<= t_1 -4e+56)
         (* (* 27.0 (fmin a b)) (fmax a b))
         (if (<= t_1 5e+34) (+ x x) (* 27.0 (* (fmin a b) (fmax a b)))))))
    double code(double x, double y, double z, double t, double a, double b) {
    	double t_1 = (fmin(a, b) * 27.0) * fmax(a, b);
    	double tmp;
    	if (t_1 <= -4e+56) {
    		tmp = (27.0 * fmin(a, b)) * fmax(a, b);
    	} else if (t_1 <= 5e+34) {
    		tmp = x + x;
    	} else {
    		tmp = 27.0 * (fmin(a, b) * fmax(a, b));
    	}
    	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)
    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) :: t_1
        real(8) :: tmp
        t_1 = (fmin(a, b) * 27.0d0) * fmax(a, b)
        if (t_1 <= (-4d+56)) then
            tmp = (27.0d0 * fmin(a, b)) * fmax(a, b)
        else if (t_1 <= 5d+34) then
            tmp = x + x
        else
            tmp = 27.0d0 * (fmin(a, b) * fmax(a, b))
        end if
        code = tmp
    end function
    
    public static double code(double x, double y, double z, double t, double a, double b) {
    	double t_1 = (fmin(a, b) * 27.0) * fmax(a, b);
    	double tmp;
    	if (t_1 <= -4e+56) {
    		tmp = (27.0 * fmin(a, b)) * fmax(a, b);
    	} else if (t_1 <= 5e+34) {
    		tmp = x + x;
    	} else {
    		tmp = 27.0 * (fmin(a, b) * fmax(a, b));
    	}
    	return tmp;
    }
    
    def code(x, y, z, t, a, b):
    	t_1 = (fmin(a, b) * 27.0) * fmax(a, b)
    	tmp = 0
    	if t_1 <= -4e+56:
    		tmp = (27.0 * fmin(a, b)) * fmax(a, b)
    	elif t_1 <= 5e+34:
    		tmp = x + x
    	else:
    		tmp = 27.0 * (fmin(a, b) * fmax(a, b))
    	return tmp
    
    function code(x, y, z, t, a, b)
    	t_1 = Float64(Float64(fmin(a, b) * 27.0) * fmax(a, b))
    	tmp = 0.0
    	if (t_1 <= -4e+56)
    		tmp = Float64(Float64(27.0 * fmin(a, b)) * fmax(a, b));
    	elseif (t_1 <= 5e+34)
    		tmp = Float64(x + x);
    	else
    		tmp = Float64(27.0 * Float64(fmin(a, b) * fmax(a, b)));
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, y, z, t, a, b)
    	t_1 = (min(a, b) * 27.0) * max(a, b);
    	tmp = 0.0;
    	if (t_1 <= -4e+56)
    		tmp = (27.0 * min(a, b)) * max(a, b);
    	elseif (t_1 <= 5e+34)
    		tmp = x + x;
    	else
    		tmp = 27.0 * (min(a, b) * max(a, b));
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[Min[a, b], $MachinePrecision] * 27.0), $MachinePrecision] * N[Max[a, b], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -4e+56], N[(N[(27.0 * N[Min[a, b], $MachinePrecision]), $MachinePrecision] * N[Max[a, b], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+34], N[(x + x), $MachinePrecision], N[(27.0 * N[(N[Min[a, b], $MachinePrecision] * N[Max[a, b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
    
    \begin{array}{l}
    t_1 := \left(\mathsf{min}\left(a, b\right) \cdot 27\right) \cdot \mathsf{max}\left(a, b\right)\\
    \mathbf{if}\;t\_1 \leq -4 \cdot 10^{+56}:\\
    \;\;\;\;\left(27 \cdot \mathsf{min}\left(a, b\right)\right) \cdot \mathsf{max}\left(a, b\right)\\
    
    \mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+34}:\\
    \;\;\;\;x + x\\
    
    \mathbf{else}:\\
    \;\;\;\;27 \cdot \left(\mathsf{min}\left(a, b\right) \cdot \mathsf{max}\left(a, b\right)\right)\\
    
    
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if (*.f64 (*.f64 a #s(literal 27 binary64)) b) < -4.00000000000000037e56

      1. Initial program 94.9%

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

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

          \[\leadsto \mathsf{fma}\left(2, \color{blue}{x}, 27 \cdot \left(a \cdot b\right)\right) \]
        2. lower-*.f64N/A

          \[\leadsto \mathsf{fma}\left(2, x, 27 \cdot \left(a \cdot b\right)\right) \]
        3. lower-*.f6465.0

          \[\leadsto \mathsf{fma}\left(2, x, 27 \cdot \left(a \cdot b\right)\right) \]
      4. Applied rewrites65.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(2, x, 27 \cdot \left(a \cdot b\right)\right)} \]
      5. Taylor expanded in x around 0

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

          \[\leadsto 27 \cdot \left(a \cdot \color{blue}{b}\right) \]
        2. lower-*.f6435.6

          \[\leadsto 27 \cdot \left(a \cdot b\right) \]
      7. Applied rewrites35.6%

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

          \[\leadsto 27 \cdot \left(a \cdot \color{blue}{b}\right) \]
        2. lift-*.f64N/A

          \[\leadsto 27 \cdot \left(a \cdot b\right) \]
        3. associate-*r*N/A

          \[\leadsto \left(27 \cdot a\right) \cdot b \]
        4. *-commutativeN/A

          \[\leadsto \left(a \cdot 27\right) \cdot b \]
        5. lift-*.f64N/A

          \[\leadsto \left(a \cdot 27\right) \cdot b \]
        6. lift-*.f6435.6

          \[\leadsto \left(a \cdot 27\right) \cdot b \]
        7. lift-*.f64N/A

          \[\leadsto \left(a \cdot 27\right) \cdot b \]
        8. *-commutativeN/A

          \[\leadsto \left(27 \cdot a\right) \cdot b \]
        9. lower-*.f6435.6

          \[\leadsto \left(27 \cdot a\right) \cdot b \]
      9. Applied rewrites35.6%

        \[\leadsto \left(27 \cdot a\right) \cdot b \]

      if -4.00000000000000037e56 < (*.f64 (*.f64 a #s(literal 27 binary64)) b) < 4.9999999999999998e34

      1. Initial program 94.9%

        \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      2. Step-by-step derivation
        1. lift-+.f64N/A

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

          \[\leadsto \color{blue}{\left(a \cdot 27\right) \cdot b + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)} \]
        3. lift-*.f64N/A

          \[\leadsto \color{blue}{\left(a \cdot 27\right) \cdot b} + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
        4. lift-*.f64N/A

          \[\leadsto \color{blue}{\left(a \cdot 27\right)} \cdot b + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
        5. associate-*l*N/A

          \[\leadsto \color{blue}{a \cdot \left(27 \cdot b\right)} + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
        6. *-commutativeN/A

          \[\leadsto \color{blue}{\left(27 \cdot b\right) \cdot a} + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
        7. lower-fma.f64N/A

          \[\leadsto \color{blue}{\mathsf{fma}\left(27 \cdot b, a, x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)} \]
        8. *-commutativeN/A

          \[\leadsto \mathsf{fma}\left(\color{blue}{b \cdot 27}, a, x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
        9. lower-*.f6495.7

          \[\leadsto \mathsf{fma}\left(\color{blue}{b \cdot 27}, a, x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
        10. lift--.f64N/A

          \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t}\right) \]
        11. lift-*.f64N/A

          \[\leadsto \mathsf{fma}\left(b \cdot 27, a, x \cdot 2 - \color{blue}{\left(\left(y \cdot 9\right) \cdot z\right) \cdot t}\right) \]
        12. fp-cancel-sub-sign-invN/A

          \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{x \cdot 2 + \left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t}\right) \]
        13. +-commutativeN/A

          \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t + x \cdot 2}\right) \]
        14. add-flipN/A

          \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t - \left(\mathsf{neg}\left(x \cdot 2\right)\right)}\right) \]
        15. lift-*.f64N/A

          \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t - \left(\mathsf{neg}\left(\color{blue}{x \cdot 2}\right)\right)\right) \]
        16. distribute-rgt-neg-inN/A

          \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t - \color{blue}{x \cdot \left(\mathsf{neg}\left(2\right)\right)}\right) \]
        17. fp-cancel-sub-sign-invN/A

          \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t + \left(\mathsf{neg}\left(x\right)\right) \cdot \left(\mathsf{neg}\left(2\right)\right)}\right) \]
      3. Applied rewrites95.7%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\left(z \cdot t\right) \cdot -9, y, \mathsf{fma}\left(a \cdot b, 27, x\right)\right) + x} \]
      5. Taylor expanded in x around inf

        \[\leadsto \color{blue}{2 \cdot x} \]
      6. Step-by-step derivation
        1. lower-*.f6431.3

          \[\leadsto 2 \cdot \color{blue}{x} \]
      7. Applied rewrites31.3%

        \[\leadsto \color{blue}{2 \cdot x} \]
      8. Step-by-step derivation
        1. lift-*.f64N/A

          \[\leadsto 2 \cdot \color{blue}{x} \]
        2. count-2-revN/A

          \[\leadsto x + \color{blue}{x} \]
        3. lift-+.f6431.3

          \[\leadsto x + \color{blue}{x} \]
      9. Applied rewrites31.3%

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

      if 4.9999999999999998e34 < (*.f64 (*.f64 a #s(literal 27 binary64)) b)

      1. Initial program 94.9%

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

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

          \[\leadsto \mathsf{fma}\left(2, \color{blue}{x}, 27 \cdot \left(a \cdot b\right)\right) \]
        2. lower-*.f64N/A

          \[\leadsto \mathsf{fma}\left(2, x, 27 \cdot \left(a \cdot b\right)\right) \]
        3. lower-*.f6465.0

          \[\leadsto \mathsf{fma}\left(2, x, 27 \cdot \left(a \cdot b\right)\right) \]
      4. Applied rewrites65.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(2, x, 27 \cdot \left(a \cdot b\right)\right)} \]
      5. Taylor expanded in x around 0

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

          \[\leadsto 27 \cdot \left(a \cdot \color{blue}{b}\right) \]
        2. lower-*.f6435.6

          \[\leadsto 27 \cdot \left(a \cdot b\right) \]
      7. Applied rewrites35.6%

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

    Alternative 14: 53.9% accurate, 0.9× speedup?

    \[\begin{array}{l} t_1 := \left(a \cdot 27\right) \cdot b\\ t_2 := 27 \cdot \left(a \cdot b\right)\\ \mathbf{if}\;t\_1 \leq -4 \cdot 10^{+56}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+34}:\\ \;\;\;\;x + x\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \]
    (FPCore (x y z t a b)
     :precision binary64
     (let* ((t_1 (* (* a 27.0) b)) (t_2 (* 27.0 (* a b))))
       (if (<= t_1 -4e+56) t_2 (if (<= t_1 5e+34) (+ x x) t_2))))
    double code(double x, double y, double z, double t, double a, double b) {
    	double t_1 = (a * 27.0) * b;
    	double t_2 = 27.0 * (a * b);
    	double tmp;
    	if (t_1 <= -4e+56) {
    		tmp = t_2;
    	} else if (t_1 <= 5e+34) {
    		tmp = x + x;
    	} else {
    		tmp = t_2;
    	}
    	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)
    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) :: t_1
        real(8) :: t_2
        real(8) :: tmp
        t_1 = (a * 27.0d0) * b
        t_2 = 27.0d0 * (a * b)
        if (t_1 <= (-4d+56)) then
            tmp = t_2
        else if (t_1 <= 5d+34) then
            tmp = x + x
        else
            tmp = t_2
        end if
        code = tmp
    end function
    
    public static double code(double x, double y, double z, double t, double a, double b) {
    	double t_1 = (a * 27.0) * b;
    	double t_2 = 27.0 * (a * b);
    	double tmp;
    	if (t_1 <= -4e+56) {
    		tmp = t_2;
    	} else if (t_1 <= 5e+34) {
    		tmp = x + x;
    	} else {
    		tmp = t_2;
    	}
    	return tmp;
    }
    
    def code(x, y, z, t, a, b):
    	t_1 = (a * 27.0) * b
    	t_2 = 27.0 * (a * b)
    	tmp = 0
    	if t_1 <= -4e+56:
    		tmp = t_2
    	elif t_1 <= 5e+34:
    		tmp = x + x
    	else:
    		tmp = t_2
    	return tmp
    
    function code(x, y, z, t, a, b)
    	t_1 = Float64(Float64(a * 27.0) * b)
    	t_2 = Float64(27.0 * Float64(a * b))
    	tmp = 0.0
    	if (t_1 <= -4e+56)
    		tmp = t_2;
    	elseif (t_1 <= 5e+34)
    		tmp = Float64(x + x);
    	else
    		tmp = t_2;
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, y, z, t, a, b)
    	t_1 = (a * 27.0) * b;
    	t_2 = 27.0 * (a * b);
    	tmp = 0.0;
    	if (t_1 <= -4e+56)
    		tmp = t_2;
    	elseif (t_1 <= 5e+34)
    		tmp = x + x;
    	else
    		tmp = t_2;
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision]}, Block[{t$95$2 = N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -4e+56], t$95$2, If[LessEqual[t$95$1, 5e+34], N[(x + x), $MachinePrecision], t$95$2]]]]
    
    \begin{array}{l}
    t_1 := \left(a \cdot 27\right) \cdot b\\
    t_2 := 27 \cdot \left(a \cdot b\right)\\
    \mathbf{if}\;t\_1 \leq -4 \cdot 10^{+56}:\\
    \;\;\;\;t\_2\\
    
    \mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+34}:\\
    \;\;\;\;x + x\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_2\\
    
    
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if (*.f64 (*.f64 a #s(literal 27 binary64)) b) < -4.00000000000000037e56 or 4.9999999999999998e34 < (*.f64 (*.f64 a #s(literal 27 binary64)) b)

      1. Initial program 94.9%

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

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

          \[\leadsto \mathsf{fma}\left(2, \color{blue}{x}, 27 \cdot \left(a \cdot b\right)\right) \]
        2. lower-*.f64N/A

          \[\leadsto \mathsf{fma}\left(2, x, 27 \cdot \left(a \cdot b\right)\right) \]
        3. lower-*.f6465.0

          \[\leadsto \mathsf{fma}\left(2, x, 27 \cdot \left(a \cdot b\right)\right) \]
      4. Applied rewrites65.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(2, x, 27 \cdot \left(a \cdot b\right)\right)} \]
      5. Taylor expanded in x around 0

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

          \[\leadsto 27 \cdot \left(a \cdot \color{blue}{b}\right) \]
        2. lower-*.f6435.6

          \[\leadsto 27 \cdot \left(a \cdot b\right) \]
      7. Applied rewrites35.6%

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

      if -4.00000000000000037e56 < (*.f64 (*.f64 a #s(literal 27 binary64)) b) < 4.9999999999999998e34

      1. Initial program 94.9%

        \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
      2. Step-by-step derivation
        1. lift-+.f64N/A

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

          \[\leadsto \color{blue}{\left(a \cdot 27\right) \cdot b + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)} \]
        3. lift-*.f64N/A

          \[\leadsto \color{blue}{\left(a \cdot 27\right) \cdot b} + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
        4. lift-*.f64N/A

          \[\leadsto \color{blue}{\left(a \cdot 27\right)} \cdot b + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
        5. associate-*l*N/A

          \[\leadsto \color{blue}{a \cdot \left(27 \cdot b\right)} + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
        6. *-commutativeN/A

          \[\leadsto \color{blue}{\left(27 \cdot b\right) \cdot a} + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
        7. lower-fma.f64N/A

          \[\leadsto \color{blue}{\mathsf{fma}\left(27 \cdot b, a, x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)} \]
        8. *-commutativeN/A

          \[\leadsto \mathsf{fma}\left(\color{blue}{b \cdot 27}, a, x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
        9. lower-*.f6495.7

          \[\leadsto \mathsf{fma}\left(\color{blue}{b \cdot 27}, a, x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
        10. lift--.f64N/A

          \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t}\right) \]
        11. lift-*.f64N/A

          \[\leadsto \mathsf{fma}\left(b \cdot 27, a, x \cdot 2 - \color{blue}{\left(\left(y \cdot 9\right) \cdot z\right) \cdot t}\right) \]
        12. fp-cancel-sub-sign-invN/A

          \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{x \cdot 2 + \left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t}\right) \]
        13. +-commutativeN/A

          \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t + x \cdot 2}\right) \]
        14. add-flipN/A

          \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t - \left(\mathsf{neg}\left(x \cdot 2\right)\right)}\right) \]
        15. lift-*.f64N/A

          \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t - \left(\mathsf{neg}\left(\color{blue}{x \cdot 2}\right)\right)\right) \]
        16. distribute-rgt-neg-inN/A

          \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t - \color{blue}{x \cdot \left(\mathsf{neg}\left(2\right)\right)}\right) \]
        17. fp-cancel-sub-sign-invN/A

          \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t + \left(\mathsf{neg}\left(x\right)\right) \cdot \left(\mathsf{neg}\left(2\right)\right)}\right) \]
      3. Applied rewrites95.7%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\left(z \cdot t\right) \cdot -9, y, \mathsf{fma}\left(a \cdot b, 27, x\right)\right) + x} \]
      5. Taylor expanded in x around inf

        \[\leadsto \color{blue}{2 \cdot x} \]
      6. Step-by-step derivation
        1. lower-*.f6431.3

          \[\leadsto 2 \cdot \color{blue}{x} \]
      7. Applied rewrites31.3%

        \[\leadsto \color{blue}{2 \cdot x} \]
      8. Step-by-step derivation
        1. lift-*.f64N/A

          \[\leadsto 2 \cdot \color{blue}{x} \]
        2. count-2-revN/A

          \[\leadsto x + \color{blue}{x} \]
        3. lift-+.f6431.3

          \[\leadsto x + \color{blue}{x} \]
      9. Applied rewrites31.3%

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

    Alternative 15: 31.3% accurate, 6.4× speedup?

    \[x + x \]
    (FPCore (x y z t a b) :precision binary64 (+ x x))
    double code(double x, double y, double z, double t, double a, double b) {
    	return x + x;
    }
    
    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)
    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
        code = x + x
    end function
    
    public static double code(double x, double y, double z, double t, double a, double b) {
    	return x + x;
    }
    
    def code(x, y, z, t, a, b):
    	return x + x
    
    function code(x, y, z, t, a, b)
    	return Float64(x + x)
    end
    
    function tmp = code(x, y, z, t, a, b)
    	tmp = x + x;
    end
    
    code[x_, y_, z_, t_, a_, b_] := N[(x + x), $MachinePrecision]
    
    x + x
    
    Derivation
    1. Initial program 94.9%

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b \]
    2. Step-by-step derivation
      1. lift-+.f64N/A

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

        \[\leadsto \color{blue}{\left(a \cdot 27\right) \cdot b + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)} \]
      3. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(a \cdot 27\right) \cdot b} + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      4. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(a \cdot 27\right)} \cdot b + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      5. associate-*l*N/A

        \[\leadsto \color{blue}{a \cdot \left(27 \cdot b\right)} + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      6. *-commutativeN/A

        \[\leadsto \color{blue}{\left(27 \cdot b\right) \cdot a} + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      7. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(27 \cdot b, a, x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)} \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{b \cdot 27}, a, x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      9. lower-*.f6495.7

        \[\leadsto \mathsf{fma}\left(\color{blue}{b \cdot 27}, a, x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) \]
      10. lift--.f64N/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t}\right) \]
      11. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, x \cdot 2 - \color{blue}{\left(\left(y \cdot 9\right) \cdot z\right) \cdot t}\right) \]
      12. fp-cancel-sub-sign-invN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{x \cdot 2 + \left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t}\right) \]
      13. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t + x \cdot 2}\right) \]
      14. add-flipN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t - \left(\mathsf{neg}\left(x \cdot 2\right)\right)}\right) \]
      15. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t - \left(\mathsf{neg}\left(\color{blue}{x \cdot 2}\right)\right)\right) \]
      16. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t - \color{blue}{x \cdot \left(\mathsf{neg}\left(2\right)\right)}\right) \]
      17. fp-cancel-sub-sign-invN/A

        \[\leadsto \mathsf{fma}\left(b \cdot 27, a, \color{blue}{\left(\mathsf{neg}\left(\left(y \cdot 9\right) \cdot z\right)\right) \cdot t + \left(\mathsf{neg}\left(x\right)\right) \cdot \left(\mathsf{neg}\left(2\right)\right)}\right) \]
    3. Applied rewrites95.7%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\left(z \cdot t\right) \cdot -9, y, \mathsf{fma}\left(a \cdot b, 27, x\right)\right) + x} \]
    5. Taylor expanded in x around inf

      \[\leadsto \color{blue}{2 \cdot x} \]
    6. Step-by-step derivation
      1. lower-*.f6431.3

        \[\leadsto 2 \cdot \color{blue}{x} \]
    7. Applied rewrites31.3%

      \[\leadsto \color{blue}{2 \cdot x} \]
    8. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto 2 \cdot \color{blue}{x} \]
      2. count-2-revN/A

        \[\leadsto x + \color{blue}{x} \]
      3. lift-+.f6431.3

        \[\leadsto x + \color{blue}{x} \]
    9. Applied rewrites31.3%

      \[\leadsto x + \color{blue}{x} \]
    10. Add Preprocessing

    Reproduce

    ?
    herbie shell --seed 2025181 
    (FPCore (x y z t a b)
      :name "Diagrams.Solve.Polynomial:cubForm  from diagrams-solve-0.1, A"
      :precision binary64
      (+ (- (* x 2.0) (* (* (* y 9.0) z) t)) (* (* a 27.0) b)))