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

Percentage Accurate: 87.9% → 99.2%
Time: 3.7s
Alternatives: 8
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}

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 8 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: 87.9% 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.2% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x + y}{1 - \frac{y}{z}}\\ \mathbf{if}\;t\_0 \leq -5 \cdot 10^{-243}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;t\_0 \leq 0:\\ \;\;\;\;\left(-\frac{z \cdot x}{y}\right) - z\\ \mathbf{else}:\\ \;\;\;\;\frac{x + y}{\frac{z - y}{z}}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (/ (+ x y) (- 1.0 (/ y z)))))
   (if (<= t_0 -5e-243)
     t_0
     (if (<= t_0 0.0) (- (- (/ (* z x) y)) z) (/ (+ x y) (/ (- z y) z))))))
double code(double x, double y, double z) {
	double t_0 = (x + y) / (1.0 - (y / z));
	double tmp;
	if (t_0 <= -5e-243) {
		tmp = t_0;
	} else if (t_0 <= 0.0) {
		tmp = -((z * x) / y) - z;
	} else {
		tmp = (x + y) / ((z - y) / 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) :: t_0
    real(8) :: tmp
    t_0 = (x + y) / (1.0d0 - (y / z))
    if (t_0 <= (-5d-243)) then
        tmp = t_0
    else if (t_0 <= 0.0d0) then
        tmp = -((z * x) / y) - z
    else
        tmp = (x + y) / ((z - y) / z)
    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 <= -5e-243) {
		tmp = t_0;
	} else if (t_0 <= 0.0) {
		tmp = -((z * x) / y) - z;
	} else {
		tmp = (x + y) / ((z - y) / z);
	}
	return tmp;
}
def code(x, y, z):
	t_0 = (x + y) / (1.0 - (y / z))
	tmp = 0
	if t_0 <= -5e-243:
		tmp = t_0
	elif t_0 <= 0.0:
		tmp = -((z * x) / y) - z
	else:
		tmp = (x + y) / ((z - y) / z)
	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 <= -5e-243)
		tmp = t_0;
	elseif (t_0 <= 0.0)
		tmp = Float64(Float64(-Float64(Float64(z * x) / y)) - z);
	else
		tmp = Float64(Float64(x + y) / Float64(Float64(z - y) / z));
	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 <= -5e-243)
		tmp = t_0;
	elseif (t_0 <= 0.0)
		tmp = -((z * x) / y) - z;
	else
		tmp = (x + y) / ((z - y) / z);
	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[LessEqual[t$95$0, -5e-243], t$95$0, If[LessEqual[t$95$0, 0.0], N[((-N[(N[(z * x), $MachinePrecision] / y), $MachinePrecision]) - z), $MachinePrecision], N[(N[(x + y), $MachinePrecision] / N[(N[(z - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{x + y}{1 - \frac{y}{z}}\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-243}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\left(-\frac{z \cdot x}{y}\right) - z\\

\mathbf{else}:\\
\;\;\;\;\frac{x + y}{\frac{z - y}{z}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) < -5e-243

    1. Initial program 99.9%

      \[\frac{x + y}{1 - \frac{y}{z}} \]

    if -5e-243 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) < -0.0

    1. Initial program 17.2%

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

      \[\leadsto \frac{x + y}{\color{blue}{y \cdot \left(\frac{1}{y} - \frac{1}{z}\right)}} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

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

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

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

        \[\leadsto \frac{x + y}{\left(\frac{1}{y} - \frac{1}{z}\right) \cdot y} \]
      5. lower-/.f6417.1

        \[\leadsto \frac{x + y}{\left(\frac{1}{y} - \frac{1}{z}\right) \cdot y} \]
    4. Applied rewrites17.1%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{z \cdot \left(x + y\right)}{y}} \]
    6. Step-by-step derivation
      1. div-add-revN/A

        \[\leadsto \color{blue}{-1} \cdot \frac{z \cdot \left(x + y\right)}{y} \]
      2. frac-addN/A

        \[\leadsto \color{blue}{-1} \cdot \frac{z \cdot \left(x + y\right)}{y} \]
      3. mul-1-negN/A

        \[\leadsto \mathsf{neg}\left(\frac{z \cdot \left(x + y\right)}{y}\right) \]
      4. lower-neg.f64N/A

        \[\leadsto -\frac{z \cdot \left(x + y\right)}{y} \]
      5. lower-/.f64N/A

        \[\leadsto -\frac{z \cdot \left(x + y\right)}{y} \]
      6. *-commutativeN/A

        \[\leadsto -\frac{\left(x + y\right) \cdot z}{y} \]
      7. lower-*.f64N/A

        \[\leadsto -\frac{\left(x + y\right) \cdot z}{y} \]
      8. +-commutativeN/A

        \[\leadsto -\frac{\left(y + x\right) \cdot z}{y} \]
      9. lower-+.f6492.0

        \[\leadsto -\frac{\left(y + x\right) \cdot z}{y} \]
    7. Applied rewrites92.0%

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

      \[\leadsto -1 \cdot \frac{x \cdot z}{y} - \color{blue}{z} \]
    9. Step-by-step derivation
      1. lower--.f64N/A

        \[\leadsto -1 \cdot \frac{x \cdot z}{y} - z \]
      2. mul-1-negN/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{x \cdot z}{y}\right)\right) - z \]
      3. lower-neg.f64N/A

        \[\leadsto \left(-\frac{x \cdot z}{y}\right) - z \]
      4. lower-/.f64N/A

        \[\leadsto \left(-\frac{x \cdot z}{y}\right) - z \]
      5. *-commutativeN/A

        \[\leadsto \left(-\frac{z \cdot x}{y}\right) - z \]
      6. lower-*.f6495.4

        \[\leadsto \left(-\frac{z \cdot x}{y}\right) - z \]
    10. Applied rewrites95.4%

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

    if -0.0 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z)))

    1. Initial program 99.9%

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

      \[\leadsto \frac{x + y}{\color{blue}{\frac{z - y}{z}}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{x + y}{\frac{z - y}{\color{blue}{z}}} \]
      2. lower--.f6499.9

        \[\leadsto \frac{x + y}{\frac{z - y}{z}} \]
    4. Applied rewrites99.9%

      \[\leadsto \frac{x + y}{\color{blue}{\frac{z - y}{z}}} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 2: 99.2% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x + y}{1 - \frac{y}{z}}\\ t_1 := \frac{x + y}{\frac{z - y}{z}}\\ \mathbf{if}\;t\_0 \leq -5 \cdot 10^{-243}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_0 \leq 0:\\ \;\;\;\;\left(-\frac{z \cdot x}{y}\right) - z\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (/ (+ x y) (- 1.0 (/ y z)))) (t_1 (/ (+ x y) (/ (- z y) z))))
   (if (<= t_0 -5e-243) t_1 (if (<= t_0 0.0) (- (- (/ (* z x) y)) z) t_1))))
double code(double x, double y, double z) {
	double t_0 = (x + y) / (1.0 - (y / z));
	double t_1 = (x + y) / ((z - y) / z);
	double tmp;
	if (t_0 <= -5e-243) {
		tmp = t_1;
	} else if (t_0 <= 0.0) {
		tmp = -((z * x) / y) - z;
	} else {
		tmp = t_1;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y, z)
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) :: t_1
    real(8) :: tmp
    t_0 = (x + y) / (1.0d0 - (y / z))
    t_1 = (x + y) / ((z - y) / z)
    if (t_0 <= (-5d-243)) then
        tmp = t_1
    else if (t_0 <= 0.0d0) then
        tmp = -((z * x) / y) - z
    else
        tmp = t_1
    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 t_1 = (x + y) / ((z - y) / z);
	double tmp;
	if (t_0 <= -5e-243) {
		tmp = t_1;
	} else if (t_0 <= 0.0) {
		tmp = -((z * x) / y) - z;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = (x + y) / (1.0 - (y / z))
	t_1 = (x + y) / ((z - y) / z)
	tmp = 0
	if t_0 <= -5e-243:
		tmp = t_1
	elif t_0 <= 0.0:
		tmp = -((z * x) / y) - z
	else:
		tmp = t_1
	return tmp
function code(x, y, z)
	t_0 = Float64(Float64(x + y) / Float64(1.0 - Float64(y / z)))
	t_1 = Float64(Float64(x + y) / Float64(Float64(z - y) / z))
	tmp = 0.0
	if (t_0 <= -5e-243)
		tmp = t_1;
	elseif (t_0 <= 0.0)
		tmp = Float64(Float64(-Float64(Float64(z * x) / y)) - z);
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = (x + y) / (1.0 - (y / z));
	t_1 = (x + y) / ((z - y) / z);
	tmp = 0.0;
	if (t_0 <= -5e-243)
		tmp = t_1;
	elseif (t_0 <= 0.0)
		tmp = -((z * x) / y) - z;
	else
		tmp = t_1;
	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]}, Block[{t$95$1 = N[(N[(x + y), $MachinePrecision] / N[(N[(z - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -5e-243], t$95$1, If[LessEqual[t$95$0, 0.0], N[((-N[(N[(z * x), $MachinePrecision] / y), $MachinePrecision]) - z), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{x + y}{1 - \frac{y}{z}}\\
t_1 := \frac{x + y}{\frac{z - y}{z}}\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-243}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\left(-\frac{z \cdot x}{y}\right) - z\\

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


\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))) < -5e-243 or -0.0 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z)))

    1. Initial program 99.9%

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

      \[\leadsto \frac{x + y}{\color{blue}{\frac{z - y}{z}}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{x + y}{\frac{z - y}{\color{blue}{z}}} \]
      2. lower--.f6499.9

        \[\leadsto \frac{x + y}{\frac{z - y}{z}} \]
    4. Applied rewrites99.9%

      \[\leadsto \frac{x + y}{\color{blue}{\frac{z - y}{z}}} \]

    if -5e-243 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) < -0.0

    1. Initial program 17.2%

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

      \[\leadsto \frac{x + y}{\color{blue}{y \cdot \left(\frac{1}{y} - \frac{1}{z}\right)}} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

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

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

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

        \[\leadsto \frac{x + y}{\left(\frac{1}{y} - \frac{1}{z}\right) \cdot y} \]
      5. lower-/.f6417.1

        \[\leadsto \frac{x + y}{\left(\frac{1}{y} - \frac{1}{z}\right) \cdot y} \]
    4. Applied rewrites17.1%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{z \cdot \left(x + y\right)}{y}} \]
    6. Step-by-step derivation
      1. div-add-revN/A

        \[\leadsto \color{blue}{-1} \cdot \frac{z \cdot \left(x + y\right)}{y} \]
      2. frac-addN/A

        \[\leadsto \color{blue}{-1} \cdot \frac{z \cdot \left(x + y\right)}{y} \]
      3. mul-1-negN/A

        \[\leadsto \mathsf{neg}\left(\frac{z \cdot \left(x + y\right)}{y}\right) \]
      4. lower-neg.f64N/A

        \[\leadsto -\frac{z \cdot \left(x + y\right)}{y} \]
      5. lower-/.f64N/A

        \[\leadsto -\frac{z \cdot \left(x + y\right)}{y} \]
      6. *-commutativeN/A

        \[\leadsto -\frac{\left(x + y\right) \cdot z}{y} \]
      7. lower-*.f64N/A

        \[\leadsto -\frac{\left(x + y\right) \cdot z}{y} \]
      8. +-commutativeN/A

        \[\leadsto -\frac{\left(y + x\right) \cdot z}{y} \]
      9. lower-+.f6492.0

        \[\leadsto -\frac{\left(y + x\right) \cdot z}{y} \]
    7. Applied rewrites92.0%

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

      \[\leadsto -1 \cdot \frac{x \cdot z}{y} - \color{blue}{z} \]
    9. Step-by-step derivation
      1. lower--.f64N/A

        \[\leadsto -1 \cdot \frac{x \cdot z}{y} - z \]
      2. mul-1-negN/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{x \cdot z}{y}\right)\right) - z \]
      3. lower-neg.f64N/A

        \[\leadsto \left(-\frac{x \cdot z}{y}\right) - z \]
      4. lower-/.f64N/A

        \[\leadsto \left(-\frac{x \cdot z}{y}\right) - z \]
      5. *-commutativeN/A

        \[\leadsto \left(-\frac{z \cdot x}{y}\right) - z \]
      6. lower-*.f6495.4

        \[\leadsto \left(-\frac{z \cdot x}{y}\right) - z \]
    10. Applied rewrites95.4%

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

Alternative 3: 71.7% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.4 \cdot 10^{+80}:\\ \;\;\;\;\left(-\frac{z \cdot x}{y}\right) - z\\ \mathbf{elif}\;y \leq 4 \cdot 10^{-36}:\\ \;\;\;\;\frac{x}{1 - \frac{y}{z}}\\ \mathbf{else}:\\ \;\;\;\;-\mathsf{fma}\left(x, \frac{z}{y}, z\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= y -1.4e+80)
   (- (- (/ (* z x) y)) z)
   (if (<= y 4e-36) (/ x (- 1.0 (/ y z))) (- (fma x (/ z y) z)))))
double code(double x, double y, double z) {
	double tmp;
	if (y <= -1.4e+80) {
		tmp = -((z * x) / y) - z;
	} else if (y <= 4e-36) {
		tmp = x / (1.0 - (y / z));
	} else {
		tmp = -fma(x, (z / y), z);
	}
	return tmp;
}
function code(x, y, z)
	tmp = 0.0
	if (y <= -1.4e+80)
		tmp = Float64(Float64(-Float64(Float64(z * x) / y)) - z);
	elseif (y <= 4e-36)
		tmp = Float64(x / Float64(1.0 - Float64(y / z)));
	else
		tmp = Float64(-fma(x, Float64(z / y), z));
	end
	return tmp
end
code[x_, y_, z_] := If[LessEqual[y, -1.4e+80], N[((-N[(N[(z * x), $MachinePrecision] / y), $MachinePrecision]) - z), $MachinePrecision], If[LessEqual[y, 4e-36], N[(x / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], (-N[(x * N[(z / y), $MachinePrecision] + z), $MachinePrecision])]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.4 \cdot 10^{+80}:\\
\;\;\;\;\left(-\frac{z \cdot x}{y}\right) - z\\

\mathbf{elif}\;y \leq 4 \cdot 10^{-36}:\\
\;\;\;\;\frac{x}{1 - \frac{y}{z}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.39999999999999992e80

    1. Initial program 70.7%

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

      \[\leadsto \frac{x + y}{\color{blue}{y \cdot \left(\frac{1}{y} - \frac{1}{z}\right)}} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

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

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

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

        \[\leadsto \frac{x + y}{\left(\frac{1}{y} - \frac{1}{z}\right) \cdot y} \]
      5. lower-/.f6470.5

        \[\leadsto \frac{x + y}{\left(\frac{1}{y} - \frac{1}{z}\right) \cdot y} \]
    4. Applied rewrites70.5%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{z \cdot \left(x + y\right)}{y}} \]
    6. Step-by-step derivation
      1. div-add-revN/A

        \[\leadsto \color{blue}{-1} \cdot \frac{z \cdot \left(x + y\right)}{y} \]
      2. frac-addN/A

        \[\leadsto \color{blue}{-1} \cdot \frac{z \cdot \left(x + y\right)}{y} \]
      3. mul-1-negN/A

        \[\leadsto \mathsf{neg}\left(\frac{z \cdot \left(x + y\right)}{y}\right) \]
      4. lower-neg.f64N/A

        \[\leadsto -\frac{z \cdot \left(x + y\right)}{y} \]
      5. lower-/.f64N/A

        \[\leadsto -\frac{z \cdot \left(x + y\right)}{y} \]
      6. *-commutativeN/A

        \[\leadsto -\frac{\left(x + y\right) \cdot z}{y} \]
      7. lower-*.f64N/A

        \[\leadsto -\frac{\left(x + y\right) \cdot z}{y} \]
      8. +-commutativeN/A

        \[\leadsto -\frac{\left(y + x\right) \cdot z}{y} \]
      9. lower-+.f6464.1

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

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

      \[\leadsto -1 \cdot \frac{x \cdot z}{y} - \color{blue}{z} \]
    9. Step-by-step derivation
      1. lower--.f64N/A

        \[\leadsto -1 \cdot \frac{x \cdot z}{y} - z \]
      2. mul-1-negN/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{x \cdot z}{y}\right)\right) - z \]
      3. lower-neg.f64N/A

        \[\leadsto \left(-\frac{x \cdot z}{y}\right) - z \]
      4. lower-/.f64N/A

        \[\leadsto \left(-\frac{x \cdot z}{y}\right) - z \]
      5. *-commutativeN/A

        \[\leadsto \left(-\frac{z \cdot x}{y}\right) - z \]
      6. lower-*.f6476.0

        \[\leadsto \left(-\frac{z \cdot x}{y}\right) - z \]
    10. Applied rewrites76.0%

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

    if -1.39999999999999992e80 < y < 3.9999999999999998e-36

    1. Initial program 99.2%

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

      \[\leadsto \frac{\color{blue}{x}}{1 - \frac{y}{z}} \]
    3. Step-by-step derivation
      1. Applied rewrites71.6%

        \[\leadsto \frac{\color{blue}{x}}{1 - \frac{y}{z}} \]

      if 3.9999999999999998e-36 < y

      1. Initial program 78.0%

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

        \[\leadsto \frac{x + y}{\color{blue}{y \cdot \left(\frac{1}{y} - \frac{1}{z}\right)}} \]
      3. Step-by-step derivation
        1. *-commutativeN/A

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

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

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

          \[\leadsto \frac{x + y}{\left(\frac{1}{y} - \frac{1}{z}\right) \cdot y} \]
        5. lower-/.f6477.8

          \[\leadsto \frac{x + y}{\left(\frac{1}{y} - \frac{1}{z}\right) \cdot y} \]
      4. Applied rewrites77.8%

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

        \[\leadsto \color{blue}{-1 \cdot \frac{z \cdot \left(x + y\right)}{y}} \]
      6. Step-by-step derivation
        1. div-add-revN/A

          \[\leadsto \color{blue}{-1} \cdot \frac{z \cdot \left(x + y\right)}{y} \]
        2. frac-addN/A

          \[\leadsto \color{blue}{-1} \cdot \frac{z \cdot \left(x + y\right)}{y} \]
        3. mul-1-negN/A

          \[\leadsto \mathsf{neg}\left(\frac{z \cdot \left(x + y\right)}{y}\right) \]
        4. lower-neg.f64N/A

          \[\leadsto -\frac{z \cdot \left(x + y\right)}{y} \]
        5. lower-/.f64N/A

          \[\leadsto -\frac{z \cdot \left(x + y\right)}{y} \]
        6. *-commutativeN/A

          \[\leadsto -\frac{\left(x + y\right) \cdot z}{y} \]
        7. lower-*.f64N/A

          \[\leadsto -\frac{\left(x + y\right) \cdot z}{y} \]
        8. +-commutativeN/A

          \[\leadsto -\frac{\left(y + x\right) \cdot z}{y} \]
        9. lower-+.f6461.2

          \[\leadsto -\frac{\left(y + x\right) \cdot z}{y} \]
      7. Applied rewrites61.2%

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

        \[\leadsto -\left(z + \frac{x \cdot z}{y}\right) \]
      9. Step-by-step derivation
        1. +-commutativeN/A

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

          \[\leadsto -\left(x \cdot \frac{z}{y} + z\right) \]
        3. lower-fma.f64N/A

          \[\leadsto -\mathsf{fma}\left(x, \frac{z}{y}, z\right) \]
        4. lower-/.f6468.3

          \[\leadsto -\mathsf{fma}\left(x, \frac{z}{y}, z\right) \]
      10. Applied rewrites68.3%

        \[\leadsto -\mathsf{fma}\left(x, \frac{z}{y}, z\right) \]
    4. Recombined 3 regimes into one program.
    5. Add Preprocessing

    Alternative 4: 71.5% accurate, 0.7× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := -\mathsf{fma}\left(x, \frac{z}{y}, z\right)\\ \mathbf{if}\;y \leq -1.85 \cdot 10^{+80}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq 4 \cdot 10^{-36}:\\ \;\;\;\;\frac{x}{1 - \frac{y}{z}}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
    (FPCore (x y z)
     :precision binary64
     (let* ((t_0 (- (fma x (/ z y) z))))
       (if (<= y -1.85e+80) t_0 (if (<= y 4e-36) (/ x (- 1.0 (/ y z))) t_0))))
    double code(double x, double y, double z) {
    	double t_0 = -fma(x, (z / y), z);
    	double tmp;
    	if (y <= -1.85e+80) {
    		tmp = t_0;
    	} else if (y <= 4e-36) {
    		tmp = x / (1.0 - (y / z));
    	} else {
    		tmp = t_0;
    	}
    	return tmp;
    }
    
    function code(x, y, z)
    	t_0 = Float64(-fma(x, Float64(z / y), z))
    	tmp = 0.0
    	if (y <= -1.85e+80)
    		tmp = t_0;
    	elseif (y <= 4e-36)
    		tmp = Float64(x / Float64(1.0 - Float64(y / z)));
    	else
    		tmp = t_0;
    	end
    	return tmp
    end
    
    code[x_, y_, z_] := Block[{t$95$0 = (-N[(x * N[(z / y), $MachinePrecision] + z), $MachinePrecision])}, If[LessEqual[y, -1.85e+80], t$95$0, If[LessEqual[y, 4e-36], N[(x / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := -\mathsf{fma}\left(x, \frac{z}{y}, z\right)\\
    \mathbf{if}\;y \leq -1.85 \cdot 10^{+80}:\\
    \;\;\;\;t\_0\\
    
    \mathbf{elif}\;y \leq 4 \cdot 10^{-36}:\\
    \;\;\;\;\frac{x}{1 - \frac{y}{z}}\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_0\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if y < -1.84999999999999998e80 or 3.9999999999999998e-36 < y

      1. Initial program 75.0%

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

        \[\leadsto \frac{x + y}{\color{blue}{y \cdot \left(\frac{1}{y} - \frac{1}{z}\right)}} \]
      3. Step-by-step derivation
        1. *-commutativeN/A

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

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

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

          \[\leadsto \frac{x + y}{\left(\frac{1}{y} - \frac{1}{z}\right) \cdot y} \]
        5. lower-/.f6474.8

          \[\leadsto \frac{x + y}{\left(\frac{1}{y} - \frac{1}{z}\right) \cdot y} \]
      4. Applied rewrites74.8%

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

        \[\leadsto \color{blue}{-1 \cdot \frac{z \cdot \left(x + y\right)}{y}} \]
      6. Step-by-step derivation
        1. div-add-revN/A

          \[\leadsto \color{blue}{-1} \cdot \frac{z \cdot \left(x + y\right)}{y} \]
        2. frac-addN/A

          \[\leadsto \color{blue}{-1} \cdot \frac{z \cdot \left(x + y\right)}{y} \]
        3. mul-1-negN/A

          \[\leadsto \mathsf{neg}\left(\frac{z \cdot \left(x + y\right)}{y}\right) \]
        4. lower-neg.f64N/A

          \[\leadsto -\frac{z \cdot \left(x + y\right)}{y} \]
        5. lower-/.f64N/A

          \[\leadsto -\frac{z \cdot \left(x + y\right)}{y} \]
        6. *-commutativeN/A

          \[\leadsto -\frac{\left(x + y\right) \cdot z}{y} \]
        7. lower-*.f64N/A

          \[\leadsto -\frac{\left(x + y\right) \cdot z}{y} \]
        8. +-commutativeN/A

          \[\leadsto -\frac{\left(y + x\right) \cdot z}{y} \]
        9. lower-+.f6462.4

          \[\leadsto -\frac{\left(y + x\right) \cdot z}{y} \]
      7. Applied rewrites62.4%

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

        \[\leadsto -\left(z + \frac{x \cdot z}{y}\right) \]
      9. Step-by-step derivation
        1. +-commutativeN/A

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

          \[\leadsto -\left(x \cdot \frac{z}{y} + z\right) \]
        3. lower-fma.f64N/A

          \[\leadsto -\mathsf{fma}\left(x, \frac{z}{y}, z\right) \]
        4. lower-/.f6471.8

          \[\leadsto -\mathsf{fma}\left(x, \frac{z}{y}, z\right) \]
      10. Applied rewrites71.8%

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

      if -1.84999999999999998e80 < y < 3.9999999999999998e-36

      1. Initial program 99.2%

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

        \[\leadsto \frac{\color{blue}{x}}{1 - \frac{y}{z}} \]
      3. Step-by-step derivation
        1. Applied rewrites71.6%

          \[\leadsto \frac{\color{blue}{x}}{1 - \frac{y}{z}} \]
      4. Recombined 2 regimes into one program.
      5. Add Preprocessing

      Alternative 5: 71.1% accurate, 0.7× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := -\mathsf{fma}\left(x, \frac{z}{y}, z\right)\\ \mathbf{if}\;y \leq -7.8 \cdot 10^{+83}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq 1.75 \cdot 10^{-84}:\\ \;\;\;\;y + x\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
      (FPCore (x y z)
       :precision binary64
       (let* ((t_0 (- (fma x (/ z y) z))))
         (if (<= y -7.8e+83) t_0 (if (<= y 1.75e-84) (+ y x) t_0))))
      double code(double x, double y, double z) {
      	double t_0 = -fma(x, (z / y), z);
      	double tmp;
      	if (y <= -7.8e+83) {
      		tmp = t_0;
      	} else if (y <= 1.75e-84) {
      		tmp = y + x;
      	} else {
      		tmp = t_0;
      	}
      	return tmp;
      }
      
      function code(x, y, z)
      	t_0 = Float64(-fma(x, Float64(z / y), z))
      	tmp = 0.0
      	if (y <= -7.8e+83)
      		tmp = t_0;
      	elseif (y <= 1.75e-84)
      		tmp = Float64(y + x);
      	else
      		tmp = t_0;
      	end
      	return tmp
      end
      
      code[x_, y_, z_] := Block[{t$95$0 = (-N[(x * N[(z / y), $MachinePrecision] + z), $MachinePrecision])}, If[LessEqual[y, -7.8e+83], t$95$0, If[LessEqual[y, 1.75e-84], N[(y + x), $MachinePrecision], t$95$0]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := -\mathsf{fma}\left(x, \frac{z}{y}, z\right)\\
      \mathbf{if}\;y \leq -7.8 \cdot 10^{+83}:\\
      \;\;\;\;t\_0\\
      
      \mathbf{elif}\;y \leq 1.75 \cdot 10^{-84}:\\
      \;\;\;\;y + x\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_0\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if y < -7.8000000000000003e83 or 1.7500000000000001e-84 < y

        1. Initial program 76.9%

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

          \[\leadsto \frac{x + y}{\color{blue}{y \cdot \left(\frac{1}{y} - \frac{1}{z}\right)}} \]
        3. Step-by-step derivation
          1. *-commutativeN/A

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

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

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

            \[\leadsto \frac{x + y}{\left(\frac{1}{y} - \frac{1}{z}\right) \cdot y} \]
          5. lower-/.f6476.8

            \[\leadsto \frac{x + y}{\left(\frac{1}{y} - \frac{1}{z}\right) \cdot y} \]
        4. Applied rewrites76.8%

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

          \[\leadsto \color{blue}{-1 \cdot \frac{z \cdot \left(x + y\right)}{y}} \]
        6. Step-by-step derivation
          1. div-add-revN/A

            \[\leadsto \color{blue}{-1} \cdot \frac{z \cdot \left(x + y\right)}{y} \]
          2. frac-addN/A

            \[\leadsto \color{blue}{-1} \cdot \frac{z \cdot \left(x + y\right)}{y} \]
          3. mul-1-negN/A

            \[\leadsto \mathsf{neg}\left(\frac{z \cdot \left(x + y\right)}{y}\right) \]
          4. lower-neg.f64N/A

            \[\leadsto -\frac{z \cdot \left(x + y\right)}{y} \]
          5. lower-/.f64N/A

            \[\leadsto -\frac{z \cdot \left(x + y\right)}{y} \]
          6. *-commutativeN/A

            \[\leadsto -\frac{\left(x + y\right) \cdot z}{y} \]
          7. lower-*.f64N/A

            \[\leadsto -\frac{\left(x + y\right) \cdot z}{y} \]
          8. +-commutativeN/A

            \[\leadsto -\frac{\left(y + x\right) \cdot z}{y} \]
          9. lower-+.f6460.2

            \[\leadsto -\frac{\left(y + x\right) \cdot z}{y} \]
        7. Applied rewrites60.2%

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

          \[\leadsto -\left(z + \frac{x \cdot z}{y}\right) \]
        9. Step-by-step derivation
          1. +-commutativeN/A

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

            \[\leadsto -\left(x \cdot \frac{z}{y} + z\right) \]
          3. lower-fma.f64N/A

            \[\leadsto -\mathsf{fma}\left(x, \frac{z}{y}, z\right) \]
          4. lower-/.f6469.4

            \[\leadsto -\mathsf{fma}\left(x, \frac{z}{y}, z\right) \]
        10. Applied rewrites69.4%

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

        if -7.8000000000000003e83 < y < 1.7500000000000001e-84

        1. Initial program 99.1%

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

          \[\leadsto \color{blue}{x + y} \]
        3. Step-by-step derivation
          1. +-commutativeN/A

            \[\leadsto y + \color{blue}{x} \]
          2. lower-+.f6472.8

            \[\leadsto y + \color{blue}{x} \]
        4. Applied rewrites72.8%

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

      Alternative 6: 67.7% accurate, 1.2× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -7.8 \cdot 10^{+83}:\\ \;\;\;\;-z\\ \mathbf{elif}\;y \leq 7.6 \cdot 10^{+128}:\\ \;\;\;\;y + x\\ \mathbf{else}:\\ \;\;\;\;-z\\ \end{array} \end{array} \]
      (FPCore (x y z)
       :precision binary64
       (if (<= y -7.8e+83) (- z) (if (<= y 7.6e+128) (+ y x) (- z))))
      double code(double x, double y, double z) {
      	double tmp;
      	if (y <= -7.8e+83) {
      		tmp = -z;
      	} else if (y <= 7.6e+128) {
      		tmp = y + x;
      	} else {
      		tmp = -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 <= (-7.8d+83)) then
              tmp = -z
          else if (y <= 7.6d+128) then
              tmp = y + x
          else
              tmp = -z
          end if
          code = tmp
      end function
      
      public static double code(double x, double y, double z) {
      	double tmp;
      	if (y <= -7.8e+83) {
      		tmp = -z;
      	} else if (y <= 7.6e+128) {
      		tmp = y + x;
      	} else {
      		tmp = -z;
      	}
      	return tmp;
      }
      
      def code(x, y, z):
      	tmp = 0
      	if y <= -7.8e+83:
      		tmp = -z
      	elif y <= 7.6e+128:
      		tmp = y + x
      	else:
      		tmp = -z
      	return tmp
      
      function code(x, y, z)
      	tmp = 0.0
      	if (y <= -7.8e+83)
      		tmp = Float64(-z);
      	elseif (y <= 7.6e+128)
      		tmp = Float64(y + x);
      	else
      		tmp = Float64(-z);
      	end
      	return tmp
      end
      
      function tmp_2 = code(x, y, z)
      	tmp = 0.0;
      	if (y <= -7.8e+83)
      		tmp = -z;
      	elseif (y <= 7.6e+128)
      		tmp = y + x;
      	else
      		tmp = -z;
      	end
      	tmp_2 = tmp;
      end
      
      code[x_, y_, z_] := If[LessEqual[y, -7.8e+83], (-z), If[LessEqual[y, 7.6e+128], N[(y + x), $MachinePrecision], (-z)]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;y \leq -7.8 \cdot 10^{+83}:\\
      \;\;\;\;-z\\
      
      \mathbf{elif}\;y \leq 7.6 \cdot 10^{+128}:\\
      \;\;\;\;y + x\\
      
      \mathbf{else}:\\
      \;\;\;\;-z\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if y < -7.8000000000000003e83 or 7.5999999999999998e128 < y

        1. Initial program 68.1%

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

          \[\leadsto \color{blue}{-1 \cdot z} \]
        3. Step-by-step derivation
          1. mul-1-negN/A

            \[\leadsto \mathsf{neg}\left(z\right) \]
          2. lower-neg.f6470.2

            \[\leadsto -z \]
        4. Applied rewrites70.2%

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

        if -7.8000000000000003e83 < y < 7.5999999999999998e128

        1. Initial program 97.8%

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

          \[\leadsto \color{blue}{x + y} \]
        3. Step-by-step derivation
          1. +-commutativeN/A

            \[\leadsto y + \color{blue}{x} \]
          2. lower-+.f6466.4

            \[\leadsto y + \color{blue}{x} \]
        4. Applied rewrites66.4%

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

      Alternative 7: 57.4% accurate, 1.4× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.4 \cdot 10^{+80}:\\ \;\;\;\;-z\\ \mathbf{elif}\;y \leq 4 \cdot 10^{-36}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;-z\\ \end{array} \end{array} \]
      (FPCore (x y z)
       :precision binary64
       (if (<= y -1.4e+80) (- z) (if (<= y 4e-36) x (- z))))
      double code(double x, double y, double z) {
      	double tmp;
      	if (y <= -1.4e+80) {
      		tmp = -z;
      	} else if (y <= 4e-36) {
      		tmp = x;
      	} else {
      		tmp = -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 <= (-1.4d+80)) then
              tmp = -z
          else if (y <= 4d-36) then
              tmp = x
          else
              tmp = -z
          end if
          code = tmp
      end function
      
      public static double code(double x, double y, double z) {
      	double tmp;
      	if (y <= -1.4e+80) {
      		tmp = -z;
      	} else if (y <= 4e-36) {
      		tmp = x;
      	} else {
      		tmp = -z;
      	}
      	return tmp;
      }
      
      def code(x, y, z):
      	tmp = 0
      	if y <= -1.4e+80:
      		tmp = -z
      	elif y <= 4e-36:
      		tmp = x
      	else:
      		tmp = -z
      	return tmp
      
      function code(x, y, z)
      	tmp = 0.0
      	if (y <= -1.4e+80)
      		tmp = Float64(-z);
      	elseif (y <= 4e-36)
      		tmp = x;
      	else
      		tmp = Float64(-z);
      	end
      	return tmp
      end
      
      function tmp_2 = code(x, y, z)
      	tmp = 0.0;
      	if (y <= -1.4e+80)
      		tmp = -z;
      	elseif (y <= 4e-36)
      		tmp = x;
      	else
      		tmp = -z;
      	end
      	tmp_2 = tmp;
      end
      
      code[x_, y_, z_] := If[LessEqual[y, -1.4e+80], (-z), If[LessEqual[y, 4e-36], x, (-z)]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;y \leq -1.4 \cdot 10^{+80}:\\
      \;\;\;\;-z\\
      
      \mathbf{elif}\;y \leq 4 \cdot 10^{-36}:\\
      \;\;\;\;x\\
      
      \mathbf{else}:\\
      \;\;\;\;-z\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if y < -1.39999999999999992e80 or 3.9999999999999998e-36 < y

        1. Initial program 75.0%

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

          \[\leadsto \color{blue}{-1 \cdot z} \]
        3. Step-by-step derivation
          1. mul-1-negN/A

            \[\leadsto \mathsf{neg}\left(z\right) \]
          2. lower-neg.f6460.8

            \[\leadsto -z \]
        4. Applied rewrites60.8%

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

        if -1.39999999999999992e80 < y < 3.9999999999999998e-36

        1. Initial program 99.2%

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

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

            \[\leadsto \color{blue}{x} \]
        4. Recombined 2 regimes into one program.
        5. Add Preprocessing

        Alternative 8: 34.0% accurate, 13.1× 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.9%

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

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

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

          Reproduce

          ?
          herbie shell --seed 2025115 
          (FPCore (x y z)
            :name "Graphics.Rendering.Chart.Backend.Diagrams:calcFontMetrics from Chart-diagrams-1.5.1, A"
            :precision binary64
            (/ (+ x y) (- 1.0 (/ y z))))