Graphics.Rendering.Chart.Backend.Diagrams:calcFontMetrics from Chart-diagrams-1.5.1, A

Percentage Accurate: 88.1% → 99.4%
Time: 9.0s
Alternatives: 9
Speedup: 0.3×

Specification

?
\[\begin{array}{l} \\ \frac{x + y}{1 - \frac{y}{z}} \end{array} \]
(FPCore (x y z) :precision binary64 (/ (+ x y) (- 1.0 (/ y z))))
double code(double x, double y, double z) {
	return (x + y) / (1.0 - (y / z));
}
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) / (1.0d0 - (y / z))
end function
public static double code(double x, double y, double z) {
	return (x + y) / (1.0 - (y / z));
}
def code(x, y, z):
	return (x + y) / (1.0 - (y / z))
function code(x, y, z)
	return Float64(Float64(x + y) / Float64(1.0 - Float64(y / z)))
end
function tmp = code(x, y, z)
	tmp = (x + y) / (1.0 - (y / z));
end
code[x_, y_, z_] := N[(N[(x + y), $MachinePrecision] / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{x + y}{1 - \frac{y}{z}}
\end{array}

Sampling outcomes in binary64 precision:

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

\[\begin{array}{l} \\ \frac{x + y}{1 - \frac{y}{z}} \end{array} \]
(FPCore (x y z) :precision binary64 (/ (+ x y) (- 1.0 (/ y z))))
double code(double x, double y, double z) {
	return (x + y) / (1.0 - (y / z));
}
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) / (1.0d0 - (y / z))
end function
public static double code(double x, double y, double z) {
	return (x + y) / (1.0 - (y / z));
}
def code(x, y, z):
	return (x + y) / (1.0 - (y / z))
function code(x, y, z)
	return Float64(Float64(x + y) / Float64(1.0 - Float64(y / z)))
end
function tmp = code(x, y, z)
	tmp = (x + y) / (1.0 - (y / z));
end
code[x_, y_, z_] := N[(N[(x + y), $MachinePrecision] / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{x + y}{1 - \frac{y}{z}}
\end{array}

Alternative 1: 99.4% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x + y}{1 - \frac{y}{z}}\\ t_1 := \frac{y + x}{y}\\ \mathbf{if}\;t\_0 \leq -4 \cdot 10^{-248} \lor \neg \left(t\_0 \leq 4 \cdot 10^{-305}\right):\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\left(-\mathsf{fma}\left(\frac{t\_1}{y}, z, t\_1\right)\right) \cdot z\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (/ (+ x y) (- 1.0 (/ y z)))) (t_1 (/ (+ y x) y)))
   (if (or (<= t_0 -4e-248) (not (<= t_0 4e-305)))
     t_0
     (* (- (fma (/ t_1 y) z t_1)) z))))
double code(double x, double y, double z) {
	double t_0 = (x + y) / (1.0 - (y / z));
	double t_1 = (y + x) / y;
	double tmp;
	if ((t_0 <= -4e-248) || !(t_0 <= 4e-305)) {
		tmp = t_0;
	} else {
		tmp = -fma((t_1 / y), z, t_1) * z;
	}
	return tmp;
}
function code(x, y, z)
	t_0 = Float64(Float64(x + y) / Float64(1.0 - Float64(y / z)))
	t_1 = Float64(Float64(y + x) / y)
	tmp = 0.0
	if ((t_0 <= -4e-248) || !(t_0 <= 4e-305))
		tmp = t_0;
	else
		tmp = Float64(Float64(-fma(Float64(t_1 / y), z, t_1)) * z);
	end
	return tmp
end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x + y), $MachinePrecision] / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(y + x), $MachinePrecision] / y), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -4e-248], N[Not[LessEqual[t$95$0, 4e-305]], $MachinePrecision]], t$95$0, N[((-N[(N[(t$95$1 / y), $MachinePrecision] * z + t$95$1), $MachinePrecision]) * z), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{x + y}{1 - \frac{y}{z}}\\
t_1 := \frac{y + x}{y}\\
\mathbf{if}\;t\_0 \leq -4 \cdot 10^{-248} \lor \neg \left(t\_0 \leq 4 \cdot 10^{-305}\right):\\
\;\;\;\;t\_0\\

\mathbf{else}:\\
\;\;\;\;\left(-\mathsf{fma}\left(\frac{t\_1}{y}, z, t\_1\right)\right) \cdot z\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) < -3.99999999999999992e-248 or 3.99999999999999999e-305 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z)))

    1. Initial program 99.8%

      \[\frac{x + y}{1 - \frac{y}{z}} \]
    2. Add Preprocessing

    if -3.99999999999999992e-248 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) < 3.99999999999999999e-305

    1. Initial program 18.8%

      \[\frac{x + y}{1 - \frac{y}{z}} \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0

      \[\leadsto \color{blue}{z \cdot \left(-1 \cdot \left(z \cdot \left(\frac{1}{y} + \frac{x}{{y}^{2}}\right)\right) + -1 \cdot \frac{x + y}{y}\right)} \]
    4. Step-by-step derivation
      1. Applied rewrites100.0%

        \[\leadsto \color{blue}{\left(-\mathsf{fma}\left(\frac{\frac{y + x}{y}}{y}, z, \frac{y + x}{y}\right)\right) \cdot z} \]
    5. Recombined 2 regimes into one program.
    6. Final simplification99.8%

      \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x + y}{1 - \frac{y}{z}} \leq -4 \cdot 10^{-248} \lor \neg \left(\frac{x + y}{1 - \frac{y}{z}} \leq 4 \cdot 10^{-305}\right):\\ \;\;\;\;\frac{x + y}{1 - \frac{y}{z}}\\ \mathbf{else}:\\ \;\;\;\;\left(-\mathsf{fma}\left(\frac{\frac{y + x}{y}}{y}, z, \frac{y + x}{y}\right)\right) \cdot z\\ \end{array} \]
    7. Add Preprocessing

    Alternative 2: 99.4% accurate, 0.3× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x + y}{1 - \frac{y}{z}}\\ \mathbf{if}\;t\_0 \leq -4 \cdot 10^{-248} \lor \neg \left(t\_0 \leq 4 \cdot 10^{-305}\right):\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(-1 - \frac{x}{y}\right)\\ \end{array} \end{array} \]
    (FPCore (x y z)
     :precision binary64
     (let* ((t_0 (/ (+ x y) (- 1.0 (/ y z)))))
       (if (or (<= t_0 -4e-248) (not (<= t_0 4e-305)))
         t_0
         (* z (- -1.0 (/ x y))))))
    double code(double x, double y, double z) {
    	double t_0 = (x + y) / (1.0 - (y / z));
    	double tmp;
    	if ((t_0 <= -4e-248) || !(t_0 <= 4e-305)) {
    		tmp = t_0;
    	} else {
    		tmp = z * (-1.0 - (x / y));
    	}
    	return tmp;
    }
    
    module fmin_fmax_functions
        implicit none
        private
        public fmax
        public fmin
    
        interface fmax
            module procedure fmax88
            module procedure fmax44
            module procedure fmax84
            module procedure fmax48
        end interface
        interface fmin
            module procedure fmin88
            module procedure fmin44
            module procedure fmin84
            module procedure fmin48
        end interface
    contains
        real(8) function fmax88(x, y) result (res)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
        end function
        real(4) function fmax44(x, y) result (res)
            real(4), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
        end function
        real(8) function fmax84(x, y) result(res)
            real(8), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
        end function
        real(8) function fmax48(x, y) result(res)
            real(4), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
        end function
        real(8) function fmin88(x, y) result (res)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
        end function
        real(4) function fmin44(x, y) result (res)
            real(4), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
        end function
        real(8) function fmin84(x, y) result(res)
            real(8), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
        end function
        real(8) function fmin48(x, y) result(res)
            real(4), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
        end function
    end module
    
    real(8) function code(x, y, z)
    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 + y) / (1.0d0 - (y / z))
        if ((t_0 <= (-4d-248)) .or. (.not. (t_0 <= 4d-305))) then
            tmp = t_0
        else
            tmp = z * ((-1.0d0) - (x / y))
        end if
        code = tmp
    end function
    
    public static double code(double x, double y, double z) {
    	double t_0 = (x + y) / (1.0 - (y / z));
    	double tmp;
    	if ((t_0 <= -4e-248) || !(t_0 <= 4e-305)) {
    		tmp = t_0;
    	} else {
    		tmp = z * (-1.0 - (x / y));
    	}
    	return tmp;
    }
    
    def code(x, y, z):
    	t_0 = (x + y) / (1.0 - (y / z))
    	tmp = 0
    	if (t_0 <= -4e-248) or not (t_0 <= 4e-305):
    		tmp = t_0
    	else:
    		tmp = z * (-1.0 - (x / y))
    	return tmp
    
    function code(x, y, z)
    	t_0 = Float64(Float64(x + y) / Float64(1.0 - Float64(y / z)))
    	tmp = 0.0
    	if ((t_0 <= -4e-248) || !(t_0 <= 4e-305))
    		tmp = t_0;
    	else
    		tmp = Float64(z * Float64(-1.0 - Float64(x / y)));
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, y, z)
    	t_0 = (x + y) / (1.0 - (y / z));
    	tmp = 0.0;
    	if ((t_0 <= -4e-248) || ~((t_0 <= 4e-305)))
    		tmp = t_0;
    	else
    		tmp = z * (-1.0 - (x / y));
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x + y), $MachinePrecision] / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -4e-248], N[Not[LessEqual[t$95$0, 4e-305]], $MachinePrecision]], t$95$0, N[(z * N[(-1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := \frac{x + y}{1 - \frac{y}{z}}\\
    \mathbf{if}\;t\_0 \leq -4 \cdot 10^{-248} \lor \neg \left(t\_0 \leq 4 \cdot 10^{-305}\right):\\
    \;\;\;\;t\_0\\
    
    \mathbf{else}:\\
    \;\;\;\;z \cdot \left(-1 - \frac{x}{y}\right)\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) < -3.99999999999999992e-248 or 3.99999999999999999e-305 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z)))

      1. Initial program 99.8%

        \[\frac{x + y}{1 - \frac{y}{z}} \]
      2. Add Preprocessing

      if -3.99999999999999992e-248 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) < 3.99999999999999999e-305

      1. Initial program 18.8%

        \[\frac{x + y}{1 - \frac{y}{z}} \]
      2. Add Preprocessing
      3. Taylor expanded in z around 0

        \[\leadsto \color{blue}{-1 \cdot \frac{z \cdot \left(x + y\right)}{y}} \]
      4. Step-by-step derivation
        1. Applied rewrites100.0%

          \[\leadsto \color{blue}{z \cdot \left(-1 - \frac{x}{y}\right)} \]
      5. Recombined 2 regimes into one program.
      6. Final simplification99.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x + y}{1 - \frac{y}{z}} \leq -4 \cdot 10^{-248} \lor \neg \left(\frac{x + y}{1 - \frac{y}{z}} \leq 4 \cdot 10^{-305}\right):\\ \;\;\;\;\frac{x + y}{1 - \frac{y}{z}}\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(-1 - \frac{x}{y}\right)\\ \end{array} \]
      7. Add Preprocessing

      Alternative 3: 73.3% accurate, 0.8× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -4.6 \cdot 10^{+65}:\\ \;\;\;\;z \cdot \left(-1 - \frac{x}{y}\right)\\ \mathbf{elif}\;y \leq 1.42 \cdot 10^{-67}:\\ \;\;\;\;y + x\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{z + x}{y} + 1\right) \cdot \left(-z\right)\\ \end{array} \end{array} \]
      (FPCore (x y z)
       :precision binary64
       (if (<= y -4.6e+65)
         (* z (- -1.0 (/ x y)))
         (if (<= y 1.42e-67) (+ y x) (* (+ (/ (+ z x) y) 1.0) (- z)))))
      double code(double x, double y, double z) {
      	double tmp;
      	if (y <= -4.6e+65) {
      		tmp = z * (-1.0 - (x / y));
      	} else if (y <= 1.42e-67) {
      		tmp = y + x;
      	} else {
      		tmp = (((z + x) / y) + 1.0) * -z;
      	}
      	return tmp;
      }
      
      module fmin_fmax_functions
          implicit none
          private
          public fmax
          public fmin
      
          interface fmax
              module procedure fmax88
              module procedure fmax44
              module procedure fmax84
              module procedure fmax48
          end interface
          interface fmin
              module procedure fmin88
              module procedure fmin44
              module procedure fmin84
              module procedure fmin48
          end interface
      contains
          real(8) function fmax88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(4) function fmax44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(8) function fmax84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmax48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
          end function
          real(8) function fmin88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(4) function fmin44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(8) function fmin84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmin48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
          end function
      end module
      
      real(8) function code(x, y, z)
      use fmin_fmax_functions
          real(8), intent (in) :: x
          real(8), intent (in) :: y
          real(8), intent (in) :: z
          real(8) :: tmp
          if (y <= (-4.6d+65)) then
              tmp = z * ((-1.0d0) - (x / y))
          else if (y <= 1.42d-67) then
              tmp = y + x
          else
              tmp = (((z + x) / y) + 1.0d0) * -z
          end if
          code = tmp
      end function
      
      public static double code(double x, double y, double z) {
      	double tmp;
      	if (y <= -4.6e+65) {
      		tmp = z * (-1.0 - (x / y));
      	} else if (y <= 1.42e-67) {
      		tmp = y + x;
      	} else {
      		tmp = (((z + x) / y) + 1.0) * -z;
      	}
      	return tmp;
      }
      
      def code(x, y, z):
      	tmp = 0
      	if y <= -4.6e+65:
      		tmp = z * (-1.0 - (x / y))
      	elif y <= 1.42e-67:
      		tmp = y + x
      	else:
      		tmp = (((z + x) / y) + 1.0) * -z
      	return tmp
      
      function code(x, y, z)
      	tmp = 0.0
      	if (y <= -4.6e+65)
      		tmp = Float64(z * Float64(-1.0 - Float64(x / y)));
      	elseif (y <= 1.42e-67)
      		tmp = Float64(y + x);
      	else
      		tmp = Float64(Float64(Float64(Float64(z + x) / y) + 1.0) * Float64(-z));
      	end
      	return tmp
      end
      
      function tmp_2 = code(x, y, z)
      	tmp = 0.0;
      	if (y <= -4.6e+65)
      		tmp = z * (-1.0 - (x / y));
      	elseif (y <= 1.42e-67)
      		tmp = y + x;
      	else
      		tmp = (((z + x) / y) + 1.0) * -z;
      	end
      	tmp_2 = tmp;
      end
      
      code[x_, y_, z_] := If[LessEqual[y, -4.6e+65], N[(z * N[(-1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.42e-67], N[(y + x), $MachinePrecision], N[(N[(N[(N[(z + x), $MachinePrecision] / y), $MachinePrecision] + 1.0), $MachinePrecision] * (-z)), $MachinePrecision]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;y \leq -4.6 \cdot 10^{+65}:\\
      \;\;\;\;z \cdot \left(-1 - \frac{x}{y}\right)\\
      
      \mathbf{elif}\;y \leq 1.42 \cdot 10^{-67}:\\
      \;\;\;\;y + x\\
      
      \mathbf{else}:\\
      \;\;\;\;\left(\frac{z + x}{y} + 1\right) \cdot \left(-z\right)\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if y < -4.6e65

        1. Initial program 75.3%

          \[\frac{x + y}{1 - \frac{y}{z}} \]
        2. Add Preprocessing
        3. Taylor expanded in z around 0

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

            \[\leadsto \color{blue}{z \cdot \left(-1 - \frac{x}{y}\right)} \]

          if -4.6e65 < y < 1.42000000000000004e-67

          1. Initial program 99.2%

            \[\frac{x + y}{1 - \frac{y}{z}} \]
          2. Add Preprocessing
          3. Taylor expanded in z around inf

            \[\leadsto \color{blue}{x + y} \]
          4. Step-by-step derivation
            1. Applied rewrites78.4%

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

            if 1.42000000000000004e-67 < y

            1. Initial program 77.7%

              \[\frac{x + y}{1 - \frac{y}{z}} \]
            2. Add Preprocessing
            3. Taylor expanded in y around 0

              \[\leadsto \color{blue}{x} \]
            4. Step-by-step derivation
              1. Applied rewrites11.5%

                \[\leadsto \color{blue}{x} \]
              2. Taylor expanded in y around inf

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

                \[\leadsto \color{blue}{\frac{z \cdot \left(\left(-x\right) - z\right)}{y} - z} \]
              4. Taylor expanded in z around 0

                \[\leadsto z \cdot \color{blue}{\left(\left(-1 \cdot \frac{x}{y} + -1 \cdot \frac{z}{y}\right) - 1\right)} \]
              5. Step-by-step derivation
                1. Applied rewrites76.3%

                  \[\leadsto \left(\frac{z + x}{-y} - 1\right) \cdot \color{blue}{z} \]
              6. Recombined 3 regimes into one program.
              7. Final simplification77.3%

                \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -4.6 \cdot 10^{+65}:\\ \;\;\;\;z \cdot \left(-1 - \frac{x}{y}\right)\\ \mathbf{elif}\;y \leq 1.42 \cdot 10^{-67}:\\ \;\;\;\;y + x\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{z + x}{y} + 1\right) \cdot \left(-z\right)\\ \end{array} \]
              8. Add Preprocessing

              Alternative 4: 73.3% accurate, 0.9× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -4.6 \cdot 10^{+65} \lor \neg \left(y \leq 1.42 \cdot 10^{-67}\right):\\ \;\;\;\;z \cdot \left(-1 - \frac{x}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;y + x\\ \end{array} \end{array} \]
              (FPCore (x y z)
               :precision binary64
               (if (or (<= y -4.6e+65) (not (<= y 1.42e-67)))
                 (* z (- -1.0 (/ x y)))
                 (+ y x)))
              double code(double x, double y, double z) {
              	double tmp;
              	if ((y <= -4.6e+65) || !(y <= 1.42e-67)) {
              		tmp = z * (-1.0 - (x / y));
              	} else {
              		tmp = y + 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 ((y <= (-4.6d+65)) .or. (.not. (y <= 1.42d-67))) then
                      tmp = z * ((-1.0d0) - (x / y))
                  else
                      tmp = y + x
                  end if
                  code = tmp
              end function
              
              public static double code(double x, double y, double z) {
              	double tmp;
              	if ((y <= -4.6e+65) || !(y <= 1.42e-67)) {
              		tmp = z * (-1.0 - (x / y));
              	} else {
              		tmp = y + x;
              	}
              	return tmp;
              }
              
              def code(x, y, z):
              	tmp = 0
              	if (y <= -4.6e+65) or not (y <= 1.42e-67):
              		tmp = z * (-1.0 - (x / y))
              	else:
              		tmp = y + x
              	return tmp
              
              function code(x, y, z)
              	tmp = 0.0
              	if ((y <= -4.6e+65) || !(y <= 1.42e-67))
              		tmp = Float64(z * Float64(-1.0 - Float64(x / y)));
              	else
              		tmp = Float64(y + x);
              	end
              	return tmp
              end
              
              function tmp_2 = code(x, y, z)
              	tmp = 0.0;
              	if ((y <= -4.6e+65) || ~((y <= 1.42e-67)))
              		tmp = z * (-1.0 - (x / y));
              	else
              		tmp = y + x;
              	end
              	tmp_2 = tmp;
              end
              
              code[x_, y_, z_] := If[Or[LessEqual[y, -4.6e+65], N[Not[LessEqual[y, 1.42e-67]], $MachinePrecision]], N[(z * N[(-1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y + x), $MachinePrecision]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              \mathbf{if}\;y \leq -4.6 \cdot 10^{+65} \lor \neg \left(y \leq 1.42 \cdot 10^{-67}\right):\\
              \;\;\;\;z \cdot \left(-1 - \frac{x}{y}\right)\\
              
              \mathbf{else}:\\
              \;\;\;\;y + x\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if y < -4.6e65 or 1.42000000000000004e-67 < y

                1. Initial program 76.8%

                  \[\frac{x + y}{1 - \frac{y}{z}} \]
                2. Add Preprocessing
                3. Taylor expanded in z around 0

                  \[\leadsto \color{blue}{-1 \cdot \frac{z \cdot \left(x + y\right)}{y}} \]
                4. Step-by-step derivation
                  1. Applied rewrites76.1%

                    \[\leadsto \color{blue}{z \cdot \left(-1 - \frac{x}{y}\right)} \]

                  if -4.6e65 < y < 1.42000000000000004e-67

                  1. Initial program 99.2%

                    \[\frac{x + y}{1 - \frac{y}{z}} \]
                  2. Add Preprocessing
                  3. Taylor expanded in z around inf

                    \[\leadsto \color{blue}{x + y} \]
                  4. Step-by-step derivation
                    1. Applied rewrites78.4%

                      \[\leadsto \color{blue}{y + x} \]
                  5. Recombined 2 regimes into one program.
                  6. Final simplification77.2%

                    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -4.6 \cdot 10^{+65} \lor \neg \left(y \leq 1.42 \cdot 10^{-67}\right):\\ \;\;\;\;z \cdot \left(-1 - \frac{x}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;y + x\\ \end{array} \]
                  7. Add Preprocessing

                  Alternative 5: 71.2% accurate, 0.9× speedup?

                  \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -4.6 \cdot 10^{+65} \lor \neg \left(y \leq 6.6 \cdot 10^{-78}\right):\\ \;\;\;\;-\mathsf{fma}\left(\frac{z}{y}, x, z\right)\\ \mathbf{else}:\\ \;\;\;\;y + x\\ \end{array} \end{array} \]
                  (FPCore (x y z)
                   :precision binary64
                   (if (or (<= y -4.6e+65) (not (<= y 6.6e-78))) (- (fma (/ z y) x z)) (+ y x)))
                  double code(double x, double y, double z) {
                  	double tmp;
                  	if ((y <= -4.6e+65) || !(y <= 6.6e-78)) {
                  		tmp = -fma((z / y), x, z);
                  	} else {
                  		tmp = y + x;
                  	}
                  	return tmp;
                  }
                  
                  function code(x, y, z)
                  	tmp = 0.0
                  	if ((y <= -4.6e+65) || !(y <= 6.6e-78))
                  		tmp = Float64(-fma(Float64(z / y), x, z));
                  	else
                  		tmp = Float64(y + x);
                  	end
                  	return tmp
                  end
                  
                  code[x_, y_, z_] := If[Or[LessEqual[y, -4.6e+65], N[Not[LessEqual[y, 6.6e-78]], $MachinePrecision]], (-N[(N[(z / y), $MachinePrecision] * x + z), $MachinePrecision]), N[(y + x), $MachinePrecision]]
                  
                  \begin{array}{l}
                  
                  \\
                  \begin{array}{l}
                  \mathbf{if}\;y \leq -4.6 \cdot 10^{+65} \lor \neg \left(y \leq 6.6 \cdot 10^{-78}\right):\\
                  \;\;\;\;-\mathsf{fma}\left(\frac{z}{y}, x, z\right)\\
                  
                  \mathbf{else}:\\
                  \;\;\;\;y + x\\
                  
                  
                  \end{array}
                  \end{array}
                  
                  Derivation
                  1. Split input into 2 regimes
                  2. if y < -4.6e65 or 6.59999999999999963e-78 < y

                    1. Initial program 77.3%

                      \[\frac{x + y}{1 - \frac{y}{z}} \]
                    2. Add Preprocessing
                    3. Taylor expanded in y around 0

                      \[\leadsto \color{blue}{x} \]
                    4. Step-by-step derivation
                      1. Applied rewrites10.4%

                        \[\leadsto \color{blue}{x} \]
                      2. Taylor expanded in z around 0

                        \[\leadsto \color{blue}{-1 \cdot \frac{z \cdot \left(x + y\right)}{y}} \]
                      3. Step-by-step derivation
                        1. Applied rewrites72.6%

                          \[\leadsto \color{blue}{-\mathsf{fma}\left(\frac{z}{y}, x, z\right)} \]

                        if -4.6e65 < y < 6.59999999999999963e-78

                        1. Initial program 99.2%

                          \[\frac{x + y}{1 - \frac{y}{z}} \]
                        2. Add Preprocessing
                        3. Taylor expanded in z around inf

                          \[\leadsto \color{blue}{x + y} \]
                        4. Step-by-step derivation
                          1. Applied rewrites79.4%

                            \[\leadsto \color{blue}{y + x} \]
                        5. Recombined 2 regimes into one program.
                        6. Final simplification75.9%

                          \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -4.6 \cdot 10^{+65} \lor \neg \left(y \leq 6.6 \cdot 10^{-78}\right):\\ \;\;\;\;-\mathsf{fma}\left(\frac{z}{y}, x, z\right)\\ \mathbf{else}:\\ \;\;\;\;y + x\\ \end{array} \]
                        7. Add Preprocessing

                        Alternative 6: 67.1% accurate, 1.8× speedup?

                        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -2.6 \cdot 10^{+66} \lor \neg \left(y \leq 0.00185\right):\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;y + x\\ \end{array} \end{array} \]
                        (FPCore (x y z)
                         :precision binary64
                         (if (or (<= y -2.6e+66) (not (<= y 0.00185))) (- z) (+ y x)))
                        double code(double x, double y, double z) {
                        	double tmp;
                        	if ((y <= -2.6e+66) || !(y <= 0.00185)) {
                        		tmp = -z;
                        	} else {
                        		tmp = y + 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 ((y <= (-2.6d+66)) .or. (.not. (y <= 0.00185d0))) then
                                tmp = -z
                            else
                                tmp = y + x
                            end if
                            code = tmp
                        end function
                        
                        public static double code(double x, double y, double z) {
                        	double tmp;
                        	if ((y <= -2.6e+66) || !(y <= 0.00185)) {
                        		tmp = -z;
                        	} else {
                        		tmp = y + x;
                        	}
                        	return tmp;
                        }
                        
                        def code(x, y, z):
                        	tmp = 0
                        	if (y <= -2.6e+66) or not (y <= 0.00185):
                        		tmp = -z
                        	else:
                        		tmp = y + x
                        	return tmp
                        
                        function code(x, y, z)
                        	tmp = 0.0
                        	if ((y <= -2.6e+66) || !(y <= 0.00185))
                        		tmp = Float64(-z);
                        	else
                        		tmp = Float64(y + x);
                        	end
                        	return tmp
                        end
                        
                        function tmp_2 = code(x, y, z)
                        	tmp = 0.0;
                        	if ((y <= -2.6e+66) || ~((y <= 0.00185)))
                        		tmp = -z;
                        	else
                        		tmp = y + x;
                        	end
                        	tmp_2 = tmp;
                        end
                        
                        code[x_, y_, z_] := If[Or[LessEqual[y, -2.6e+66], N[Not[LessEqual[y, 0.00185]], $MachinePrecision]], (-z), N[(y + x), $MachinePrecision]]
                        
                        \begin{array}{l}
                        
                        \\
                        \begin{array}{l}
                        \mathbf{if}\;y \leq -2.6 \cdot 10^{+66} \lor \neg \left(y \leq 0.00185\right):\\
                        \;\;\;\;-z\\
                        
                        \mathbf{else}:\\
                        \;\;\;\;y + x\\
                        
                        
                        \end{array}
                        \end{array}
                        
                        Derivation
                        1. Split input into 2 regimes
                        2. if y < -2.60000000000000012e66 or 0.0018500000000000001 < y

                          1. Initial program 74.0%

                            \[\frac{x + y}{1 - \frac{y}{z}} \]
                          2. Add Preprocessing
                          3. Taylor expanded in y around inf

                            \[\leadsto \color{blue}{-1 \cdot z} \]
                          4. Step-by-step derivation
                            1. Applied rewrites63.3%

                              \[\leadsto \color{blue}{-z} \]

                            if -2.60000000000000012e66 < y < 0.0018500000000000001

                            1. Initial program 99.2%

                              \[\frac{x + y}{1 - \frac{y}{z}} \]
                            2. Add Preprocessing
                            3. Taylor expanded in z around inf

                              \[\leadsto \color{blue}{x + y} \]
                            4. Step-by-step derivation
                              1. Applied rewrites75.1%

                                \[\leadsto \color{blue}{y + x} \]
                            5. Recombined 2 regimes into one program.
                            6. Final simplification69.7%

                              \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.6 \cdot 10^{+66} \lor \neg \left(y \leq 0.00185\right):\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;y + x\\ \end{array} \]
                            7. Add Preprocessing

                            Alternative 7: 57.4% accurate, 1.9× speedup?

                            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -4.6 \cdot 10^{+65} \lor \neg \left(y \leq 1.28 \cdot 10^{-51}\right):\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
                            (FPCore (x y z)
                             :precision binary64
                             (if (or (<= y -4.6e+65) (not (<= y 1.28e-51))) (- z) x))
                            double code(double x, double y, double z) {
                            	double tmp;
                            	if ((y <= -4.6e+65) || !(y <= 1.28e-51)) {
                            		tmp = -z;
                            	} else {
                            		tmp = 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 ((y <= (-4.6d+65)) .or. (.not. (y <= 1.28d-51))) then
                                    tmp = -z
                                else
                                    tmp = x
                                end if
                                code = tmp
                            end function
                            
                            public static double code(double x, double y, double z) {
                            	double tmp;
                            	if ((y <= -4.6e+65) || !(y <= 1.28e-51)) {
                            		tmp = -z;
                            	} else {
                            		tmp = x;
                            	}
                            	return tmp;
                            }
                            
                            def code(x, y, z):
                            	tmp = 0
                            	if (y <= -4.6e+65) or not (y <= 1.28e-51):
                            		tmp = -z
                            	else:
                            		tmp = x
                            	return tmp
                            
                            function code(x, y, z)
                            	tmp = 0.0
                            	if ((y <= -4.6e+65) || !(y <= 1.28e-51))
                            		tmp = Float64(-z);
                            	else
                            		tmp = x;
                            	end
                            	return tmp
                            end
                            
                            function tmp_2 = code(x, y, z)
                            	tmp = 0.0;
                            	if ((y <= -4.6e+65) || ~((y <= 1.28e-51)))
                            		tmp = -z;
                            	else
                            		tmp = x;
                            	end
                            	tmp_2 = tmp;
                            end
                            
                            code[x_, y_, z_] := If[Or[LessEqual[y, -4.6e+65], N[Not[LessEqual[y, 1.28e-51]], $MachinePrecision]], (-z), x]
                            
                            \begin{array}{l}
                            
                            \\
                            \begin{array}{l}
                            \mathbf{if}\;y \leq -4.6 \cdot 10^{+65} \lor \neg \left(y \leq 1.28 \cdot 10^{-51}\right):\\
                            \;\;\;\;-z\\
                            
                            \mathbf{else}:\\
                            \;\;\;\;x\\
                            
                            
                            \end{array}
                            \end{array}
                            
                            Derivation
                            1. Split input into 2 regimes
                            2. if y < -4.6e65 or 1.28000000000000004e-51 < y

                              1. Initial program 76.2%

                                \[\frac{x + y}{1 - \frac{y}{z}} \]
                              2. Add Preprocessing
                              3. Taylor expanded in y around inf

                                \[\leadsto \color{blue}{-1 \cdot z} \]
                              4. Step-by-step derivation
                                1. Applied rewrites61.8%

                                  \[\leadsto \color{blue}{-z} \]

                                if -4.6e65 < y < 1.28000000000000004e-51

                                1. Initial program 99.2%

                                  \[\frac{x + y}{1 - \frac{y}{z}} \]
                                2. Add Preprocessing
                                3. Taylor expanded in y around 0

                                  \[\leadsto \color{blue}{x} \]
                                4. Step-by-step derivation
                                  1. Applied rewrites59.5%

                                    \[\leadsto \color{blue}{x} \]
                                5. Recombined 2 regimes into one program.
                                6. Final simplification60.7%

                                  \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -4.6 \cdot 10^{+65} \lor \neg \left(y \leq 1.28 \cdot 10^{-51}\right):\\ \;\;\;\;-z\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
                                7. Add Preprocessing

                                Alternative 8: 40.4% accurate, 2.2× speedup?

                                \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -9.5 \cdot 10^{-184} \lor \neg \left(x \leq 2.5 \cdot 10^{-166}\right):\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array} \end{array} \]
                                (FPCore (x y z)
                                 :precision binary64
                                 (if (or (<= x -9.5e-184) (not (<= x 2.5e-166))) x y))
                                double code(double x, double y, double z) {
                                	double tmp;
                                	if ((x <= -9.5e-184) || !(x <= 2.5e-166)) {
                                		tmp = x;
                                	} else {
                                		tmp = y;
                                	}
                                	return tmp;
                                }
                                
                                module fmin_fmax_functions
                                    implicit none
                                    private
                                    public fmax
                                    public fmin
                                
                                    interface fmax
                                        module procedure fmax88
                                        module procedure fmax44
                                        module procedure fmax84
                                        module procedure fmax48
                                    end interface
                                    interface fmin
                                        module procedure fmin88
                                        module procedure fmin44
                                        module procedure fmin84
                                        module procedure fmin48
                                    end interface
                                contains
                                    real(8) function fmax88(x, y) result (res)
                                        real(8), intent (in) :: x
                                        real(8), intent (in) :: y
                                        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                    end function
                                    real(4) function fmax44(x, y) result (res)
                                        real(4), intent (in) :: x
                                        real(4), intent (in) :: y
                                        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                    end function
                                    real(8) function fmax84(x, y) result(res)
                                        real(8), intent (in) :: x
                                        real(4), intent (in) :: y
                                        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                    end function
                                    real(8) function fmax48(x, y) result(res)
                                        real(4), intent (in) :: x
                                        real(8), intent (in) :: y
                                        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                    end function
                                    real(8) function fmin88(x, y) result (res)
                                        real(8), intent (in) :: x
                                        real(8), intent (in) :: y
                                        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                    end function
                                    real(4) function fmin44(x, y) result (res)
                                        real(4), intent (in) :: x
                                        real(4), intent (in) :: y
                                        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                    end function
                                    real(8) function fmin84(x, y) result(res)
                                        real(8), intent (in) :: x
                                        real(4), intent (in) :: y
                                        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                    end function
                                    real(8) function fmin48(x, y) result(res)
                                        real(4), intent (in) :: x
                                        real(8), intent (in) :: y
                                        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                    end function
                                end module
                                
                                real(8) function code(x, y, z)
                                use fmin_fmax_functions
                                    real(8), intent (in) :: x
                                    real(8), intent (in) :: y
                                    real(8), intent (in) :: z
                                    real(8) :: tmp
                                    if ((x <= (-9.5d-184)) .or. (.not. (x <= 2.5d-166))) then
                                        tmp = x
                                    else
                                        tmp = y
                                    end if
                                    code = tmp
                                end function
                                
                                public static double code(double x, double y, double z) {
                                	double tmp;
                                	if ((x <= -9.5e-184) || !(x <= 2.5e-166)) {
                                		tmp = x;
                                	} else {
                                		tmp = y;
                                	}
                                	return tmp;
                                }
                                
                                def code(x, y, z):
                                	tmp = 0
                                	if (x <= -9.5e-184) or not (x <= 2.5e-166):
                                		tmp = x
                                	else:
                                		tmp = y
                                	return tmp
                                
                                function code(x, y, z)
                                	tmp = 0.0
                                	if ((x <= -9.5e-184) || !(x <= 2.5e-166))
                                		tmp = x;
                                	else
                                		tmp = y;
                                	end
                                	return tmp
                                end
                                
                                function tmp_2 = code(x, y, z)
                                	tmp = 0.0;
                                	if ((x <= -9.5e-184) || ~((x <= 2.5e-166)))
                                		tmp = x;
                                	else
                                		tmp = y;
                                	end
                                	tmp_2 = tmp;
                                end
                                
                                code[x_, y_, z_] := If[Or[LessEqual[x, -9.5e-184], N[Not[LessEqual[x, 2.5e-166]], $MachinePrecision]], x, y]
                                
                                \begin{array}{l}
                                
                                \\
                                \begin{array}{l}
                                \mathbf{if}\;x \leq -9.5 \cdot 10^{-184} \lor \neg \left(x \leq 2.5 \cdot 10^{-166}\right):\\
                                \;\;\;\;x\\
                                
                                \mathbf{else}:\\
                                \;\;\;\;y\\
                                
                                
                                \end{array}
                                \end{array}
                                
                                Derivation
                                1. Split input into 2 regimes
                                2. if x < -9.4999999999999991e-184 or 2.5e-166 < x

                                  1. Initial program 87.8%

                                    \[\frac{x + y}{1 - \frac{y}{z}} \]
                                  2. Add Preprocessing
                                  3. Taylor expanded in y around 0

                                    \[\leadsto \color{blue}{x} \]
                                  4. Step-by-step derivation
                                    1. Applied rewrites44.7%

                                      \[\leadsto \color{blue}{x} \]

                                    if -9.4999999999999991e-184 < x < 2.5e-166

                                    1. Initial program 87.7%

                                      \[\frac{x + y}{1 - \frac{y}{z}} \]
                                    2. Add Preprocessing
                                    3. Taylor expanded in z around inf

                                      \[\leadsto \color{blue}{x + \left(y + \frac{y \cdot \left(x + y\right)}{z}\right)} \]
                                    4. Step-by-step derivation
                                      1. Applied rewrites44.3%

                                        \[\leadsto \color{blue}{\mathsf{fma}\left(y + x, \frac{y}{z}, y\right) + x} \]
                                      2. Taylor expanded in x around 0

                                        \[\leadsto y + \color{blue}{\frac{{y}^{2}}{z}} \]
                                      3. Step-by-step derivation
                                        1. Applied rewrites40.1%

                                          \[\leadsto \mathsf{fma}\left(\frac{y}{z}, \color{blue}{y}, y\right) \]
                                        2. Taylor expanded in y around 0

                                          \[\leadsto y \]
                                        3. Step-by-step derivation
                                          1. Applied rewrites39.9%

                                            \[\leadsto y \]
                                        4. Recombined 2 regimes into one program.
                                        5. Final simplification43.4%

                                          \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -9.5 \cdot 10^{-184} \lor \neg \left(x \leq 2.5 \cdot 10^{-166}\right):\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array} \]
                                        6. Add Preprocessing

                                        Alternative 9: 34.4% accurate, 29.0× speedup?

                                        \[\begin{array}{l} \\ x \end{array} \]
                                        (FPCore (x y z) :precision binary64 x)
                                        double code(double x, double y, double z) {
                                        	return 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 = x
                                        end function
                                        
                                        public static double code(double x, double y, double z) {
                                        	return x;
                                        }
                                        
                                        def code(x, y, z):
                                        	return x
                                        
                                        function code(x, y, z)
                                        	return x
                                        end
                                        
                                        function tmp = code(x, y, z)
                                        	tmp = x;
                                        end
                                        
                                        code[x_, y_, z_] := x
                                        
                                        \begin{array}{l}
                                        
                                        \\
                                        x
                                        \end{array}
                                        
                                        Derivation
                                        1. Initial program 87.8%

                                          \[\frac{x + y}{1 - \frac{y}{z}} \]
                                        2. Add Preprocessing
                                        3. Taylor expanded in y around 0

                                          \[\leadsto \color{blue}{x} \]
                                        4. Step-by-step derivation
                                          1. Applied rewrites34.9%

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

                                          Developer Target 1: 93.9% accurate, 0.7× speedup?

                                          \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{y + x}{-y} \cdot z\\ \mathbf{if}\;y < -3.7429310762689856 \cdot 10^{+171}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y < 3.5534662456086734 \cdot 10^{+168}:\\ \;\;\;\;\frac{x + y}{1 - \frac{y}{z}}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
                                          (FPCore (x y z)
                                           :precision binary64
                                           (let* ((t_0 (* (/ (+ y x) (- y)) z)))
                                             (if (< y -3.7429310762689856e+171)
                                               t_0
                                               (if (< y 3.5534662456086734e+168) (/ (+ x y) (- 1.0 (/ y z))) t_0))))
                                          double code(double x, double y, double z) {
                                          	double t_0 = ((y + x) / -y) * z;
                                          	double tmp;
                                          	if (y < -3.7429310762689856e+171) {
                                          		tmp = t_0;
                                          	} else if (y < 3.5534662456086734e+168) {
                                          		tmp = (x + y) / (1.0 - (y / 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 = ((y + x) / -y) * z
                                              if (y < (-3.7429310762689856d+171)) then
                                                  tmp = t_0
                                              else if (y < 3.5534662456086734d+168) then
                                                  tmp = (x + y) / (1.0d0 - (y / z))
                                              else
                                                  tmp = t_0
                                              end if
                                              code = tmp
                                          end function
                                          
                                          public static double code(double x, double y, double z) {
                                          	double t_0 = ((y + x) / -y) * z;
                                          	double tmp;
                                          	if (y < -3.7429310762689856e+171) {
                                          		tmp = t_0;
                                          	} else if (y < 3.5534662456086734e+168) {
                                          		tmp = (x + y) / (1.0 - (y / z));
                                          	} else {
                                          		tmp = t_0;
                                          	}
                                          	return tmp;
                                          }
                                          
                                          def code(x, y, z):
                                          	t_0 = ((y + x) / -y) * z
                                          	tmp = 0
                                          	if y < -3.7429310762689856e+171:
                                          		tmp = t_0
                                          	elif y < 3.5534662456086734e+168:
                                          		tmp = (x + y) / (1.0 - (y / z))
                                          	else:
                                          		tmp = t_0
                                          	return tmp
                                          
                                          function code(x, y, z)
                                          	t_0 = Float64(Float64(Float64(y + x) / Float64(-y)) * z)
                                          	tmp = 0.0
                                          	if (y < -3.7429310762689856e+171)
                                          		tmp = t_0;
                                          	elseif (y < 3.5534662456086734e+168)
                                          		tmp = Float64(Float64(x + y) / Float64(1.0 - Float64(y / z)));
                                          	else
                                          		tmp = t_0;
                                          	end
                                          	return tmp
                                          end
                                          
                                          function tmp_2 = code(x, y, z)
                                          	t_0 = ((y + x) / -y) * z;
                                          	tmp = 0.0;
                                          	if (y < -3.7429310762689856e+171)
                                          		tmp = t_0;
                                          	elseif (y < 3.5534662456086734e+168)
                                          		tmp = (x + y) / (1.0 - (y / z));
                                          	else
                                          		tmp = t_0;
                                          	end
                                          	tmp_2 = tmp;
                                          end
                                          
                                          code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(y + x), $MachinePrecision] / (-y)), $MachinePrecision] * z), $MachinePrecision]}, If[Less[y, -3.7429310762689856e+171], t$95$0, If[Less[y, 3.5534662456086734e+168], N[(N[(x + y), $MachinePrecision] / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
                                          
                                          \begin{array}{l}
                                          
                                          \\
                                          \begin{array}{l}
                                          t_0 := \frac{y + x}{-y} \cdot z\\
                                          \mathbf{if}\;y < -3.7429310762689856 \cdot 10^{+171}:\\
                                          \;\;\;\;t\_0\\
                                          
                                          \mathbf{elif}\;y < 3.5534662456086734 \cdot 10^{+168}:\\
                                          \;\;\;\;\frac{x + y}{1 - \frac{y}{z}}\\
                                          
                                          \mathbf{else}:\\
                                          \;\;\;\;t\_0\\
                                          
                                          
                                          \end{array}
                                          \end{array}
                                          

                                          Reproduce

                                          ?
                                          herbie shell --seed 2025022 
                                          (FPCore (x y z)
                                            :name "Graphics.Rendering.Chart.Backend.Diagrams:calcFontMetrics from Chart-diagrams-1.5.1, A"
                                            :precision binary64
                                          
                                            :alt
                                            (! :herbie-platform default (if (< y -3742931076268985600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (* (/ (+ y x) (- y)) z) (if (< y 3553466245608673400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (/ (+ x y) (- 1 (/ y z))) (* (/ (+ y x) (- y)) z))))
                                          
                                            (/ (+ x y) (- 1.0 (/ y z))))