fabs fraction 1

Percentage Accurate: 91.6% → 99.6%
Time: 5.6s
Alternatives: 10
Speedup: 1.1×

Specification

?
\[\begin{array}{l} \\ \left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \end{array} \]
(FPCore (x y z) :precision binary64 (fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))
double code(double x, double y, double z) {
	return fabs((((x + 4.0) / y) - ((x / 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 = abs((((x + 4.0d0) / y) - ((x / y) * z)))
end function
public static double code(double x, double y, double z) {
	return Math.abs((((x + 4.0) / y) - ((x / y) * z)));
}
def code(x, y, z):
	return math.fabs((((x + 4.0) / y) - ((x / y) * z)))
function code(x, y, z)
	return abs(Float64(Float64(Float64(x + 4.0) / y) - Float64(Float64(x / y) * z)))
end
function tmp = code(x, y, z)
	tmp = abs((((x + 4.0) / y) - ((x / y) * z)));
end
code[x_, y_, z_] := N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision] - N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|
\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 10 alternatives:

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

Initial Program: 91.6% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \end{array} \]
(FPCore (x y z) :precision binary64 (fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))
double code(double x, double y, double z) {
	return fabs((((x + 4.0) / y) - ((x / 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 = abs((((x + 4.0d0) / y) - ((x / y) * z)))
end function
public static double code(double x, double y, double z) {
	return Math.abs((((x + 4.0) / y) - ((x / y) * z)));
}
def code(x, y, z):
	return math.fabs((((x + 4.0) / y) - ((x / y) * z)))
function code(x, y, z)
	return abs(Float64(Float64(Float64(x + 4.0) / y) - Float64(Float64(x / y) * z)))
end
function tmp = code(x, y, z)
	tmp = abs((((x + 4.0) / y) - ((x / y) * z)));
end
code[x_, y_, z_] := N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision] - N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|
\end{array}

Alternative 1: 99.6% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -3.1 \cdot 10^{+93} \lor \neg \left(x \leq 2.6 \cdot 10^{+67}\right):\\ \;\;\;\;\left|\left(1 - z\right) \cdot \frac{x}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{\mathsf{fma}\left(z, x, -4 - x\right)}{y}\right|\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= x -3.1e+93) (not (<= x 2.6e+67)))
   (fabs (* (- 1.0 z) (/ x y)))
   (fabs (/ (fma z x (- -4.0 x)) y))))
double code(double x, double y, double z) {
	double tmp;
	if ((x <= -3.1e+93) || !(x <= 2.6e+67)) {
		tmp = fabs(((1.0 - z) * (x / y)));
	} else {
		tmp = fabs((fma(z, x, (-4.0 - x)) / y));
	}
	return tmp;
}
function code(x, y, z)
	tmp = 0.0
	if ((x <= -3.1e+93) || !(x <= 2.6e+67))
		tmp = abs(Float64(Float64(1.0 - z) * Float64(x / y)));
	else
		tmp = abs(Float64(fma(z, x, Float64(-4.0 - x)) / y));
	end
	return tmp
end
code[x_, y_, z_] := If[Or[LessEqual[x, -3.1e+93], N[Not[LessEqual[x, 2.6e+67]], $MachinePrecision]], N[Abs[N[(N[(1.0 - z), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(z * x + N[(-4.0 - x), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.1 \cdot 10^{+93} \lor \neg \left(x \leq 2.6 \cdot 10^{+67}\right):\\
\;\;\;\;\left|\left(1 - z\right) \cdot \frac{x}{y}\right|\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -3.10000000000000019e93 or 2.6e67 < x

    1. Initial program 84.0%

      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf

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

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

      if -3.10000000000000019e93 < x < 2.6e67

      1. Initial program 94.3%

        \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
      2. Add Preprocessing
      3. Taylor expanded in x around 0

        \[\leadsto \color{blue}{\left|\left(4 \cdot \frac{1}{y} + \frac{x}{y}\right) - \frac{x \cdot z}{y}\right|} \]
      4. Applied rewrites99.9%

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

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

    Alternative 2: 97.8% accurate, 0.9× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 6 \cdot 10^{+90}:\\ \;\;\;\;\left|\frac{\mathsf{fma}\left(z, x, -4 - x\right)}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\mathsf{fma}\left(-x, \frac{z}{y}, \frac{4 + x}{y}\right)\right|\\ \end{array} \end{array} \]
    (FPCore (x y z)
     :precision binary64
     (if (<= y 6e+90)
       (fabs (/ (fma z x (- -4.0 x)) y))
       (fabs (fma (- x) (/ z y) (/ (+ 4.0 x) y)))))
    double code(double x, double y, double z) {
    	double tmp;
    	if (y <= 6e+90) {
    		tmp = fabs((fma(z, x, (-4.0 - x)) / y));
    	} else {
    		tmp = fabs(fma(-x, (z / y), ((4.0 + x) / y)));
    	}
    	return tmp;
    }
    
    function code(x, y, z)
    	tmp = 0.0
    	if (y <= 6e+90)
    		tmp = abs(Float64(fma(z, x, Float64(-4.0 - x)) / y));
    	else
    		tmp = abs(fma(Float64(-x), Float64(z / y), Float64(Float64(4.0 + x) / y)));
    	end
    	return tmp
    end
    
    code[x_, y_, z_] := If[LessEqual[y, 6e+90], N[Abs[N[(N[(z * x + N[(-4.0 - x), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision], N[Abs[N[((-x) * N[(z / y), $MachinePrecision] + N[(N[(4.0 + x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;y \leq 6 \cdot 10^{+90}:\\
    \;\;\;\;\left|\frac{\mathsf{fma}\left(z, x, -4 - x\right)}{y}\right|\\
    
    \mathbf{else}:\\
    \;\;\;\;\left|\mathsf{fma}\left(-x, \frac{z}{y}, \frac{4 + x}{y}\right)\right|\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if y < 5.99999999999999957e90

      1. Initial program 90.0%

        \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
      2. Add Preprocessing
      3. Taylor expanded in x around 0

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

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

      if 5.99999999999999957e90 < y

      1. Initial program 94.1%

        \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. lift--.f64N/A

          \[\leadsto \left|\color{blue}{\frac{x + 4}{y} - \frac{x}{y} \cdot z}\right| \]
        2. lift-*.f64N/A

          \[\leadsto \left|\frac{x + 4}{y} - \color{blue}{\frac{x}{y} \cdot z}\right| \]
        3. fp-cancel-sub-sign-invN/A

          \[\leadsto \left|\color{blue}{\frac{x + 4}{y} + \left(\mathsf{neg}\left(\frac{x}{y}\right)\right) \cdot z}\right| \]
        4. +-commutativeN/A

          \[\leadsto \left|\color{blue}{\left(\mathsf{neg}\left(\frac{x}{y}\right)\right) \cdot z + \frac{x + 4}{y}}\right| \]
        5. distribute-lft-neg-outN/A

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

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

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

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

          \[\leadsto \left|\left(\mathsf{neg}\left(\color{blue}{\frac{x \cdot z}{y}}\right)\right) + \frac{x + 4}{y}\right| \]
        10. associate-/l*N/A

          \[\leadsto \left|\left(\mathsf{neg}\left(\color{blue}{x \cdot \frac{z}{y}}\right)\right) + \frac{x + 4}{y}\right| \]
        11. distribute-lft-neg-inN/A

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

          \[\leadsto \left|\color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(x\right), \frac{z}{y}, \frac{x + 4}{y}\right)}\right| \]
        13. lower-neg.f64N/A

          \[\leadsto \left|\mathsf{fma}\left(\color{blue}{-x}, \frac{z}{y}, \frac{x + 4}{y}\right)\right| \]
        14. lower-/.f6499.9

          \[\leadsto \left|\mathsf{fma}\left(-x, \color{blue}{\frac{z}{y}}, \frac{x + 4}{y}\right)\right| \]
        15. lift-+.f64N/A

          \[\leadsto \left|\mathsf{fma}\left(-x, \frac{z}{y}, \frac{\color{blue}{x + 4}}{y}\right)\right| \]
        16. +-commutativeN/A

          \[\leadsto \left|\mathsf{fma}\left(-x, \frac{z}{y}, \frac{\color{blue}{4 + x}}{y}\right)\right| \]
        17. lower-+.f6499.9

          \[\leadsto \left|\mathsf{fma}\left(-x, \frac{z}{y}, \frac{\color{blue}{4 + x}}{y}\right)\right| \]
      4. Applied rewrites99.9%

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

    Alternative 3: 98.8% accurate, 1.1× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -10.2 \lor \neg \left(x \leq 4.2\right):\\ \;\;\;\;\left|\left(1 - z\right) \cdot \frac{x}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{\mathsf{fma}\left(z, x, -4\right)}{y}\right|\\ \end{array} \end{array} \]
    (FPCore (x y z)
     :precision binary64
     (if (or (<= x -10.2) (not (<= x 4.2)))
       (fabs (* (- 1.0 z) (/ x y)))
       (fabs (/ (fma z x -4.0) y))))
    double code(double x, double y, double z) {
    	double tmp;
    	if ((x <= -10.2) || !(x <= 4.2)) {
    		tmp = fabs(((1.0 - z) * (x / y)));
    	} else {
    		tmp = fabs((fma(z, x, -4.0) / y));
    	}
    	return tmp;
    }
    
    function code(x, y, z)
    	tmp = 0.0
    	if ((x <= -10.2) || !(x <= 4.2))
    		tmp = abs(Float64(Float64(1.0 - z) * Float64(x / y)));
    	else
    		tmp = abs(Float64(fma(z, x, -4.0) / y));
    	end
    	return tmp
    end
    
    code[x_, y_, z_] := If[Or[LessEqual[x, -10.2], N[Not[LessEqual[x, 4.2]], $MachinePrecision]], N[Abs[N[(N[(1.0 - z), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(z * x + -4.0), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;x \leq -10.2 \lor \neg \left(x \leq 4.2\right):\\
    \;\;\;\;\left|\left(1 - z\right) \cdot \frac{x}{y}\right|\\
    
    \mathbf{else}:\\
    \;\;\;\;\left|\frac{\mathsf{fma}\left(z, x, -4\right)}{y}\right|\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if x < -10.199999999999999 or 4.20000000000000018 < x

      1. Initial program 88.3%

        \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
      2. Add Preprocessing
      3. Taylor expanded in x around inf

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

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

        if -10.199999999999999 < x < 4.20000000000000018

        1. Initial program 93.3%

          \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
        2. Add Preprocessing
        3. Taylor expanded in x around 0

          \[\leadsto \color{blue}{\left|\left(4 \cdot \frac{1}{y} + \frac{x}{y}\right) - \frac{x \cdot z}{y}\right|} \]
        4. Applied rewrites99.9%

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

          \[\leadsto \left|\frac{\mathsf{fma}\left(z, x, -4\right)}{y}\right| \]
        6. Step-by-step derivation
          1. Applied rewrites99.5%

            \[\leadsto \left|\frac{\mathsf{fma}\left(z, x, -4\right)}{y}\right| \]
        7. Recombined 2 regimes into one program.
        8. Final simplification98.8%

          \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -10.2 \lor \neg \left(x \leq 4.2\right):\\ \;\;\;\;\left|\left(1 - z\right) \cdot \frac{x}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{\mathsf{fma}\left(z, x, -4\right)}{y}\right|\\ \end{array} \]
        9. Add Preprocessing

        Alternative 4: 95.0% accurate, 1.1× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -10.2 \lor \neg \left(x \leq 4\right):\\ \;\;\;\;\left|\frac{\mathsf{fma}\left(z, x, -x\right)}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{\mathsf{fma}\left(z, x, -4\right)}{y}\right|\\ \end{array} \end{array} \]
        (FPCore (x y z)
         :precision binary64
         (if (or (<= x -10.2) (not (<= x 4.0)))
           (fabs (/ (fma z x (- x)) y))
           (fabs (/ (fma z x -4.0) y))))
        double code(double x, double y, double z) {
        	double tmp;
        	if ((x <= -10.2) || !(x <= 4.0)) {
        		tmp = fabs((fma(z, x, -x) / y));
        	} else {
        		tmp = fabs((fma(z, x, -4.0) / y));
        	}
        	return tmp;
        }
        
        function code(x, y, z)
        	tmp = 0.0
        	if ((x <= -10.2) || !(x <= 4.0))
        		tmp = abs(Float64(fma(z, x, Float64(-x)) / y));
        	else
        		tmp = abs(Float64(fma(z, x, -4.0) / y));
        	end
        	return tmp
        end
        
        code[x_, y_, z_] := If[Or[LessEqual[x, -10.2], N[Not[LessEqual[x, 4.0]], $MachinePrecision]], N[Abs[N[(N[(z * x + (-x)), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(z * x + -4.0), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;x \leq -10.2 \lor \neg \left(x \leq 4\right):\\
        \;\;\;\;\left|\frac{\mathsf{fma}\left(z, x, -x\right)}{y}\right|\\
        
        \mathbf{else}:\\
        \;\;\;\;\left|\frac{\mathsf{fma}\left(z, x, -4\right)}{y}\right|\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if x < -10.199999999999999 or 4 < x

          1. Initial program 88.3%

            \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
          2. Add Preprocessing
          3. Taylor expanded in x around 0

            \[\leadsto \color{blue}{\left|\left(4 \cdot \frac{1}{y} + \frac{x}{y}\right) - \frac{x \cdot z}{y}\right|} \]
          4. Applied rewrites89.0%

            \[\leadsto \color{blue}{\left|\frac{\mathsf{fma}\left(z, x, -4 - x\right)}{y}\right|} \]
          5. Taylor expanded in x around inf

            \[\leadsto \left|\frac{\mathsf{fma}\left(z, x, -1 \cdot x\right)}{y}\right| \]
          6. Step-by-step derivation
            1. Applied rewrites87.2%

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

            if -10.199999999999999 < x < 4

            1. Initial program 93.3%

              \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
            2. Add Preprocessing
            3. Taylor expanded in x around 0

              \[\leadsto \color{blue}{\left|\left(4 \cdot \frac{1}{y} + \frac{x}{y}\right) - \frac{x \cdot z}{y}\right|} \]
            4. Applied rewrites99.9%

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

              \[\leadsto \left|\frac{\mathsf{fma}\left(z, x, -4\right)}{y}\right| \]
            6. Step-by-step derivation
              1. Applied rewrites99.5%

                \[\leadsto \left|\frac{\mathsf{fma}\left(z, x, -4\right)}{y}\right| \]
            7. Recombined 2 regimes into one program.
            8. Final simplification93.3%

              \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -10.2 \lor \neg \left(x \leq 4\right):\\ \;\;\;\;\left|\frac{\mathsf{fma}\left(z, x, -x\right)}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{\mathsf{fma}\left(z, x, -4\right)}{y}\right|\\ \end{array} \]
            9. Add Preprocessing

            Alternative 5: 95.0% accurate, 1.1× speedup?

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

              1. Initial program 86.9%

                \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
              2. Add Preprocessing
              3. Taylor expanded in x around 0

                \[\leadsto \color{blue}{\left|\left(4 \cdot \frac{1}{y} + \frac{x}{y}\right) - \frac{x \cdot z}{y}\right|} \]
              4. Applied rewrites88.7%

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

                \[\leadsto \left|\frac{\mathsf{fma}\left(z, x, -4\right)}{y}\right| \]
              6. Step-by-step derivation
                1. Applied rewrites88.2%

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

                if -2.7e15 < z < 0.160000000000000003

                1. Initial program 94.5%

                  \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
                2. Add Preprocessing
                3. Taylor expanded in z around 0

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

                    \[\leadsto \left|\color{blue}{\frac{x - -4}{y}}\right| \]
                5. Recombined 2 regimes into one program.
                6. Final simplification93.0%

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

                Alternative 6: 85.2% accurate, 1.2× speedup?

                \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -4 \cdot 10^{+26} \lor \neg \left(z \leq 1.25 \cdot 10^{+111}\right):\\ \;\;\;\;\left|\frac{x}{y} \cdot z\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{x - -4}{y}\right|\\ \end{array} \end{array} \]
                (FPCore (x y z)
                 :precision binary64
                 (if (or (<= z -4e+26) (not (<= z 1.25e+111)))
                   (fabs (* (/ x y) z))
                   (fabs (/ (- x -4.0) y))))
                double code(double x, double y, double z) {
                	double tmp;
                	if ((z <= -4e+26) || !(z <= 1.25e+111)) {
                		tmp = fabs(((x / y) * z));
                	} else {
                		tmp = fabs(((x - -4.0) / 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 ((z <= (-4d+26)) .or. (.not. (z <= 1.25d+111))) then
                        tmp = abs(((x / y) * z))
                    else
                        tmp = abs(((x - (-4.0d0)) / y))
                    end if
                    code = tmp
                end function
                
                public static double code(double x, double y, double z) {
                	double tmp;
                	if ((z <= -4e+26) || !(z <= 1.25e+111)) {
                		tmp = Math.abs(((x / y) * z));
                	} else {
                		tmp = Math.abs(((x - -4.0) / y));
                	}
                	return tmp;
                }
                
                def code(x, y, z):
                	tmp = 0
                	if (z <= -4e+26) or not (z <= 1.25e+111):
                		tmp = math.fabs(((x / y) * z))
                	else:
                		tmp = math.fabs(((x - -4.0) / y))
                	return tmp
                
                function code(x, y, z)
                	tmp = 0.0
                	if ((z <= -4e+26) || !(z <= 1.25e+111))
                		tmp = abs(Float64(Float64(x / y) * z));
                	else
                		tmp = abs(Float64(Float64(x - -4.0) / y));
                	end
                	return tmp
                end
                
                function tmp_2 = code(x, y, z)
                	tmp = 0.0;
                	if ((z <= -4e+26) || ~((z <= 1.25e+111)))
                		tmp = abs(((x / y) * z));
                	else
                		tmp = abs(((x - -4.0) / y));
                	end
                	tmp_2 = tmp;
                end
                
                code[x_, y_, z_] := If[Or[LessEqual[z, -4e+26], N[Not[LessEqual[z, 1.25e+111]], $MachinePrecision]], N[Abs[N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(x - -4.0), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision]]
                
                \begin{array}{l}
                
                \\
                \begin{array}{l}
                \mathbf{if}\;z \leq -4 \cdot 10^{+26} \lor \neg \left(z \leq 1.25 \cdot 10^{+111}\right):\\
                \;\;\;\;\left|\frac{x}{y} \cdot z\right|\\
                
                \mathbf{else}:\\
                \;\;\;\;\left|\frac{x - -4}{y}\right|\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 2 regimes
                2. if z < -4.00000000000000019e26 or 1.2499999999999999e111 < z

                  1. Initial program 85.7%

                    \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
                  2. Add Preprocessing
                  3. Taylor expanded in x around 0

                    \[\leadsto \color{blue}{\left|\left(4 \cdot \frac{1}{y} + \frac{x}{y}\right) - \frac{x \cdot z}{y}\right|} \]
                  4. Applied rewrites86.0%

                    \[\leadsto \color{blue}{\left|\frac{\mathsf{fma}\left(z, x, -4 - x\right)}{y}\right|} \]
                  5. Taylor expanded in z around inf

                    \[\leadsto \left|\frac{x \cdot z}{y}\right| \]
                  6. Step-by-step derivation
                    1. Applied rewrites77.7%

                      \[\leadsto \left|\frac{z}{y} \cdot x\right| \]
                    2. Step-by-step derivation
                      1. Applied rewrites74.2%

                        \[\leadsto \color{blue}{\left|\frac{x}{y} \cdot z\right|} \]

                      if -4.00000000000000019e26 < z < 1.2499999999999999e111

                      1. Initial program 94.1%

                        \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
                      2. Add Preprocessing
                      3. Taylor expanded in z around 0

                        \[\leadsto \left|\color{blue}{4 \cdot \frac{1}{y} + \frac{x}{y}}\right| \]
                      4. Step-by-step derivation
                        1. Applied rewrites95.2%

                          \[\leadsto \left|\color{blue}{\frac{x - -4}{y}}\right| \]
                      5. Recombined 2 regimes into one program.
                      6. Final simplification86.8%

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

                      Alternative 7: 85.2% accurate, 1.2× speedup?

                      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -4 \cdot 10^{+26}:\\ \;\;\;\;\left|\frac{x}{y} \cdot z\right|\\ \mathbf{elif}\;z \leq 1.25 \cdot 10^{+111}:\\ \;\;\;\;\left|\frac{x - -4}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{z}{y} \cdot x\right|\\ \end{array} \end{array} \]
                      (FPCore (x y z)
                       :precision binary64
                       (if (<= z -4e+26)
                         (fabs (* (/ x y) z))
                         (if (<= z 1.25e+111) (fabs (/ (- x -4.0) y)) (fabs (* (/ z y) x)))))
                      double code(double x, double y, double z) {
                      	double tmp;
                      	if (z <= -4e+26) {
                      		tmp = fabs(((x / y) * z));
                      	} else if (z <= 1.25e+111) {
                      		tmp = fabs(((x - -4.0) / y));
                      	} else {
                      		tmp = fabs(((z / 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 (z <= (-4d+26)) then
                              tmp = abs(((x / y) * z))
                          else if (z <= 1.25d+111) then
                              tmp = abs(((x - (-4.0d0)) / y))
                          else
                              tmp = abs(((z / y) * x))
                          end if
                          code = tmp
                      end function
                      
                      public static double code(double x, double y, double z) {
                      	double tmp;
                      	if (z <= -4e+26) {
                      		tmp = Math.abs(((x / y) * z));
                      	} else if (z <= 1.25e+111) {
                      		tmp = Math.abs(((x - -4.0) / y));
                      	} else {
                      		tmp = Math.abs(((z / y) * x));
                      	}
                      	return tmp;
                      }
                      
                      def code(x, y, z):
                      	tmp = 0
                      	if z <= -4e+26:
                      		tmp = math.fabs(((x / y) * z))
                      	elif z <= 1.25e+111:
                      		tmp = math.fabs(((x - -4.0) / y))
                      	else:
                      		tmp = math.fabs(((z / y) * x))
                      	return tmp
                      
                      function code(x, y, z)
                      	tmp = 0.0
                      	if (z <= -4e+26)
                      		tmp = abs(Float64(Float64(x / y) * z));
                      	elseif (z <= 1.25e+111)
                      		tmp = abs(Float64(Float64(x - -4.0) / y));
                      	else
                      		tmp = abs(Float64(Float64(z / y) * x));
                      	end
                      	return tmp
                      end
                      
                      function tmp_2 = code(x, y, z)
                      	tmp = 0.0;
                      	if (z <= -4e+26)
                      		tmp = abs(((x / y) * z));
                      	elseif (z <= 1.25e+111)
                      		tmp = abs(((x - -4.0) / y));
                      	else
                      		tmp = abs(((z / y) * x));
                      	end
                      	tmp_2 = tmp;
                      end
                      
                      code[x_, y_, z_] := If[LessEqual[z, -4e+26], N[Abs[N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]], $MachinePrecision], If[LessEqual[z, 1.25e+111], N[Abs[N[(N[(x - -4.0), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(z / y), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision]]]
                      
                      \begin{array}{l}
                      
                      \\
                      \begin{array}{l}
                      \mathbf{if}\;z \leq -4 \cdot 10^{+26}:\\
                      \;\;\;\;\left|\frac{x}{y} \cdot z\right|\\
                      
                      \mathbf{elif}\;z \leq 1.25 \cdot 10^{+111}:\\
                      \;\;\;\;\left|\frac{x - -4}{y}\right|\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;\left|\frac{z}{y} \cdot x\right|\\
                      
                      
                      \end{array}
                      \end{array}
                      
                      Derivation
                      1. Split input into 3 regimes
                      2. if z < -4.00000000000000019e26

                        1. Initial program 93.4%

                          \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
                        2. Add Preprocessing
                        3. Taylor expanded in x around 0

                          \[\leadsto \color{blue}{\left|\left(4 \cdot \frac{1}{y} + \frac{x}{y}\right) - \frac{x \cdot z}{y}\right|} \]
                        4. Applied rewrites90.0%

                          \[\leadsto \color{blue}{\left|\frac{\mathsf{fma}\left(z, x, -4 - x\right)}{y}\right|} \]
                        5. Taylor expanded in z around inf

                          \[\leadsto \left|\frac{x \cdot z}{y}\right| \]
                        6. Step-by-step derivation
                          1. Applied rewrites75.3%

                            \[\leadsto \left|\frac{z}{y} \cdot x\right| \]
                          2. Step-by-step derivation
                            1. Applied rewrites75.6%

                              \[\leadsto \color{blue}{\left|\frac{x}{y} \cdot z\right|} \]

                            if -4.00000000000000019e26 < z < 1.2499999999999999e111

                            1. Initial program 94.1%

                              \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
                            2. Add Preprocessing
                            3. Taylor expanded in z around 0

                              \[\leadsto \left|\color{blue}{4 \cdot \frac{1}{y} + \frac{x}{y}}\right| \]
                            4. Step-by-step derivation
                              1. Applied rewrites95.2%

                                \[\leadsto \left|\color{blue}{\frac{x - -4}{y}}\right| \]

                              if 1.2499999999999999e111 < z

                              1. Initial program 76.0%

                                \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
                              2. Add Preprocessing
                              3. Taylor expanded in x around 0

                                \[\leadsto \color{blue}{\left|\left(4 \cdot \frac{1}{y} + \frac{x}{y}\right) - \frac{x \cdot z}{y}\right|} \]
                              4. Applied rewrites80.9%

                                \[\leadsto \color{blue}{\left|\frac{\mathsf{fma}\left(z, x, -4 - x\right)}{y}\right|} \]
                              5. Taylor expanded in z around inf

                                \[\leadsto \left|\frac{x \cdot z}{y}\right| \]
                              6. Step-by-step derivation
                                1. Applied rewrites80.7%

                                  \[\leadsto \left|\frac{z}{y} \cdot x\right| \]
                              7. Recombined 3 regimes into one program.
                              8. Add Preprocessing

                              Alternative 8: 68.8% accurate, 1.4× speedup?

                              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -10.5 \lor \neg \left(x \leq 4\right):\\ \;\;\;\;\left|\frac{x}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{4}{y}\right|\\ \end{array} \end{array} \]
                              (FPCore (x y z)
                               :precision binary64
                               (if (or (<= x -10.5) (not (<= x 4.0))) (fabs (/ x y)) (fabs (/ 4.0 y))))
                              double code(double x, double y, double z) {
                              	double tmp;
                              	if ((x <= -10.5) || !(x <= 4.0)) {
                              		tmp = fabs((x / y));
                              	} else {
                              		tmp = fabs((4.0 / 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 <= (-10.5d0)) .or. (.not. (x <= 4.0d0))) then
                                      tmp = abs((x / y))
                                  else
                                      tmp = abs((4.0d0 / y))
                                  end if
                                  code = tmp
                              end function
                              
                              public static double code(double x, double y, double z) {
                              	double tmp;
                              	if ((x <= -10.5) || !(x <= 4.0)) {
                              		tmp = Math.abs((x / y));
                              	} else {
                              		tmp = Math.abs((4.0 / y));
                              	}
                              	return tmp;
                              }
                              
                              def code(x, y, z):
                              	tmp = 0
                              	if (x <= -10.5) or not (x <= 4.0):
                              		tmp = math.fabs((x / y))
                              	else:
                              		tmp = math.fabs((4.0 / y))
                              	return tmp
                              
                              function code(x, y, z)
                              	tmp = 0.0
                              	if ((x <= -10.5) || !(x <= 4.0))
                              		tmp = abs(Float64(x / y));
                              	else
                              		tmp = abs(Float64(4.0 / y));
                              	end
                              	return tmp
                              end
                              
                              function tmp_2 = code(x, y, z)
                              	tmp = 0.0;
                              	if ((x <= -10.5) || ~((x <= 4.0)))
                              		tmp = abs((x / y));
                              	else
                              		tmp = abs((4.0 / y));
                              	end
                              	tmp_2 = tmp;
                              end
                              
                              code[x_, y_, z_] := If[Or[LessEqual[x, -10.5], N[Not[LessEqual[x, 4.0]], $MachinePrecision]], N[Abs[N[(x / y), $MachinePrecision]], $MachinePrecision], N[Abs[N[(4.0 / y), $MachinePrecision]], $MachinePrecision]]
                              
                              \begin{array}{l}
                              
                              \\
                              \begin{array}{l}
                              \mathbf{if}\;x \leq -10.5 \lor \neg \left(x \leq 4\right):\\
                              \;\;\;\;\left|\frac{x}{y}\right|\\
                              
                              \mathbf{else}:\\
                              \;\;\;\;\left|\frac{4}{y}\right|\\
                              
                              
                              \end{array}
                              \end{array}
                              
                              Derivation
                              1. Split input into 2 regimes
                              2. if x < -10.5 or 4 < x

                                1. Initial program 88.3%

                                  \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
                                2. Add Preprocessing
                                3. Taylor expanded in z around 0

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

                                    \[\leadsto \left|\color{blue}{\frac{x - -4}{y}}\right| \]
                                  2. Taylor expanded in x around inf

                                    \[\leadsto \left|\frac{x}{y}\right| \]
                                  3. Step-by-step derivation
                                    1. Applied rewrites61.0%

                                      \[\leadsto \left|\frac{x}{y}\right| \]

                                    if -10.5 < x < 4

                                    1. Initial program 93.3%

                                      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
                                    2. Add Preprocessing
                                    3. Taylor expanded in x around 0

                                      \[\leadsto \left|\color{blue}{\frac{4}{y}}\right| \]
                                    4. Step-by-step derivation
                                      1. Applied rewrites74.9%

                                        \[\leadsto \left|\color{blue}{\frac{4}{y}}\right| \]
                                    5. Recombined 2 regimes into one program.
                                    6. Final simplification67.9%

                                      \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -10.5 \lor \neg \left(x \leq 4\right):\\ \;\;\;\;\left|\frac{x}{y}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{4}{y}\right|\\ \end{array} \]
                                    7. Add Preprocessing

                                    Alternative 9: 69.8% accurate, 2.1× speedup?

                                    \[\begin{array}{l} \\ \left|\frac{x - -4}{y}\right| \end{array} \]
                                    (FPCore (x y z) :precision binary64 (fabs (/ (- x -4.0) y)))
                                    double code(double x, double y, double z) {
                                    	return fabs(((x - -4.0) / y));
                                    }
                                    
                                    module fmin_fmax_functions
                                        implicit none
                                        private
                                        public fmax
                                        public fmin
                                    
                                        interface fmax
                                            module procedure fmax88
                                            module procedure fmax44
                                            module procedure fmax84
                                            module procedure fmax48
                                        end interface
                                        interface fmin
                                            module procedure fmin88
                                            module procedure fmin44
                                            module procedure fmin84
                                            module procedure fmin48
                                        end interface
                                    contains
                                        real(8) function fmax88(x, y) result (res)
                                            real(8), intent (in) :: x
                                            real(8), intent (in) :: y
                                            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                        end function
                                        real(4) function fmax44(x, y) result (res)
                                            real(4), intent (in) :: x
                                            real(4), intent (in) :: y
                                            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                        end function
                                        real(8) function fmax84(x, y) result(res)
                                            real(8), intent (in) :: x
                                            real(4), intent (in) :: y
                                            res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                        end function
                                        real(8) function fmax48(x, y) result(res)
                                            real(4), intent (in) :: x
                                            real(8), intent (in) :: y
                                            res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                        end function
                                        real(8) function fmin88(x, y) result (res)
                                            real(8), intent (in) :: x
                                            real(8), intent (in) :: y
                                            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                        end function
                                        real(4) function fmin44(x, y) result (res)
                                            real(4), intent (in) :: x
                                            real(4), intent (in) :: y
                                            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                        end function
                                        real(8) function fmin84(x, y) result(res)
                                            real(8), intent (in) :: x
                                            real(4), intent (in) :: y
                                            res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                        end function
                                        real(8) function fmin48(x, y) result(res)
                                            real(4), intent (in) :: x
                                            real(8), intent (in) :: y
                                            res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                        end function
                                    end module
                                    
                                    real(8) function code(x, y, z)
                                    use fmin_fmax_functions
                                        real(8), intent (in) :: x
                                        real(8), intent (in) :: y
                                        real(8), intent (in) :: z
                                        code = abs(((x - (-4.0d0)) / y))
                                    end function
                                    
                                    public static double code(double x, double y, double z) {
                                    	return Math.abs(((x - -4.0) / y));
                                    }
                                    
                                    def code(x, y, z):
                                    	return math.fabs(((x - -4.0) / y))
                                    
                                    function code(x, y, z)
                                    	return abs(Float64(Float64(x - -4.0) / y))
                                    end
                                    
                                    function tmp = code(x, y, z)
                                    	tmp = abs(((x - -4.0) / y));
                                    end
                                    
                                    code[x_, y_, z_] := N[Abs[N[(N[(x - -4.0), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision]
                                    
                                    \begin{array}{l}
                                    
                                    \\
                                    \left|\frac{x - -4}{y}\right|
                                    \end{array}
                                    
                                    Derivation
                                    1. Initial program 90.8%

                                      \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
                                    2. Add Preprocessing
                                    3. Taylor expanded in z around 0

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

                                        \[\leadsto \left|\color{blue}{\frac{x - -4}{y}}\right| \]
                                      2. Add Preprocessing

                                      Alternative 10: 39.9% accurate, 2.6× speedup?

                                      \[\begin{array}{l} \\ \left|\frac{4}{y}\right| \end{array} \]
                                      (FPCore (x y z) :precision binary64 (fabs (/ 4.0 y)))
                                      double code(double x, double y, double z) {
                                      	return fabs((4.0 / y));
                                      }
                                      
                                      module fmin_fmax_functions
                                          implicit none
                                          private
                                          public fmax
                                          public fmin
                                      
                                          interface fmax
                                              module procedure fmax88
                                              module procedure fmax44
                                              module procedure fmax84
                                              module procedure fmax48
                                          end interface
                                          interface fmin
                                              module procedure fmin88
                                              module procedure fmin44
                                              module procedure fmin84
                                              module procedure fmin48
                                          end interface
                                      contains
                                          real(8) function fmax88(x, y) result (res)
                                              real(8), intent (in) :: x
                                              real(8), intent (in) :: y
                                              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                          end function
                                          real(4) function fmax44(x, y) result (res)
                                              real(4), intent (in) :: x
                                              real(4), intent (in) :: y
                                              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                          end function
                                          real(8) function fmax84(x, y) result(res)
                                              real(8), intent (in) :: x
                                              real(4), intent (in) :: y
                                              res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                          end function
                                          real(8) function fmax48(x, y) result(res)
                                              real(4), intent (in) :: x
                                              real(8), intent (in) :: y
                                              res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                          end function
                                          real(8) function fmin88(x, y) result (res)
                                              real(8), intent (in) :: x
                                              real(8), intent (in) :: y
                                              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                          end function
                                          real(4) function fmin44(x, y) result (res)
                                              real(4), intent (in) :: x
                                              real(4), intent (in) :: y
                                              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                          end function
                                          real(8) function fmin84(x, y) result(res)
                                              real(8), intent (in) :: x
                                              real(4), intent (in) :: y
                                              res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                          end function
                                          real(8) function fmin48(x, y) result(res)
                                              real(4), intent (in) :: x
                                              real(8), intent (in) :: y
                                              res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                          end function
                                      end module
                                      
                                      real(8) function code(x, y, z)
                                      use fmin_fmax_functions
                                          real(8), intent (in) :: x
                                          real(8), intent (in) :: y
                                          real(8), intent (in) :: z
                                          code = abs((4.0d0 / y))
                                      end function
                                      
                                      public static double code(double x, double y, double z) {
                                      	return Math.abs((4.0 / y));
                                      }
                                      
                                      def code(x, y, z):
                                      	return math.fabs((4.0 / y))
                                      
                                      function code(x, y, z)
                                      	return abs(Float64(4.0 / y))
                                      end
                                      
                                      function tmp = code(x, y, z)
                                      	tmp = abs((4.0 / y));
                                      end
                                      
                                      code[x_, y_, z_] := N[Abs[N[(4.0 / y), $MachinePrecision]], $MachinePrecision]
                                      
                                      \begin{array}{l}
                                      
                                      \\
                                      \left|\frac{4}{y}\right|
                                      \end{array}
                                      
                                      Derivation
                                      1. Initial program 90.8%

                                        \[\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right| \]
                                      2. Add Preprocessing
                                      3. Taylor expanded in x around 0

                                        \[\leadsto \left|\color{blue}{\frac{4}{y}}\right| \]
                                      4. Step-by-step derivation
                                        1. Applied rewrites39.9%

                                          \[\leadsto \left|\color{blue}{\frac{4}{y}}\right| \]
                                        2. Add Preprocessing

                                        Reproduce

                                        ?
                                        herbie shell --seed 2025018 
                                        (FPCore (x y z)
                                          :name "fabs fraction 1"
                                          :precision binary64
                                          (fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))