Numeric.SpecFunctions:logGamma from math-functions-0.1.5.2, D

Percentage Accurate: 59.2% → 98.3%
Time: 7.1s
Alternatives: 17
Speedup: 7.9×

Specification

?
\[\begin{array}{l} \\ x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (+
  x
  (/
   (*
    y
    (+ (* (+ (* (+ (* (+ (* z 3.13060547623) 11.1667541262) z) t) z) a) z) b))
   (+
    (* (+ (* (+ (* (+ z 15.234687407) z) 31.4690115749) z) 11.9400905721) z)
    0.607771387771))))
double code(double x, double y, double z, double t, double a, double b) {
	return x + ((y * ((((((((z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / (((((((z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771));
}
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 + ((y * ((((((((z * 3.13060547623d0) + 11.1667541262d0) * z) + t) * z) + a) * z) + b)) / (((((((z + 15.234687407d0) * z) + 31.4690115749d0) * z) + 11.9400905721d0) * z) + 0.607771387771d0))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	return x + ((y * ((((((((z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / (((((((z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771));
}
def code(x, y, z, t, a, b):
	return x + ((y * ((((((((z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / (((((((z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771))
function code(x, y, z, t, a, b)
	return Float64(x + Float64(Float64(y * Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / Float64(Float64(Float64(Float64(Float64(Float64(Float64(z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771)))
end
function tmp = code(x, y, z, t, a, b)
	tmp = x + ((y * ((((((((z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / (((((((z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771));
end
code[x_, y_, z_, t_, a_, b_] := N[(x + N[(N[(y * N[(N[(N[(N[(N[(N[(N[(N[(z * 3.13060547623), $MachinePrecision] + 11.1667541262), $MachinePrecision] * z), $MachinePrecision] + t), $MachinePrecision] * z), $MachinePrecision] + a), $MachinePrecision] * z), $MachinePrecision] + b), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(N[(N[(N[(N[(z + 15.234687407), $MachinePrecision] * z), $MachinePrecision] + 31.4690115749), $MachinePrecision] * z), $MachinePrecision] + 11.9400905721), $MachinePrecision] * z), $MachinePrecision] + 0.607771387771), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771}
\end{array}

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 17 alternatives:

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

Initial Program: 59.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (+
  x
  (/
   (*
    y
    (+ (* (+ (* (+ (* (+ (* z 3.13060547623) 11.1667541262) z) t) z) a) z) b))
   (+
    (* (+ (* (+ (* (+ z 15.234687407) z) 31.4690115749) z) 11.9400905721) z)
    0.607771387771))))
double code(double x, double y, double z, double t, double a, double b) {
	return x + ((y * ((((((((z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / (((((((z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771));
}
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 + ((y * ((((((((z * 3.13060547623d0) + 11.1667541262d0) * z) + t) * z) + a) * z) + b)) / (((((((z + 15.234687407d0) * z) + 31.4690115749d0) * z) + 11.9400905721d0) * z) + 0.607771387771d0))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	return x + ((y * ((((((((z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / (((((((z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771));
}
def code(x, y, z, t, a, b):
	return x + ((y * ((((((((z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / (((((((z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771))
function code(x, y, z, t, a, b)
	return Float64(x + Float64(Float64(y * Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / Float64(Float64(Float64(Float64(Float64(Float64(Float64(z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771)))
end
function tmp = code(x, y, z, t, a, b)
	tmp = x + ((y * ((((((((z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / (((((((z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771));
end
code[x_, y_, z_, t_, a_, b_] := N[(x + N[(N[(y * N[(N[(N[(N[(N[(N[(N[(N[(z * 3.13060547623), $MachinePrecision] + 11.1667541262), $MachinePrecision] * z), $MachinePrecision] + t), $MachinePrecision] * z), $MachinePrecision] + a), $MachinePrecision] * z), $MachinePrecision] + b), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(N[(N[(N[(N[(z + 15.234687407), $MachinePrecision] * z), $MachinePrecision] + 31.4690115749), $MachinePrecision] * z), $MachinePrecision] + 11.9400905721), $MachinePrecision] * z), $MachinePrecision] + 0.607771387771), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771}
\end{array}

Alternative 1: 98.3% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771} \leq \infty:\\ \;\;\;\;x + \frac{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(z, 3.13060547623, 11.1667541262\right), z, t\right), z, a\right), z, b\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(z + 15.234687407, z, 31.4690115749\right), z, 11.9400905721\right), z, 0.607771387771\right)} \cdot y\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \left(3.13060547623 + -1 \cdot \frac{36.52704169880642 + -1 \cdot \frac{457.9610022158428 + t}{z}}{z}\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (<=
      (+
       x
       (/
        (*
         y
         (+
          (* (+ (* (+ (* (+ (* z 3.13060547623) 11.1667541262) z) t) z) a) z)
          b))
        (+
         (*
          (+ (* (+ (* (+ z 15.234687407) z) 31.4690115749) z) 11.9400905721)
          z)
         0.607771387771)))
      INFINITY)
   (+
    x
    (*
     (/
      (fma (fma (fma (fma z 3.13060547623 11.1667541262) z t) z a) z b)
      (fma
       (fma (fma (+ z 15.234687407) z 31.4690115749) z 11.9400905721)
       z
       0.607771387771))
     y))
   (+
    x
    (*
     y
     (+
      3.13060547623
      (*
       -1.0
       (/ (+ 36.52704169880642 (* -1.0 (/ (+ 457.9610022158428 t) z))) z)))))))
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if ((x + ((y * ((((((((z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / (((((((z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771))) <= ((double) INFINITY)) {
		tmp = x + ((fma(fma(fma(fma(z, 3.13060547623, 11.1667541262), z, t), z, a), z, b) / fma(fma(fma((z + 15.234687407), z, 31.4690115749), z, 11.9400905721), z, 0.607771387771)) * y);
	} else {
		tmp = x + (y * (3.13060547623 + (-1.0 * ((36.52704169880642 + (-1.0 * ((457.9610022158428 + t) / z))) / z))));
	}
	return tmp;
}
function code(x, y, z, t, a, b)
	tmp = 0.0
	if (Float64(x + Float64(Float64(y * Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / Float64(Float64(Float64(Float64(Float64(Float64(Float64(z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771))) <= Inf)
		tmp = Float64(x + Float64(Float64(fma(fma(fma(fma(z, 3.13060547623, 11.1667541262), z, t), z, a), z, b) / fma(fma(fma(Float64(z + 15.234687407), z, 31.4690115749), z, 11.9400905721), z, 0.607771387771)) * y));
	else
		tmp = Float64(x + Float64(y * Float64(3.13060547623 + Float64(-1.0 * Float64(Float64(36.52704169880642 + Float64(-1.0 * Float64(Float64(457.9610022158428 + t) / z))) / z)))));
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(x + N[(N[(y * N[(N[(N[(N[(N[(N[(N[(N[(z * 3.13060547623), $MachinePrecision] + 11.1667541262), $MachinePrecision] * z), $MachinePrecision] + t), $MachinePrecision] * z), $MachinePrecision] + a), $MachinePrecision] * z), $MachinePrecision] + b), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(N[(N[(N[(N[(z + 15.234687407), $MachinePrecision] * z), $MachinePrecision] + 31.4690115749), $MachinePrecision] * z), $MachinePrecision] + 11.9400905721), $MachinePrecision] * z), $MachinePrecision] + 0.607771387771), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(x + N[(N[(N[(N[(N[(N[(z * 3.13060547623 + 11.1667541262), $MachinePrecision] * z + t), $MachinePrecision] * z + a), $MachinePrecision] * z + b), $MachinePrecision] / N[(N[(N[(N[(z + 15.234687407), $MachinePrecision] * z + 31.4690115749), $MachinePrecision] * z + 11.9400905721), $MachinePrecision] * z + 0.607771387771), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(3.13060547623 + N[(-1.0 * N[(N[(36.52704169880642 + N[(-1.0 * N[(N[(457.9610022158428 + t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771} \leq \infty:\\
\;\;\;\;x + \frac{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(z, 3.13060547623, 11.1667541262\right), z, t\right), z, a\right), z, b\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(z + 15.234687407, z, 31.4690115749\right), z, 11.9400905721\right), z, 0.607771387771\right)} \cdot y\\

\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(3.13060547623 + -1 \cdot \frac{36.52704169880642 + -1 \cdot \frac{457.9610022158428 + t}{z}}{z}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (+.f64 x (/.f64 (*.f64 y (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 z #s(literal 313060547623/100000000000 binary64)) #s(literal 55833770631/5000000000 binary64)) z) t) z) a) z) b)) (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 z #s(literal 15234687407/1000000000 binary64)) z) #s(literal 314690115749/10000000000 binary64)) z) #s(literal 119400905721/10000000000 binary64)) z) #s(literal 607771387771/1000000000000 binary64)))) < +inf.0

    1. Initial program 59.2%

      \[x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771} \]
    2. Applied rewrites61.2%

      \[\leadsto x + \color{blue}{\frac{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(z, 3.13060547623, 11.1667541262\right), z, t\right), z, a\right), z, b\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(z + 15.234687407, z, 31.4690115749\right), z, 11.9400905721\right), z, 0.607771387771\right)} \cdot y} \]

    if +inf.0 < (+.f64 x (/.f64 (*.f64 y (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 z #s(literal 313060547623/100000000000 binary64)) #s(literal 55833770631/5000000000 binary64)) z) t) z) a) z) b)) (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 z #s(literal 15234687407/1000000000 binary64)) z) #s(literal 314690115749/10000000000 binary64)) z) #s(literal 119400905721/10000000000 binary64)) z) #s(literal 607771387771/1000000000000 binary64))))

    1. Initial program 59.2%

      \[x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771} \]
    2. Taylor expanded in z around -inf

      \[\leadsto x + \color{blue}{\left(-1 \cdot \frac{\left(\frac{-55833770631}{5000000000} \cdot y + -1 \cdot \frac{t \cdot y - \left(\frac{-15234687407}{1000000000} \cdot \left(\frac{-55833770631}{5000000000} \cdot y - \frac{-4769379582500641883561}{100000000000000000000} \cdot y\right) + \frac{98517059967927196814627}{1000000000000000000000} \cdot y\right)}{z}\right) - \frac{-4769379582500641883561}{100000000000000000000} \cdot y}{z} + \frac{313060547623}{100000000000} \cdot y\right)} \]
    3. Applied rewrites51.4%

      \[\leadsto x + \color{blue}{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-11.1667541262, y, -1 \cdot \frac{t \cdot y - \mathsf{fma}\left(-15.234687407, -11.1667541262 \cdot y - -47.69379582500642 \cdot y, 98.5170599679272 \cdot y\right)}{z}\right) - -47.69379582500642 \cdot y}{z}, 3.13060547623 \cdot y\right)} \]
    4. Taylor expanded in y around 0

      \[\leadsto x + y \cdot \color{blue}{\left(\frac{313060547623}{100000000000} + -1 \cdot \frac{\frac{3652704169880641883561}{100000000000000000000} + -1 \cdot \frac{\frac{45796100221584283915100827016327}{100000000000000000000000000000} + t}{z}}{z}\right)} \]
    5. Applied rewrites55.4%

      \[\leadsto x + y \cdot \color{blue}{\left(3.13060547623 + -1 \cdot \frac{36.52704169880642 + -1 \cdot \frac{457.9610022158428 + t}{z}}{z}\right)} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 2: 97.8% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771} \leq \infty:\\ \;\;\;\;x + \frac{y}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(z + 15.234687407, z, 31.4690115749\right), z, 11.9400905721\right), z, 0.607771387771\right)} \cdot \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(z, 3.13060547623, 11.1667541262\right), z, t\right), z, a\right), z, b\right)\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \left(3.13060547623 + -1 \cdot \frac{36.52704169880642 + -1 \cdot \frac{457.9610022158428 + t}{z}}{z}\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (<=
      (+
       x
       (/
        (*
         y
         (+
          (* (+ (* (+ (* (+ (* z 3.13060547623) 11.1667541262) z) t) z) a) z)
          b))
        (+
         (*
          (+ (* (+ (* (+ z 15.234687407) z) 31.4690115749) z) 11.9400905721)
          z)
         0.607771387771)))
      INFINITY)
   (+
    x
    (*
     (/
      y
      (fma
       (fma (fma (+ z 15.234687407) z 31.4690115749) z 11.9400905721)
       z
       0.607771387771))
     (fma (fma (fma (fma z 3.13060547623 11.1667541262) z t) z a) z b)))
   (+
    x
    (*
     y
     (+
      3.13060547623
      (*
       -1.0
       (/ (+ 36.52704169880642 (* -1.0 (/ (+ 457.9610022158428 t) z))) z)))))))
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if ((x + ((y * ((((((((z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / (((((((z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771))) <= ((double) INFINITY)) {
		tmp = x + ((y / fma(fma(fma((z + 15.234687407), z, 31.4690115749), z, 11.9400905721), z, 0.607771387771)) * fma(fma(fma(fma(z, 3.13060547623, 11.1667541262), z, t), z, a), z, b));
	} else {
		tmp = x + (y * (3.13060547623 + (-1.0 * ((36.52704169880642 + (-1.0 * ((457.9610022158428 + t) / z))) / z))));
	}
	return tmp;
}
function code(x, y, z, t, a, b)
	tmp = 0.0
	if (Float64(x + Float64(Float64(y * Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / Float64(Float64(Float64(Float64(Float64(Float64(Float64(z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771))) <= Inf)
		tmp = Float64(x + Float64(Float64(y / fma(fma(fma(Float64(z + 15.234687407), z, 31.4690115749), z, 11.9400905721), z, 0.607771387771)) * fma(fma(fma(fma(z, 3.13060547623, 11.1667541262), z, t), z, a), z, b)));
	else
		tmp = Float64(x + Float64(y * Float64(3.13060547623 + Float64(-1.0 * Float64(Float64(36.52704169880642 + Float64(-1.0 * Float64(Float64(457.9610022158428 + t) / z))) / z)))));
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(x + N[(N[(y * N[(N[(N[(N[(N[(N[(N[(N[(z * 3.13060547623), $MachinePrecision] + 11.1667541262), $MachinePrecision] * z), $MachinePrecision] + t), $MachinePrecision] * z), $MachinePrecision] + a), $MachinePrecision] * z), $MachinePrecision] + b), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(N[(N[(N[(N[(z + 15.234687407), $MachinePrecision] * z), $MachinePrecision] + 31.4690115749), $MachinePrecision] * z), $MachinePrecision] + 11.9400905721), $MachinePrecision] * z), $MachinePrecision] + 0.607771387771), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(x + N[(N[(y / N[(N[(N[(N[(z + 15.234687407), $MachinePrecision] * z + 31.4690115749), $MachinePrecision] * z + 11.9400905721), $MachinePrecision] * z + 0.607771387771), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(z * 3.13060547623 + 11.1667541262), $MachinePrecision] * z + t), $MachinePrecision] * z + a), $MachinePrecision] * z + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(3.13060547623 + N[(-1.0 * N[(N[(36.52704169880642 + N[(-1.0 * N[(N[(457.9610022158428 + t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771} \leq \infty:\\
\;\;\;\;x + \frac{y}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(z + 15.234687407, z, 31.4690115749\right), z, 11.9400905721\right), z, 0.607771387771\right)} \cdot \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(z, 3.13060547623, 11.1667541262\right), z, t\right), z, a\right), z, b\right)\\

\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(3.13060547623 + -1 \cdot \frac{36.52704169880642 + -1 \cdot \frac{457.9610022158428 + t}{z}}{z}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (+.f64 x (/.f64 (*.f64 y (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 z #s(literal 313060547623/100000000000 binary64)) #s(literal 55833770631/5000000000 binary64)) z) t) z) a) z) b)) (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 z #s(literal 15234687407/1000000000 binary64)) z) #s(literal 314690115749/10000000000 binary64)) z) #s(literal 119400905721/10000000000 binary64)) z) #s(literal 607771387771/1000000000000 binary64)))) < +inf.0

    1. Initial program 59.2%

      \[x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771} \]
    2. Applied rewrites60.7%

      \[\leadsto x + \color{blue}{\frac{y}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(z + 15.234687407, z, 31.4690115749\right), z, 11.9400905721\right), z, 0.607771387771\right)} \cdot \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(z, 3.13060547623, 11.1667541262\right), z, t\right), z, a\right), z, b\right)} \]

    if +inf.0 < (+.f64 x (/.f64 (*.f64 y (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 z #s(literal 313060547623/100000000000 binary64)) #s(literal 55833770631/5000000000 binary64)) z) t) z) a) z) b)) (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 z #s(literal 15234687407/1000000000 binary64)) z) #s(literal 314690115749/10000000000 binary64)) z) #s(literal 119400905721/10000000000 binary64)) z) #s(literal 607771387771/1000000000000 binary64))))

    1. Initial program 59.2%

      \[x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771} \]
    2. Taylor expanded in z around -inf

      \[\leadsto x + \color{blue}{\left(-1 \cdot \frac{\left(\frac{-55833770631}{5000000000} \cdot y + -1 \cdot \frac{t \cdot y - \left(\frac{-15234687407}{1000000000} \cdot \left(\frac{-55833770631}{5000000000} \cdot y - \frac{-4769379582500641883561}{100000000000000000000} \cdot y\right) + \frac{98517059967927196814627}{1000000000000000000000} \cdot y\right)}{z}\right) - \frac{-4769379582500641883561}{100000000000000000000} \cdot y}{z} + \frac{313060547623}{100000000000} \cdot y\right)} \]
    3. Applied rewrites51.4%

      \[\leadsto x + \color{blue}{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-11.1667541262, y, -1 \cdot \frac{t \cdot y - \mathsf{fma}\left(-15.234687407, -11.1667541262 \cdot y - -47.69379582500642 \cdot y, 98.5170599679272 \cdot y\right)}{z}\right) - -47.69379582500642 \cdot y}{z}, 3.13060547623 \cdot y\right)} \]
    4. Taylor expanded in y around 0

      \[\leadsto x + y \cdot \color{blue}{\left(\frac{313060547623}{100000000000} + -1 \cdot \frac{\frac{3652704169880641883561}{100000000000000000000} + -1 \cdot \frac{\frac{45796100221584283915100827016327}{100000000000000000000000000000} + t}{z}}{z}\right)} \]
    5. Applied rewrites55.4%

      \[\leadsto x + y \cdot \color{blue}{\left(3.13060547623 + -1 \cdot \frac{36.52704169880642 + -1 \cdot \frac{457.9610022158428 + t}{z}}{z}\right)} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 3: 97.0% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x + y \cdot \left(3.13060547623 + -1 \cdot \frac{36.52704169880642 + -1 \cdot \frac{457.9610022158428 + t}{z}}{z}\right)\\ \mathbf{if}\;z \leq -5.2 \cdot 10^{+20}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 1060000:\\ \;\;\;\;x + \frac{y \cdot \left(\left(t \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1
         (+
          x
          (*
           y
           (+
            3.13060547623
            (*
             -1.0
             (/
              (+ 36.52704169880642 (* -1.0 (/ (+ 457.9610022158428 t) z)))
              z)))))))
   (if (<= z -5.2e+20)
     t_1
     (if (<= z 1060000.0)
       (+
        x
        (/
         (* y (+ (* (+ (* t z) a) z) b))
         (+
          (*
           (+ (* (+ (* (+ z 15.234687407) z) 31.4690115749) z) 11.9400905721)
           z)
          0.607771387771)))
       t_1))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = x + (y * (3.13060547623 + (-1.0 * ((36.52704169880642 + (-1.0 * ((457.9610022158428 + t) / z))) / z))));
	double tmp;
	if (z <= -5.2e+20) {
		tmp = t_1;
	} else if (z <= 1060000.0) {
		tmp = x + ((y * ((((t * z) + a) * z) + b)) / (((((((z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771));
	} else {
		tmp = t_1;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y, z, t, a, b)
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 = x + (y * (3.13060547623d0 + ((-1.0d0) * ((36.52704169880642d0 + ((-1.0d0) * ((457.9610022158428d0 + t) / z))) / z))))
    if (z <= (-5.2d+20)) then
        tmp = t_1
    else if (z <= 1060000.0d0) then
        tmp = x + ((y * ((((t * z) + a) * z) + b)) / (((((((z + 15.234687407d0) * z) + 31.4690115749d0) * z) + 11.9400905721d0) * z) + 0.607771387771d0))
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = x + (y * (3.13060547623 + (-1.0 * ((36.52704169880642 + (-1.0 * ((457.9610022158428 + t) / z))) / z))));
	double tmp;
	if (z <= -5.2e+20) {
		tmp = t_1;
	} else if (z <= 1060000.0) {
		tmp = x + ((y * ((((t * z) + a) * z) + b)) / (((((((z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771));
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	t_1 = x + (y * (3.13060547623 + (-1.0 * ((36.52704169880642 + (-1.0 * ((457.9610022158428 + t) / z))) / z))))
	tmp = 0
	if z <= -5.2e+20:
		tmp = t_1
	elif z <= 1060000.0:
		tmp = x + ((y * ((((t * z) + a) * z) + b)) / (((((((z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771))
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a, b)
	t_1 = Float64(x + Float64(y * Float64(3.13060547623 + Float64(-1.0 * Float64(Float64(36.52704169880642 + Float64(-1.0 * Float64(Float64(457.9610022158428 + t) / z))) / z)))))
	tmp = 0.0
	if (z <= -5.2e+20)
		tmp = t_1;
	elseif (z <= 1060000.0)
		tmp = Float64(x + Float64(Float64(y * Float64(Float64(Float64(Float64(t * z) + a) * z) + b)) / Float64(Float64(Float64(Float64(Float64(Float64(Float64(z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771)));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	t_1 = x + (y * (3.13060547623 + (-1.0 * ((36.52704169880642 + (-1.0 * ((457.9610022158428 + t) / z))) / z))));
	tmp = 0.0;
	if (z <= -5.2e+20)
		tmp = t_1;
	elseif (z <= 1060000.0)
		tmp = x + ((y * ((((t * z) + a) * z) + b)) / (((((((z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771));
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x + N[(y * N[(3.13060547623 + N[(-1.0 * N[(N[(36.52704169880642 + N[(-1.0 * N[(N[(457.9610022158428 + t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -5.2e+20], t$95$1, If[LessEqual[z, 1060000.0], N[(x + N[(N[(y * N[(N[(N[(N[(t * z), $MachinePrecision] + a), $MachinePrecision] * z), $MachinePrecision] + b), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(N[(N[(N[(N[(z + 15.234687407), $MachinePrecision] * z), $MachinePrecision] + 31.4690115749), $MachinePrecision] * z), $MachinePrecision] + 11.9400905721), $MachinePrecision] * z), $MachinePrecision] + 0.607771387771), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x + y \cdot \left(3.13060547623 + -1 \cdot \frac{36.52704169880642 + -1 \cdot \frac{457.9610022158428 + t}{z}}{z}\right)\\
\mathbf{if}\;z \leq -5.2 \cdot 10^{+20}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq 1060000:\\
\;\;\;\;x + \frac{y \cdot \left(\left(t \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -5.2e20 or 1.06e6 < z

    1. Initial program 59.2%

      \[x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771} \]
    2. Taylor expanded in z around -inf

      \[\leadsto x + \color{blue}{\left(-1 \cdot \frac{\left(\frac{-55833770631}{5000000000} \cdot y + -1 \cdot \frac{t \cdot y - \left(\frac{-15234687407}{1000000000} \cdot \left(\frac{-55833770631}{5000000000} \cdot y - \frac{-4769379582500641883561}{100000000000000000000} \cdot y\right) + \frac{98517059967927196814627}{1000000000000000000000} \cdot y\right)}{z}\right) - \frac{-4769379582500641883561}{100000000000000000000} \cdot y}{z} + \frac{313060547623}{100000000000} \cdot y\right)} \]
    3. Applied rewrites51.4%

      \[\leadsto x + \color{blue}{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-11.1667541262, y, -1 \cdot \frac{t \cdot y - \mathsf{fma}\left(-15.234687407, -11.1667541262 \cdot y - -47.69379582500642 \cdot y, 98.5170599679272 \cdot y\right)}{z}\right) - -47.69379582500642 \cdot y}{z}, 3.13060547623 \cdot y\right)} \]
    4. Taylor expanded in y around 0

      \[\leadsto x + y \cdot \color{blue}{\left(\frac{313060547623}{100000000000} + -1 \cdot \frac{\frac{3652704169880641883561}{100000000000000000000} + -1 \cdot \frac{\frac{45796100221584283915100827016327}{100000000000000000000000000000} + t}{z}}{z}\right)} \]
    5. Applied rewrites55.4%

      \[\leadsto x + y \cdot \color{blue}{\left(3.13060547623 + -1 \cdot \frac{36.52704169880642 + -1 \cdot \frac{457.9610022158428 + t}{z}}{z}\right)} \]

    if -5.2e20 < z < 1.06e6

    1. Initial program 59.2%

      \[x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771} \]
    2. Taylor expanded in z around 0

      \[\leadsto x + \frac{y \cdot \left(\left(\color{blue}{t} \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + \frac{15234687407}{1000000000}\right) \cdot z + \frac{314690115749}{10000000000}\right) \cdot z + \frac{119400905721}{10000000000}\right) \cdot z + \frac{607771387771}{1000000000000}} \]
    3. Applied rewrites62.8%

      \[\leadsto x + \frac{y \cdot \left(\left(\color{blue}{t} \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 4: 97.0% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x + y \cdot \left(3.13060547623 + -1 \cdot \frac{36.52704169880642 + -1 \cdot \frac{457.9610022158428 + t}{z}}{z}\right)\\ \mathbf{if}\;z \leq -5.2 \cdot 10^{+20}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 1060000:\\ \;\;\;\;x + \frac{y \cdot \left(\left(t \cdot z + a\right) \cdot z + b\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(z + 15.234687407, z, 31.4690115749\right), z, 11.9400905721\right), z, 0.607771387771\right)}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1
         (+
          x
          (*
           y
           (+
            3.13060547623
            (*
             -1.0
             (/
              (+ 36.52704169880642 (* -1.0 (/ (+ 457.9610022158428 t) z)))
              z)))))))
   (if (<= z -5.2e+20)
     t_1
     (if (<= z 1060000.0)
       (+
        x
        (/
         (* y (+ (* (+ (* t z) a) z) b))
         (fma
          (fma (fma (+ z 15.234687407) z 31.4690115749) z 11.9400905721)
          z
          0.607771387771)))
       t_1))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = x + (y * (3.13060547623 + (-1.0 * ((36.52704169880642 + (-1.0 * ((457.9610022158428 + t) / z))) / z))));
	double tmp;
	if (z <= -5.2e+20) {
		tmp = t_1;
	} else if (z <= 1060000.0) {
		tmp = x + ((y * ((((t * z) + a) * z) + b)) / fma(fma(fma((z + 15.234687407), z, 31.4690115749), z, 11.9400905721), z, 0.607771387771));
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(x, y, z, t, a, b)
	t_1 = Float64(x + Float64(y * Float64(3.13060547623 + Float64(-1.0 * Float64(Float64(36.52704169880642 + Float64(-1.0 * Float64(Float64(457.9610022158428 + t) / z))) / z)))))
	tmp = 0.0
	if (z <= -5.2e+20)
		tmp = t_1;
	elseif (z <= 1060000.0)
		tmp = Float64(x + Float64(Float64(y * Float64(Float64(Float64(Float64(t * z) + a) * z) + b)) / fma(fma(fma(Float64(z + 15.234687407), z, 31.4690115749), z, 11.9400905721), z, 0.607771387771)));
	else
		tmp = t_1;
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x + N[(y * N[(3.13060547623 + N[(-1.0 * N[(N[(36.52704169880642 + N[(-1.0 * N[(N[(457.9610022158428 + t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -5.2e+20], t$95$1, If[LessEqual[z, 1060000.0], N[(x + N[(N[(y * N[(N[(N[(N[(t * z), $MachinePrecision] + a), $MachinePrecision] * z), $MachinePrecision] + b), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(N[(z + 15.234687407), $MachinePrecision] * z + 31.4690115749), $MachinePrecision] * z + 11.9400905721), $MachinePrecision] * z + 0.607771387771), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x + y \cdot \left(3.13060547623 + -1 \cdot \frac{36.52704169880642 + -1 \cdot \frac{457.9610022158428 + t}{z}}{z}\right)\\
\mathbf{if}\;z \leq -5.2 \cdot 10^{+20}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq 1060000:\\
\;\;\;\;x + \frac{y \cdot \left(\left(t \cdot z + a\right) \cdot z + b\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(z + 15.234687407, z, 31.4690115749\right), z, 11.9400905721\right), z, 0.607771387771\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -5.2e20 or 1.06e6 < z

    1. Initial program 59.2%

      \[x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771} \]
    2. Taylor expanded in z around -inf

      \[\leadsto x + \color{blue}{\left(-1 \cdot \frac{\left(\frac{-55833770631}{5000000000} \cdot y + -1 \cdot \frac{t \cdot y - \left(\frac{-15234687407}{1000000000} \cdot \left(\frac{-55833770631}{5000000000} \cdot y - \frac{-4769379582500641883561}{100000000000000000000} \cdot y\right) + \frac{98517059967927196814627}{1000000000000000000000} \cdot y\right)}{z}\right) - \frac{-4769379582500641883561}{100000000000000000000} \cdot y}{z} + \frac{313060547623}{100000000000} \cdot y\right)} \]
    3. Applied rewrites51.4%

      \[\leadsto x + \color{blue}{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-11.1667541262, y, -1 \cdot \frac{t \cdot y - \mathsf{fma}\left(-15.234687407, -11.1667541262 \cdot y - -47.69379582500642 \cdot y, 98.5170599679272 \cdot y\right)}{z}\right) - -47.69379582500642 \cdot y}{z}, 3.13060547623 \cdot y\right)} \]
    4. Taylor expanded in y around 0

      \[\leadsto x + y \cdot \color{blue}{\left(\frac{313060547623}{100000000000} + -1 \cdot \frac{\frac{3652704169880641883561}{100000000000000000000} + -1 \cdot \frac{\frac{45796100221584283915100827016327}{100000000000000000000000000000} + t}{z}}{z}\right)} \]
    5. Applied rewrites55.4%

      \[\leadsto x + y \cdot \color{blue}{\left(3.13060547623 + -1 \cdot \frac{36.52704169880642 + -1 \cdot \frac{457.9610022158428 + t}{z}}{z}\right)} \]

    if -5.2e20 < z < 1.06e6

    1. Initial program 59.2%

      \[x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771} \]
    2. Taylor expanded in z around 0

      \[\leadsto x + \frac{y \cdot \left(\left(\color{blue}{t} \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + \frac{15234687407}{1000000000}\right) \cdot z + \frac{314690115749}{10000000000}\right) \cdot z + \frac{119400905721}{10000000000}\right) \cdot z + \frac{607771387771}{1000000000000}} \]
    3. Applied rewrites62.8%

      \[\leadsto x + \frac{y \cdot \left(\left(\color{blue}{t} \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771} \]
    4. Applied rewrites62.8%

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

Alternative 5: 96.0% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x + y \cdot \left(3.13060547623 + -1 \cdot \frac{36.52704169880642 + -1 \cdot \frac{457.9610022158428 + t}{z}}{z}\right)\\ \mathbf{if}\;z \leq -4100000000:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 2950:\\ \;\;\;\;x + \frac{y \cdot \left(\left(t \cdot z + a\right) \cdot z + b\right)}{11.9400905721 \cdot z + 0.607771387771}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1
         (+
          x
          (*
           y
           (+
            3.13060547623
            (*
             -1.0
             (/
              (+ 36.52704169880642 (* -1.0 (/ (+ 457.9610022158428 t) z)))
              z)))))))
   (if (<= z -4100000000.0)
     t_1
     (if (<= z 2950.0)
       (+
        x
        (/
         (* y (+ (* (+ (* t z) a) z) b))
         (+ (* 11.9400905721 z) 0.607771387771)))
       t_1))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = x + (y * (3.13060547623 + (-1.0 * ((36.52704169880642 + (-1.0 * ((457.9610022158428 + t) / z))) / z))));
	double tmp;
	if (z <= -4100000000.0) {
		tmp = t_1;
	} else if (z <= 2950.0) {
		tmp = x + ((y * ((((t * z) + a) * z) + b)) / ((11.9400905721 * z) + 0.607771387771));
	} else {
		tmp = t_1;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y, z, t, a, b)
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 = x + (y * (3.13060547623d0 + ((-1.0d0) * ((36.52704169880642d0 + ((-1.0d0) * ((457.9610022158428d0 + t) / z))) / z))))
    if (z <= (-4100000000.0d0)) then
        tmp = t_1
    else if (z <= 2950.0d0) then
        tmp = x + ((y * ((((t * z) + a) * z) + b)) / ((11.9400905721d0 * z) + 0.607771387771d0))
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = x + (y * (3.13060547623 + (-1.0 * ((36.52704169880642 + (-1.0 * ((457.9610022158428 + t) / z))) / z))));
	double tmp;
	if (z <= -4100000000.0) {
		tmp = t_1;
	} else if (z <= 2950.0) {
		tmp = x + ((y * ((((t * z) + a) * z) + b)) / ((11.9400905721 * z) + 0.607771387771));
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	t_1 = x + (y * (3.13060547623 + (-1.0 * ((36.52704169880642 + (-1.0 * ((457.9610022158428 + t) / z))) / z))))
	tmp = 0
	if z <= -4100000000.0:
		tmp = t_1
	elif z <= 2950.0:
		tmp = x + ((y * ((((t * z) + a) * z) + b)) / ((11.9400905721 * z) + 0.607771387771))
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a, b)
	t_1 = Float64(x + Float64(y * Float64(3.13060547623 + Float64(-1.0 * Float64(Float64(36.52704169880642 + Float64(-1.0 * Float64(Float64(457.9610022158428 + t) / z))) / z)))))
	tmp = 0.0
	if (z <= -4100000000.0)
		tmp = t_1;
	elseif (z <= 2950.0)
		tmp = Float64(x + Float64(Float64(y * Float64(Float64(Float64(Float64(t * z) + a) * z) + b)) / Float64(Float64(11.9400905721 * z) + 0.607771387771)));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	t_1 = x + (y * (3.13060547623 + (-1.0 * ((36.52704169880642 + (-1.0 * ((457.9610022158428 + t) / z))) / z))));
	tmp = 0.0;
	if (z <= -4100000000.0)
		tmp = t_1;
	elseif (z <= 2950.0)
		tmp = x + ((y * ((((t * z) + a) * z) + b)) / ((11.9400905721 * z) + 0.607771387771));
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x + N[(y * N[(3.13060547623 + N[(-1.0 * N[(N[(36.52704169880642 + N[(-1.0 * N[(N[(457.9610022158428 + t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4100000000.0], t$95$1, If[LessEqual[z, 2950.0], N[(x + N[(N[(y * N[(N[(N[(N[(t * z), $MachinePrecision] + a), $MachinePrecision] * z), $MachinePrecision] + b), $MachinePrecision]), $MachinePrecision] / N[(N[(11.9400905721 * z), $MachinePrecision] + 0.607771387771), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x + y \cdot \left(3.13060547623 + -1 \cdot \frac{36.52704169880642 + -1 \cdot \frac{457.9610022158428 + t}{z}}{z}\right)\\
\mathbf{if}\;z \leq -4100000000:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq 2950:\\
\;\;\;\;x + \frac{y \cdot \left(\left(t \cdot z + a\right) \cdot z + b\right)}{11.9400905721 \cdot z + 0.607771387771}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -4.1e9 or 2950 < z

    1. Initial program 59.2%

      \[x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771} \]
    2. Taylor expanded in z around -inf

      \[\leadsto x + \color{blue}{\left(-1 \cdot \frac{\left(\frac{-55833770631}{5000000000} \cdot y + -1 \cdot \frac{t \cdot y - \left(\frac{-15234687407}{1000000000} \cdot \left(\frac{-55833770631}{5000000000} \cdot y - \frac{-4769379582500641883561}{100000000000000000000} \cdot y\right) + \frac{98517059967927196814627}{1000000000000000000000} \cdot y\right)}{z}\right) - \frac{-4769379582500641883561}{100000000000000000000} \cdot y}{z} + \frac{313060547623}{100000000000} \cdot y\right)} \]
    3. Applied rewrites51.4%

      \[\leadsto x + \color{blue}{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-11.1667541262, y, -1 \cdot \frac{t \cdot y - \mathsf{fma}\left(-15.234687407, -11.1667541262 \cdot y - -47.69379582500642 \cdot y, 98.5170599679272 \cdot y\right)}{z}\right) - -47.69379582500642 \cdot y}{z}, 3.13060547623 \cdot y\right)} \]
    4. Taylor expanded in y around 0

      \[\leadsto x + y \cdot \color{blue}{\left(\frac{313060547623}{100000000000} + -1 \cdot \frac{\frac{3652704169880641883561}{100000000000000000000} + -1 \cdot \frac{\frac{45796100221584283915100827016327}{100000000000000000000000000000} + t}{z}}{z}\right)} \]
    5. Applied rewrites55.4%

      \[\leadsto x + y \cdot \color{blue}{\left(3.13060547623 + -1 \cdot \frac{36.52704169880642 + -1 \cdot \frac{457.9610022158428 + t}{z}}{z}\right)} \]

    if -4.1e9 < z < 2950

    1. Initial program 59.2%

      \[x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771} \]
    2. Taylor expanded in z around 0

      \[\leadsto x + \frac{y \cdot \left(\left(\color{blue}{t} \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + \frac{15234687407}{1000000000}\right) \cdot z + \frac{314690115749}{10000000000}\right) \cdot z + \frac{119400905721}{10000000000}\right) \cdot z + \frac{607771387771}{1000000000000}} \]
    3. Applied rewrites62.8%

      \[\leadsto x + \frac{y \cdot \left(\left(\color{blue}{t} \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771} \]
    4. Taylor expanded in z around 0

      \[\leadsto x + \frac{y \cdot \left(\left(t \cdot z + a\right) \cdot z + b\right)}{\color{blue}{\frac{119400905721}{10000000000}} \cdot z + \frac{607771387771}{1000000000000}} \]
    5. Applied rewrites58.9%

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

Alternative 6: 92.7% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -4100000000:\\ \;\;\;\;x + \mathsf{fma}\left(-1, \frac{-1 \cdot \frac{t \cdot y}{z}}{z}, 3.13060547623 \cdot y\right)\\ \mathbf{elif}\;z \leq 1050000:\\ \;\;\;\;x + \frac{y \cdot \left(\left(t \cdot z + a\right) \cdot z + b\right)}{11.9400905721 \cdot z + 0.607771387771}\\ \mathbf{else}:\\ \;\;\;\;x + \left(\mathsf{fma}\left(3.13060547623, y, 11.1667541262 \cdot \frac{y}{z}\right) - 47.69379582500642 \cdot \frac{y}{z}\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (<= z -4100000000.0)
   (+ x (fma -1.0 (/ (* -1.0 (/ (* t y) z)) z) (* 3.13060547623 y)))
   (if (<= z 1050000.0)
     (+
      x
      (/
       (* y (+ (* (+ (* t z) a) z) b))
       (+ (* 11.9400905721 z) 0.607771387771)))
     (+
      x
      (-
       (fma 3.13060547623 y (* 11.1667541262 (/ y z)))
       (* 47.69379582500642 (/ y z)))))))
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (z <= -4100000000.0) {
		tmp = x + fma(-1.0, ((-1.0 * ((t * y) / z)) / z), (3.13060547623 * y));
	} else if (z <= 1050000.0) {
		tmp = x + ((y * ((((t * z) + a) * z) + b)) / ((11.9400905721 * z) + 0.607771387771));
	} else {
		tmp = x + (fma(3.13060547623, y, (11.1667541262 * (y / z))) - (47.69379582500642 * (y / z)));
	}
	return tmp;
}
function code(x, y, z, t, a, b)
	tmp = 0.0
	if (z <= -4100000000.0)
		tmp = Float64(x + fma(-1.0, Float64(Float64(-1.0 * Float64(Float64(t * y) / z)) / z), Float64(3.13060547623 * y)));
	elseif (z <= 1050000.0)
		tmp = Float64(x + Float64(Float64(y * Float64(Float64(Float64(Float64(t * z) + a) * z) + b)) / Float64(Float64(11.9400905721 * z) + 0.607771387771)));
	else
		tmp = Float64(x + Float64(fma(3.13060547623, y, Float64(11.1667541262 * Float64(y / z))) - Float64(47.69379582500642 * Float64(y / z))));
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -4100000000.0], N[(x + N[(-1.0 * N[(N[(-1.0 * N[(N[(t * y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision] + N[(3.13060547623 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1050000.0], N[(x + N[(N[(y * N[(N[(N[(N[(t * z), $MachinePrecision] + a), $MachinePrecision] * z), $MachinePrecision] + b), $MachinePrecision]), $MachinePrecision] / N[(N[(11.9400905721 * z), $MachinePrecision] + 0.607771387771), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(3.13060547623 * y + N[(11.1667541262 * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(47.69379582500642 * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -4100000000:\\
\;\;\;\;x + \mathsf{fma}\left(-1, \frac{-1 \cdot \frac{t \cdot y}{z}}{z}, 3.13060547623 \cdot y\right)\\

\mathbf{elif}\;z \leq 1050000:\\
\;\;\;\;x + \frac{y \cdot \left(\left(t \cdot z + a\right) \cdot z + b\right)}{11.9400905721 \cdot z + 0.607771387771}\\

\mathbf{else}:\\
\;\;\;\;x + \left(\mathsf{fma}\left(3.13060547623, y, 11.1667541262 \cdot \frac{y}{z}\right) - 47.69379582500642 \cdot \frac{y}{z}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -4.1e9

    1. Initial program 59.2%

      \[x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771} \]
    2. Taylor expanded in z around -inf

      \[\leadsto x + \color{blue}{\left(-1 \cdot \frac{\left(\frac{-55833770631}{5000000000} \cdot y + -1 \cdot \frac{t \cdot y - \left(\frac{-15234687407}{1000000000} \cdot \left(\frac{-55833770631}{5000000000} \cdot y - \frac{-4769379582500641883561}{100000000000000000000} \cdot y\right) + \frac{98517059967927196814627}{1000000000000000000000} \cdot y\right)}{z}\right) - \frac{-4769379582500641883561}{100000000000000000000} \cdot y}{z} + \frac{313060547623}{100000000000} \cdot y\right)} \]
    3. Applied rewrites51.4%

      \[\leadsto x + \color{blue}{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-11.1667541262, y, -1 \cdot \frac{t \cdot y - \mathsf{fma}\left(-15.234687407, -11.1667541262 \cdot y - -47.69379582500642 \cdot y, 98.5170599679272 \cdot y\right)}{z}\right) - -47.69379582500642 \cdot y}{z}, 3.13060547623 \cdot y\right)} \]
    4. Taylor expanded in t around inf

      \[\leadsto x + \mathsf{fma}\left(-1, \frac{-1 \cdot \frac{t \cdot y}{z}}{z}, \frac{313060547623}{100000000000} \cdot y\right) \]
    5. Applied rewrites53.9%

      \[\leadsto x + \mathsf{fma}\left(-1, \frac{-1 \cdot \frac{t \cdot y}{z}}{z}, 3.13060547623 \cdot y\right) \]

    if -4.1e9 < z < 1.05e6

    1. Initial program 59.2%

      \[x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771} \]
    2. Taylor expanded in z around 0

      \[\leadsto x + \frac{y \cdot \left(\left(\color{blue}{t} \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + \frac{15234687407}{1000000000}\right) \cdot z + \frac{314690115749}{10000000000}\right) \cdot z + \frac{119400905721}{10000000000}\right) \cdot z + \frac{607771387771}{1000000000000}} \]
    3. Applied rewrites62.8%

      \[\leadsto x + \frac{y \cdot \left(\left(\color{blue}{t} \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771} \]
    4. Taylor expanded in z around 0

      \[\leadsto x + \frac{y \cdot \left(\left(t \cdot z + a\right) \cdot z + b\right)}{\color{blue}{\frac{119400905721}{10000000000}} \cdot z + \frac{607771387771}{1000000000000}} \]
    5. Applied rewrites58.9%

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

    if 1.05e6 < z

    1. Initial program 59.2%

      \[x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771} \]
    2. Taylor expanded in z around inf

      \[\leadsto x + \color{blue}{\left(\left(\frac{313060547623}{100000000000} \cdot y + \frac{55833770631}{5000000000} \cdot \frac{y}{z}\right) - \frac{4769379582500641883561}{100000000000000000000} \cdot \frac{y}{z}\right)} \]
    3. Applied rewrites56.0%

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

Alternative 7: 92.7% accurate, 1.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -2.16 \cdot 10^{+17}:\\ \;\;\;\;x + \mathsf{fma}\left(-1, \frac{-1 \cdot \frac{t \cdot y}{z}}{z}, 3.13060547623 \cdot y\right)\\ \mathbf{elif}\;z \leq 1050000:\\ \;\;\;\;x + \frac{y \cdot \left(\left(t \cdot z + a\right) \cdot z + b\right)}{0.607771387771}\\ \mathbf{else}:\\ \;\;\;\;x + \left(\mathsf{fma}\left(3.13060547623, y, 11.1667541262 \cdot \frac{y}{z}\right) - 47.69379582500642 \cdot \frac{y}{z}\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (<= z -2.16e+17)
   (+ x (fma -1.0 (/ (* -1.0 (/ (* t y) z)) z) (* 3.13060547623 y)))
   (if (<= z 1050000.0)
     (+ x (/ (* y (+ (* (+ (* t z) a) z) b)) 0.607771387771))
     (+
      x
      (-
       (fma 3.13060547623 y (* 11.1667541262 (/ y z)))
       (* 47.69379582500642 (/ y z)))))))
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (z <= -2.16e+17) {
		tmp = x + fma(-1.0, ((-1.0 * ((t * y) / z)) / z), (3.13060547623 * y));
	} else if (z <= 1050000.0) {
		tmp = x + ((y * ((((t * z) + a) * z) + b)) / 0.607771387771);
	} else {
		tmp = x + (fma(3.13060547623, y, (11.1667541262 * (y / z))) - (47.69379582500642 * (y / z)));
	}
	return tmp;
}
function code(x, y, z, t, a, b)
	tmp = 0.0
	if (z <= -2.16e+17)
		tmp = Float64(x + fma(-1.0, Float64(Float64(-1.0 * Float64(Float64(t * y) / z)) / z), Float64(3.13060547623 * y)));
	elseif (z <= 1050000.0)
		tmp = Float64(x + Float64(Float64(y * Float64(Float64(Float64(Float64(t * z) + a) * z) + b)) / 0.607771387771));
	else
		tmp = Float64(x + Float64(fma(3.13060547623, y, Float64(11.1667541262 * Float64(y / z))) - Float64(47.69379582500642 * Float64(y / z))));
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -2.16e+17], N[(x + N[(-1.0 * N[(N[(-1.0 * N[(N[(t * y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision] + N[(3.13060547623 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1050000.0], N[(x + N[(N[(y * N[(N[(N[(N[(t * z), $MachinePrecision] + a), $MachinePrecision] * z), $MachinePrecision] + b), $MachinePrecision]), $MachinePrecision] / 0.607771387771), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(3.13060547623 * y + N[(11.1667541262 * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(47.69379582500642 * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.16 \cdot 10^{+17}:\\
\;\;\;\;x + \mathsf{fma}\left(-1, \frac{-1 \cdot \frac{t \cdot y}{z}}{z}, 3.13060547623 \cdot y\right)\\

\mathbf{elif}\;z \leq 1050000:\\
\;\;\;\;x + \frac{y \cdot \left(\left(t \cdot z + a\right) \cdot z + b\right)}{0.607771387771}\\

\mathbf{else}:\\
\;\;\;\;x + \left(\mathsf{fma}\left(3.13060547623, y, 11.1667541262 \cdot \frac{y}{z}\right) - 47.69379582500642 \cdot \frac{y}{z}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -2.16e17

    1. Initial program 59.2%

      \[x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771} \]
    2. Taylor expanded in z around -inf

      \[\leadsto x + \color{blue}{\left(-1 \cdot \frac{\left(\frac{-55833770631}{5000000000} \cdot y + -1 \cdot \frac{t \cdot y - \left(\frac{-15234687407}{1000000000} \cdot \left(\frac{-55833770631}{5000000000} \cdot y - \frac{-4769379582500641883561}{100000000000000000000} \cdot y\right) + \frac{98517059967927196814627}{1000000000000000000000} \cdot y\right)}{z}\right) - \frac{-4769379582500641883561}{100000000000000000000} \cdot y}{z} + \frac{313060547623}{100000000000} \cdot y\right)} \]
    3. Applied rewrites51.4%

      \[\leadsto x + \color{blue}{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-11.1667541262, y, -1 \cdot \frac{t \cdot y - \mathsf{fma}\left(-15.234687407, -11.1667541262 \cdot y - -47.69379582500642 \cdot y, 98.5170599679272 \cdot y\right)}{z}\right) - -47.69379582500642 \cdot y}{z}, 3.13060547623 \cdot y\right)} \]
    4. Taylor expanded in t around inf

      \[\leadsto x + \mathsf{fma}\left(-1, \frac{-1 \cdot \frac{t \cdot y}{z}}{z}, \frac{313060547623}{100000000000} \cdot y\right) \]
    5. Applied rewrites53.9%

      \[\leadsto x + \mathsf{fma}\left(-1, \frac{-1 \cdot \frac{t \cdot y}{z}}{z}, 3.13060547623 \cdot y\right) \]

    if -2.16e17 < z < 1.05e6

    1. Initial program 59.2%

      \[x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771} \]
    2. Taylor expanded in z around 0

      \[\leadsto x + \frac{y \cdot \left(\left(\color{blue}{t} \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + \frac{15234687407}{1000000000}\right) \cdot z + \frac{314690115749}{10000000000}\right) \cdot z + \frac{119400905721}{10000000000}\right) \cdot z + \frac{607771387771}{1000000000000}} \]
    3. Applied rewrites62.8%

      \[\leadsto x + \frac{y \cdot \left(\left(\color{blue}{t} \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771} \]
    4. Taylor expanded in z around 0

      \[\leadsto x + \frac{y \cdot \left(\left(t \cdot z + a\right) \cdot z + b\right)}{\color{blue}{\frac{607771387771}{1000000000000}}} \]
    5. Applied rewrites57.8%

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

    if 1.05e6 < z

    1. Initial program 59.2%

      \[x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771} \]
    2. Taylor expanded in z around inf

      \[\leadsto x + \color{blue}{\left(\left(\frac{313060547623}{100000000000} \cdot y + \frac{55833770631}{5000000000} \cdot \frac{y}{z}\right) - \frac{4769379582500641883561}{100000000000000000000} \cdot \frac{y}{z}\right)} \]
    3. Applied rewrites56.0%

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

Alternative 8: 91.9% accurate, 1.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.5 \cdot 10^{+18}:\\
\;\;\;\;x + 3.13060547623 \cdot y\\

\mathbf{elif}\;z \leq 1050000:\\
\;\;\;\;x + \frac{y \cdot \left(\left(t \cdot z + a\right) \cdot z + b\right)}{0.607771387771}\\

\mathbf{else}:\\
\;\;\;\;x + \left(\mathsf{fma}\left(3.13060547623, y, 11.1667541262 \cdot \frac{y}{z}\right) - 47.69379582500642 \cdot \frac{y}{z}\right)\\


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

    1. Initial program 59.2%

      \[x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771} \]
    2. Taylor expanded in z around inf

      \[\leadsto x + \color{blue}{\frac{313060547623}{100000000000} \cdot y} \]
    3. Applied rewrites62.4%

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

    if -4.5e18 < z < 1.05e6

    1. Initial program 59.2%

      \[x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771} \]
    2. Taylor expanded in z around 0

      \[\leadsto x + \frac{y \cdot \left(\left(\color{blue}{t} \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + \frac{15234687407}{1000000000}\right) \cdot z + \frac{314690115749}{10000000000}\right) \cdot z + \frac{119400905721}{10000000000}\right) \cdot z + \frac{607771387771}{1000000000000}} \]
    3. Applied rewrites62.8%

      \[\leadsto x + \frac{y \cdot \left(\left(\color{blue}{t} \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771} \]
    4. Taylor expanded in z around 0

      \[\leadsto x + \frac{y \cdot \left(\left(t \cdot z + a\right) \cdot z + b\right)}{\color{blue}{\frac{607771387771}{1000000000000}}} \]
    5. Applied rewrites57.8%

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

    if 1.05e6 < z

    1. Initial program 59.2%

      \[x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771} \]
    2. Taylor expanded in z around inf

      \[\leadsto x + \color{blue}{\left(\left(\frac{313060547623}{100000000000} \cdot y + \frac{55833770631}{5000000000} \cdot \frac{y}{z}\right) - \frac{4769379582500641883561}{100000000000000000000} \cdot \frac{y}{z}\right)} \]
    3. Applied rewrites56.0%

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

Alternative 9: 91.7% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -4.5 \cdot 10^{+18}:\\ \;\;\;\;x + 3.13060547623 \cdot y\\ \mathbf{elif}\;z \leq 1050000:\\ \;\;\;\;x + \frac{y \cdot \left(\left(t \cdot z + a\right) \cdot z + b\right)}{0.607771387771}\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \left(3.13060547623 - 36.52704169880642 \cdot \frac{1}{z}\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (<= z -4.5e+18)
   (+ x (* 3.13060547623 y))
   (if (<= z 1050000.0)
     (+ x (/ (* y (+ (* (+ (* t z) a) z) b)) 0.607771387771))
     (+ x (* y (- 3.13060547623 (* 36.52704169880642 (/ 1.0 z))))))))
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (z <= -4.5e+18) {
		tmp = x + (3.13060547623 * y);
	} else if (z <= 1050000.0) {
		tmp = x + ((y * ((((t * z) + a) * z) + b)) / 0.607771387771);
	} else {
		tmp = x + (y * (3.13060547623 - (36.52704169880642 * (1.0 / z))));
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y, z, t, a, b)
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) :: tmp
    if (z <= (-4.5d+18)) then
        tmp = x + (3.13060547623d0 * y)
    else if (z <= 1050000.0d0) then
        tmp = x + ((y * ((((t * z) + a) * z) + b)) / 0.607771387771d0)
    else
        tmp = x + (y * (3.13060547623d0 - (36.52704169880642d0 * (1.0d0 / z))))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (z <= -4.5e+18) {
		tmp = x + (3.13060547623 * y);
	} else if (z <= 1050000.0) {
		tmp = x + ((y * ((((t * z) + a) * z) + b)) / 0.607771387771);
	} else {
		tmp = x + (y * (3.13060547623 - (36.52704169880642 * (1.0 / z))));
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	tmp = 0
	if z <= -4.5e+18:
		tmp = x + (3.13060547623 * y)
	elif z <= 1050000.0:
		tmp = x + ((y * ((((t * z) + a) * z) + b)) / 0.607771387771)
	else:
		tmp = x + (y * (3.13060547623 - (36.52704169880642 * (1.0 / z))))
	return tmp
function code(x, y, z, t, a, b)
	tmp = 0.0
	if (z <= -4.5e+18)
		tmp = Float64(x + Float64(3.13060547623 * y));
	elseif (z <= 1050000.0)
		tmp = Float64(x + Float64(Float64(y * Float64(Float64(Float64(Float64(t * z) + a) * z) + b)) / 0.607771387771));
	else
		tmp = Float64(x + Float64(y * Float64(3.13060547623 - Float64(36.52704169880642 * Float64(1.0 / z)))));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	tmp = 0.0;
	if (z <= -4.5e+18)
		tmp = x + (3.13060547623 * y);
	elseif (z <= 1050000.0)
		tmp = x + ((y * ((((t * z) + a) * z) + b)) / 0.607771387771);
	else
		tmp = x + (y * (3.13060547623 - (36.52704169880642 * (1.0 / z))));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -4.5e+18], N[(x + N[(3.13060547623 * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1050000.0], N[(x + N[(N[(y * N[(N[(N[(N[(t * z), $MachinePrecision] + a), $MachinePrecision] * z), $MachinePrecision] + b), $MachinePrecision]), $MachinePrecision] / 0.607771387771), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(3.13060547623 - N[(36.52704169880642 * N[(1.0 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.5 \cdot 10^{+18}:\\
\;\;\;\;x + 3.13060547623 \cdot y\\

\mathbf{elif}\;z \leq 1050000:\\
\;\;\;\;x + \frac{y \cdot \left(\left(t \cdot z + a\right) \cdot z + b\right)}{0.607771387771}\\

\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(3.13060547623 - 36.52704169880642 \cdot \frac{1}{z}\right)\\


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

    1. Initial program 59.2%

      \[x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771} \]
    2. Taylor expanded in z around inf

      \[\leadsto x + \color{blue}{\frac{313060547623}{100000000000} \cdot y} \]
    3. Applied rewrites62.4%

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

    if -4.5e18 < z < 1.05e6

    1. Initial program 59.2%

      \[x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771} \]
    2. Taylor expanded in z around 0

      \[\leadsto x + \frac{y \cdot \left(\left(\color{blue}{t} \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + \frac{15234687407}{1000000000}\right) \cdot z + \frac{314690115749}{10000000000}\right) \cdot z + \frac{119400905721}{10000000000}\right) \cdot z + \frac{607771387771}{1000000000000}} \]
    3. Applied rewrites62.8%

      \[\leadsto x + \frac{y \cdot \left(\left(\color{blue}{t} \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771} \]
    4. Taylor expanded in z around 0

      \[\leadsto x + \frac{y \cdot \left(\left(t \cdot z + a\right) \cdot z + b\right)}{\color{blue}{\frac{607771387771}{1000000000000}}} \]
    5. Applied rewrites57.8%

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

    if 1.05e6 < z

    1. Initial program 59.2%

      \[x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771} \]
    2. Taylor expanded in z around -inf

      \[\leadsto x + \color{blue}{\left(-1 \cdot \frac{\frac{-55833770631}{5000000000} \cdot y - \frac{-4769379582500641883561}{100000000000000000000} \cdot y}{z} + \frac{313060547623}{100000000000} \cdot y\right)} \]
    3. Applied rewrites58.4%

      \[\leadsto x + \color{blue}{\mathsf{fma}\left(-1, \frac{-11.1667541262 \cdot y - -47.69379582500642 \cdot y}{z}, 3.13060547623 \cdot y\right)} \]
    4. Taylor expanded in y around 0

      \[\leadsto x + y \cdot \color{blue}{\left(\frac{313060547623}{100000000000} - \frac{3652704169880641883561}{100000000000000000000} \cdot \frac{1}{z}\right)} \]
    5. Applied rewrites58.5%

      \[\leadsto x + y \cdot \color{blue}{\left(3.13060547623 - 36.52704169880642 \cdot \frac{1}{z}\right)} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 10: 89.8% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -5.5 \cdot 10^{+20}:\\ \;\;\;\;x + 3.13060547623 \cdot y\\ \mathbf{elif}\;z \leq 1050000:\\ \;\;\;\;x + \frac{y \cdot \left(a \cdot z + b\right)}{11.9400905721 \cdot z + 0.607771387771}\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \left(3.13060547623 - 36.52704169880642 \cdot \frac{1}{z}\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (<= z -5.5e+20)
   (+ x (* 3.13060547623 y))
   (if (<= z 1050000.0)
     (+ x (/ (* y (+ (* a z) b)) (+ (* 11.9400905721 z) 0.607771387771)))
     (+ x (* y (- 3.13060547623 (* 36.52704169880642 (/ 1.0 z))))))))
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (z <= -5.5e+20) {
		tmp = x + (3.13060547623 * y);
	} else if (z <= 1050000.0) {
		tmp = x + ((y * ((a * z) + b)) / ((11.9400905721 * z) + 0.607771387771));
	} else {
		tmp = x + (y * (3.13060547623 - (36.52704169880642 * (1.0 / z))));
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y, z, t, a, b)
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) :: tmp
    if (z <= (-5.5d+20)) then
        tmp = x + (3.13060547623d0 * y)
    else if (z <= 1050000.0d0) then
        tmp = x + ((y * ((a * z) + b)) / ((11.9400905721d0 * z) + 0.607771387771d0))
    else
        tmp = x + (y * (3.13060547623d0 - (36.52704169880642d0 * (1.0d0 / z))))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (z <= -5.5e+20) {
		tmp = x + (3.13060547623 * y);
	} else if (z <= 1050000.0) {
		tmp = x + ((y * ((a * z) + b)) / ((11.9400905721 * z) + 0.607771387771));
	} else {
		tmp = x + (y * (3.13060547623 - (36.52704169880642 * (1.0 / z))));
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	tmp = 0
	if z <= -5.5e+20:
		tmp = x + (3.13060547623 * y)
	elif z <= 1050000.0:
		tmp = x + ((y * ((a * z) + b)) / ((11.9400905721 * z) + 0.607771387771))
	else:
		tmp = x + (y * (3.13060547623 - (36.52704169880642 * (1.0 / z))))
	return tmp
function code(x, y, z, t, a, b)
	tmp = 0.0
	if (z <= -5.5e+20)
		tmp = Float64(x + Float64(3.13060547623 * y));
	elseif (z <= 1050000.0)
		tmp = Float64(x + Float64(Float64(y * Float64(Float64(a * z) + b)) / Float64(Float64(11.9400905721 * z) + 0.607771387771)));
	else
		tmp = Float64(x + Float64(y * Float64(3.13060547623 - Float64(36.52704169880642 * Float64(1.0 / z)))));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	tmp = 0.0;
	if (z <= -5.5e+20)
		tmp = x + (3.13060547623 * y);
	elseif (z <= 1050000.0)
		tmp = x + ((y * ((a * z) + b)) / ((11.9400905721 * z) + 0.607771387771));
	else
		tmp = x + (y * (3.13060547623 - (36.52704169880642 * (1.0 / z))));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -5.5e+20], N[(x + N[(3.13060547623 * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1050000.0], N[(x + N[(N[(y * N[(N[(a * z), $MachinePrecision] + b), $MachinePrecision]), $MachinePrecision] / N[(N[(11.9400905721 * z), $MachinePrecision] + 0.607771387771), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(3.13060547623 - N[(36.52704169880642 * N[(1.0 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.5 \cdot 10^{+20}:\\
\;\;\;\;x + 3.13060547623 \cdot y\\

\mathbf{elif}\;z \leq 1050000:\\
\;\;\;\;x + \frac{y \cdot \left(a \cdot z + b\right)}{11.9400905721 \cdot z + 0.607771387771}\\

\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(3.13060547623 - 36.52704169880642 \cdot \frac{1}{z}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -5.5e20

    1. Initial program 59.2%

      \[x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771} \]
    2. Taylor expanded in z around inf

      \[\leadsto x + \color{blue}{\frac{313060547623}{100000000000} \cdot y} \]
    3. Applied rewrites62.4%

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

    if -5.5e20 < z < 1.05e6

    1. Initial program 59.2%

      \[x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771} \]
    2. Taylor expanded in z around 0

      \[\leadsto x + \frac{y \cdot \left(\left(\color{blue}{t} \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + \frac{15234687407}{1000000000}\right) \cdot z + \frac{314690115749}{10000000000}\right) \cdot z + \frac{119400905721}{10000000000}\right) \cdot z + \frac{607771387771}{1000000000000}} \]
    3. Applied rewrites62.8%

      \[\leadsto x + \frac{y \cdot \left(\left(\color{blue}{t} \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771} \]
    4. Taylor expanded in z around 0

      \[\leadsto x + \frac{y \cdot \left(\left(t \cdot z + a\right) \cdot z + b\right)}{\color{blue}{\frac{119400905721}{10000000000}} \cdot z + \frac{607771387771}{1000000000000}} \]
    5. Applied rewrites58.9%

      \[\leadsto x + \frac{y \cdot \left(\left(t \cdot z + a\right) \cdot z + b\right)}{\color{blue}{11.9400905721} \cdot z + 0.607771387771} \]
    6. Taylor expanded in z around 0

      \[\leadsto x + \frac{y \cdot \left(\color{blue}{a} \cdot z + b\right)}{\frac{119400905721}{10000000000} \cdot z + \frac{607771387771}{1000000000000}} \]
    7. Applied rewrites63.3%

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

    if 1.05e6 < z

    1. Initial program 59.2%

      \[x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771} \]
    2. Taylor expanded in z around -inf

      \[\leadsto x + \color{blue}{\left(-1 \cdot \frac{\frac{-55833770631}{5000000000} \cdot y - \frac{-4769379582500641883561}{100000000000000000000} \cdot y}{z} + \frac{313060547623}{100000000000} \cdot y\right)} \]
    3. Applied rewrites58.4%

      \[\leadsto x + \color{blue}{\mathsf{fma}\left(-1, \frac{-11.1667541262 \cdot y - -47.69379582500642 \cdot y}{z}, 3.13060547623 \cdot y\right)} \]
    4. Taylor expanded in y around 0

      \[\leadsto x + y \cdot \color{blue}{\left(\frac{313060547623}{100000000000} - \frac{3652704169880641883561}{100000000000000000000} \cdot \frac{1}{z}\right)} \]
    5. Applied rewrites58.5%

      \[\leadsto x + y \cdot \color{blue}{\left(3.13060547623 - 36.52704169880642 \cdot \frac{1}{z}\right)} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 11: 89.8% accurate, 2.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -1.55 \cdot 10^{+16}:\\ \;\;\;\;x + 3.13060547623 \cdot y\\ \mathbf{elif}\;z \leq 900000:\\ \;\;\;\;x + \frac{y \cdot \left(a \cdot z + b\right)}{0.607771387771}\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \left(3.13060547623 - 36.52704169880642 \cdot \frac{1}{z}\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (<= z -1.55e+16)
   (+ x (* 3.13060547623 y))
   (if (<= z 900000.0)
     (+ x (/ (* y (+ (* a z) b)) 0.607771387771))
     (+ x (* y (- 3.13060547623 (* 36.52704169880642 (/ 1.0 z))))))))
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (z <= -1.55e+16) {
		tmp = x + (3.13060547623 * y);
	} else if (z <= 900000.0) {
		tmp = x + ((y * ((a * z) + b)) / 0.607771387771);
	} else {
		tmp = x + (y * (3.13060547623 - (36.52704169880642 * (1.0 / z))));
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y, z, t, a, b)
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) :: tmp
    if (z <= (-1.55d+16)) then
        tmp = x + (3.13060547623d0 * y)
    else if (z <= 900000.0d0) then
        tmp = x + ((y * ((a * z) + b)) / 0.607771387771d0)
    else
        tmp = x + (y * (3.13060547623d0 - (36.52704169880642d0 * (1.0d0 / z))))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (z <= -1.55e+16) {
		tmp = x + (3.13060547623 * y);
	} else if (z <= 900000.0) {
		tmp = x + ((y * ((a * z) + b)) / 0.607771387771);
	} else {
		tmp = x + (y * (3.13060547623 - (36.52704169880642 * (1.0 / z))));
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	tmp = 0
	if z <= -1.55e+16:
		tmp = x + (3.13060547623 * y)
	elif z <= 900000.0:
		tmp = x + ((y * ((a * z) + b)) / 0.607771387771)
	else:
		tmp = x + (y * (3.13060547623 - (36.52704169880642 * (1.0 / z))))
	return tmp
function code(x, y, z, t, a, b)
	tmp = 0.0
	if (z <= -1.55e+16)
		tmp = Float64(x + Float64(3.13060547623 * y));
	elseif (z <= 900000.0)
		tmp = Float64(x + Float64(Float64(y * Float64(Float64(a * z) + b)) / 0.607771387771));
	else
		tmp = Float64(x + Float64(y * Float64(3.13060547623 - Float64(36.52704169880642 * Float64(1.0 / z)))));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	tmp = 0.0;
	if (z <= -1.55e+16)
		tmp = x + (3.13060547623 * y);
	elseif (z <= 900000.0)
		tmp = x + ((y * ((a * z) + b)) / 0.607771387771);
	else
		tmp = x + (y * (3.13060547623 - (36.52704169880642 * (1.0 / z))));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -1.55e+16], N[(x + N[(3.13060547623 * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 900000.0], N[(x + N[(N[(y * N[(N[(a * z), $MachinePrecision] + b), $MachinePrecision]), $MachinePrecision] / 0.607771387771), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(3.13060547623 - N[(36.52704169880642 * N[(1.0 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.55 \cdot 10^{+16}:\\
\;\;\;\;x + 3.13060547623 \cdot y\\

\mathbf{elif}\;z \leq 900000:\\
\;\;\;\;x + \frac{y \cdot \left(a \cdot z + b\right)}{0.607771387771}\\

\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(3.13060547623 - 36.52704169880642 \cdot \frac{1}{z}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.55e16

    1. Initial program 59.2%

      \[x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771} \]
    2. Taylor expanded in z around inf

      \[\leadsto x + \color{blue}{\frac{313060547623}{100000000000} \cdot y} \]
    3. Applied rewrites62.4%

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

    if -1.55e16 < z < 9e5

    1. Initial program 59.2%

      \[x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771} \]
    2. Taylor expanded in z around 0

      \[\leadsto x + \frac{y \cdot \left(\left(\color{blue}{t} \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + \frac{15234687407}{1000000000}\right) \cdot z + \frac{314690115749}{10000000000}\right) \cdot z + \frac{119400905721}{10000000000}\right) \cdot z + \frac{607771387771}{1000000000000}} \]
    3. Applied rewrites62.8%

      \[\leadsto x + \frac{y \cdot \left(\left(\color{blue}{t} \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771} \]
    4. Taylor expanded in z around 0

      \[\leadsto x + \frac{y \cdot \left(\left(t \cdot z + a\right) \cdot z + b\right)}{\color{blue}{\frac{607771387771}{1000000000000}}} \]
    5. Applied rewrites57.8%

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

      \[\leadsto x + \frac{y \cdot \left(\color{blue}{a} \cdot z + b\right)}{\frac{607771387771}{1000000000000}} \]
    7. Applied rewrites60.1%

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

    if 9e5 < z

    1. Initial program 59.2%

      \[x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771} \]
    2. Taylor expanded in z around -inf

      \[\leadsto x + \color{blue}{\left(-1 \cdot \frac{\frac{-55833770631}{5000000000} \cdot y - \frac{-4769379582500641883561}{100000000000000000000} \cdot y}{z} + \frac{313060547623}{100000000000} \cdot y\right)} \]
    3. Applied rewrites58.4%

      \[\leadsto x + \color{blue}{\mathsf{fma}\left(-1, \frac{-11.1667541262 \cdot y - -47.69379582500642 \cdot y}{z}, 3.13060547623 \cdot y\right)} \]
    4. Taylor expanded in y around 0

      \[\leadsto x + y \cdot \color{blue}{\left(\frac{313060547623}{100000000000} - \frac{3652704169880641883561}{100000000000000000000} \cdot \frac{1}{z}\right)} \]
    5. Applied rewrites58.5%

      \[\leadsto x + y \cdot \color{blue}{\left(3.13060547623 - 36.52704169880642 \cdot \frac{1}{z}\right)} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 12: 83.1% accurate, 2.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -5.5 \cdot 10^{+20}:\\ \;\;\;\;x + 3.13060547623 \cdot y\\ \mathbf{elif}\;z \leq 1.75:\\ \;\;\;\;x + \frac{y \cdot b}{11.9400905721 \cdot z + 0.607771387771}\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \left(3.13060547623 - 36.52704169880642 \cdot \frac{1}{z}\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (<= z -5.5e+20)
   (+ x (* 3.13060547623 y))
   (if (<= z 1.75)
     (+ x (/ (* y b) (+ (* 11.9400905721 z) 0.607771387771)))
     (+ x (* y (- 3.13060547623 (* 36.52704169880642 (/ 1.0 z))))))))
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (z <= -5.5e+20) {
		tmp = x + (3.13060547623 * y);
	} else if (z <= 1.75) {
		tmp = x + ((y * b) / ((11.9400905721 * z) + 0.607771387771));
	} else {
		tmp = x + (y * (3.13060547623 - (36.52704169880642 * (1.0 / z))));
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y, z, t, a, b)
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) :: tmp
    if (z <= (-5.5d+20)) then
        tmp = x + (3.13060547623d0 * y)
    else if (z <= 1.75d0) then
        tmp = x + ((y * b) / ((11.9400905721d0 * z) + 0.607771387771d0))
    else
        tmp = x + (y * (3.13060547623d0 - (36.52704169880642d0 * (1.0d0 / z))))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (z <= -5.5e+20) {
		tmp = x + (3.13060547623 * y);
	} else if (z <= 1.75) {
		tmp = x + ((y * b) / ((11.9400905721 * z) + 0.607771387771));
	} else {
		tmp = x + (y * (3.13060547623 - (36.52704169880642 * (1.0 / z))));
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	tmp = 0
	if z <= -5.5e+20:
		tmp = x + (3.13060547623 * y)
	elif z <= 1.75:
		tmp = x + ((y * b) / ((11.9400905721 * z) + 0.607771387771))
	else:
		tmp = x + (y * (3.13060547623 - (36.52704169880642 * (1.0 / z))))
	return tmp
function code(x, y, z, t, a, b)
	tmp = 0.0
	if (z <= -5.5e+20)
		tmp = Float64(x + Float64(3.13060547623 * y));
	elseif (z <= 1.75)
		tmp = Float64(x + Float64(Float64(y * b) / Float64(Float64(11.9400905721 * z) + 0.607771387771)));
	else
		tmp = Float64(x + Float64(y * Float64(3.13060547623 - Float64(36.52704169880642 * Float64(1.0 / z)))));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	tmp = 0.0;
	if (z <= -5.5e+20)
		tmp = x + (3.13060547623 * y);
	elseif (z <= 1.75)
		tmp = x + ((y * b) / ((11.9400905721 * z) + 0.607771387771));
	else
		tmp = x + (y * (3.13060547623 - (36.52704169880642 * (1.0 / z))));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -5.5e+20], N[(x + N[(3.13060547623 * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.75], N[(x + N[(N[(y * b), $MachinePrecision] / N[(N[(11.9400905721 * z), $MachinePrecision] + 0.607771387771), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(3.13060547623 - N[(36.52704169880642 * N[(1.0 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.5 \cdot 10^{+20}:\\
\;\;\;\;x + 3.13060547623 \cdot y\\

\mathbf{elif}\;z \leq 1.75:\\
\;\;\;\;x + \frac{y \cdot b}{11.9400905721 \cdot z + 0.607771387771}\\

\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(3.13060547623 - 36.52704169880642 \cdot \frac{1}{z}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -5.5e20

    1. Initial program 59.2%

      \[x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771} \]
    2. Taylor expanded in z around inf

      \[\leadsto x + \color{blue}{\frac{313060547623}{100000000000} \cdot y} \]
    3. Applied rewrites62.4%

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

    if -5.5e20 < z < 1.75

    1. Initial program 59.2%

      \[x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771} \]
    2. Taylor expanded in z around 0

      \[\leadsto x + \frac{y \cdot \color{blue}{b}}{\left(\left(\left(z + \frac{15234687407}{1000000000}\right) \cdot z + \frac{314690115749}{10000000000}\right) \cdot z + \frac{119400905721}{10000000000}\right) \cdot z + \frac{607771387771}{1000000000000}} \]
    3. Applied rewrites64.7%

      \[\leadsto x + \frac{y \cdot \color{blue}{b}}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771} \]
    4. Taylor expanded in z around 0

      \[\leadsto x + \frac{y \cdot b}{\color{blue}{\frac{119400905721}{10000000000}} \cdot z + \frac{607771387771}{1000000000000}} \]
    5. Applied rewrites63.3%

      \[\leadsto x + \frac{y \cdot b}{\color{blue}{11.9400905721} \cdot z + 0.607771387771} \]

    if 1.75 < z

    1. Initial program 59.2%

      \[x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771} \]
    2. Taylor expanded in z around -inf

      \[\leadsto x + \color{blue}{\left(-1 \cdot \frac{\frac{-55833770631}{5000000000} \cdot y - \frac{-4769379582500641883561}{100000000000000000000} \cdot y}{z} + \frac{313060547623}{100000000000} \cdot y\right)} \]
    3. Applied rewrites58.4%

      \[\leadsto x + \color{blue}{\mathsf{fma}\left(-1, \frac{-11.1667541262 \cdot y - -47.69379582500642 \cdot y}{z}, 3.13060547623 \cdot y\right)} \]
    4. Taylor expanded in y around 0

      \[\leadsto x + y \cdot \color{blue}{\left(\frac{313060547623}{100000000000} - \frac{3652704169880641883561}{100000000000000000000} \cdot \frac{1}{z}\right)} \]
    5. Applied rewrites58.5%

      \[\leadsto x + y \cdot \color{blue}{\left(3.13060547623 - 36.52704169880642 \cdot \frac{1}{z}\right)} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 13: 83.1% accurate, 2.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -1.35 \cdot 10^{+16}:\\ \;\;\;\;x + 3.13060547623 \cdot y\\ \mathbf{elif}\;z \leq 1.75:\\ \;\;\;\;x + \left(y \cdot 1.6453555072203998\right) \cdot b\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \left(3.13060547623 - 36.52704169880642 \cdot \frac{1}{z}\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (<= z -1.35e+16)
   (+ x (* 3.13060547623 y))
   (if (<= z 1.75)
     (+ x (* (* y 1.6453555072203998) b))
     (+ x (* y (- 3.13060547623 (* 36.52704169880642 (/ 1.0 z))))))))
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (z <= -1.35e+16) {
		tmp = x + (3.13060547623 * y);
	} else if (z <= 1.75) {
		tmp = x + ((y * 1.6453555072203998) * b);
	} else {
		tmp = x + (y * (3.13060547623 - (36.52704169880642 * (1.0 / z))));
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y, z, t, a, b)
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) :: tmp
    if (z <= (-1.35d+16)) then
        tmp = x + (3.13060547623d0 * y)
    else if (z <= 1.75d0) then
        tmp = x + ((y * 1.6453555072203998d0) * b)
    else
        tmp = x + (y * (3.13060547623d0 - (36.52704169880642d0 * (1.0d0 / z))))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (z <= -1.35e+16) {
		tmp = x + (3.13060547623 * y);
	} else if (z <= 1.75) {
		tmp = x + ((y * 1.6453555072203998) * b);
	} else {
		tmp = x + (y * (3.13060547623 - (36.52704169880642 * (1.0 / z))));
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	tmp = 0
	if z <= -1.35e+16:
		tmp = x + (3.13060547623 * y)
	elif z <= 1.75:
		tmp = x + ((y * 1.6453555072203998) * b)
	else:
		tmp = x + (y * (3.13060547623 - (36.52704169880642 * (1.0 / z))))
	return tmp
function code(x, y, z, t, a, b)
	tmp = 0.0
	if (z <= -1.35e+16)
		tmp = Float64(x + Float64(3.13060547623 * y));
	elseif (z <= 1.75)
		tmp = Float64(x + Float64(Float64(y * 1.6453555072203998) * b));
	else
		tmp = Float64(x + Float64(y * Float64(3.13060547623 - Float64(36.52704169880642 * Float64(1.0 / z)))));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	tmp = 0.0;
	if (z <= -1.35e+16)
		tmp = x + (3.13060547623 * y);
	elseif (z <= 1.75)
		tmp = x + ((y * 1.6453555072203998) * b);
	else
		tmp = x + (y * (3.13060547623 - (36.52704169880642 * (1.0 / z))));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -1.35e+16], N[(x + N[(3.13060547623 * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.75], N[(x + N[(N[(y * 1.6453555072203998), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(3.13060547623 - N[(36.52704169880642 * N[(1.0 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.35 \cdot 10^{+16}:\\
\;\;\;\;x + 3.13060547623 \cdot y\\

\mathbf{elif}\;z \leq 1.75:\\
\;\;\;\;x + \left(y \cdot 1.6453555072203998\right) \cdot b\\

\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(3.13060547623 - 36.52704169880642 \cdot \frac{1}{z}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.35e16

    1. Initial program 59.2%

      \[x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771} \]
    2. Taylor expanded in z around inf

      \[\leadsto x + \color{blue}{\frac{313060547623}{100000000000} \cdot y} \]
    3. Applied rewrites62.4%

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

    if -1.35e16 < z < 1.75

    1. Initial program 59.2%

      \[x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771} \]
    2. Taylor expanded in z around 0

      \[\leadsto x + \color{blue}{\frac{1000000000000}{607771387771} \cdot \left(b \cdot y\right)} \]
    3. Applied rewrites60.7%

      \[\leadsto x + \color{blue}{1.6453555072203998 \cdot \left(b \cdot y\right)} \]
    4. Applied rewrites60.8%

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

    if 1.75 < z

    1. Initial program 59.2%

      \[x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771} \]
    2. Taylor expanded in z around -inf

      \[\leadsto x + \color{blue}{\left(-1 \cdot \frac{\frac{-55833770631}{5000000000} \cdot y - \frac{-4769379582500641883561}{100000000000000000000} \cdot y}{z} + \frac{313060547623}{100000000000} \cdot y\right)} \]
    3. Applied rewrites58.4%

      \[\leadsto x + \color{blue}{\mathsf{fma}\left(-1, \frac{-11.1667541262 \cdot y - -47.69379582500642 \cdot y}{z}, 3.13060547623 \cdot y\right)} \]
    4. Taylor expanded in y around 0

      \[\leadsto x + y \cdot \color{blue}{\left(\frac{313060547623}{100000000000} - \frac{3652704169880641883561}{100000000000000000000} \cdot \frac{1}{z}\right)} \]
    5. Applied rewrites58.5%

      \[\leadsto x + y \cdot \color{blue}{\left(3.13060547623 - 36.52704169880642 \cdot \frac{1}{z}\right)} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 14: 83.1% accurate, 3.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x + 3.13060547623 \cdot y\\ \mathbf{if}\;z \leq -1.35 \cdot 10^{+16}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 860000:\\ \;\;\;\;x + \left(y \cdot 1.6453555072203998\right) \cdot b\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (+ x (* 3.13060547623 y))))
   (if (<= z -1.35e+16)
     t_1
     (if (<= z 860000.0) (+ x (* (* y 1.6453555072203998) b)) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = x + (3.13060547623 * y);
	double tmp;
	if (z <= -1.35e+16) {
		tmp = t_1;
	} else if (z <= 860000.0) {
		tmp = x + ((y * 1.6453555072203998) * b);
	} else {
		tmp = t_1;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y, z, t, a, b)
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 = x + (3.13060547623d0 * y)
    if (z <= (-1.35d+16)) then
        tmp = t_1
    else if (z <= 860000.0d0) then
        tmp = x + ((y * 1.6453555072203998d0) * b)
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = x + (3.13060547623 * y);
	double tmp;
	if (z <= -1.35e+16) {
		tmp = t_1;
	} else if (z <= 860000.0) {
		tmp = x + ((y * 1.6453555072203998) * b);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	t_1 = x + (3.13060547623 * y)
	tmp = 0
	if z <= -1.35e+16:
		tmp = t_1
	elif z <= 860000.0:
		tmp = x + ((y * 1.6453555072203998) * b)
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a, b)
	t_1 = Float64(x + Float64(3.13060547623 * y))
	tmp = 0.0
	if (z <= -1.35e+16)
		tmp = t_1;
	elseif (z <= 860000.0)
		tmp = Float64(x + Float64(Float64(y * 1.6453555072203998) * b));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	t_1 = x + (3.13060547623 * y);
	tmp = 0.0;
	if (z <= -1.35e+16)
		tmp = t_1;
	elseif (z <= 860000.0)
		tmp = x + ((y * 1.6453555072203998) * b);
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x + N[(3.13060547623 * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.35e+16], t$95$1, If[LessEqual[z, 860000.0], N[(x + N[(N[(y * 1.6453555072203998), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x + 3.13060547623 \cdot y\\
\mathbf{if}\;z \leq -1.35 \cdot 10^{+16}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq 860000:\\
\;\;\;\;x + \left(y \cdot 1.6453555072203998\right) \cdot b\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.35e16 or 8.6e5 < z

    1. Initial program 59.2%

      \[x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771} \]
    2. Taylor expanded in z around inf

      \[\leadsto x + \color{blue}{\frac{313060547623}{100000000000} \cdot y} \]
    3. Applied rewrites62.4%

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

    if -1.35e16 < z < 8.6e5

    1. Initial program 59.2%

      \[x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771} \]
    2. Taylor expanded in z around 0

      \[\leadsto x + \color{blue}{\frac{1000000000000}{607771387771} \cdot \left(b \cdot y\right)} \]
    3. Applied rewrites60.7%

      \[\leadsto x + \color{blue}{1.6453555072203998 \cdot \left(b \cdot y\right)} \]
    4. Applied rewrites60.8%

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

Alternative 15: 83.1% accurate, 3.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x + 3.13060547623 \cdot y\\ \mathbf{if}\;z \leq -1.35 \cdot 10^{+16}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 860000:\\ \;\;\;\;x + \left(b \cdot 1.6453555072203998\right) \cdot y\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (+ x (* 3.13060547623 y))))
   (if (<= z -1.35e+16)
     t_1
     (if (<= z 860000.0) (+ x (* (* b 1.6453555072203998) y)) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = x + (3.13060547623 * y);
	double tmp;
	if (z <= -1.35e+16) {
		tmp = t_1;
	} else if (z <= 860000.0) {
		tmp = x + ((b * 1.6453555072203998) * y);
	} else {
		tmp = t_1;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y, z, t, a, b)
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 = x + (3.13060547623d0 * y)
    if (z <= (-1.35d+16)) then
        tmp = t_1
    else if (z <= 860000.0d0) then
        tmp = x + ((b * 1.6453555072203998d0) * y)
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = x + (3.13060547623 * y);
	double tmp;
	if (z <= -1.35e+16) {
		tmp = t_1;
	} else if (z <= 860000.0) {
		tmp = x + ((b * 1.6453555072203998) * y);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	t_1 = x + (3.13060547623 * y)
	tmp = 0
	if z <= -1.35e+16:
		tmp = t_1
	elif z <= 860000.0:
		tmp = x + ((b * 1.6453555072203998) * y)
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a, b)
	t_1 = Float64(x + Float64(3.13060547623 * y))
	tmp = 0.0
	if (z <= -1.35e+16)
		tmp = t_1;
	elseif (z <= 860000.0)
		tmp = Float64(x + Float64(Float64(b * 1.6453555072203998) * y));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	t_1 = x + (3.13060547623 * y);
	tmp = 0.0;
	if (z <= -1.35e+16)
		tmp = t_1;
	elseif (z <= 860000.0)
		tmp = x + ((b * 1.6453555072203998) * y);
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x + N[(3.13060547623 * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.35e+16], t$95$1, If[LessEqual[z, 860000.0], N[(x + N[(N[(b * 1.6453555072203998), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x + 3.13060547623 \cdot y\\
\mathbf{if}\;z \leq -1.35 \cdot 10^{+16}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq 860000:\\
\;\;\;\;x + \left(b \cdot 1.6453555072203998\right) \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.35e16 or 8.6e5 < z

    1. Initial program 59.2%

      \[x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771} \]
    2. Taylor expanded in z around inf

      \[\leadsto x + \color{blue}{\frac{313060547623}{100000000000} \cdot y} \]
    3. Applied rewrites62.4%

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

    if -1.35e16 < z < 8.6e5

    1. Initial program 59.2%

      \[x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771} \]
    2. Taylor expanded in z around 0

      \[\leadsto x + \color{blue}{\frac{1000000000000}{607771387771} \cdot \left(b \cdot y\right)} \]
    3. Applied rewrites60.7%

      \[\leadsto x + \color{blue}{1.6453555072203998 \cdot \left(b \cdot y\right)} \]
    4. Applied rewrites60.7%

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

Alternative 16: 83.0% accurate, 3.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x + 3.13060547623 \cdot y\\ \mathbf{if}\;z \leq -1.35 \cdot 10^{+16}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 860000:\\ \;\;\;\;x + 1.6453555072203998 \cdot \left(b \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (+ x (* 3.13060547623 y))))
   (if (<= z -1.35e+16)
     t_1
     (if (<= z 860000.0) (+ x (* 1.6453555072203998 (* b y))) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = x + (3.13060547623 * y);
	double tmp;
	if (z <= -1.35e+16) {
		tmp = t_1;
	} else if (z <= 860000.0) {
		tmp = x + (1.6453555072203998 * (b * y));
	} else {
		tmp = t_1;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y, z, t, a, b)
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 = x + (3.13060547623d0 * y)
    if (z <= (-1.35d+16)) then
        tmp = t_1
    else if (z <= 860000.0d0) then
        tmp = x + (1.6453555072203998d0 * (b * y))
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = x + (3.13060547623 * y);
	double tmp;
	if (z <= -1.35e+16) {
		tmp = t_1;
	} else if (z <= 860000.0) {
		tmp = x + (1.6453555072203998 * (b * y));
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	t_1 = x + (3.13060547623 * y)
	tmp = 0
	if z <= -1.35e+16:
		tmp = t_1
	elif z <= 860000.0:
		tmp = x + (1.6453555072203998 * (b * y))
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a, b)
	t_1 = Float64(x + Float64(3.13060547623 * y))
	tmp = 0.0
	if (z <= -1.35e+16)
		tmp = t_1;
	elseif (z <= 860000.0)
		tmp = Float64(x + Float64(1.6453555072203998 * Float64(b * y)));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	t_1 = x + (3.13060547623 * y);
	tmp = 0.0;
	if (z <= -1.35e+16)
		tmp = t_1;
	elseif (z <= 860000.0)
		tmp = x + (1.6453555072203998 * (b * y));
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x + N[(3.13060547623 * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.35e+16], t$95$1, If[LessEqual[z, 860000.0], N[(x + N[(1.6453555072203998 * N[(b * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x + 3.13060547623 \cdot y\\
\mathbf{if}\;z \leq -1.35 \cdot 10^{+16}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq 860000:\\
\;\;\;\;x + 1.6453555072203998 \cdot \left(b \cdot y\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.35e16 or 8.6e5 < z

    1. Initial program 59.2%

      \[x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771} \]
    2. Taylor expanded in z around inf

      \[\leadsto x + \color{blue}{\frac{313060547623}{100000000000} \cdot y} \]
    3. Applied rewrites62.4%

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

    if -1.35e16 < z < 8.6e5

    1. Initial program 59.2%

      \[x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771} \]
    2. Taylor expanded in z around 0

      \[\leadsto x + \color{blue}{\frac{1000000000000}{607771387771} \cdot \left(b \cdot y\right)} \]
    3. Applied rewrites60.7%

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

Alternative 17: 62.4% accurate, 7.9× speedup?

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

\\
x + 3.13060547623 \cdot y
\end{array}
Derivation
  1. Initial program 59.2%

    \[x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771} \]
  2. Taylor expanded in z around inf

    \[\leadsto x + \color{blue}{\frac{313060547623}{100000000000} \cdot y} \]
  3. Applied rewrites62.4%

    \[\leadsto x + \color{blue}{3.13060547623 \cdot y} \]
  4. Add Preprocessing

Reproduce

?
herbie shell --seed 2025159 
(FPCore (x y z t a b)
  :name "Numeric.SpecFunctions:logGamma from math-functions-0.1.5.2, D"
  :precision binary64
  (+ x (/ (* y (+ (* (+ (* (+ (* (+ (* z 3.13060547623) 11.1667541262) z) t) z) a) z) b)) (+ (* (+ (* (+ (* (+ z 15.234687407) z) 31.4690115749) z) 11.9400905721) z) 0.607771387771))))