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

Percentage Accurate: 68.3% → 99.7%
Time: 16.6s
Alternatives: 10
Speedup: 5.2×

Specification

?
\[x + \frac{y \cdot \left(\left(z \cdot \frac{692910599291889}{10000000000000000} + \frac{307332350656623}{625000000000000}\right) \cdot z + \frac{11167812716741}{40000000000000}\right)}{\left(z + \frac{6012459259764103}{1000000000000000}\right) \cdot z + \frac{104698244219447}{31250000000000}} \]
(FPCore (x y z)
  :precision binary64
  (+
 x
 (/
  (*
   y
   (+
    (*
     (+
      (* z 692910599291889/10000000000000000)
      307332350656623/625000000000000)
     z)
    11167812716741/40000000000000))
  (+
   (* (+ z 6012459259764103/1000000000000000) z)
   104698244219447/31250000000000))))
double code(double x, double y, double z) {
	return x + ((y * ((((z * 0.0692910599291889) + 0.4917317610505968) * z) + 0.279195317918525)) / (((z + 6.012459259764103) * z) + 3.350343815022304));
}
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)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = x + ((y * ((((z * 0.0692910599291889d0) + 0.4917317610505968d0) * z) + 0.279195317918525d0)) / (((z + 6.012459259764103d0) * z) + 3.350343815022304d0))
end function
public static double code(double x, double y, double z) {
	return x + ((y * ((((z * 0.0692910599291889) + 0.4917317610505968) * z) + 0.279195317918525)) / (((z + 6.012459259764103) * z) + 3.350343815022304));
}
def code(x, y, z):
	return x + ((y * ((((z * 0.0692910599291889) + 0.4917317610505968) * z) + 0.279195317918525)) / (((z + 6.012459259764103) * z) + 3.350343815022304))
function code(x, y, z)
	return Float64(x + Float64(Float64(y * Float64(Float64(Float64(Float64(z * 0.0692910599291889) + 0.4917317610505968) * z) + 0.279195317918525)) / Float64(Float64(Float64(z + 6.012459259764103) * z) + 3.350343815022304)))
end
function tmp = code(x, y, z)
	tmp = x + ((y * ((((z * 0.0692910599291889) + 0.4917317610505968) * z) + 0.279195317918525)) / (((z + 6.012459259764103) * z) + 3.350343815022304));
end
code[x_, y_, z_] := N[(x + N[(N[(y * N[(N[(N[(N[(z * 692910599291889/10000000000000000), $MachinePrecision] + 307332350656623/625000000000000), $MachinePrecision] * z), $MachinePrecision] + 11167812716741/40000000000000), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(z + 6012459259764103/1000000000000000), $MachinePrecision] * z), $MachinePrecision] + 104698244219447/31250000000000), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x + \frac{y \cdot \left(\left(z \cdot \frac{692910599291889}{10000000000000000} + \frac{307332350656623}{625000000000000}\right) \cdot z + \frac{11167812716741}{40000000000000}\right)}{\left(z + \frac{6012459259764103}{1000000000000000}\right) \cdot z + \frac{104698244219447}{31250000000000}}

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 10 alternatives:

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

Initial Program: 68.3% accurate, 1.0× speedup?

\[x + \frac{y \cdot \left(\left(z \cdot \frac{692910599291889}{10000000000000000} + \frac{307332350656623}{625000000000000}\right) \cdot z + \frac{11167812716741}{40000000000000}\right)}{\left(z + \frac{6012459259764103}{1000000000000000}\right) \cdot z + \frac{104698244219447}{31250000000000}} \]
(FPCore (x y z)
  :precision binary64
  (+
 x
 (/
  (*
   y
   (+
    (*
     (+
      (* z 692910599291889/10000000000000000)
      307332350656623/625000000000000)
     z)
    11167812716741/40000000000000))
  (+
   (* (+ z 6012459259764103/1000000000000000) z)
   104698244219447/31250000000000))))
double code(double x, double y, double z) {
	return x + ((y * ((((z * 0.0692910599291889) + 0.4917317610505968) * z) + 0.279195317918525)) / (((z + 6.012459259764103) * z) + 3.350343815022304));
}
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)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = x + ((y * ((((z * 0.0692910599291889d0) + 0.4917317610505968d0) * z) + 0.279195317918525d0)) / (((z + 6.012459259764103d0) * z) + 3.350343815022304d0))
end function
public static double code(double x, double y, double z) {
	return x + ((y * ((((z * 0.0692910599291889) + 0.4917317610505968) * z) + 0.279195317918525)) / (((z + 6.012459259764103) * z) + 3.350343815022304));
}
def code(x, y, z):
	return x + ((y * ((((z * 0.0692910599291889) + 0.4917317610505968) * z) + 0.279195317918525)) / (((z + 6.012459259764103) * z) + 3.350343815022304))
function code(x, y, z)
	return Float64(x + Float64(Float64(y * Float64(Float64(Float64(Float64(z * 0.0692910599291889) + 0.4917317610505968) * z) + 0.279195317918525)) / Float64(Float64(Float64(z + 6.012459259764103) * z) + 3.350343815022304)))
end
function tmp = code(x, y, z)
	tmp = x + ((y * ((((z * 0.0692910599291889) + 0.4917317610505968) * z) + 0.279195317918525)) / (((z + 6.012459259764103) * z) + 3.350343815022304));
end
code[x_, y_, z_] := N[(x + N[(N[(y * N[(N[(N[(N[(z * 692910599291889/10000000000000000), $MachinePrecision] + 307332350656623/625000000000000), $MachinePrecision] * z), $MachinePrecision] + 11167812716741/40000000000000), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(z + 6012459259764103/1000000000000000), $MachinePrecision] * z), $MachinePrecision] + 104698244219447/31250000000000), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x + \frac{y \cdot \left(\left(z \cdot \frac{692910599291889}{10000000000000000} + \frac{307332350656623}{625000000000000}\right) \cdot z + \frac{11167812716741}{40000000000000}\right)}{\left(z + \frac{6012459259764103}{1000000000000000}\right) \cdot z + \frac{104698244219447}{31250000000000}}

Alternative 1: 99.7% accurate, 0.8× speedup?

\[\begin{array}{l} t_0 := \left(\frac{y \cdot \frac{751220861604756070699018739433}{10000000000000000000000000000000}}{z} - \frac{y}{\frac{-10000000000000000}{692910599291889}}\right) + x\\ \mathbf{if}\;z \leq -9999999999999999635896294965248:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 880000:\\ \;\;\;\;x + \frac{y \cdot \left(\left(z \cdot \frac{692910599291889}{10000000000000000} + \frac{307332350656623}{625000000000000}\right) \cdot z + \frac{11167812716741}{40000000000000}\right)}{\left(z + \frac{6012459259764103}{1000000000000000}\right) \cdot z + \frac{104698244219447}{31250000000000}}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \]
(FPCore (x y z)
  :precision binary64
  (let* ((t_0
        (+
         (-
          (/
           (*
            y
            751220861604756070699018739433/10000000000000000000000000000000)
           z)
          (/ y -10000000000000000/692910599291889))
         x)))
  (if (<= z -9999999999999999635896294965248)
    t_0
    (if (<= z 880000)
      (+
       x
       (/
        (*
         y
         (+
          (*
           (+
            (* z 692910599291889/10000000000000000)
            307332350656623/625000000000000)
           z)
          11167812716741/40000000000000))
        (+
         (* (+ z 6012459259764103/1000000000000000) z)
         104698244219447/31250000000000)))
      t_0))))
double code(double x, double y, double z) {
	double t_0 = (((y * 0.07512208616047561) / z) - (y / -14.431876219268936)) + x;
	double tmp;
	if (z <= -1e+31) {
		tmp = t_0;
	} else if (z <= 880000.0) {
		tmp = x + ((y * ((((z * 0.0692910599291889) + 0.4917317610505968) * z) + 0.279195317918525)) / (((z + 6.012459259764103) * z) + 3.350343815022304));
	} else {
		tmp = t_0;
	}
	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)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (((y * 0.07512208616047561d0) / z) - (y / (-14.431876219268936d0))) + x
    if (z <= (-1d+31)) then
        tmp = t_0
    else if (z <= 880000.0d0) then
        tmp = x + ((y * ((((z * 0.0692910599291889d0) + 0.4917317610505968d0) * z) + 0.279195317918525d0)) / (((z + 6.012459259764103d0) * z) + 3.350343815022304d0))
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = (((y * 0.07512208616047561) / z) - (y / -14.431876219268936)) + x;
	double tmp;
	if (z <= -1e+31) {
		tmp = t_0;
	} else if (z <= 880000.0) {
		tmp = x + ((y * ((((z * 0.0692910599291889) + 0.4917317610505968) * z) + 0.279195317918525)) / (((z + 6.012459259764103) * z) + 3.350343815022304));
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = (((y * 0.07512208616047561) / z) - (y / -14.431876219268936)) + x
	tmp = 0
	if z <= -1e+31:
		tmp = t_0
	elif z <= 880000.0:
		tmp = x + ((y * ((((z * 0.0692910599291889) + 0.4917317610505968) * z) + 0.279195317918525)) / (((z + 6.012459259764103) * z) + 3.350343815022304))
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(Float64(Float64(Float64(y * 0.07512208616047561) / z) - Float64(y / -14.431876219268936)) + x)
	tmp = 0.0
	if (z <= -1e+31)
		tmp = t_0;
	elseif (z <= 880000.0)
		tmp = Float64(x + Float64(Float64(y * Float64(Float64(Float64(Float64(z * 0.0692910599291889) + 0.4917317610505968) * z) + 0.279195317918525)) / Float64(Float64(Float64(z + 6.012459259764103) * z) + 3.350343815022304)));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = (((y * 0.07512208616047561) / z) - (y / -14.431876219268936)) + x;
	tmp = 0.0;
	if (z <= -1e+31)
		tmp = t_0;
	elseif (z <= 880000.0)
		tmp = x + ((y * ((((z * 0.0692910599291889) + 0.4917317610505968) * z) + 0.279195317918525)) / (((z + 6.012459259764103) * z) + 3.350343815022304));
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(N[(y * 751220861604756070699018739433/10000000000000000000000000000000), $MachinePrecision] / z), $MachinePrecision] - N[(y / -10000000000000000/692910599291889), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[z, -9999999999999999635896294965248], t$95$0, If[LessEqual[z, 880000], N[(x + N[(N[(y * N[(N[(N[(N[(z * 692910599291889/10000000000000000), $MachinePrecision] + 307332350656623/625000000000000), $MachinePrecision] * z), $MachinePrecision] + 11167812716741/40000000000000), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(z + 6012459259764103/1000000000000000), $MachinePrecision] * z), $MachinePrecision] + 104698244219447/31250000000000), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := \left(\frac{y \cdot \frac{751220861604756070699018739433}{10000000000000000000000000000000}}{z} - \frac{y}{\frac{-10000000000000000}{692910599291889}}\right) + x\\
\mathbf{if}\;z \leq -9999999999999999635896294965248:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq 880000:\\
\;\;\;\;x + \frac{y \cdot \left(\left(z \cdot \frac{692910599291889}{10000000000000000} + \frac{307332350656623}{625000000000000}\right) \cdot z + \frac{11167812716741}{40000000000000}\right)}{\left(z + \frac{6012459259764103}{1000000000000000}\right) \cdot z + \frac{104698244219447}{31250000000000}}\\

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


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -9.9999999999999996e30 or 8.8e5 < z

    1. Initial program 68.3%

      \[x + \frac{y \cdot \left(\left(z \cdot \frac{692910599291889}{10000000000000000} + \frac{307332350656623}{625000000000000}\right) \cdot z + \frac{11167812716741}{40000000000000}\right)}{\left(z + \frac{6012459259764103}{1000000000000000}\right) \cdot z + \frac{104698244219447}{31250000000000}} \]
    2. Taylor expanded in z around -inf

      \[\leadsto x + \color{blue}{\left(-1 \cdot \frac{\frac{-307332350656623}{625000000000000} \cdot y - \frac{-4166096748901211929300981260567}{10000000000000000000000000000000} \cdot y}{z} + \frac{692910599291889}{10000000000000000} \cdot y\right)} \]
    3. Step-by-step derivation
      1. lower-+.f64N/A

        \[\leadsto x + \left(-1 \cdot \frac{\frac{-307332350656623}{625000000000000} \cdot y - \frac{-4166096748901211929300981260567}{10000000000000000000000000000000} \cdot y}{z} + \color{blue}{\frac{692910599291889}{10000000000000000} \cdot y}\right) \]
      2. lower-*.f64N/A

        \[\leadsto x + \left(-1 \cdot \frac{\frac{-307332350656623}{625000000000000} \cdot y - \frac{-4166096748901211929300981260567}{10000000000000000000000000000000} \cdot y}{z} + \color{blue}{\frac{692910599291889}{10000000000000000}} \cdot y\right) \]
      3. lower-/.f64N/A

        \[\leadsto x + \left(-1 \cdot \frac{\frac{-307332350656623}{625000000000000} \cdot y - \frac{-4166096748901211929300981260567}{10000000000000000000000000000000} \cdot y}{z} + \frac{692910599291889}{10000000000000000} \cdot y\right) \]
      4. lower--.f64N/A

        \[\leadsto x + \left(-1 \cdot \frac{\frac{-307332350656623}{625000000000000} \cdot y - \frac{-4166096748901211929300981260567}{10000000000000000000000000000000} \cdot y}{z} + \frac{692910599291889}{10000000000000000} \cdot y\right) \]
      5. lower-*.f64N/A

        \[\leadsto x + \left(-1 \cdot \frac{\frac{-307332350656623}{625000000000000} \cdot y - \frac{-4166096748901211929300981260567}{10000000000000000000000000000000} \cdot y}{z} + \frac{692910599291889}{10000000000000000} \cdot y\right) \]
      6. lower-*.f64N/A

        \[\leadsto x + \left(-1 \cdot \frac{\frac{-307332350656623}{625000000000000} \cdot y - \frac{-4166096748901211929300981260567}{10000000000000000000000000000000} \cdot y}{z} + \frac{692910599291889}{10000000000000000} \cdot y\right) \]
      7. lower-*.f6466.2%

        \[\leadsto x + \left(-1 \cdot \frac{\frac{-307332350656623}{625000000000000} \cdot y - \frac{-4166096748901211929300981260567}{10000000000000000000000000000000} \cdot y}{z} + \frac{692910599291889}{10000000000000000} \cdot \color{blue}{y}\right) \]
    4. Applied rewrites66.2%

      \[\leadsto x + \color{blue}{\left(-1 \cdot \frac{\frac{-307332350656623}{625000000000000} \cdot y - \frac{-4166096748901211929300981260567}{10000000000000000000000000000000} \cdot y}{z} + \frac{692910599291889}{10000000000000000} \cdot y\right)} \]
    5. Step-by-step derivation
      1. lift-+.f64N/A

        \[\leadsto \color{blue}{x + \left(-1 \cdot \frac{\frac{-307332350656623}{625000000000000} \cdot y - \frac{-4166096748901211929300981260567}{10000000000000000000000000000000} \cdot y}{z} + \frac{692910599291889}{10000000000000000} \cdot y\right)} \]
      2. +-commutativeN/A

        \[\leadsto \color{blue}{\left(-1 \cdot \frac{\frac{-307332350656623}{625000000000000} \cdot y - \frac{-4166096748901211929300981260567}{10000000000000000000000000000000} \cdot y}{z} + \frac{692910599291889}{10000000000000000} \cdot y\right) + x} \]
      3. lower-+.f6466.2%

        \[\leadsto \color{blue}{\left(-1 \cdot \frac{\frac{-307332350656623}{625000000000000} \cdot y - \frac{-4166096748901211929300981260567}{10000000000000000000000000000000} \cdot y}{z} + \frac{692910599291889}{10000000000000000} \cdot y\right) + x} \]
    6. Applied rewrites66.2%

      \[\leadsto \color{blue}{\left(\frac{y \cdot \frac{751220861604756070699018739433}{10000000000000000000000000000000}}{z} - \frac{-692910599291889}{10000000000000000} \cdot y\right) + x} \]
    7. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \left(\frac{y \cdot \frac{751220861604756070699018739433}{10000000000000000000000000000000}}{z} - \frac{-692910599291889}{10000000000000000} \cdot \color{blue}{y}\right) + x \]
      2. *-commutativeN/A

        \[\leadsto \left(\frac{y \cdot \frac{751220861604756070699018739433}{10000000000000000000000000000000}}{z} - y \cdot \color{blue}{\frac{-692910599291889}{10000000000000000}}\right) + x \]
      3. metadata-evalN/A

        \[\leadsto \left(\frac{y \cdot \frac{751220861604756070699018739433}{10000000000000000000000000000000}}{z} - y \cdot \left(\mathsf{neg}\left(\frac{692910599291889}{10000000000000000}\right)\right)\right) + x \]
      4. distribute-rgt-neg-inN/A

        \[\leadsto \left(\frac{y \cdot \frac{751220861604756070699018739433}{10000000000000000000000000000000}}{z} - \left(\mathsf{neg}\left(y \cdot \frac{692910599291889}{10000000000000000}\right)\right)\right) + x \]
      5. metadata-evalN/A

        \[\leadsto \left(\frac{y \cdot \frac{751220861604756070699018739433}{10000000000000000000000000000000}}{z} - \left(\mathsf{neg}\left(y \cdot \frac{1}{\frac{10000000000000000}{692910599291889}}\right)\right)\right) + x \]
      6. mult-flipN/A

        \[\leadsto \left(\frac{y \cdot \frac{751220861604756070699018739433}{10000000000000000000000000000000}}{z} - \left(\mathsf{neg}\left(\frac{y}{\frac{10000000000000000}{692910599291889}}\right)\right)\right) + x \]
      7. distribute-neg-frac2N/A

        \[\leadsto \left(\frac{y \cdot \frac{751220861604756070699018739433}{10000000000000000000000000000000}}{z} - \frac{y}{\color{blue}{\mathsf{neg}\left(\frac{10000000000000000}{692910599291889}\right)}}\right) + x \]
      8. lower-/.f64N/A

        \[\leadsto \left(\frac{y \cdot \frac{751220861604756070699018739433}{10000000000000000000000000000000}}{z} - \frac{y}{\color{blue}{\mathsf{neg}\left(\frac{10000000000000000}{692910599291889}\right)}}\right) + x \]
      9. metadata-eval66.4%

        \[\leadsto \left(\frac{y \cdot \frac{751220861604756070699018739433}{10000000000000000000000000000000}}{z} - \frac{y}{\frac{-10000000000000000}{692910599291889}}\right) + x \]
    8. Applied rewrites66.4%

      \[\leadsto \left(\frac{y \cdot \frac{751220861604756070699018739433}{10000000000000000000000000000000}}{z} - \frac{y}{\color{blue}{\frac{-10000000000000000}{692910599291889}}}\right) + x \]

    if -9.9999999999999996e30 < z < 8.8e5

    1. Initial program 68.3%

      \[x + \frac{y \cdot \left(\left(z \cdot \frac{692910599291889}{10000000000000000} + \frac{307332350656623}{625000000000000}\right) \cdot z + \frac{11167812716741}{40000000000000}\right)}{\left(z + \frac{6012459259764103}{1000000000000000}\right) \cdot z + \frac{104698244219447}{31250000000000}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 2: 99.4% accurate, 1.0× speedup?

\[\begin{array}{l} t_0 := \left(\frac{y \cdot \frac{751220861604756070699018739433}{10000000000000000000000000000000}}{z} - \frac{y}{\frac{-10000000000000000}{692910599291889}}\right) + x\\ \mathbf{if}\;z \leq \frac{-6530219459687219}{1125899906842624}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq \frac{5404319552844595}{1125899906842624}:\\ \;\;\;\;\left(\left(\frac{-155900051080628738716045985239}{56124018394291031809500087342080} \cdot y\right) \cdot z - \frac{-279195317918525}{3350343815022304} \cdot y\right) + x\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \]
(FPCore (x y z)
  :precision binary64
  (let* ((t_0
        (+
         (-
          (/
           (*
            y
            751220861604756070699018739433/10000000000000000000000000000000)
           z)
          (/ y -10000000000000000/692910599291889))
         x)))
  (if (<= z -6530219459687219/1125899906842624)
    t_0
    (if (<= z 5404319552844595/1125899906842624)
      (+
       (-
        (*
         (*
          -155900051080628738716045985239/56124018394291031809500087342080
          y)
         z)
        (* -279195317918525/3350343815022304 y))
       x)
      t_0))))
double code(double x, double y, double z) {
	double t_0 = (((y * 0.07512208616047561) / z) - (y / -14.431876219268936)) + x;
	double tmp;
	if (z <= -5.8) {
		tmp = t_0;
	} else if (z <= 4.8) {
		tmp = (((-0.00277777777751721 * y) * z) - (-0.08333333333333323 * y)) + x;
	} else {
		tmp = t_0;
	}
	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)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (((y * 0.07512208616047561d0) / z) - (y / (-14.431876219268936d0))) + x
    if (z <= (-5.8d0)) then
        tmp = t_0
    else if (z <= 4.8d0) then
        tmp = ((((-0.00277777777751721d0) * y) * z) - ((-0.08333333333333323d0) * y)) + x
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = (((y * 0.07512208616047561) / z) - (y / -14.431876219268936)) + x;
	double tmp;
	if (z <= -5.8) {
		tmp = t_0;
	} else if (z <= 4.8) {
		tmp = (((-0.00277777777751721 * y) * z) - (-0.08333333333333323 * y)) + x;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = (((y * 0.07512208616047561) / z) - (y / -14.431876219268936)) + x
	tmp = 0
	if z <= -5.8:
		tmp = t_0
	elif z <= 4.8:
		tmp = (((-0.00277777777751721 * y) * z) - (-0.08333333333333323 * y)) + x
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(Float64(Float64(Float64(y * 0.07512208616047561) / z) - Float64(y / -14.431876219268936)) + x)
	tmp = 0.0
	if (z <= -5.8)
		tmp = t_0;
	elseif (z <= 4.8)
		tmp = Float64(Float64(Float64(Float64(-0.00277777777751721 * y) * z) - Float64(-0.08333333333333323 * y)) + x);
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = (((y * 0.07512208616047561) / z) - (y / -14.431876219268936)) + x;
	tmp = 0.0;
	if (z <= -5.8)
		tmp = t_0;
	elseif (z <= 4.8)
		tmp = (((-0.00277777777751721 * y) * z) - (-0.08333333333333323 * y)) + x;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(N[(y * 751220861604756070699018739433/10000000000000000000000000000000), $MachinePrecision] / z), $MachinePrecision] - N[(y / -10000000000000000/692910599291889), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[z, -6530219459687219/1125899906842624], t$95$0, If[LessEqual[z, 5404319552844595/1125899906842624], N[(N[(N[(N[(-155900051080628738716045985239/56124018394291031809500087342080 * y), $MachinePrecision] * z), $MachinePrecision] - N[(-279195317918525/3350343815022304 * y), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := \left(\frac{y \cdot \frac{751220861604756070699018739433}{10000000000000000000000000000000}}{z} - \frac{y}{\frac{-10000000000000000}{692910599291889}}\right) + x\\
\mathbf{if}\;z \leq \frac{-6530219459687219}{1125899906842624}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq \frac{5404319552844595}{1125899906842624}:\\
\;\;\;\;\left(\left(\frac{-155900051080628738716045985239}{56124018394291031809500087342080} \cdot y\right) \cdot z - \frac{-279195317918525}{3350343815022304} \cdot y\right) + x\\

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


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -5.7999999999999998 or 4.7999999999999998 < z

    1. Initial program 68.3%

      \[x + \frac{y \cdot \left(\left(z \cdot \frac{692910599291889}{10000000000000000} + \frac{307332350656623}{625000000000000}\right) \cdot z + \frac{11167812716741}{40000000000000}\right)}{\left(z + \frac{6012459259764103}{1000000000000000}\right) \cdot z + \frac{104698244219447}{31250000000000}} \]
    2. Taylor expanded in z around -inf

      \[\leadsto x + \color{blue}{\left(-1 \cdot \frac{\frac{-307332350656623}{625000000000000} \cdot y - \frac{-4166096748901211929300981260567}{10000000000000000000000000000000} \cdot y}{z} + \frac{692910599291889}{10000000000000000} \cdot y\right)} \]
    3. Step-by-step derivation
      1. lower-+.f64N/A

        \[\leadsto x + \left(-1 \cdot \frac{\frac{-307332350656623}{625000000000000} \cdot y - \frac{-4166096748901211929300981260567}{10000000000000000000000000000000} \cdot y}{z} + \color{blue}{\frac{692910599291889}{10000000000000000} \cdot y}\right) \]
      2. lower-*.f64N/A

        \[\leadsto x + \left(-1 \cdot \frac{\frac{-307332350656623}{625000000000000} \cdot y - \frac{-4166096748901211929300981260567}{10000000000000000000000000000000} \cdot y}{z} + \color{blue}{\frac{692910599291889}{10000000000000000}} \cdot y\right) \]
      3. lower-/.f64N/A

        \[\leadsto x + \left(-1 \cdot \frac{\frac{-307332350656623}{625000000000000} \cdot y - \frac{-4166096748901211929300981260567}{10000000000000000000000000000000} \cdot y}{z} + \frac{692910599291889}{10000000000000000} \cdot y\right) \]
      4. lower--.f64N/A

        \[\leadsto x + \left(-1 \cdot \frac{\frac{-307332350656623}{625000000000000} \cdot y - \frac{-4166096748901211929300981260567}{10000000000000000000000000000000} \cdot y}{z} + \frac{692910599291889}{10000000000000000} \cdot y\right) \]
      5. lower-*.f64N/A

        \[\leadsto x + \left(-1 \cdot \frac{\frac{-307332350656623}{625000000000000} \cdot y - \frac{-4166096748901211929300981260567}{10000000000000000000000000000000} \cdot y}{z} + \frac{692910599291889}{10000000000000000} \cdot y\right) \]
      6. lower-*.f64N/A

        \[\leadsto x + \left(-1 \cdot \frac{\frac{-307332350656623}{625000000000000} \cdot y - \frac{-4166096748901211929300981260567}{10000000000000000000000000000000} \cdot y}{z} + \frac{692910599291889}{10000000000000000} \cdot y\right) \]
      7. lower-*.f6466.2%

        \[\leadsto x + \left(-1 \cdot \frac{\frac{-307332350656623}{625000000000000} \cdot y - \frac{-4166096748901211929300981260567}{10000000000000000000000000000000} \cdot y}{z} + \frac{692910599291889}{10000000000000000} \cdot \color{blue}{y}\right) \]
    4. Applied rewrites66.2%

      \[\leadsto x + \color{blue}{\left(-1 \cdot \frac{\frac{-307332350656623}{625000000000000} \cdot y - \frac{-4166096748901211929300981260567}{10000000000000000000000000000000} \cdot y}{z} + \frac{692910599291889}{10000000000000000} \cdot y\right)} \]
    5. Step-by-step derivation
      1. lift-+.f64N/A

        \[\leadsto \color{blue}{x + \left(-1 \cdot \frac{\frac{-307332350656623}{625000000000000} \cdot y - \frac{-4166096748901211929300981260567}{10000000000000000000000000000000} \cdot y}{z} + \frac{692910599291889}{10000000000000000} \cdot y\right)} \]
      2. +-commutativeN/A

        \[\leadsto \color{blue}{\left(-1 \cdot \frac{\frac{-307332350656623}{625000000000000} \cdot y - \frac{-4166096748901211929300981260567}{10000000000000000000000000000000} \cdot y}{z} + \frac{692910599291889}{10000000000000000} \cdot y\right) + x} \]
      3. lower-+.f6466.2%

        \[\leadsto \color{blue}{\left(-1 \cdot \frac{\frac{-307332350656623}{625000000000000} \cdot y - \frac{-4166096748901211929300981260567}{10000000000000000000000000000000} \cdot y}{z} + \frac{692910599291889}{10000000000000000} \cdot y\right) + x} \]
    6. Applied rewrites66.2%

      \[\leadsto \color{blue}{\left(\frac{y \cdot \frac{751220861604756070699018739433}{10000000000000000000000000000000}}{z} - \frac{-692910599291889}{10000000000000000} \cdot y\right) + x} \]
    7. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \left(\frac{y \cdot \frac{751220861604756070699018739433}{10000000000000000000000000000000}}{z} - \frac{-692910599291889}{10000000000000000} \cdot \color{blue}{y}\right) + x \]
      2. *-commutativeN/A

        \[\leadsto \left(\frac{y \cdot \frac{751220861604756070699018739433}{10000000000000000000000000000000}}{z} - y \cdot \color{blue}{\frac{-692910599291889}{10000000000000000}}\right) + x \]
      3. metadata-evalN/A

        \[\leadsto \left(\frac{y \cdot \frac{751220861604756070699018739433}{10000000000000000000000000000000}}{z} - y \cdot \left(\mathsf{neg}\left(\frac{692910599291889}{10000000000000000}\right)\right)\right) + x \]
      4. distribute-rgt-neg-inN/A

        \[\leadsto \left(\frac{y \cdot \frac{751220861604756070699018739433}{10000000000000000000000000000000}}{z} - \left(\mathsf{neg}\left(y \cdot \frac{692910599291889}{10000000000000000}\right)\right)\right) + x \]
      5. metadata-evalN/A

        \[\leadsto \left(\frac{y \cdot \frac{751220861604756070699018739433}{10000000000000000000000000000000}}{z} - \left(\mathsf{neg}\left(y \cdot \frac{1}{\frac{10000000000000000}{692910599291889}}\right)\right)\right) + x \]
      6. mult-flipN/A

        \[\leadsto \left(\frac{y \cdot \frac{751220861604756070699018739433}{10000000000000000000000000000000}}{z} - \left(\mathsf{neg}\left(\frac{y}{\frac{10000000000000000}{692910599291889}}\right)\right)\right) + x \]
      7. distribute-neg-frac2N/A

        \[\leadsto \left(\frac{y \cdot \frac{751220861604756070699018739433}{10000000000000000000000000000000}}{z} - \frac{y}{\color{blue}{\mathsf{neg}\left(\frac{10000000000000000}{692910599291889}\right)}}\right) + x \]
      8. lower-/.f64N/A

        \[\leadsto \left(\frac{y \cdot \frac{751220861604756070699018739433}{10000000000000000000000000000000}}{z} - \frac{y}{\color{blue}{\mathsf{neg}\left(\frac{10000000000000000}{692910599291889}\right)}}\right) + x \]
      9. metadata-eval66.4%

        \[\leadsto \left(\frac{y \cdot \frac{751220861604756070699018739433}{10000000000000000000000000000000}}{z} - \frac{y}{\frac{-10000000000000000}{692910599291889}}\right) + x \]
    8. Applied rewrites66.4%

      \[\leadsto \left(\frac{y \cdot \frac{751220861604756070699018739433}{10000000000000000000000000000000}}{z} - \frac{y}{\color{blue}{\frac{-10000000000000000}{692910599291889}}}\right) + x \]

    if -5.7999999999999998 < z < 4.7999999999999998

    1. Initial program 68.3%

      \[x + \frac{y \cdot \left(\left(z \cdot \frac{692910599291889}{10000000000000000} + \frac{307332350656623}{625000000000000}\right) \cdot z + \frac{11167812716741}{40000000000000}\right)}{\left(z + \frac{6012459259764103}{1000000000000000}\right) \cdot z + \frac{104698244219447}{31250000000000}} \]
    2. Taylor expanded in z around 0

      \[\leadsto x + \color{blue}{\left(\frac{279195317918525}{3350343815022304} \cdot y + z \cdot \left(\frac{307332350656623}{2093964884388940} \cdot y - \frac{1678650474502018223880473708075}{11224803678858206361900017468416} \cdot y\right)\right)} \]
    3. Step-by-step derivation
      1. lower-+.f64N/A

        \[\leadsto x + \left(\frac{279195317918525}{3350343815022304} \cdot y + \color{blue}{z \cdot \left(\frac{307332350656623}{2093964884388940} \cdot y - \frac{1678650474502018223880473708075}{11224803678858206361900017468416} \cdot y\right)}\right) \]
      2. lower-*.f64N/A

        \[\leadsto x + \left(\frac{279195317918525}{3350343815022304} \cdot y + \color{blue}{z} \cdot \left(\frac{307332350656623}{2093964884388940} \cdot y - \frac{1678650474502018223880473708075}{11224803678858206361900017468416} \cdot y\right)\right) \]
      3. lower-*.f64N/A

        \[\leadsto x + \left(\frac{279195317918525}{3350343815022304} \cdot y + z \cdot \color{blue}{\left(\frac{307332350656623}{2093964884388940} \cdot y - \frac{1678650474502018223880473708075}{11224803678858206361900017468416} \cdot y\right)}\right) \]
      4. lower--.f64N/A

        \[\leadsto x + \left(\frac{279195317918525}{3350343815022304} \cdot y + z \cdot \left(\frac{307332350656623}{2093964884388940} \cdot y - \color{blue}{\frac{1678650474502018223880473708075}{11224803678858206361900017468416} \cdot y}\right)\right) \]
      5. lower-*.f64N/A

        \[\leadsto x + \left(\frac{279195317918525}{3350343815022304} \cdot y + z \cdot \left(\frac{307332350656623}{2093964884388940} \cdot y - \color{blue}{\frac{1678650474502018223880473708075}{11224803678858206361900017468416}} \cdot y\right)\right) \]
      6. lower-*.f6464.8%

        \[\leadsto x + \left(\frac{279195317918525}{3350343815022304} \cdot y + z \cdot \left(\frac{307332350656623}{2093964884388940} \cdot y - \frac{1678650474502018223880473708075}{11224803678858206361900017468416} \cdot \color{blue}{y}\right)\right) \]
    4. Applied rewrites64.8%

      \[\leadsto x + \color{blue}{\left(\frac{279195317918525}{3350343815022304} \cdot y + z \cdot \left(\frac{307332350656623}{2093964884388940} \cdot y - \frac{1678650474502018223880473708075}{11224803678858206361900017468416} \cdot y\right)\right)} \]
    5. Step-by-step derivation
      1. lift-+.f64N/A

        \[\leadsto \color{blue}{x + \left(\frac{279195317918525}{3350343815022304} \cdot y + z \cdot \left(\frac{307332350656623}{2093964884388940} \cdot y - \frac{1678650474502018223880473708075}{11224803678858206361900017468416} \cdot y\right)\right)} \]
      2. +-commutativeN/A

        \[\leadsto \color{blue}{\left(\frac{279195317918525}{3350343815022304} \cdot y + z \cdot \left(\frac{307332350656623}{2093964884388940} \cdot y - \frac{1678650474502018223880473708075}{11224803678858206361900017468416} \cdot y\right)\right) + x} \]
      3. lower-+.f6464.8%

        \[\leadsto \color{blue}{\left(\frac{279195317918525}{3350343815022304} \cdot y + z \cdot \left(\frac{307332350656623}{2093964884388940} \cdot y - \frac{1678650474502018223880473708075}{11224803678858206361900017468416} \cdot y\right)\right) + x} \]
    6. Applied rewrites64.8%

      \[\leadsto \color{blue}{\left(\left(\frac{-155900051080628738716045985239}{56124018394291031809500087342080} \cdot y\right) \cdot z - \frac{-279195317918525}{3350343815022304} \cdot y\right) + x} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 3: 99.1% accurate, 1.3× speedup?

\[\begin{array}{l} \mathbf{if}\;z \leq \frac{-2582544170319337}{4611686018427387904}:\\ \;\;\;\;x + \frac{1}{\frac{\frac{10000000000000000}{692910599291889}}{y}}\\ \mathbf{elif}\;z \leq \frac{5404319552844595}{1125899906842624}:\\ \;\;\;\;\left(\left(\frac{-155900051080628738716045985239}{56124018394291031809500087342080} \cdot y\right) \cdot z - \frac{-279195317918525}{3350343815022304} \cdot y\right) + x\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(\frac{\frac{751220861604756070699018739433}{10000000000000000000000000000000}}{z} - \frac{-692910599291889}{10000000000000000}\right) + x\\ \end{array} \]
(FPCore (x y z)
  :precision binary64
  (if (<= z -2582544170319337/4611686018427387904)
  (+ x (/ 1 (/ 10000000000000000/692910599291889 y)))
  (if (<= z 5404319552844595/1125899906842624)
    (+
     (-
      (*
       (*
        -155900051080628738716045985239/56124018394291031809500087342080
        y)
       z)
      (* -279195317918525/3350343815022304 y))
     x)
    (+
     (*
      y
      (-
       (/
        751220861604756070699018739433/10000000000000000000000000000000
        z)
       -692910599291889/10000000000000000))
     x))))
double code(double x, double y, double z) {
	double tmp;
	if (z <= -0.00056) {
		tmp = x + (1.0 / (14.431876219268936 / y));
	} else if (z <= 4.8) {
		tmp = (((-0.00277777777751721 * y) * z) - (-0.08333333333333323 * y)) + x;
	} else {
		tmp = (y * ((0.07512208616047561 / z) - -0.0692910599291889)) + x;
	}
	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)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (z <= (-0.00056d0)) then
        tmp = x + (1.0d0 / (14.431876219268936d0 / y))
    else if (z <= 4.8d0) then
        tmp = ((((-0.00277777777751721d0) * y) * z) - ((-0.08333333333333323d0) * y)) + x
    else
        tmp = (y * ((0.07512208616047561d0 / z) - (-0.0692910599291889d0))) + x
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (z <= -0.00056) {
		tmp = x + (1.0 / (14.431876219268936 / y));
	} else if (z <= 4.8) {
		tmp = (((-0.00277777777751721 * y) * z) - (-0.08333333333333323 * y)) + x;
	} else {
		tmp = (y * ((0.07512208616047561 / z) - -0.0692910599291889)) + x;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if z <= -0.00056:
		tmp = x + (1.0 / (14.431876219268936 / y))
	elif z <= 4.8:
		tmp = (((-0.00277777777751721 * y) * z) - (-0.08333333333333323 * y)) + x
	else:
		tmp = (y * ((0.07512208616047561 / z) - -0.0692910599291889)) + x
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (z <= -0.00056)
		tmp = Float64(x + Float64(1.0 / Float64(14.431876219268936 / y)));
	elseif (z <= 4.8)
		tmp = Float64(Float64(Float64(Float64(-0.00277777777751721 * y) * z) - Float64(-0.08333333333333323 * y)) + x);
	else
		tmp = Float64(Float64(y * Float64(Float64(0.07512208616047561 / z) - -0.0692910599291889)) + x);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (z <= -0.00056)
		tmp = x + (1.0 / (14.431876219268936 / y));
	elseif (z <= 4.8)
		tmp = (((-0.00277777777751721 * y) * z) - (-0.08333333333333323 * y)) + x;
	else
		tmp = (y * ((0.07512208616047561 / z) - -0.0692910599291889)) + x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[z, -2582544170319337/4611686018427387904], N[(x + N[(1 / N[(10000000000000000/692910599291889 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5404319552844595/1125899906842624], N[(N[(N[(N[(-155900051080628738716045985239/56124018394291031809500087342080 * y), $MachinePrecision] * z), $MachinePrecision] - N[(-279195317918525/3350343815022304 * y), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(N[(y * N[(N[(751220861604756070699018739433/10000000000000000000000000000000 / z), $MachinePrecision] - -692910599291889/10000000000000000), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;z \leq \frac{-2582544170319337}{4611686018427387904}:\\
\;\;\;\;x + \frac{1}{\frac{\frac{10000000000000000}{692910599291889}}{y}}\\

\mathbf{elif}\;z \leq \frac{5404319552844595}{1125899906842624}:\\
\;\;\;\;\left(\left(\frac{-155900051080628738716045985239}{56124018394291031809500087342080} \cdot y\right) \cdot z - \frac{-279195317918525}{3350343815022304} \cdot y\right) + x\\

\mathbf{else}:\\
\;\;\;\;y \cdot \left(\frac{\frac{751220861604756070699018739433}{10000000000000000000000000000000}}{z} - \frac{-692910599291889}{10000000000000000}\right) + x\\


\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -5.5999999999999995e-4

    1. Initial program 68.3%

      \[x + \frac{y \cdot \left(\left(z \cdot \frac{692910599291889}{10000000000000000} + \frac{307332350656623}{625000000000000}\right) \cdot z + \frac{11167812716741}{40000000000000}\right)}{\left(z + \frac{6012459259764103}{1000000000000000}\right) \cdot z + \frac{104698244219447}{31250000000000}} \]
    2. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto x + \color{blue}{\frac{y \cdot \left(\left(z \cdot \frac{692910599291889}{10000000000000000} + \frac{307332350656623}{625000000000000}\right) \cdot z + \frac{11167812716741}{40000000000000}\right)}{\left(z + \frac{6012459259764103}{1000000000000000}\right) \cdot z + \frac{104698244219447}{31250000000000}}} \]
      2. div-flipN/A

        \[\leadsto x + \color{blue}{\frac{1}{\frac{\left(z + \frac{6012459259764103}{1000000000000000}\right) \cdot z + \frac{104698244219447}{31250000000000}}{y \cdot \left(\left(z \cdot \frac{692910599291889}{10000000000000000} + \frac{307332350656623}{625000000000000}\right) \cdot z + \frac{11167812716741}{40000000000000}\right)}}} \]
      3. lower-unsound-/.f64N/A

        \[\leadsto x + \color{blue}{\frac{1}{\frac{\left(z + \frac{6012459259764103}{1000000000000000}\right) \cdot z + \frac{104698244219447}{31250000000000}}{y \cdot \left(\left(z \cdot \frac{692910599291889}{10000000000000000} + \frac{307332350656623}{625000000000000}\right) \cdot z + \frac{11167812716741}{40000000000000}\right)}}} \]
      4. lower-unsound-/.f6468.3%

        \[\leadsto x + \frac{1}{\color{blue}{\frac{\left(z + \frac{6012459259764103}{1000000000000000}\right) \cdot z + \frac{104698244219447}{31250000000000}}{y \cdot \left(\left(z \cdot \frac{692910599291889}{10000000000000000} + \frac{307332350656623}{625000000000000}\right) \cdot z + \frac{11167812716741}{40000000000000}\right)}}} \]
      5. lift-+.f64N/A

        \[\leadsto x + \frac{1}{\frac{\color{blue}{\left(z + \frac{6012459259764103}{1000000000000000}\right) \cdot z + \frac{104698244219447}{31250000000000}}}{y \cdot \left(\left(z \cdot \frac{692910599291889}{10000000000000000} + \frac{307332350656623}{625000000000000}\right) \cdot z + \frac{11167812716741}{40000000000000}\right)}} \]
      6. add-flipN/A

        \[\leadsto x + \frac{1}{\frac{\color{blue}{\left(z + \frac{6012459259764103}{1000000000000000}\right) \cdot z - \left(\mathsf{neg}\left(\frac{104698244219447}{31250000000000}\right)\right)}}{y \cdot \left(\left(z \cdot \frac{692910599291889}{10000000000000000} + \frac{307332350656623}{625000000000000}\right) \cdot z + \frac{11167812716741}{40000000000000}\right)}} \]
      7. lower--.f64N/A

        \[\leadsto x + \frac{1}{\frac{\color{blue}{\left(z + \frac{6012459259764103}{1000000000000000}\right) \cdot z - \left(\mathsf{neg}\left(\frac{104698244219447}{31250000000000}\right)\right)}}{y \cdot \left(\left(z \cdot \frac{692910599291889}{10000000000000000} + \frac{307332350656623}{625000000000000}\right) \cdot z + \frac{11167812716741}{40000000000000}\right)}} \]
      8. lift-+.f64N/A

        \[\leadsto x + \frac{1}{\frac{\color{blue}{\left(z + \frac{6012459259764103}{1000000000000000}\right)} \cdot z - \left(\mathsf{neg}\left(\frac{104698244219447}{31250000000000}\right)\right)}{y \cdot \left(\left(z \cdot \frac{692910599291889}{10000000000000000} + \frac{307332350656623}{625000000000000}\right) \cdot z + \frac{11167812716741}{40000000000000}\right)}} \]
      9. add-flipN/A

        \[\leadsto x + \frac{1}{\frac{\color{blue}{\left(z - \left(\mathsf{neg}\left(\frac{6012459259764103}{1000000000000000}\right)\right)\right)} \cdot z - \left(\mathsf{neg}\left(\frac{104698244219447}{31250000000000}\right)\right)}{y \cdot \left(\left(z \cdot \frac{692910599291889}{10000000000000000} + \frac{307332350656623}{625000000000000}\right) \cdot z + \frac{11167812716741}{40000000000000}\right)}} \]
      10. lower--.f64N/A

        \[\leadsto x + \frac{1}{\frac{\color{blue}{\left(z - \left(\mathsf{neg}\left(\frac{6012459259764103}{1000000000000000}\right)\right)\right)} \cdot z - \left(\mathsf{neg}\left(\frac{104698244219447}{31250000000000}\right)\right)}{y \cdot \left(\left(z \cdot \frac{692910599291889}{10000000000000000} + \frac{307332350656623}{625000000000000}\right) \cdot z + \frac{11167812716741}{40000000000000}\right)}} \]
      11. metadata-evalN/A

        \[\leadsto x + \frac{1}{\frac{\left(z - \color{blue}{\frac{-6012459259764103}{1000000000000000}}\right) \cdot z - \left(\mathsf{neg}\left(\frac{104698244219447}{31250000000000}\right)\right)}{y \cdot \left(\left(z \cdot \frac{692910599291889}{10000000000000000} + \frac{307332350656623}{625000000000000}\right) \cdot z + \frac{11167812716741}{40000000000000}\right)}} \]
      12. metadata-eval68.3%

        \[\leadsto x + \frac{1}{\frac{\left(z - \frac{-6012459259764103}{1000000000000000}\right) \cdot z - \color{blue}{\frac{-104698244219447}{31250000000000}}}{y \cdot \left(\left(z \cdot \frac{692910599291889}{10000000000000000} + \frac{307332350656623}{625000000000000}\right) \cdot z + \frac{11167812716741}{40000000000000}\right)}} \]
      13. lift-*.f64N/A

        \[\leadsto x + \frac{1}{\frac{\left(z - \frac{-6012459259764103}{1000000000000000}\right) \cdot z - \frac{-104698244219447}{31250000000000}}{\color{blue}{y \cdot \left(\left(z \cdot \frac{692910599291889}{10000000000000000} + \frac{307332350656623}{625000000000000}\right) \cdot z + \frac{11167812716741}{40000000000000}\right)}}} \]
      14. *-commutativeN/A

        \[\leadsto x + \frac{1}{\frac{\left(z - \frac{-6012459259764103}{1000000000000000}\right) \cdot z - \frac{-104698244219447}{31250000000000}}{\color{blue}{\left(\left(z \cdot \frac{692910599291889}{10000000000000000} + \frac{307332350656623}{625000000000000}\right) \cdot z + \frac{11167812716741}{40000000000000}\right) \cdot y}}} \]
      15. lower-*.f6468.3%

        \[\leadsto x + \frac{1}{\frac{\left(z - \frac{-6012459259764103}{1000000000000000}\right) \cdot z - \frac{-104698244219447}{31250000000000}}{\color{blue}{\left(\left(z \cdot \frac{692910599291889}{10000000000000000} + \frac{307332350656623}{625000000000000}\right) \cdot z + \frac{11167812716741}{40000000000000}\right) \cdot y}}} \]
    3. Applied rewrites68.3%

      \[\leadsto x + \color{blue}{\frac{1}{\frac{\left(z - \frac{-6012459259764103}{1000000000000000}\right) \cdot z - \frac{-104698244219447}{31250000000000}}{\left(\left(\frac{692910599291889}{10000000000000000} \cdot z - \frac{-307332350656623}{625000000000000}\right) \cdot z - \frac{-11167812716741}{40000000000000}\right) \cdot y}}} \]
    4. Taylor expanded in z around inf

      \[\leadsto x + \frac{1}{\color{blue}{\frac{\frac{10000000000000000}{692910599291889}}{y}}} \]
    5. Step-by-step derivation
      1. lower-/.f6480.1%

        \[\leadsto x + \frac{1}{\frac{\frac{10000000000000000}{692910599291889}}{\color{blue}{y}}} \]
    6. Applied rewrites80.1%

      \[\leadsto x + \frac{1}{\color{blue}{\frac{\frac{10000000000000000}{692910599291889}}{y}}} \]

    if -5.5999999999999995e-4 < z < 4.7999999999999998

    1. Initial program 68.3%

      \[x + \frac{y \cdot \left(\left(z \cdot \frac{692910599291889}{10000000000000000} + \frac{307332350656623}{625000000000000}\right) \cdot z + \frac{11167812716741}{40000000000000}\right)}{\left(z + \frac{6012459259764103}{1000000000000000}\right) \cdot z + \frac{104698244219447}{31250000000000}} \]
    2. Taylor expanded in z around 0

      \[\leadsto x + \color{blue}{\left(\frac{279195317918525}{3350343815022304} \cdot y + z \cdot \left(\frac{307332350656623}{2093964884388940} \cdot y - \frac{1678650474502018223880473708075}{11224803678858206361900017468416} \cdot y\right)\right)} \]
    3. Step-by-step derivation
      1. lower-+.f64N/A

        \[\leadsto x + \left(\frac{279195317918525}{3350343815022304} \cdot y + \color{blue}{z \cdot \left(\frac{307332350656623}{2093964884388940} \cdot y - \frac{1678650474502018223880473708075}{11224803678858206361900017468416} \cdot y\right)}\right) \]
      2. lower-*.f64N/A

        \[\leadsto x + \left(\frac{279195317918525}{3350343815022304} \cdot y + \color{blue}{z} \cdot \left(\frac{307332350656623}{2093964884388940} \cdot y - \frac{1678650474502018223880473708075}{11224803678858206361900017468416} \cdot y\right)\right) \]
      3. lower-*.f64N/A

        \[\leadsto x + \left(\frac{279195317918525}{3350343815022304} \cdot y + z \cdot \color{blue}{\left(\frac{307332350656623}{2093964884388940} \cdot y - \frac{1678650474502018223880473708075}{11224803678858206361900017468416} \cdot y\right)}\right) \]
      4. lower--.f64N/A

        \[\leadsto x + \left(\frac{279195317918525}{3350343815022304} \cdot y + z \cdot \left(\frac{307332350656623}{2093964884388940} \cdot y - \color{blue}{\frac{1678650474502018223880473708075}{11224803678858206361900017468416} \cdot y}\right)\right) \]
      5. lower-*.f64N/A

        \[\leadsto x + \left(\frac{279195317918525}{3350343815022304} \cdot y + z \cdot \left(\frac{307332350656623}{2093964884388940} \cdot y - \color{blue}{\frac{1678650474502018223880473708075}{11224803678858206361900017468416}} \cdot y\right)\right) \]
      6. lower-*.f6464.8%

        \[\leadsto x + \left(\frac{279195317918525}{3350343815022304} \cdot y + z \cdot \left(\frac{307332350656623}{2093964884388940} \cdot y - \frac{1678650474502018223880473708075}{11224803678858206361900017468416} \cdot \color{blue}{y}\right)\right) \]
    4. Applied rewrites64.8%

      \[\leadsto x + \color{blue}{\left(\frac{279195317918525}{3350343815022304} \cdot y + z \cdot \left(\frac{307332350656623}{2093964884388940} \cdot y - \frac{1678650474502018223880473708075}{11224803678858206361900017468416} \cdot y\right)\right)} \]
    5. Step-by-step derivation
      1. lift-+.f64N/A

        \[\leadsto \color{blue}{x + \left(\frac{279195317918525}{3350343815022304} \cdot y + z \cdot \left(\frac{307332350656623}{2093964884388940} \cdot y - \frac{1678650474502018223880473708075}{11224803678858206361900017468416} \cdot y\right)\right)} \]
      2. +-commutativeN/A

        \[\leadsto \color{blue}{\left(\frac{279195317918525}{3350343815022304} \cdot y + z \cdot \left(\frac{307332350656623}{2093964884388940} \cdot y - \frac{1678650474502018223880473708075}{11224803678858206361900017468416} \cdot y\right)\right) + x} \]
      3. lower-+.f6464.8%

        \[\leadsto \color{blue}{\left(\frac{279195317918525}{3350343815022304} \cdot y + z \cdot \left(\frac{307332350656623}{2093964884388940} \cdot y - \frac{1678650474502018223880473708075}{11224803678858206361900017468416} \cdot y\right)\right) + x} \]
    6. Applied rewrites64.8%

      \[\leadsto \color{blue}{\left(\left(\frac{-155900051080628738716045985239}{56124018394291031809500087342080} \cdot y\right) \cdot z - \frac{-279195317918525}{3350343815022304} \cdot y\right) + x} \]

    if 4.7999999999999998 < z

    1. Initial program 68.3%

      \[x + \frac{y \cdot \left(\left(z \cdot \frac{692910599291889}{10000000000000000} + \frac{307332350656623}{625000000000000}\right) \cdot z + \frac{11167812716741}{40000000000000}\right)}{\left(z + \frac{6012459259764103}{1000000000000000}\right) \cdot z + \frac{104698244219447}{31250000000000}} \]
    2. Taylor expanded in z around -inf

      \[\leadsto x + \color{blue}{\left(-1 \cdot \frac{\frac{-307332350656623}{625000000000000} \cdot y - \frac{-4166096748901211929300981260567}{10000000000000000000000000000000} \cdot y}{z} + \frac{692910599291889}{10000000000000000} \cdot y\right)} \]
    3. Step-by-step derivation
      1. lower-+.f64N/A

        \[\leadsto x + \left(-1 \cdot \frac{\frac{-307332350656623}{625000000000000} \cdot y - \frac{-4166096748901211929300981260567}{10000000000000000000000000000000} \cdot y}{z} + \color{blue}{\frac{692910599291889}{10000000000000000} \cdot y}\right) \]
      2. lower-*.f64N/A

        \[\leadsto x + \left(-1 \cdot \frac{\frac{-307332350656623}{625000000000000} \cdot y - \frac{-4166096748901211929300981260567}{10000000000000000000000000000000} \cdot y}{z} + \color{blue}{\frac{692910599291889}{10000000000000000}} \cdot y\right) \]
      3. lower-/.f64N/A

        \[\leadsto x + \left(-1 \cdot \frac{\frac{-307332350656623}{625000000000000} \cdot y - \frac{-4166096748901211929300981260567}{10000000000000000000000000000000} \cdot y}{z} + \frac{692910599291889}{10000000000000000} \cdot y\right) \]
      4. lower--.f64N/A

        \[\leadsto x + \left(-1 \cdot \frac{\frac{-307332350656623}{625000000000000} \cdot y - \frac{-4166096748901211929300981260567}{10000000000000000000000000000000} \cdot y}{z} + \frac{692910599291889}{10000000000000000} \cdot y\right) \]
      5. lower-*.f64N/A

        \[\leadsto x + \left(-1 \cdot \frac{\frac{-307332350656623}{625000000000000} \cdot y - \frac{-4166096748901211929300981260567}{10000000000000000000000000000000} \cdot y}{z} + \frac{692910599291889}{10000000000000000} \cdot y\right) \]
      6. lower-*.f64N/A

        \[\leadsto x + \left(-1 \cdot \frac{\frac{-307332350656623}{625000000000000} \cdot y - \frac{-4166096748901211929300981260567}{10000000000000000000000000000000} \cdot y}{z} + \frac{692910599291889}{10000000000000000} \cdot y\right) \]
      7. lower-*.f6466.2%

        \[\leadsto x + \left(-1 \cdot \frac{\frac{-307332350656623}{625000000000000} \cdot y - \frac{-4166096748901211929300981260567}{10000000000000000000000000000000} \cdot y}{z} + \frac{692910599291889}{10000000000000000} \cdot \color{blue}{y}\right) \]
    4. Applied rewrites66.2%

      \[\leadsto x + \color{blue}{\left(-1 \cdot \frac{\frac{-307332350656623}{625000000000000} \cdot y - \frac{-4166096748901211929300981260567}{10000000000000000000000000000000} \cdot y}{z} + \frac{692910599291889}{10000000000000000} \cdot y\right)} \]
    5. Step-by-step derivation
      1. lift-+.f64N/A

        \[\leadsto \color{blue}{x + \left(-1 \cdot \frac{\frac{-307332350656623}{625000000000000} \cdot y - \frac{-4166096748901211929300981260567}{10000000000000000000000000000000} \cdot y}{z} + \frac{692910599291889}{10000000000000000} \cdot y\right)} \]
      2. +-commutativeN/A

        \[\leadsto \color{blue}{\left(-1 \cdot \frac{\frac{-307332350656623}{625000000000000} \cdot y - \frac{-4166096748901211929300981260567}{10000000000000000000000000000000} \cdot y}{z} + \frac{692910599291889}{10000000000000000} \cdot y\right) + x} \]
      3. lower-+.f6466.2%

        \[\leadsto \color{blue}{\left(-1 \cdot \frac{\frac{-307332350656623}{625000000000000} \cdot y - \frac{-4166096748901211929300981260567}{10000000000000000000000000000000} \cdot y}{z} + \frac{692910599291889}{10000000000000000} \cdot y\right) + x} \]
    6. Applied rewrites66.2%

      \[\leadsto \color{blue}{\left(\frac{y \cdot \frac{751220861604756070699018739433}{10000000000000000000000000000000}}{z} - \frac{-692910599291889}{10000000000000000} \cdot y\right) + x} \]
    7. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto \left(\frac{y \cdot \frac{751220861604756070699018739433}{10000000000000000000000000000000}}{z} - \color{blue}{\frac{-692910599291889}{10000000000000000} \cdot y}\right) + x \]
      2. lift-/.f64N/A

        \[\leadsto \left(\frac{y \cdot \frac{751220861604756070699018739433}{10000000000000000000000000000000}}{z} - \color{blue}{\frac{-692910599291889}{10000000000000000}} \cdot y\right) + x \]
      3. lift-*.f64N/A

        \[\leadsto \left(\frac{y \cdot \frac{751220861604756070699018739433}{10000000000000000000000000000000}}{z} - \frac{-692910599291889}{10000000000000000} \cdot y\right) + x \]
      4. associate-/l*N/A

        \[\leadsto \left(y \cdot \frac{\frac{751220861604756070699018739433}{10000000000000000000000000000000}}{z} - \color{blue}{\frac{-692910599291889}{10000000000000000}} \cdot y\right) + x \]
      5. lift-*.f64N/A

        \[\leadsto \left(y \cdot \frac{\frac{751220861604756070699018739433}{10000000000000000000000000000000}}{z} - \frac{-692910599291889}{10000000000000000} \cdot \color{blue}{y}\right) + x \]
      6. *-commutativeN/A

        \[\leadsto \left(y \cdot \frac{\frac{751220861604756070699018739433}{10000000000000000000000000000000}}{z} - y \cdot \color{blue}{\frac{-692910599291889}{10000000000000000}}\right) + x \]
      7. distribute-lft-out--N/A

        \[\leadsto y \cdot \color{blue}{\left(\frac{\frac{751220861604756070699018739433}{10000000000000000000000000000000}}{z} - \frac{-692910599291889}{10000000000000000}\right)} + x \]
      8. lower-*.f64N/A

        \[\leadsto y \cdot \color{blue}{\left(\frac{\frac{751220861604756070699018739433}{10000000000000000000000000000000}}{z} - \frac{-692910599291889}{10000000000000000}\right)} + x \]
      9. lower--.f64N/A

        \[\leadsto y \cdot \left(\frac{\frac{751220861604756070699018739433}{10000000000000000000000000000000}}{z} - \color{blue}{\frac{-692910599291889}{10000000000000000}}\right) + x \]
      10. lower-/.f6466.2%

        \[\leadsto y \cdot \left(\frac{\frac{751220861604756070699018739433}{10000000000000000000000000000000}}{z} - \frac{-692910599291889}{10000000000000000}\right) + x \]
    8. Applied rewrites66.2%

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

Alternative 4: 99.1% accurate, 1.3× speedup?

\[\begin{array}{l} \mathbf{if}\;z \leq \frac{-2582544170319337}{4611686018427387904}:\\ \;\;\;\;x + \frac{692910599291889}{10000000000000000} \cdot y\\ \mathbf{elif}\;z \leq \frac{5404319552844595}{1125899906842624}:\\ \;\;\;\;\left(\left(\frac{-155900051080628738716045985239}{56124018394291031809500087342080} \cdot y\right) \cdot z - \frac{-279195317918525}{3350343815022304} \cdot y\right) + x\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(\frac{\frac{751220861604756070699018739433}{10000000000000000000000000000000}}{z} - \frac{-692910599291889}{10000000000000000}\right) + x\\ \end{array} \]
(FPCore (x y z)
  :precision binary64
  (if (<= z -2582544170319337/4611686018427387904)
  (+ x (* 692910599291889/10000000000000000 y))
  (if (<= z 5404319552844595/1125899906842624)
    (+
     (-
      (*
       (*
        -155900051080628738716045985239/56124018394291031809500087342080
        y)
       z)
      (* -279195317918525/3350343815022304 y))
     x)
    (+
     (*
      y
      (-
       (/
        751220861604756070699018739433/10000000000000000000000000000000
        z)
       -692910599291889/10000000000000000))
     x))))
double code(double x, double y, double z) {
	double tmp;
	if (z <= -0.00056) {
		tmp = x + (0.0692910599291889 * y);
	} else if (z <= 4.8) {
		tmp = (((-0.00277777777751721 * y) * z) - (-0.08333333333333323 * y)) + x;
	} else {
		tmp = (y * ((0.07512208616047561 / z) - -0.0692910599291889)) + x;
	}
	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)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (z <= (-0.00056d0)) then
        tmp = x + (0.0692910599291889d0 * y)
    else if (z <= 4.8d0) then
        tmp = ((((-0.00277777777751721d0) * y) * z) - ((-0.08333333333333323d0) * y)) + x
    else
        tmp = (y * ((0.07512208616047561d0 / z) - (-0.0692910599291889d0))) + x
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (z <= -0.00056) {
		tmp = x + (0.0692910599291889 * y);
	} else if (z <= 4.8) {
		tmp = (((-0.00277777777751721 * y) * z) - (-0.08333333333333323 * y)) + x;
	} else {
		tmp = (y * ((0.07512208616047561 / z) - -0.0692910599291889)) + x;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if z <= -0.00056:
		tmp = x + (0.0692910599291889 * y)
	elif z <= 4.8:
		tmp = (((-0.00277777777751721 * y) * z) - (-0.08333333333333323 * y)) + x
	else:
		tmp = (y * ((0.07512208616047561 / z) - -0.0692910599291889)) + x
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (z <= -0.00056)
		tmp = Float64(x + Float64(0.0692910599291889 * y));
	elseif (z <= 4.8)
		tmp = Float64(Float64(Float64(Float64(-0.00277777777751721 * y) * z) - Float64(-0.08333333333333323 * y)) + x);
	else
		tmp = Float64(Float64(y * Float64(Float64(0.07512208616047561 / z) - -0.0692910599291889)) + x);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (z <= -0.00056)
		tmp = x + (0.0692910599291889 * y);
	elseif (z <= 4.8)
		tmp = (((-0.00277777777751721 * y) * z) - (-0.08333333333333323 * y)) + x;
	else
		tmp = (y * ((0.07512208616047561 / z) - -0.0692910599291889)) + x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[z, -2582544170319337/4611686018427387904], N[(x + N[(692910599291889/10000000000000000 * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5404319552844595/1125899906842624], N[(N[(N[(N[(-155900051080628738716045985239/56124018394291031809500087342080 * y), $MachinePrecision] * z), $MachinePrecision] - N[(-279195317918525/3350343815022304 * y), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(N[(y * N[(N[(751220861604756070699018739433/10000000000000000000000000000000 / z), $MachinePrecision] - -692910599291889/10000000000000000), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;z \leq \frac{-2582544170319337}{4611686018427387904}:\\
\;\;\;\;x + \frac{692910599291889}{10000000000000000} \cdot y\\

\mathbf{elif}\;z \leq \frac{5404319552844595}{1125899906842624}:\\
\;\;\;\;\left(\left(\frac{-155900051080628738716045985239}{56124018394291031809500087342080} \cdot y\right) \cdot z - \frac{-279195317918525}{3350343815022304} \cdot y\right) + x\\

\mathbf{else}:\\
\;\;\;\;y \cdot \left(\frac{\frac{751220861604756070699018739433}{10000000000000000000000000000000}}{z} - \frac{-692910599291889}{10000000000000000}\right) + x\\


\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -5.5999999999999995e-4

    1. Initial program 68.3%

      \[x + \frac{y \cdot \left(\left(z \cdot \frac{692910599291889}{10000000000000000} + \frac{307332350656623}{625000000000000}\right) \cdot z + \frac{11167812716741}{40000000000000}\right)}{\left(z + \frac{6012459259764103}{1000000000000000}\right) \cdot z + \frac{104698244219447}{31250000000000}} \]
    2. Taylor expanded in z around inf

      \[\leadsto x + \color{blue}{\frac{692910599291889}{10000000000000000} \cdot y} \]
    3. Step-by-step derivation
      1. lower-*.f6480.1%

        \[\leadsto x + \frac{692910599291889}{10000000000000000} \cdot \color{blue}{y} \]
    4. Applied rewrites80.1%

      \[\leadsto x + \color{blue}{\frac{692910599291889}{10000000000000000} \cdot y} \]

    if -5.5999999999999995e-4 < z < 4.7999999999999998

    1. Initial program 68.3%

      \[x + \frac{y \cdot \left(\left(z \cdot \frac{692910599291889}{10000000000000000} + \frac{307332350656623}{625000000000000}\right) \cdot z + \frac{11167812716741}{40000000000000}\right)}{\left(z + \frac{6012459259764103}{1000000000000000}\right) \cdot z + \frac{104698244219447}{31250000000000}} \]
    2. Taylor expanded in z around 0

      \[\leadsto x + \color{blue}{\left(\frac{279195317918525}{3350343815022304} \cdot y + z \cdot \left(\frac{307332350656623}{2093964884388940} \cdot y - \frac{1678650474502018223880473708075}{11224803678858206361900017468416} \cdot y\right)\right)} \]
    3. Step-by-step derivation
      1. lower-+.f64N/A

        \[\leadsto x + \left(\frac{279195317918525}{3350343815022304} \cdot y + \color{blue}{z \cdot \left(\frac{307332350656623}{2093964884388940} \cdot y - \frac{1678650474502018223880473708075}{11224803678858206361900017468416} \cdot y\right)}\right) \]
      2. lower-*.f64N/A

        \[\leadsto x + \left(\frac{279195317918525}{3350343815022304} \cdot y + \color{blue}{z} \cdot \left(\frac{307332350656623}{2093964884388940} \cdot y - \frac{1678650474502018223880473708075}{11224803678858206361900017468416} \cdot y\right)\right) \]
      3. lower-*.f64N/A

        \[\leadsto x + \left(\frac{279195317918525}{3350343815022304} \cdot y + z \cdot \color{blue}{\left(\frac{307332350656623}{2093964884388940} \cdot y - \frac{1678650474502018223880473708075}{11224803678858206361900017468416} \cdot y\right)}\right) \]
      4. lower--.f64N/A

        \[\leadsto x + \left(\frac{279195317918525}{3350343815022304} \cdot y + z \cdot \left(\frac{307332350656623}{2093964884388940} \cdot y - \color{blue}{\frac{1678650474502018223880473708075}{11224803678858206361900017468416} \cdot y}\right)\right) \]
      5. lower-*.f64N/A

        \[\leadsto x + \left(\frac{279195317918525}{3350343815022304} \cdot y + z \cdot \left(\frac{307332350656623}{2093964884388940} \cdot y - \color{blue}{\frac{1678650474502018223880473708075}{11224803678858206361900017468416}} \cdot y\right)\right) \]
      6. lower-*.f6464.8%

        \[\leadsto x + \left(\frac{279195317918525}{3350343815022304} \cdot y + z \cdot \left(\frac{307332350656623}{2093964884388940} \cdot y - \frac{1678650474502018223880473708075}{11224803678858206361900017468416} \cdot \color{blue}{y}\right)\right) \]
    4. Applied rewrites64.8%

      \[\leadsto x + \color{blue}{\left(\frac{279195317918525}{3350343815022304} \cdot y + z \cdot \left(\frac{307332350656623}{2093964884388940} \cdot y - \frac{1678650474502018223880473708075}{11224803678858206361900017468416} \cdot y\right)\right)} \]
    5. Step-by-step derivation
      1. lift-+.f64N/A

        \[\leadsto \color{blue}{x + \left(\frac{279195317918525}{3350343815022304} \cdot y + z \cdot \left(\frac{307332350656623}{2093964884388940} \cdot y - \frac{1678650474502018223880473708075}{11224803678858206361900017468416} \cdot y\right)\right)} \]
      2. +-commutativeN/A

        \[\leadsto \color{blue}{\left(\frac{279195317918525}{3350343815022304} \cdot y + z \cdot \left(\frac{307332350656623}{2093964884388940} \cdot y - \frac{1678650474502018223880473708075}{11224803678858206361900017468416} \cdot y\right)\right) + x} \]
      3. lower-+.f6464.8%

        \[\leadsto \color{blue}{\left(\frac{279195317918525}{3350343815022304} \cdot y + z \cdot \left(\frac{307332350656623}{2093964884388940} \cdot y - \frac{1678650474502018223880473708075}{11224803678858206361900017468416} \cdot y\right)\right) + x} \]
    6. Applied rewrites64.8%

      \[\leadsto \color{blue}{\left(\left(\frac{-155900051080628738716045985239}{56124018394291031809500087342080} \cdot y\right) \cdot z - \frac{-279195317918525}{3350343815022304} \cdot y\right) + x} \]

    if 4.7999999999999998 < z

    1. Initial program 68.3%

      \[x + \frac{y \cdot \left(\left(z \cdot \frac{692910599291889}{10000000000000000} + \frac{307332350656623}{625000000000000}\right) \cdot z + \frac{11167812716741}{40000000000000}\right)}{\left(z + \frac{6012459259764103}{1000000000000000}\right) \cdot z + \frac{104698244219447}{31250000000000}} \]
    2. Taylor expanded in z around -inf

      \[\leadsto x + \color{blue}{\left(-1 \cdot \frac{\frac{-307332350656623}{625000000000000} \cdot y - \frac{-4166096748901211929300981260567}{10000000000000000000000000000000} \cdot y}{z} + \frac{692910599291889}{10000000000000000} \cdot y\right)} \]
    3. Step-by-step derivation
      1. lower-+.f64N/A

        \[\leadsto x + \left(-1 \cdot \frac{\frac{-307332350656623}{625000000000000} \cdot y - \frac{-4166096748901211929300981260567}{10000000000000000000000000000000} \cdot y}{z} + \color{blue}{\frac{692910599291889}{10000000000000000} \cdot y}\right) \]
      2. lower-*.f64N/A

        \[\leadsto x + \left(-1 \cdot \frac{\frac{-307332350656623}{625000000000000} \cdot y - \frac{-4166096748901211929300981260567}{10000000000000000000000000000000} \cdot y}{z} + \color{blue}{\frac{692910599291889}{10000000000000000}} \cdot y\right) \]
      3. lower-/.f64N/A

        \[\leadsto x + \left(-1 \cdot \frac{\frac{-307332350656623}{625000000000000} \cdot y - \frac{-4166096748901211929300981260567}{10000000000000000000000000000000} \cdot y}{z} + \frac{692910599291889}{10000000000000000} \cdot y\right) \]
      4. lower--.f64N/A

        \[\leadsto x + \left(-1 \cdot \frac{\frac{-307332350656623}{625000000000000} \cdot y - \frac{-4166096748901211929300981260567}{10000000000000000000000000000000} \cdot y}{z} + \frac{692910599291889}{10000000000000000} \cdot y\right) \]
      5. lower-*.f64N/A

        \[\leadsto x + \left(-1 \cdot \frac{\frac{-307332350656623}{625000000000000} \cdot y - \frac{-4166096748901211929300981260567}{10000000000000000000000000000000} \cdot y}{z} + \frac{692910599291889}{10000000000000000} \cdot y\right) \]
      6. lower-*.f64N/A

        \[\leadsto x + \left(-1 \cdot \frac{\frac{-307332350656623}{625000000000000} \cdot y - \frac{-4166096748901211929300981260567}{10000000000000000000000000000000} \cdot y}{z} + \frac{692910599291889}{10000000000000000} \cdot y\right) \]
      7. lower-*.f6466.2%

        \[\leadsto x + \left(-1 \cdot \frac{\frac{-307332350656623}{625000000000000} \cdot y - \frac{-4166096748901211929300981260567}{10000000000000000000000000000000} \cdot y}{z} + \frac{692910599291889}{10000000000000000} \cdot \color{blue}{y}\right) \]
    4. Applied rewrites66.2%

      \[\leadsto x + \color{blue}{\left(-1 \cdot \frac{\frac{-307332350656623}{625000000000000} \cdot y - \frac{-4166096748901211929300981260567}{10000000000000000000000000000000} \cdot y}{z} + \frac{692910599291889}{10000000000000000} \cdot y\right)} \]
    5. Step-by-step derivation
      1. lift-+.f64N/A

        \[\leadsto \color{blue}{x + \left(-1 \cdot \frac{\frac{-307332350656623}{625000000000000} \cdot y - \frac{-4166096748901211929300981260567}{10000000000000000000000000000000} \cdot y}{z} + \frac{692910599291889}{10000000000000000} \cdot y\right)} \]
      2. +-commutativeN/A

        \[\leadsto \color{blue}{\left(-1 \cdot \frac{\frac{-307332350656623}{625000000000000} \cdot y - \frac{-4166096748901211929300981260567}{10000000000000000000000000000000} \cdot y}{z} + \frac{692910599291889}{10000000000000000} \cdot y\right) + x} \]
      3. lower-+.f6466.2%

        \[\leadsto \color{blue}{\left(-1 \cdot \frac{\frac{-307332350656623}{625000000000000} \cdot y - \frac{-4166096748901211929300981260567}{10000000000000000000000000000000} \cdot y}{z} + \frac{692910599291889}{10000000000000000} \cdot y\right) + x} \]
    6. Applied rewrites66.2%

      \[\leadsto \color{blue}{\left(\frac{y \cdot \frac{751220861604756070699018739433}{10000000000000000000000000000000}}{z} - \frac{-692910599291889}{10000000000000000} \cdot y\right) + x} \]
    7. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto \left(\frac{y \cdot \frac{751220861604756070699018739433}{10000000000000000000000000000000}}{z} - \color{blue}{\frac{-692910599291889}{10000000000000000} \cdot y}\right) + x \]
      2. lift-/.f64N/A

        \[\leadsto \left(\frac{y \cdot \frac{751220861604756070699018739433}{10000000000000000000000000000000}}{z} - \color{blue}{\frac{-692910599291889}{10000000000000000}} \cdot y\right) + x \]
      3. lift-*.f64N/A

        \[\leadsto \left(\frac{y \cdot \frac{751220861604756070699018739433}{10000000000000000000000000000000}}{z} - \frac{-692910599291889}{10000000000000000} \cdot y\right) + x \]
      4. associate-/l*N/A

        \[\leadsto \left(y \cdot \frac{\frac{751220861604756070699018739433}{10000000000000000000000000000000}}{z} - \color{blue}{\frac{-692910599291889}{10000000000000000}} \cdot y\right) + x \]
      5. lift-*.f64N/A

        \[\leadsto \left(y \cdot \frac{\frac{751220861604756070699018739433}{10000000000000000000000000000000}}{z} - \frac{-692910599291889}{10000000000000000} \cdot \color{blue}{y}\right) + x \]
      6. *-commutativeN/A

        \[\leadsto \left(y \cdot \frac{\frac{751220861604756070699018739433}{10000000000000000000000000000000}}{z} - y \cdot \color{blue}{\frac{-692910599291889}{10000000000000000}}\right) + x \]
      7. distribute-lft-out--N/A

        \[\leadsto y \cdot \color{blue}{\left(\frac{\frac{751220861604756070699018739433}{10000000000000000000000000000000}}{z} - \frac{-692910599291889}{10000000000000000}\right)} + x \]
      8. lower-*.f64N/A

        \[\leadsto y \cdot \color{blue}{\left(\frac{\frac{751220861604756070699018739433}{10000000000000000000000000000000}}{z} - \frac{-692910599291889}{10000000000000000}\right)} + x \]
      9. lower--.f64N/A

        \[\leadsto y \cdot \left(\frac{\frac{751220861604756070699018739433}{10000000000000000000000000000000}}{z} - \color{blue}{\frac{-692910599291889}{10000000000000000}}\right) + x \]
      10. lower-/.f6466.2%

        \[\leadsto y \cdot \left(\frac{\frac{751220861604756070699018739433}{10000000000000000000000000000000}}{z} - \frac{-692910599291889}{10000000000000000}\right) + x \]
    8. Applied rewrites66.2%

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

Alternative 5: 98.9% accurate, 1.4× speedup?

\[\begin{array}{l} t_0 := x + \frac{692910599291889}{10000000000000000} \cdot y\\ \mathbf{if}\;z \leq \frac{-2582544170319337}{4611686018427387904}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq \frac{7378697629483821}{73786976294838206464}:\\ \;\;\;\;\left(\left(\frac{-155900051080628738716045985239}{56124018394291031809500087342080} \cdot y\right) \cdot z - \frac{-279195317918525}{3350343815022304} \cdot y\right) + x\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \]
(FPCore (x y z)
  :precision binary64
  (let* ((t_0 (+ x (* 692910599291889/10000000000000000 y))))
  (if (<= z -2582544170319337/4611686018427387904)
    t_0
    (if (<= z 7378697629483821/73786976294838206464)
      (+
       (-
        (*
         (*
          -155900051080628738716045985239/56124018394291031809500087342080
          y)
         z)
        (* -279195317918525/3350343815022304 y))
       x)
      t_0))))
double code(double x, double y, double z) {
	double t_0 = x + (0.0692910599291889 * y);
	double tmp;
	if (z <= -0.00056) {
		tmp = t_0;
	} else if (z <= 0.0001) {
		tmp = (((-0.00277777777751721 * y) * z) - (-0.08333333333333323 * y)) + x;
	} else {
		tmp = t_0;
	}
	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)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = x + (0.0692910599291889d0 * y)
    if (z <= (-0.00056d0)) then
        tmp = t_0
    else if (z <= 0.0001d0) then
        tmp = ((((-0.00277777777751721d0) * y) * z) - ((-0.08333333333333323d0) * y)) + x
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = x + (0.0692910599291889 * y);
	double tmp;
	if (z <= -0.00056) {
		tmp = t_0;
	} else if (z <= 0.0001) {
		tmp = (((-0.00277777777751721 * y) * z) - (-0.08333333333333323 * y)) + x;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = x + (0.0692910599291889 * y)
	tmp = 0
	if z <= -0.00056:
		tmp = t_0
	elif z <= 0.0001:
		tmp = (((-0.00277777777751721 * y) * z) - (-0.08333333333333323 * y)) + x
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(x + Float64(0.0692910599291889 * y))
	tmp = 0.0
	if (z <= -0.00056)
		tmp = t_0;
	elseif (z <= 0.0001)
		tmp = Float64(Float64(Float64(Float64(-0.00277777777751721 * y) * z) - Float64(-0.08333333333333323 * y)) + x);
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = x + (0.0692910599291889 * y);
	tmp = 0.0;
	if (z <= -0.00056)
		tmp = t_0;
	elseif (z <= 0.0001)
		tmp = (((-0.00277777777751721 * y) * z) - (-0.08333333333333323 * y)) + x;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(x + N[(692910599291889/10000000000000000 * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2582544170319337/4611686018427387904], t$95$0, If[LessEqual[z, 7378697629483821/73786976294838206464], N[(N[(N[(N[(-155900051080628738716045985239/56124018394291031809500087342080 * y), $MachinePrecision] * z), $MachinePrecision] - N[(-279195317918525/3350343815022304 * y), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := x + \frac{692910599291889}{10000000000000000} \cdot y\\
\mathbf{if}\;z \leq \frac{-2582544170319337}{4611686018427387904}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq \frac{7378697629483821}{73786976294838206464}:\\
\;\;\;\;\left(\left(\frac{-155900051080628738716045985239}{56124018394291031809500087342080} \cdot y\right) \cdot z - \frac{-279195317918525}{3350343815022304} \cdot y\right) + x\\

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


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -5.5999999999999995e-4 or 1e-4 < z

    1. Initial program 68.3%

      \[x + \frac{y \cdot \left(\left(z \cdot \frac{692910599291889}{10000000000000000} + \frac{307332350656623}{625000000000000}\right) \cdot z + \frac{11167812716741}{40000000000000}\right)}{\left(z + \frac{6012459259764103}{1000000000000000}\right) \cdot z + \frac{104698244219447}{31250000000000}} \]
    2. Taylor expanded in z around inf

      \[\leadsto x + \color{blue}{\frac{692910599291889}{10000000000000000} \cdot y} \]
    3. Step-by-step derivation
      1. lower-*.f6480.1%

        \[\leadsto x + \frac{692910599291889}{10000000000000000} \cdot \color{blue}{y} \]
    4. Applied rewrites80.1%

      \[\leadsto x + \color{blue}{\frac{692910599291889}{10000000000000000} \cdot y} \]

    if -5.5999999999999995e-4 < z < 1e-4

    1. Initial program 68.3%

      \[x + \frac{y \cdot \left(\left(z \cdot \frac{692910599291889}{10000000000000000} + \frac{307332350656623}{625000000000000}\right) \cdot z + \frac{11167812716741}{40000000000000}\right)}{\left(z + \frac{6012459259764103}{1000000000000000}\right) \cdot z + \frac{104698244219447}{31250000000000}} \]
    2. Taylor expanded in z around 0

      \[\leadsto x + \color{blue}{\left(\frac{279195317918525}{3350343815022304} \cdot y + z \cdot \left(\frac{307332350656623}{2093964884388940} \cdot y - \frac{1678650474502018223880473708075}{11224803678858206361900017468416} \cdot y\right)\right)} \]
    3. Step-by-step derivation
      1. lower-+.f64N/A

        \[\leadsto x + \left(\frac{279195317918525}{3350343815022304} \cdot y + \color{blue}{z \cdot \left(\frac{307332350656623}{2093964884388940} \cdot y - \frac{1678650474502018223880473708075}{11224803678858206361900017468416} \cdot y\right)}\right) \]
      2. lower-*.f64N/A

        \[\leadsto x + \left(\frac{279195317918525}{3350343815022304} \cdot y + \color{blue}{z} \cdot \left(\frac{307332350656623}{2093964884388940} \cdot y - \frac{1678650474502018223880473708075}{11224803678858206361900017468416} \cdot y\right)\right) \]
      3. lower-*.f64N/A

        \[\leadsto x + \left(\frac{279195317918525}{3350343815022304} \cdot y + z \cdot \color{blue}{\left(\frac{307332350656623}{2093964884388940} \cdot y - \frac{1678650474502018223880473708075}{11224803678858206361900017468416} \cdot y\right)}\right) \]
      4. lower--.f64N/A

        \[\leadsto x + \left(\frac{279195317918525}{3350343815022304} \cdot y + z \cdot \left(\frac{307332350656623}{2093964884388940} \cdot y - \color{blue}{\frac{1678650474502018223880473708075}{11224803678858206361900017468416} \cdot y}\right)\right) \]
      5. lower-*.f64N/A

        \[\leadsto x + \left(\frac{279195317918525}{3350343815022304} \cdot y + z \cdot \left(\frac{307332350656623}{2093964884388940} \cdot y - \color{blue}{\frac{1678650474502018223880473708075}{11224803678858206361900017468416}} \cdot y\right)\right) \]
      6. lower-*.f6464.8%

        \[\leadsto x + \left(\frac{279195317918525}{3350343815022304} \cdot y + z \cdot \left(\frac{307332350656623}{2093964884388940} \cdot y - \frac{1678650474502018223880473708075}{11224803678858206361900017468416} \cdot \color{blue}{y}\right)\right) \]
    4. Applied rewrites64.8%

      \[\leadsto x + \color{blue}{\left(\frac{279195317918525}{3350343815022304} \cdot y + z \cdot \left(\frac{307332350656623}{2093964884388940} \cdot y - \frac{1678650474502018223880473708075}{11224803678858206361900017468416} \cdot y\right)\right)} \]
    5. Step-by-step derivation
      1. lift-+.f64N/A

        \[\leadsto \color{blue}{x + \left(\frac{279195317918525}{3350343815022304} \cdot y + z \cdot \left(\frac{307332350656623}{2093964884388940} \cdot y - \frac{1678650474502018223880473708075}{11224803678858206361900017468416} \cdot y\right)\right)} \]
      2. +-commutativeN/A

        \[\leadsto \color{blue}{\left(\frac{279195317918525}{3350343815022304} \cdot y + z \cdot \left(\frac{307332350656623}{2093964884388940} \cdot y - \frac{1678650474502018223880473708075}{11224803678858206361900017468416} \cdot y\right)\right) + x} \]
      3. lower-+.f6464.8%

        \[\leadsto \color{blue}{\left(\frac{279195317918525}{3350343815022304} \cdot y + z \cdot \left(\frac{307332350656623}{2093964884388940} \cdot y - \frac{1678650474502018223880473708075}{11224803678858206361900017468416} \cdot y\right)\right) + x} \]
    6. Applied rewrites64.8%

      \[\leadsto \color{blue}{\left(\left(\frac{-155900051080628738716045985239}{56124018394291031809500087342080} \cdot y\right) \cdot z - \frac{-279195317918525}{3350343815022304} \cdot y\right) + x} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 6: 98.9% accurate, 1.6× speedup?

\[\begin{array}{l} t_0 := x + \frac{692910599291889}{10000000000000000} \cdot y\\ \mathbf{if}\;z \leq \frac{-2582544170319337}{4611686018427387904}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq \frac{7378697629483821}{73786976294838206464}:\\ \;\;\;\;x + y \cdot \left(\frac{279195317918525}{3350343815022304} + \frac{-155900051080628738716045985239}{56124018394291031809500087342080} \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \]
(FPCore (x y z)
  :precision binary64
  (let* ((t_0 (+ x (* 692910599291889/10000000000000000 y))))
  (if (<= z -2582544170319337/4611686018427387904)
    t_0
    (if (<= z 7378697629483821/73786976294838206464)
      (+
       x
       (*
        y
        (+
         279195317918525/3350343815022304
         (*
          -155900051080628738716045985239/56124018394291031809500087342080
          z))))
      t_0))))
double code(double x, double y, double z) {
	double t_0 = x + (0.0692910599291889 * y);
	double tmp;
	if (z <= -0.00056) {
		tmp = t_0;
	} else if (z <= 0.0001) {
		tmp = x + (y * (0.08333333333333323 + (-0.00277777777751721 * z)));
	} else {
		tmp = t_0;
	}
	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)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = x + (0.0692910599291889d0 * y)
    if (z <= (-0.00056d0)) then
        tmp = t_0
    else if (z <= 0.0001d0) then
        tmp = x + (y * (0.08333333333333323d0 + ((-0.00277777777751721d0) * z)))
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = x + (0.0692910599291889 * y);
	double tmp;
	if (z <= -0.00056) {
		tmp = t_0;
	} else if (z <= 0.0001) {
		tmp = x + (y * (0.08333333333333323 + (-0.00277777777751721 * z)));
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = x + (0.0692910599291889 * y)
	tmp = 0
	if z <= -0.00056:
		tmp = t_0
	elif z <= 0.0001:
		tmp = x + (y * (0.08333333333333323 + (-0.00277777777751721 * z)))
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(x + Float64(0.0692910599291889 * y))
	tmp = 0.0
	if (z <= -0.00056)
		tmp = t_0;
	elseif (z <= 0.0001)
		tmp = Float64(x + Float64(y * Float64(0.08333333333333323 + Float64(-0.00277777777751721 * z))));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = x + (0.0692910599291889 * y);
	tmp = 0.0;
	if (z <= -0.00056)
		tmp = t_0;
	elseif (z <= 0.0001)
		tmp = x + (y * (0.08333333333333323 + (-0.00277777777751721 * z)));
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(x + N[(692910599291889/10000000000000000 * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2582544170319337/4611686018427387904], t$95$0, If[LessEqual[z, 7378697629483821/73786976294838206464], N[(x + N[(y * N[(279195317918525/3350343815022304 + N[(-155900051080628738716045985239/56124018394291031809500087342080 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := x + \frac{692910599291889}{10000000000000000} \cdot y\\
\mathbf{if}\;z \leq \frac{-2582544170319337}{4611686018427387904}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq \frac{7378697629483821}{73786976294838206464}:\\
\;\;\;\;x + y \cdot \left(\frac{279195317918525}{3350343815022304} + \frac{-155900051080628738716045985239}{56124018394291031809500087342080} \cdot z\right)\\

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


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -5.5999999999999995e-4 or 1e-4 < z

    1. Initial program 68.3%

      \[x + \frac{y \cdot \left(\left(z \cdot \frac{692910599291889}{10000000000000000} + \frac{307332350656623}{625000000000000}\right) \cdot z + \frac{11167812716741}{40000000000000}\right)}{\left(z + \frac{6012459259764103}{1000000000000000}\right) \cdot z + \frac{104698244219447}{31250000000000}} \]
    2. Taylor expanded in z around inf

      \[\leadsto x + \color{blue}{\frac{692910599291889}{10000000000000000} \cdot y} \]
    3. Step-by-step derivation
      1. lower-*.f6480.1%

        \[\leadsto x + \frac{692910599291889}{10000000000000000} \cdot \color{blue}{y} \]
    4. Applied rewrites80.1%

      \[\leadsto x + \color{blue}{\frac{692910599291889}{10000000000000000} \cdot y} \]

    if -5.5999999999999995e-4 < z < 1e-4

    1. Initial program 68.3%

      \[x + \frac{y \cdot \left(\left(z \cdot \frac{692910599291889}{10000000000000000} + \frac{307332350656623}{625000000000000}\right) \cdot z + \frac{11167812716741}{40000000000000}\right)}{\left(z + \frac{6012459259764103}{1000000000000000}\right) \cdot z + \frac{104698244219447}{31250000000000}} \]
    2. Taylor expanded in z around 0

      \[\leadsto x + \color{blue}{\left(\frac{279195317918525}{3350343815022304} \cdot y + z \cdot \left(\frac{307332350656623}{2093964884388940} \cdot y - \frac{1678650474502018223880473708075}{11224803678858206361900017468416} \cdot y\right)\right)} \]
    3. Step-by-step derivation
      1. lower-+.f64N/A

        \[\leadsto x + \left(\frac{279195317918525}{3350343815022304} \cdot y + \color{blue}{z \cdot \left(\frac{307332350656623}{2093964884388940} \cdot y - \frac{1678650474502018223880473708075}{11224803678858206361900017468416} \cdot y\right)}\right) \]
      2. lower-*.f64N/A

        \[\leadsto x + \left(\frac{279195317918525}{3350343815022304} \cdot y + \color{blue}{z} \cdot \left(\frac{307332350656623}{2093964884388940} \cdot y - \frac{1678650474502018223880473708075}{11224803678858206361900017468416} \cdot y\right)\right) \]
      3. lower-*.f64N/A

        \[\leadsto x + \left(\frac{279195317918525}{3350343815022304} \cdot y + z \cdot \color{blue}{\left(\frac{307332350656623}{2093964884388940} \cdot y - \frac{1678650474502018223880473708075}{11224803678858206361900017468416} \cdot y\right)}\right) \]
      4. lower--.f64N/A

        \[\leadsto x + \left(\frac{279195317918525}{3350343815022304} \cdot y + z \cdot \left(\frac{307332350656623}{2093964884388940} \cdot y - \color{blue}{\frac{1678650474502018223880473708075}{11224803678858206361900017468416} \cdot y}\right)\right) \]
      5. lower-*.f64N/A

        \[\leadsto x + \left(\frac{279195317918525}{3350343815022304} \cdot y + z \cdot \left(\frac{307332350656623}{2093964884388940} \cdot y - \color{blue}{\frac{1678650474502018223880473708075}{11224803678858206361900017468416}} \cdot y\right)\right) \]
      6. lower-*.f6464.8%

        \[\leadsto x + \left(\frac{279195317918525}{3350343815022304} \cdot y + z \cdot \left(\frac{307332350656623}{2093964884388940} \cdot y - \frac{1678650474502018223880473708075}{11224803678858206361900017468416} \cdot \color{blue}{y}\right)\right) \]
    4. Applied rewrites64.8%

      \[\leadsto x + \color{blue}{\left(\frac{279195317918525}{3350343815022304} \cdot y + z \cdot \left(\frac{307332350656623}{2093964884388940} \cdot y - \frac{1678650474502018223880473708075}{11224803678858206361900017468416} \cdot y\right)\right)} \]
    5. Taylor expanded in y around 0

      \[\leadsto x + y \cdot \color{blue}{\left(\frac{279195317918525}{3350343815022304} + \frac{-155900051080628738716045985239}{56124018394291031809500087342080} \cdot z\right)} \]
    6. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto x + y \cdot \left(\frac{279195317918525}{3350343815022304} + \color{blue}{\frac{-155900051080628738716045985239}{56124018394291031809500087342080} \cdot z}\right) \]
      2. lower-+.f64N/A

        \[\leadsto x + y \cdot \left(\frac{279195317918525}{3350343815022304} + \frac{-155900051080628738716045985239}{56124018394291031809500087342080} \cdot \color{blue}{z}\right) \]
      3. lower-*.f6464.8%

        \[\leadsto x + y \cdot \left(\frac{279195317918525}{3350343815022304} + \frac{-155900051080628738716045985239}{56124018394291031809500087342080} \cdot z\right) \]
    7. Applied rewrites64.8%

      \[\leadsto x + y \cdot \color{blue}{\left(\frac{279195317918525}{3350343815022304} + \frac{-155900051080628738716045985239}{56124018394291031809500087342080} \cdot z\right)} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 7: 98.7% accurate, 2.2× speedup?

\[\begin{array}{l} t_0 := x + \frac{692910599291889}{10000000000000000} \cdot y\\ \mathbf{if}\;z \leq -3150000000:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 5200000:\\ \;\;\;\;x + \frac{279195317918525}{3350343815022304} \cdot y\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \]
(FPCore (x y z)
  :precision binary64
  (let* ((t_0 (+ x (* 692910599291889/10000000000000000 y))))
  (if (<= z -3150000000)
    t_0
    (if (<= z 5200000)
      (+ x (* 279195317918525/3350343815022304 y))
      t_0))))
double code(double x, double y, double z) {
	double t_0 = x + (0.0692910599291889 * y);
	double tmp;
	if (z <= -3150000000.0) {
		tmp = t_0;
	} else if (z <= 5200000.0) {
		tmp = x + (0.08333333333333323 * y);
	} else {
		tmp = t_0;
	}
	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)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = x + (0.0692910599291889d0 * y)
    if (z <= (-3150000000.0d0)) then
        tmp = t_0
    else if (z <= 5200000.0d0) then
        tmp = x + (0.08333333333333323d0 * y)
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = x + (0.0692910599291889 * y);
	double tmp;
	if (z <= -3150000000.0) {
		tmp = t_0;
	} else if (z <= 5200000.0) {
		tmp = x + (0.08333333333333323 * y);
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = x + (0.0692910599291889 * y)
	tmp = 0
	if z <= -3150000000.0:
		tmp = t_0
	elif z <= 5200000.0:
		tmp = x + (0.08333333333333323 * y)
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(x + Float64(0.0692910599291889 * y))
	tmp = 0.0
	if (z <= -3150000000.0)
		tmp = t_0;
	elseif (z <= 5200000.0)
		tmp = Float64(x + Float64(0.08333333333333323 * y));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = x + (0.0692910599291889 * y);
	tmp = 0.0;
	if (z <= -3150000000.0)
		tmp = t_0;
	elseif (z <= 5200000.0)
		tmp = x + (0.08333333333333323 * y);
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(x + N[(692910599291889/10000000000000000 * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3150000000], t$95$0, If[LessEqual[z, 5200000], N[(x + N[(279195317918525/3350343815022304 * y), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := x + \frac{692910599291889}{10000000000000000} \cdot y\\
\mathbf{if}\;z \leq -3150000000:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq 5200000:\\
\;\;\;\;x + \frac{279195317918525}{3350343815022304} \cdot y\\

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


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

    1. Initial program 68.3%

      \[x + \frac{y \cdot \left(\left(z \cdot \frac{692910599291889}{10000000000000000} + \frac{307332350656623}{625000000000000}\right) \cdot z + \frac{11167812716741}{40000000000000}\right)}{\left(z + \frac{6012459259764103}{1000000000000000}\right) \cdot z + \frac{104698244219447}{31250000000000}} \]
    2. Taylor expanded in z around inf

      \[\leadsto x + \color{blue}{\frac{692910599291889}{10000000000000000} \cdot y} \]
    3. Step-by-step derivation
      1. lower-*.f6480.1%

        \[\leadsto x + \frac{692910599291889}{10000000000000000} \cdot \color{blue}{y} \]
    4. Applied rewrites80.1%

      \[\leadsto x + \color{blue}{\frac{692910599291889}{10000000000000000} \cdot y} \]

    if -3.15e9 < z < 5.2e6

    1. Initial program 68.3%

      \[x + \frac{y \cdot \left(\left(z \cdot \frac{692910599291889}{10000000000000000} + \frac{307332350656623}{625000000000000}\right) \cdot z + \frac{11167812716741}{40000000000000}\right)}{\left(z + \frac{6012459259764103}{1000000000000000}\right) \cdot z + \frac{104698244219447}{31250000000000}} \]
    2. Taylor expanded in z around 0

      \[\leadsto x + \color{blue}{\frac{279195317918525}{3350343815022304} \cdot y} \]
    3. Step-by-step derivation
      1. lower-*.f6479.1%

        \[\leadsto x + \frac{279195317918525}{3350343815022304} \cdot \color{blue}{y} \]
    4. Applied rewrites79.1%

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

Alternative 8: 98.6% accurate, 0.5× speedup?

\[\begin{array}{l} \mathbf{if}\;x + \frac{y \cdot \left(\left(z \cdot \frac{692910599291889}{10000000000000000} + \frac{307332350656623}{625000000000000}\right) \cdot z + \frac{11167812716741}{40000000000000}\right)}{\left(z + \frac{6012459259764103}{1000000000000000}\right) \cdot z + \frac{104698244219447}{31250000000000}} \leq 39999999999999997570142100221458487440161148880469299812763086285292818252052935611373237029762030993747424472224648690314868774970544122120943195363467531099949205766728044164270841012649763623374879210194206396306558730203287330638196449078431799221384139674650289625630417523383839448299617392552574976:\\ \;\;\;\;x - \left(\frac{-11167812716741}{40000000000000} - \left(\frac{692910599291889}{10000000000000000} \cdot z - \frac{-307332350656623}{625000000000000}\right) \cdot z\right) \cdot \frac{y}{\left(z - \frac{-6012459259764103}{1000000000000000}\right) \cdot z - \frac{-104698244219447}{31250000000000}}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{y \cdot \frac{751220861604756070699018739433}{10000000000000000000000000000000}}{z} - \frac{y}{\frac{-10000000000000000}{692910599291889}}\right) + x\\ \end{array} \]
(FPCore (x y z)
  :precision binary64
  (if (<=
     (+
      x
      (/
       (*
        y
        (+
         (*
          (+
           (* z 692910599291889/10000000000000000)
           307332350656623/625000000000000)
          z)
         11167812716741/40000000000000))
       (+
        (* (+ z 6012459259764103/1000000000000000) z)
        104698244219447/31250000000000)))
     39999999999999997570142100221458487440161148880469299812763086285292818252052935611373237029762030993747424472224648690314868774970544122120943195363467531099949205766728044164270841012649763623374879210194206396306558730203287330638196449078431799221384139674650289625630417523383839448299617392552574976)
  (-
   x
   (*
    (-
     -11167812716741/40000000000000
     (*
      (-
       (* 692910599291889/10000000000000000 z)
       -307332350656623/625000000000000)
      z))
    (/
     y
     (-
      (* (- z -6012459259764103/1000000000000000) z)
      -104698244219447/31250000000000))))
  (+
   (-
    (/
     (*
      y
      751220861604756070699018739433/10000000000000000000000000000000)
     z)
    (/ y -10000000000000000/692910599291889))
   x)))
double code(double x, double y, double z) {
	double tmp;
	if ((x + ((y * ((((z * 0.0692910599291889) + 0.4917317610505968) * z) + 0.279195317918525)) / (((z + 6.012459259764103) * z) + 3.350343815022304))) <= 4e+304) {
		tmp = x - ((-0.279195317918525 - (((0.0692910599291889 * z) - -0.4917317610505968) * z)) * (y / (((z - -6.012459259764103) * z) - -3.350343815022304)));
	} else {
		tmp = (((y * 0.07512208616047561) / z) - (y / -14.431876219268936)) + x;
	}
	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)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if ((x + ((y * ((((z * 0.0692910599291889d0) + 0.4917317610505968d0) * z) + 0.279195317918525d0)) / (((z + 6.012459259764103d0) * z) + 3.350343815022304d0))) <= 4d+304) then
        tmp = x - (((-0.279195317918525d0) - (((0.0692910599291889d0 * z) - (-0.4917317610505968d0)) * z)) * (y / (((z - (-6.012459259764103d0)) * z) - (-3.350343815022304d0))))
    else
        tmp = (((y * 0.07512208616047561d0) / z) - (y / (-14.431876219268936d0))) + x
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if ((x + ((y * ((((z * 0.0692910599291889) + 0.4917317610505968) * z) + 0.279195317918525)) / (((z + 6.012459259764103) * z) + 3.350343815022304))) <= 4e+304) {
		tmp = x - ((-0.279195317918525 - (((0.0692910599291889 * z) - -0.4917317610505968) * z)) * (y / (((z - -6.012459259764103) * z) - -3.350343815022304)));
	} else {
		tmp = (((y * 0.07512208616047561) / z) - (y / -14.431876219268936)) + x;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (x + ((y * ((((z * 0.0692910599291889) + 0.4917317610505968) * z) + 0.279195317918525)) / (((z + 6.012459259764103) * z) + 3.350343815022304))) <= 4e+304:
		tmp = x - ((-0.279195317918525 - (((0.0692910599291889 * z) - -0.4917317610505968) * z)) * (y / (((z - -6.012459259764103) * z) - -3.350343815022304)))
	else:
		tmp = (((y * 0.07512208616047561) / z) - (y / -14.431876219268936)) + x
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (Float64(x + Float64(Float64(y * Float64(Float64(Float64(Float64(z * 0.0692910599291889) + 0.4917317610505968) * z) + 0.279195317918525)) / Float64(Float64(Float64(z + 6.012459259764103) * z) + 3.350343815022304))) <= 4e+304)
		tmp = Float64(x - Float64(Float64(-0.279195317918525 - Float64(Float64(Float64(0.0692910599291889 * z) - -0.4917317610505968) * z)) * Float64(y / Float64(Float64(Float64(z - -6.012459259764103) * z) - -3.350343815022304))));
	else
		tmp = Float64(Float64(Float64(Float64(y * 0.07512208616047561) / z) - Float64(y / -14.431876219268936)) + x);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((x + ((y * ((((z * 0.0692910599291889) + 0.4917317610505968) * z) + 0.279195317918525)) / (((z + 6.012459259764103) * z) + 3.350343815022304))) <= 4e+304)
		tmp = x - ((-0.279195317918525 - (((0.0692910599291889 * z) - -0.4917317610505968) * z)) * (y / (((z - -6.012459259764103) * z) - -3.350343815022304)));
	else
		tmp = (((y * 0.07512208616047561) / z) - (y / -14.431876219268936)) + x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[N[(x + N[(N[(y * N[(N[(N[(N[(z * 692910599291889/10000000000000000), $MachinePrecision] + 307332350656623/625000000000000), $MachinePrecision] * z), $MachinePrecision] + 11167812716741/40000000000000), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(z + 6012459259764103/1000000000000000), $MachinePrecision] * z), $MachinePrecision] + 104698244219447/31250000000000), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 39999999999999997570142100221458487440161148880469299812763086285292818252052935611373237029762030993747424472224648690314868774970544122120943195363467531099949205766728044164270841012649763623374879210194206396306558730203287330638196449078431799221384139674650289625630417523383839448299617392552574976], N[(x - N[(N[(-11167812716741/40000000000000 - N[(N[(N[(692910599291889/10000000000000000 * z), $MachinePrecision] - -307332350656623/625000000000000), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] * N[(y / N[(N[(N[(z - -6012459259764103/1000000000000000), $MachinePrecision] * z), $MachinePrecision] - -104698244219447/31250000000000), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(y * 751220861604756070699018739433/10000000000000000000000000000000), $MachinePrecision] / z), $MachinePrecision] - N[(y / -10000000000000000/692910599291889), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;x + \frac{y \cdot \left(\left(z \cdot \frac{692910599291889}{10000000000000000} + \frac{307332350656623}{625000000000000}\right) \cdot z + \frac{11167812716741}{40000000000000}\right)}{\left(z + \frac{6012459259764103}{1000000000000000}\right) \cdot z + \frac{104698244219447}{31250000000000}} \leq 39999999999999997570142100221458487440161148880469299812763086285292818252052935611373237029762030993747424472224648690314868774970544122120943195363467531099949205766728044164270841012649763623374879210194206396306558730203287330638196449078431799221384139674650289625630417523383839448299617392552574976:\\
\;\;\;\;x - \left(\frac{-11167812716741}{40000000000000} - \left(\frac{692910599291889}{10000000000000000} \cdot z - \frac{-307332350656623}{625000000000000}\right) \cdot z\right) \cdot \frac{y}{\left(z - \frac{-6012459259764103}{1000000000000000}\right) \cdot z - \frac{-104698244219447}{31250000000000}}\\

\mathbf{else}:\\
\;\;\;\;\left(\frac{y \cdot \frac{751220861604756070699018739433}{10000000000000000000000000000000}}{z} - \frac{y}{\frac{-10000000000000000}{692910599291889}}\right) + x\\


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (+.f64 x (/.f64 (*.f64 y (+.f64 (*.f64 (+.f64 (*.f64 z #s(literal 692910599291889/10000000000000000 binary64)) #s(literal 307332350656623/625000000000000 binary64)) z) #s(literal 11167812716741/40000000000000 binary64))) (+.f64 (*.f64 (+.f64 z #s(literal 6012459259764103/1000000000000000 binary64)) z) #s(literal 104698244219447/31250000000000 binary64)))) < 3.9999999999999998e304

    1. Initial program 68.3%

      \[x + \frac{y \cdot \left(\left(z \cdot \frac{692910599291889}{10000000000000000} + \frac{307332350656623}{625000000000000}\right) \cdot z + \frac{11167812716741}{40000000000000}\right)}{\left(z + \frac{6012459259764103}{1000000000000000}\right) \cdot z + \frac{104698244219447}{31250000000000}} \]
    2. Step-by-step derivation
      1. lift-+.f64N/A

        \[\leadsto \color{blue}{x + \frac{y \cdot \left(\left(z \cdot \frac{692910599291889}{10000000000000000} + \frac{307332350656623}{625000000000000}\right) \cdot z + \frac{11167812716741}{40000000000000}\right)}{\left(z + \frac{6012459259764103}{1000000000000000}\right) \cdot z + \frac{104698244219447}{31250000000000}}} \]
      2. add-flipN/A

        \[\leadsto \color{blue}{x - \left(\mathsf{neg}\left(\frac{y \cdot \left(\left(z \cdot \frac{692910599291889}{10000000000000000} + \frac{307332350656623}{625000000000000}\right) \cdot z + \frac{11167812716741}{40000000000000}\right)}{\left(z + \frac{6012459259764103}{1000000000000000}\right) \cdot z + \frac{104698244219447}{31250000000000}}\right)\right)} \]
      3. lower--.f64N/A

        \[\leadsto \color{blue}{x - \left(\mathsf{neg}\left(\frac{y \cdot \left(\left(z \cdot \frac{692910599291889}{10000000000000000} + \frac{307332350656623}{625000000000000}\right) \cdot z + \frac{11167812716741}{40000000000000}\right)}{\left(z + \frac{6012459259764103}{1000000000000000}\right) \cdot z + \frac{104698244219447}{31250000000000}}\right)\right)} \]
      4. lift-/.f64N/A

        \[\leadsto x - \left(\mathsf{neg}\left(\color{blue}{\frac{y \cdot \left(\left(z \cdot \frac{692910599291889}{10000000000000000} + \frac{307332350656623}{625000000000000}\right) \cdot z + \frac{11167812716741}{40000000000000}\right)}{\left(z + \frac{6012459259764103}{1000000000000000}\right) \cdot z + \frac{104698244219447}{31250000000000}}}\right)\right) \]
      5. mult-flipN/A

        \[\leadsto x - \left(\mathsf{neg}\left(\color{blue}{\left(y \cdot \left(\left(z \cdot \frac{692910599291889}{10000000000000000} + \frac{307332350656623}{625000000000000}\right) \cdot z + \frac{11167812716741}{40000000000000}\right)\right) \cdot \frac{1}{\left(z + \frac{6012459259764103}{1000000000000000}\right) \cdot z + \frac{104698244219447}{31250000000000}}}\right)\right) \]
      6. lift-*.f64N/A

        \[\leadsto x - \left(\mathsf{neg}\left(\color{blue}{\left(y \cdot \left(\left(z \cdot \frac{692910599291889}{10000000000000000} + \frac{307332350656623}{625000000000000}\right) \cdot z + \frac{11167812716741}{40000000000000}\right)\right)} \cdot \frac{1}{\left(z + \frac{6012459259764103}{1000000000000000}\right) \cdot z + \frac{104698244219447}{31250000000000}}\right)\right) \]
      7. *-commutativeN/A

        \[\leadsto x - \left(\mathsf{neg}\left(\color{blue}{\left(\left(\left(z \cdot \frac{692910599291889}{10000000000000000} + \frac{307332350656623}{625000000000000}\right) \cdot z + \frac{11167812716741}{40000000000000}\right) \cdot y\right)} \cdot \frac{1}{\left(z + \frac{6012459259764103}{1000000000000000}\right) \cdot z + \frac{104698244219447}{31250000000000}}\right)\right) \]
      8. associate-*l*N/A

        \[\leadsto x - \left(\mathsf{neg}\left(\color{blue}{\left(\left(z \cdot \frac{692910599291889}{10000000000000000} + \frac{307332350656623}{625000000000000}\right) \cdot z + \frac{11167812716741}{40000000000000}\right) \cdot \left(y \cdot \frac{1}{\left(z + \frac{6012459259764103}{1000000000000000}\right) \cdot z + \frac{104698244219447}{31250000000000}}\right)}\right)\right) \]
      9. distribute-lft-neg-inN/A

        \[\leadsto x - \color{blue}{\left(\mathsf{neg}\left(\left(\left(z \cdot \frac{692910599291889}{10000000000000000} + \frac{307332350656623}{625000000000000}\right) \cdot z + \frac{11167812716741}{40000000000000}\right)\right)\right) \cdot \left(y \cdot \frac{1}{\left(z + \frac{6012459259764103}{1000000000000000}\right) \cdot z + \frac{104698244219447}{31250000000000}}\right)} \]
      10. lower-*.f64N/A

        \[\leadsto x - \color{blue}{\left(\mathsf{neg}\left(\left(\left(z \cdot \frac{692910599291889}{10000000000000000} + \frac{307332350656623}{625000000000000}\right) \cdot z + \frac{11167812716741}{40000000000000}\right)\right)\right) \cdot \left(y \cdot \frac{1}{\left(z + \frac{6012459259764103}{1000000000000000}\right) \cdot z + \frac{104698244219447}{31250000000000}}\right)} \]
    3. Applied rewrites73.4%

      \[\leadsto \color{blue}{x - \left(\frac{-11167812716741}{40000000000000} - \left(\frac{692910599291889}{10000000000000000} \cdot z - \frac{-307332350656623}{625000000000000}\right) \cdot z\right) \cdot \frac{y}{\left(z - \frac{-6012459259764103}{1000000000000000}\right) \cdot z - \frac{-104698244219447}{31250000000000}}} \]

    if 3.9999999999999998e304 < (+.f64 x (/.f64 (*.f64 y (+.f64 (*.f64 (+.f64 (*.f64 z #s(literal 692910599291889/10000000000000000 binary64)) #s(literal 307332350656623/625000000000000 binary64)) z) #s(literal 11167812716741/40000000000000 binary64))) (+.f64 (*.f64 (+.f64 z #s(literal 6012459259764103/1000000000000000 binary64)) z) #s(literal 104698244219447/31250000000000 binary64))))

    1. Initial program 68.3%

      \[x + \frac{y \cdot \left(\left(z \cdot \frac{692910599291889}{10000000000000000} + \frac{307332350656623}{625000000000000}\right) \cdot z + \frac{11167812716741}{40000000000000}\right)}{\left(z + \frac{6012459259764103}{1000000000000000}\right) \cdot z + \frac{104698244219447}{31250000000000}} \]
    2. Taylor expanded in z around -inf

      \[\leadsto x + \color{blue}{\left(-1 \cdot \frac{\frac{-307332350656623}{625000000000000} \cdot y - \frac{-4166096748901211929300981260567}{10000000000000000000000000000000} \cdot y}{z} + \frac{692910599291889}{10000000000000000} \cdot y\right)} \]
    3. Step-by-step derivation
      1. lower-+.f64N/A

        \[\leadsto x + \left(-1 \cdot \frac{\frac{-307332350656623}{625000000000000} \cdot y - \frac{-4166096748901211929300981260567}{10000000000000000000000000000000} \cdot y}{z} + \color{blue}{\frac{692910599291889}{10000000000000000} \cdot y}\right) \]
      2. lower-*.f64N/A

        \[\leadsto x + \left(-1 \cdot \frac{\frac{-307332350656623}{625000000000000} \cdot y - \frac{-4166096748901211929300981260567}{10000000000000000000000000000000} \cdot y}{z} + \color{blue}{\frac{692910599291889}{10000000000000000}} \cdot y\right) \]
      3. lower-/.f64N/A

        \[\leadsto x + \left(-1 \cdot \frac{\frac{-307332350656623}{625000000000000} \cdot y - \frac{-4166096748901211929300981260567}{10000000000000000000000000000000} \cdot y}{z} + \frac{692910599291889}{10000000000000000} \cdot y\right) \]
      4. lower--.f64N/A

        \[\leadsto x + \left(-1 \cdot \frac{\frac{-307332350656623}{625000000000000} \cdot y - \frac{-4166096748901211929300981260567}{10000000000000000000000000000000} \cdot y}{z} + \frac{692910599291889}{10000000000000000} \cdot y\right) \]
      5. lower-*.f64N/A

        \[\leadsto x + \left(-1 \cdot \frac{\frac{-307332350656623}{625000000000000} \cdot y - \frac{-4166096748901211929300981260567}{10000000000000000000000000000000} \cdot y}{z} + \frac{692910599291889}{10000000000000000} \cdot y\right) \]
      6. lower-*.f64N/A

        \[\leadsto x + \left(-1 \cdot \frac{\frac{-307332350656623}{625000000000000} \cdot y - \frac{-4166096748901211929300981260567}{10000000000000000000000000000000} \cdot y}{z} + \frac{692910599291889}{10000000000000000} \cdot y\right) \]
      7. lower-*.f6466.2%

        \[\leadsto x + \left(-1 \cdot \frac{\frac{-307332350656623}{625000000000000} \cdot y - \frac{-4166096748901211929300981260567}{10000000000000000000000000000000} \cdot y}{z} + \frac{692910599291889}{10000000000000000} \cdot \color{blue}{y}\right) \]
    4. Applied rewrites66.2%

      \[\leadsto x + \color{blue}{\left(-1 \cdot \frac{\frac{-307332350656623}{625000000000000} \cdot y - \frac{-4166096748901211929300981260567}{10000000000000000000000000000000} \cdot y}{z} + \frac{692910599291889}{10000000000000000} \cdot y\right)} \]
    5. Step-by-step derivation
      1. lift-+.f64N/A

        \[\leadsto \color{blue}{x + \left(-1 \cdot \frac{\frac{-307332350656623}{625000000000000} \cdot y - \frac{-4166096748901211929300981260567}{10000000000000000000000000000000} \cdot y}{z} + \frac{692910599291889}{10000000000000000} \cdot y\right)} \]
      2. +-commutativeN/A

        \[\leadsto \color{blue}{\left(-1 \cdot \frac{\frac{-307332350656623}{625000000000000} \cdot y - \frac{-4166096748901211929300981260567}{10000000000000000000000000000000} \cdot y}{z} + \frac{692910599291889}{10000000000000000} \cdot y\right) + x} \]
      3. lower-+.f6466.2%

        \[\leadsto \color{blue}{\left(-1 \cdot \frac{\frac{-307332350656623}{625000000000000} \cdot y - \frac{-4166096748901211929300981260567}{10000000000000000000000000000000} \cdot y}{z} + \frac{692910599291889}{10000000000000000} \cdot y\right) + x} \]
    6. Applied rewrites66.2%

      \[\leadsto \color{blue}{\left(\frac{y \cdot \frac{751220861604756070699018739433}{10000000000000000000000000000000}}{z} - \frac{-692910599291889}{10000000000000000} \cdot y\right) + x} \]
    7. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \left(\frac{y \cdot \frac{751220861604756070699018739433}{10000000000000000000000000000000}}{z} - \frac{-692910599291889}{10000000000000000} \cdot \color{blue}{y}\right) + x \]
      2. *-commutativeN/A

        \[\leadsto \left(\frac{y \cdot \frac{751220861604756070699018739433}{10000000000000000000000000000000}}{z} - y \cdot \color{blue}{\frac{-692910599291889}{10000000000000000}}\right) + x \]
      3. metadata-evalN/A

        \[\leadsto \left(\frac{y \cdot \frac{751220861604756070699018739433}{10000000000000000000000000000000}}{z} - y \cdot \left(\mathsf{neg}\left(\frac{692910599291889}{10000000000000000}\right)\right)\right) + x \]
      4. distribute-rgt-neg-inN/A

        \[\leadsto \left(\frac{y \cdot \frac{751220861604756070699018739433}{10000000000000000000000000000000}}{z} - \left(\mathsf{neg}\left(y \cdot \frac{692910599291889}{10000000000000000}\right)\right)\right) + x \]
      5. metadata-evalN/A

        \[\leadsto \left(\frac{y \cdot \frac{751220861604756070699018739433}{10000000000000000000000000000000}}{z} - \left(\mathsf{neg}\left(y \cdot \frac{1}{\frac{10000000000000000}{692910599291889}}\right)\right)\right) + x \]
      6. mult-flipN/A

        \[\leadsto \left(\frac{y \cdot \frac{751220861604756070699018739433}{10000000000000000000000000000000}}{z} - \left(\mathsf{neg}\left(\frac{y}{\frac{10000000000000000}{692910599291889}}\right)\right)\right) + x \]
      7. distribute-neg-frac2N/A

        \[\leadsto \left(\frac{y \cdot \frac{751220861604756070699018739433}{10000000000000000000000000000000}}{z} - \frac{y}{\color{blue}{\mathsf{neg}\left(\frac{10000000000000000}{692910599291889}\right)}}\right) + x \]
      8. lower-/.f64N/A

        \[\leadsto \left(\frac{y \cdot \frac{751220861604756070699018739433}{10000000000000000000000000000000}}{z} - \frac{y}{\color{blue}{\mathsf{neg}\left(\frac{10000000000000000}{692910599291889}\right)}}\right) + x \]
      9. metadata-eval66.4%

        \[\leadsto \left(\frac{y \cdot \frac{751220861604756070699018739433}{10000000000000000000000000000000}}{z} - \frac{y}{\frac{-10000000000000000}{692910599291889}}\right) + x \]
    8. Applied rewrites66.4%

      \[\leadsto \left(\frac{y \cdot \frac{751220861604756070699018739433}{10000000000000000000000000000000}}{z} - \frac{y}{\color{blue}{\frac{-10000000000000000}{692910599291889}}}\right) + x \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 9: 80.1% accurate, 5.2× speedup?

\[x + \frac{692910599291889}{10000000000000000} \cdot y \]
(FPCore (x y z)
  :precision binary64
  (+ x (* 692910599291889/10000000000000000 y)))
double code(double x, double y, double z) {
	return x + (0.0692910599291889 * 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)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = x + (0.0692910599291889d0 * y)
end function
public static double code(double x, double y, double z) {
	return x + (0.0692910599291889 * y);
}
def code(x, y, z):
	return x + (0.0692910599291889 * y)
function code(x, y, z)
	return Float64(x + Float64(0.0692910599291889 * y))
end
function tmp = code(x, y, z)
	tmp = x + (0.0692910599291889 * y);
end
code[x_, y_, z_] := N[(x + N[(692910599291889/10000000000000000 * y), $MachinePrecision]), $MachinePrecision]
x + \frac{692910599291889}{10000000000000000} \cdot y
Derivation
  1. Initial program 68.3%

    \[x + \frac{y \cdot \left(\left(z \cdot \frac{692910599291889}{10000000000000000} + \frac{307332350656623}{625000000000000}\right) \cdot z + \frac{11167812716741}{40000000000000}\right)}{\left(z + \frac{6012459259764103}{1000000000000000}\right) \cdot z + \frac{104698244219447}{31250000000000}} \]
  2. Taylor expanded in z around inf

    \[\leadsto x + \color{blue}{\frac{692910599291889}{10000000000000000} \cdot y} \]
  3. Step-by-step derivation
    1. lower-*.f6480.1%

      \[\leadsto x + \frac{692910599291889}{10000000000000000} \cdot \color{blue}{y} \]
  4. Applied rewrites80.1%

    \[\leadsto x + \color{blue}{\frac{692910599291889}{10000000000000000} \cdot y} \]
  5. Add Preprocessing

Alternative 10: 51.2% accurate, 7.8× speedup?

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

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

real(8) function code(x, y, z)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = 1.0d0 * x
end function
public static double code(double x, double y, double z) {
	return 1.0 * x;
}
def code(x, y, z):
	return 1.0 * x
function code(x, y, z)
	return Float64(1.0 * x)
end
function tmp = code(x, y, z)
	tmp = 1.0 * x;
end
code[x_, y_, z_] := N[(1 * x), $MachinePrecision]
1 \cdot x
Derivation
  1. Initial program 68.3%

    \[x + \frac{y \cdot \left(\left(z \cdot \frac{692910599291889}{10000000000000000} + \frac{307332350656623}{625000000000000}\right) \cdot z + \frac{11167812716741}{40000000000000}\right)}{\left(z + \frac{6012459259764103}{1000000000000000}\right) \cdot z + \frac{104698244219447}{31250000000000}} \]
  2. Taylor expanded in z around inf

    \[\leadsto x + \color{blue}{\frac{692910599291889}{10000000000000000} \cdot y} \]
  3. Step-by-step derivation
    1. lower-*.f6480.1%

      \[\leadsto x + \frac{692910599291889}{10000000000000000} \cdot \color{blue}{y} \]
  4. Applied rewrites80.1%

    \[\leadsto x + \color{blue}{\frac{692910599291889}{10000000000000000} \cdot y} \]
  5. Step-by-step derivation
    1. lift-+.f64N/A

      \[\leadsto \color{blue}{x + \frac{692910599291889}{10000000000000000} \cdot y} \]
    2. sum-to-multN/A

      \[\leadsto \color{blue}{\left(1 + \frac{\frac{692910599291889}{10000000000000000} \cdot y}{x}\right) \cdot x} \]
    3. lower-unsound-*.f64N/A

      \[\leadsto \color{blue}{\left(1 + \frac{\frac{692910599291889}{10000000000000000} \cdot y}{x}\right) \cdot x} \]
    4. lower-unsound-+.f64N/A

      \[\leadsto \color{blue}{\left(1 + \frac{\frac{692910599291889}{10000000000000000} \cdot y}{x}\right)} \cdot x \]
    5. lower-unsound-/.f6473.7%

      \[\leadsto \left(1 + \color{blue}{\frac{\frac{692910599291889}{10000000000000000} \cdot y}{x}}\right) \cdot x \]
  6. Applied rewrites73.7%

    \[\leadsto \color{blue}{\left(1 + \frac{\frac{692910599291889}{10000000000000000} \cdot y}{x}\right) \cdot x} \]
  7. Taylor expanded in x around inf

    \[\leadsto \color{blue}{1} \cdot x \]
  8. Step-by-step derivation
    1. Applied rewrites51.2%

      \[\leadsto \color{blue}{1} \cdot x \]
    2. Add Preprocessing

    Reproduce

    ?
    herbie shell --seed 2025271 -o generate:evaluate
    (FPCore (x y z)
      :name "Numeric.SpecFunctions:logGamma from math-functions-0.1.5.2, B"
      :precision binary64
      (+ x (/ (* y (+ (* (+ (* z 692910599291889/10000000000000000) 307332350656623/625000000000000) z) 11167812716741/40000000000000)) (+ (* (+ z 6012459259764103/1000000000000000) z) 104698244219447/31250000000000))))