Data.Array.Repa.Algorithms.ColorRamp:rampColorHotToCold from repa-algorithms-3.4.0.1, A

Percentage Accurate: 99.7% → 100.0%
Time: 2.4s
Alternatives: 8
Speedup: 1.5×

Specification

?
\[1 + \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y} \]
(FPCore (x y z)
  :precision binary64
  :pre TRUE
  (+ 1.0 (/ (* 4.0 (- (+ x (* y 0.75)) z)) y)))
double code(double x, double y, double z) {
	return 1.0 + ((4.0 * ((x + (y * 0.75)) - z)) / y);
}
real(8) function code(x, y, z)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = 1.0d0 + ((4.0d0 * ((x + (y * 0.75d0)) - z)) / y)
end function
public static double code(double x, double y, double z) {
	return 1.0 + ((4.0 * ((x + (y * 0.75)) - z)) / y);
}
def code(x, y, z):
	return 1.0 + ((4.0 * ((x + (y * 0.75)) - z)) / y)
function code(x, y, z)
	return Float64(1.0 + Float64(Float64(4.0 * Float64(Float64(x + Float64(y * 0.75)) - z)) / y))
end
function tmp = code(x, y, z)
	tmp = 1.0 + ((4.0 * ((x + (y * 0.75)) - z)) / y);
end
code[x_, y_, z_] := N[(1.0 + N[(N[(4.0 * N[(N[(x + N[(y * 0.75), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
f(x, y, z):
	x in [-inf, +inf],
	y in [-inf, +inf],
	z in [-inf, +inf]
code: THEORY
BEGIN
f(x, y, z: real): real =
	(1) + (((4) * ((x + (y * (75e-2))) - z)) / y)
END code
1 + \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y}

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

\[1 + \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y} \]
(FPCore (x y z)
  :precision binary64
  :pre TRUE
  (+ 1.0 (/ (* 4.0 (- (+ x (* y 0.75)) z)) y)))
double code(double x, double y, double z) {
	return 1.0 + ((4.0 * ((x + (y * 0.75)) - z)) / y);
}
real(8) function code(x, y, z)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = 1.0d0 + ((4.0d0 * ((x + (y * 0.75d0)) - z)) / y)
end function
public static double code(double x, double y, double z) {
	return 1.0 + ((4.0 * ((x + (y * 0.75)) - z)) / y);
}
def code(x, y, z):
	return 1.0 + ((4.0 * ((x + (y * 0.75)) - z)) / y)
function code(x, y, z)
	return Float64(1.0 + Float64(Float64(4.0 * Float64(Float64(x + Float64(y * 0.75)) - z)) / y))
end
function tmp = code(x, y, z)
	tmp = 1.0 + ((4.0 * ((x + (y * 0.75)) - z)) / y);
end
code[x_, y_, z_] := N[(1.0 + N[(N[(4.0 * N[(N[(x + N[(y * 0.75), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
f(x, y, z):
	x in [-inf, +inf],
	y in [-inf, +inf],
	z in [-inf, +inf]
code: THEORY
BEGIN
f(x, y, z: real): real =
	(1) + (((4) * ((x + (y * (75e-2))) - z)) / y)
END code
1 + \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y}

Alternative 1: 100.0% accurate, 1.5× speedup?

\[\mathsf{fma}\left(\frac{x - z}{y}, 4, 4\right) \]
(FPCore (x y z)
  :precision binary64
  :pre TRUE
  (fma (/ (- x z) y) 4.0 4.0))
double code(double x, double y, double z) {
	return fma(((x - z) / y), 4.0, 4.0);
}
function code(x, y, z)
	return fma(Float64(Float64(x - z) / y), 4.0, 4.0)
end
code[x_, y_, z_] := N[(N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision] * 4.0 + 4.0), $MachinePrecision]
f(x, y, z):
	x in [-inf, +inf],
	y in [-inf, +inf],
	z in [-inf, +inf]
code: THEORY
BEGIN
f(x, y, z: real): real =
	(((x - z) / y) * (4)) + (4)
END code
\mathsf{fma}\left(\frac{x - z}{y}, 4, 4\right)
Derivation
  1. Initial program 99.7%

    \[1 + \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y} \]
  2. Taylor expanded in y around inf

    \[\leadsto 4 + 4 \cdot \frac{x - z}{y} \]
  3. Step-by-step derivation
    1. Applied rewrites100.0%

      \[\leadsto 4 + 4 \cdot \frac{x - z}{y} \]
    2. Applied rewrites100.0%

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

    Alternative 2: 98.4% accurate, 0.4× speedup?

    \[\begin{array}{l} t_0 := -4 \cdot \frac{z - x}{y}\\ t_1 := \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y}\\ \mathbf{if}\;t\_1 \leq -40000000:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;t\_1 \leq 5:\\ \;\;\;\;4 + 4 \cdot \frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \]
    (FPCore (x y z)
      :precision binary64
      :pre TRUE
      (let* ((t_0 (* -4.0 (/ (- z x) y)))
           (t_1 (/ (* 4.0 (- (+ x (* y 0.75)) z)) y)))
      (if (<= t_1 -40000000.0)
        t_0
        (if (<= t_1 5.0) (+ 4.0 (* 4.0 (/ x y))) t_0))))
    double code(double x, double y, double z) {
    	double t_0 = -4.0 * ((z - x) / y);
    	double t_1 = (4.0 * ((x + (y * 0.75)) - z)) / y;
    	double tmp;
    	if (t_1 <= -40000000.0) {
    		tmp = t_0;
    	} else if (t_1 <= 5.0) {
    		tmp = 4.0 + (4.0 * (x / y));
    	} else {
    		tmp = t_0;
    	}
    	return tmp;
    }
    
    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 = (-4.0d0) * ((z - x) / y)
        t_1 = (4.0d0 * ((x + (y * 0.75d0)) - z)) / y
        if (t_1 <= (-40000000.0d0)) then
            tmp = t_0
        else if (t_1 <= 5.0d0) then
            tmp = 4.0d0 + (4.0d0 * (x / y))
        else
            tmp = t_0
        end if
        code = tmp
    end function
    
    public static double code(double x, double y, double z) {
    	double t_0 = -4.0 * ((z - x) / y);
    	double t_1 = (4.0 * ((x + (y * 0.75)) - z)) / y;
    	double tmp;
    	if (t_1 <= -40000000.0) {
    		tmp = t_0;
    	} else if (t_1 <= 5.0) {
    		tmp = 4.0 + (4.0 * (x / y));
    	} else {
    		tmp = t_0;
    	}
    	return tmp;
    }
    
    def code(x, y, z):
    	t_0 = -4.0 * ((z - x) / y)
    	t_1 = (4.0 * ((x + (y * 0.75)) - z)) / y
    	tmp = 0
    	if t_1 <= -40000000.0:
    		tmp = t_0
    	elif t_1 <= 5.0:
    		tmp = 4.0 + (4.0 * (x / y))
    	else:
    		tmp = t_0
    	return tmp
    
    function code(x, y, z)
    	t_0 = Float64(-4.0 * Float64(Float64(z - x) / y))
    	t_1 = Float64(Float64(4.0 * Float64(Float64(x + Float64(y * 0.75)) - z)) / y)
    	tmp = 0.0
    	if (t_1 <= -40000000.0)
    		tmp = t_0;
    	elseif (t_1 <= 5.0)
    		tmp = Float64(4.0 + Float64(4.0 * Float64(x / y)));
    	else
    		tmp = t_0;
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, y, z)
    	t_0 = -4.0 * ((z - x) / y);
    	t_1 = (4.0 * ((x + (y * 0.75)) - z)) / y;
    	tmp = 0.0;
    	if (t_1 <= -40000000.0)
    		tmp = t_0;
    	elseif (t_1 <= 5.0)
    		tmp = 4.0 + (4.0 * (x / y));
    	else
    		tmp = t_0;
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, y_, z_] := Block[{t$95$0 = N[(-4.0 * N[(N[(z - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(4.0 * N[(N[(x + N[(y * 0.75), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]}, If[LessEqual[t$95$1, -40000000.0], t$95$0, If[LessEqual[t$95$1, 5.0], N[(4.0 + N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
    
    f(x, y, z):
    	x in [-inf, +inf],
    	y in [-inf, +inf],
    	z in [-inf, +inf]
    code: THEORY
    BEGIN
    f(x, y, z: real): real =
    	LET t_0 = ((-4) * ((z - x) / y)) IN
    		LET t_1 = (((4) * ((x + (y * (75e-2))) - z)) / y) IN
    			LET tmp_1 = IF (t_1 <= (5)) THEN ((4) + ((4) * (x / y))) ELSE t_0 ENDIF IN
    			LET tmp = IF (t_1 <= (-4e7)) THEN t_0 ELSE tmp_1 ENDIF IN
    	tmp
    END code
    \begin{array}{l}
    t_0 := -4 \cdot \frac{z - x}{y}\\
    t_1 := \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y}\\
    \mathbf{if}\;t\_1 \leq -40000000:\\
    \;\;\;\;t\_0\\
    
    \mathbf{elif}\;t\_1 \leq 5:\\
    \;\;\;\;4 + 4 \cdot \frac{x}{y}\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_0\\
    
    
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if (/.f64 (*.f64 #s(literal 4 binary64) (-.f64 (+.f64 x (*.f64 y #s(literal 3/4 binary64))) z)) y) < -4e7 or 5 < (/.f64 (*.f64 #s(literal 4 binary64) (-.f64 (+.f64 x (*.f64 y #s(literal 3/4 binary64))) z)) y)

      1. Initial program 99.7%

        \[1 + \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y} \]
      2. Step-by-step derivation
        1. Applied rewrites99.7%

          \[\leadsto \mathsf{fma}\left(z - \mathsf{fma}\left(0.75, y, x\right), \frac{-4}{y}, 1\right) \]
        2. Taylor expanded in y around 0

          \[\leadsto -4 \cdot \frac{z - x}{y} \]
        3. Step-by-step derivation
          1. Applied rewrites67.0%

            \[\leadsto -4 \cdot \frac{z - x}{y} \]

          if -4e7 < (/.f64 (*.f64 #s(literal 4 binary64) (-.f64 (+.f64 x (*.f64 y #s(literal 3/4 binary64))) z)) y) < 5

          1. Initial program 99.7%

            \[1 + \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y} \]
          2. Taylor expanded in y around inf

            \[\leadsto 4 + 4 \cdot \frac{x - z}{y} \]
          3. Step-by-step derivation
            1. Applied rewrites100.0%

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

              \[\leadsto 4 + 4 \cdot \frac{x}{y} \]
            3. Step-by-step derivation
              1. Applied rewrites67.9%

                \[\leadsto 4 + 4 \cdot \frac{x}{y} \]
            4. Recombined 2 regimes into one program.
            5. Add Preprocessing

            Alternative 3: 98.4% accurate, 0.4× speedup?

            \[\begin{array}{l} t_0 := -4 \cdot \frac{z - x}{y}\\ t_1 := \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y}\\ \mathbf{if}\;t\_1 \leq -1000000:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+15}:\\ \;\;\;\;4 + -4 \cdot \frac{z}{y}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \]
            (FPCore (x y z)
              :precision binary64
              :pre TRUE
              (let* ((t_0 (* -4.0 (/ (- z x) y)))
                   (t_1 (/ (* 4.0 (- (+ x (* y 0.75)) z)) y)))
              (if (<= t_1 -1000000.0)
                t_0
                (if (<= t_1 2e+15) (+ 4.0 (* -4.0 (/ z y))) t_0))))
            double code(double x, double y, double z) {
            	double t_0 = -4.0 * ((z - x) / y);
            	double t_1 = (4.0 * ((x + (y * 0.75)) - z)) / y;
            	double tmp;
            	if (t_1 <= -1000000.0) {
            		tmp = t_0;
            	} else if (t_1 <= 2e+15) {
            		tmp = 4.0 + (-4.0 * (z / y));
            	} else {
            		tmp = t_0;
            	}
            	return tmp;
            }
            
            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 = (-4.0d0) * ((z - x) / y)
                t_1 = (4.0d0 * ((x + (y * 0.75d0)) - z)) / y
                if (t_1 <= (-1000000.0d0)) then
                    tmp = t_0
                else if (t_1 <= 2d+15) then
                    tmp = 4.0d0 + ((-4.0d0) * (z / y))
                else
                    tmp = t_0
                end if
                code = tmp
            end function
            
            public static double code(double x, double y, double z) {
            	double t_0 = -4.0 * ((z - x) / y);
            	double t_1 = (4.0 * ((x + (y * 0.75)) - z)) / y;
            	double tmp;
            	if (t_1 <= -1000000.0) {
            		tmp = t_0;
            	} else if (t_1 <= 2e+15) {
            		tmp = 4.0 + (-4.0 * (z / y));
            	} else {
            		tmp = t_0;
            	}
            	return tmp;
            }
            
            def code(x, y, z):
            	t_0 = -4.0 * ((z - x) / y)
            	t_1 = (4.0 * ((x + (y * 0.75)) - z)) / y
            	tmp = 0
            	if t_1 <= -1000000.0:
            		tmp = t_0
            	elif t_1 <= 2e+15:
            		tmp = 4.0 + (-4.0 * (z / y))
            	else:
            		tmp = t_0
            	return tmp
            
            function code(x, y, z)
            	t_0 = Float64(-4.0 * Float64(Float64(z - x) / y))
            	t_1 = Float64(Float64(4.0 * Float64(Float64(x + Float64(y * 0.75)) - z)) / y)
            	tmp = 0.0
            	if (t_1 <= -1000000.0)
            		tmp = t_0;
            	elseif (t_1 <= 2e+15)
            		tmp = Float64(4.0 + Float64(-4.0 * Float64(z / y)));
            	else
            		tmp = t_0;
            	end
            	return tmp
            end
            
            function tmp_2 = code(x, y, z)
            	t_0 = -4.0 * ((z - x) / y);
            	t_1 = (4.0 * ((x + (y * 0.75)) - z)) / y;
            	tmp = 0.0;
            	if (t_1 <= -1000000.0)
            		tmp = t_0;
            	elseif (t_1 <= 2e+15)
            		tmp = 4.0 + (-4.0 * (z / y));
            	else
            		tmp = t_0;
            	end
            	tmp_2 = tmp;
            end
            
            code[x_, y_, z_] := Block[{t$95$0 = N[(-4.0 * N[(N[(z - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(4.0 * N[(N[(x + N[(y * 0.75), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]}, If[LessEqual[t$95$1, -1000000.0], t$95$0, If[LessEqual[t$95$1, 2e+15], N[(4.0 + N[(-4.0 * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
            
            f(x, y, z):
            	x in [-inf, +inf],
            	y in [-inf, +inf],
            	z in [-inf, +inf]
            code: THEORY
            BEGIN
            f(x, y, z: real): real =
            	LET t_0 = ((-4) * ((z - x) / y)) IN
            		LET t_1 = (((4) * ((x + (y * (75e-2))) - z)) / y) IN
            			LET tmp_1 = IF (t_1 <= (2e15)) THEN ((4) + ((-4) * (z / y))) ELSE t_0 ENDIF IN
            			LET tmp = IF (t_1 <= (-1e6)) THEN t_0 ELSE tmp_1 ENDIF IN
            	tmp
            END code
            \begin{array}{l}
            t_0 := -4 \cdot \frac{z - x}{y}\\
            t_1 := \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y}\\
            \mathbf{if}\;t\_1 \leq -1000000:\\
            \;\;\;\;t\_0\\
            
            \mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+15}:\\
            \;\;\;\;4 + -4 \cdot \frac{z}{y}\\
            
            \mathbf{else}:\\
            \;\;\;\;t\_0\\
            
            
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if (/.f64 (*.f64 #s(literal 4 binary64) (-.f64 (+.f64 x (*.f64 y #s(literal 3/4 binary64))) z)) y) < -1e6 or 2e15 < (/.f64 (*.f64 #s(literal 4 binary64) (-.f64 (+.f64 x (*.f64 y #s(literal 3/4 binary64))) z)) y)

              1. Initial program 99.7%

                \[1 + \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y} \]
              2. Step-by-step derivation
                1. Applied rewrites99.7%

                  \[\leadsto \mathsf{fma}\left(z - \mathsf{fma}\left(0.75, y, x\right), \frac{-4}{y}, 1\right) \]
                2. Taylor expanded in y around 0

                  \[\leadsto -4 \cdot \frac{z - x}{y} \]
                3. Step-by-step derivation
                  1. Applied rewrites67.0%

                    \[\leadsto -4 \cdot \frac{z - x}{y} \]

                  if -1e6 < (/.f64 (*.f64 #s(literal 4 binary64) (-.f64 (+.f64 x (*.f64 y #s(literal 3/4 binary64))) z)) y) < 2e15

                  1. Initial program 99.7%

                    \[1 + \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y} \]
                  2. Taylor expanded in y around inf

                    \[\leadsto 4 + 4 \cdot \frac{x - z}{y} \]
                  3. Step-by-step derivation
                    1. Applied rewrites100.0%

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

                      \[\leadsto 4 + -4 \cdot \frac{z}{y} \]
                    3. Step-by-step derivation
                      1. Applied rewrites67.7%

                        \[\leadsto 4 + -4 \cdot \frac{z}{y} \]
                    4. Recombined 2 regimes into one program.
                    5. Add Preprocessing

                    Alternative 4: 97.9% accurate, 0.4× speedup?

                    \[\begin{array}{l} t_0 := -4 \cdot \frac{z - x}{y}\\ t_1 := \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y}\\ \mathbf{if}\;t\_1 \leq -50:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;t\_1 \leq 5:\\ \;\;\;\;4\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \]
                    (FPCore (x y z)
                      :precision binary64
                      :pre TRUE
                      (let* ((t_0 (* -4.0 (/ (- z x) y)))
                           (t_1 (/ (* 4.0 (- (+ x (* y 0.75)) z)) y)))
                      (if (<= t_1 -50.0) t_0 (if (<= t_1 5.0) 4.0 t_0))))
                    double code(double x, double y, double z) {
                    	double t_0 = -4.0 * ((z - x) / y);
                    	double t_1 = (4.0 * ((x + (y * 0.75)) - z)) / y;
                    	double tmp;
                    	if (t_1 <= -50.0) {
                    		tmp = t_0;
                    	} else if (t_1 <= 5.0) {
                    		tmp = 4.0;
                    	} else {
                    		tmp = t_0;
                    	}
                    	return tmp;
                    }
                    
                    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 = (-4.0d0) * ((z - x) / y)
                        t_1 = (4.0d0 * ((x + (y * 0.75d0)) - z)) / y
                        if (t_1 <= (-50.0d0)) then
                            tmp = t_0
                        else if (t_1 <= 5.0d0) then
                            tmp = 4.0d0
                        else
                            tmp = t_0
                        end if
                        code = tmp
                    end function
                    
                    public static double code(double x, double y, double z) {
                    	double t_0 = -4.0 * ((z - x) / y);
                    	double t_1 = (4.0 * ((x + (y * 0.75)) - z)) / y;
                    	double tmp;
                    	if (t_1 <= -50.0) {
                    		tmp = t_0;
                    	} else if (t_1 <= 5.0) {
                    		tmp = 4.0;
                    	} else {
                    		tmp = t_0;
                    	}
                    	return tmp;
                    }
                    
                    def code(x, y, z):
                    	t_0 = -4.0 * ((z - x) / y)
                    	t_1 = (4.0 * ((x + (y * 0.75)) - z)) / y
                    	tmp = 0
                    	if t_1 <= -50.0:
                    		tmp = t_0
                    	elif t_1 <= 5.0:
                    		tmp = 4.0
                    	else:
                    		tmp = t_0
                    	return tmp
                    
                    function code(x, y, z)
                    	t_0 = Float64(-4.0 * Float64(Float64(z - x) / y))
                    	t_1 = Float64(Float64(4.0 * Float64(Float64(x + Float64(y * 0.75)) - z)) / y)
                    	tmp = 0.0
                    	if (t_1 <= -50.0)
                    		tmp = t_0;
                    	elseif (t_1 <= 5.0)
                    		tmp = 4.0;
                    	else
                    		tmp = t_0;
                    	end
                    	return tmp
                    end
                    
                    function tmp_2 = code(x, y, z)
                    	t_0 = -4.0 * ((z - x) / y);
                    	t_1 = (4.0 * ((x + (y * 0.75)) - z)) / y;
                    	tmp = 0.0;
                    	if (t_1 <= -50.0)
                    		tmp = t_0;
                    	elseif (t_1 <= 5.0)
                    		tmp = 4.0;
                    	else
                    		tmp = t_0;
                    	end
                    	tmp_2 = tmp;
                    end
                    
                    code[x_, y_, z_] := Block[{t$95$0 = N[(-4.0 * N[(N[(z - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(4.0 * N[(N[(x + N[(y * 0.75), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]}, If[LessEqual[t$95$1, -50.0], t$95$0, If[LessEqual[t$95$1, 5.0], 4.0, t$95$0]]]]
                    
                    f(x, y, z):
                    	x in [-inf, +inf],
                    	y in [-inf, +inf],
                    	z in [-inf, +inf]
                    code: THEORY
                    BEGIN
                    f(x, y, z: real): real =
                    	LET t_0 = ((-4) * ((z - x) / y)) IN
                    		LET t_1 = (((4) * ((x + (y * (75e-2))) - z)) / y) IN
                    			LET tmp_1 = IF (t_1 <= (5)) THEN (4) ELSE t_0 ENDIF IN
                    			LET tmp = IF (t_1 <= (-50)) THEN t_0 ELSE tmp_1 ENDIF IN
                    	tmp
                    END code
                    \begin{array}{l}
                    t_0 := -4 \cdot \frac{z - x}{y}\\
                    t_1 := \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y}\\
                    \mathbf{if}\;t\_1 \leq -50:\\
                    \;\;\;\;t\_0\\
                    
                    \mathbf{elif}\;t\_1 \leq 5:\\
                    \;\;\;\;4\\
                    
                    \mathbf{else}:\\
                    \;\;\;\;t\_0\\
                    
                    
                    \end{array}
                    
                    Derivation
                    1. Split input into 2 regimes
                    2. if (/.f64 (*.f64 #s(literal 4 binary64) (-.f64 (+.f64 x (*.f64 y #s(literal 3/4 binary64))) z)) y) < -50 or 5 < (/.f64 (*.f64 #s(literal 4 binary64) (-.f64 (+.f64 x (*.f64 y #s(literal 3/4 binary64))) z)) y)

                      1. Initial program 99.7%

                        \[1 + \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y} \]
                      2. Step-by-step derivation
                        1. Applied rewrites99.7%

                          \[\leadsto \mathsf{fma}\left(z - \mathsf{fma}\left(0.75, y, x\right), \frac{-4}{y}, 1\right) \]
                        2. Taylor expanded in y around 0

                          \[\leadsto -4 \cdot \frac{z - x}{y} \]
                        3. Step-by-step derivation
                          1. Applied rewrites67.0%

                            \[\leadsto -4 \cdot \frac{z - x}{y} \]

                          if -50 < (/.f64 (*.f64 #s(literal 4 binary64) (-.f64 (+.f64 x (*.f64 y #s(literal 3/4 binary64))) z)) y) < 5

                          1. Initial program 99.7%

                            \[1 + \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y} \]
                          2. Taylor expanded in y around inf

                            \[\leadsto 4 \]
                          3. Step-by-step derivation
                            1. Applied rewrites34.2%

                              \[\leadsto 4 \]
                          4. Recombined 2 regimes into one program.
                          5. Add Preprocessing

                          Alternative 5: 66.4% accurate, 0.3× speedup?

                          \[\begin{array}{l} t_0 := 4 \cdot \frac{x}{y}\\ t_1 := \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y}\\ \mathbf{if}\;t\_1 \leq -50:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+17}:\\ \;\;\;\;4\\ \mathbf{elif}\;t\_1 \leq 10^{+171}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(z, -4, y\right)}{y}\\ \end{array} \]
                          (FPCore (x y z)
                            :precision binary64
                            :pre TRUE
                            (let* ((t_0 (* 4.0 (/ x y)))
                                 (t_1 (/ (* 4.0 (- (+ x (* y 0.75)) z)) y)))
                            (if (<= t_1 -50.0)
                              t_0
                              (if (<= t_1 5e+17)
                                4.0
                                (if (<= t_1 1e+171) t_0 (/ (fma z -4.0 y) y))))))
                          double code(double x, double y, double z) {
                          	double t_0 = 4.0 * (x / y);
                          	double t_1 = (4.0 * ((x + (y * 0.75)) - z)) / y;
                          	double tmp;
                          	if (t_1 <= -50.0) {
                          		tmp = t_0;
                          	} else if (t_1 <= 5e+17) {
                          		tmp = 4.0;
                          	} else if (t_1 <= 1e+171) {
                          		tmp = t_0;
                          	} else {
                          		tmp = fma(z, -4.0, y) / y;
                          	}
                          	return tmp;
                          }
                          
                          function code(x, y, z)
                          	t_0 = Float64(4.0 * Float64(x / y))
                          	t_1 = Float64(Float64(4.0 * Float64(Float64(x + Float64(y * 0.75)) - z)) / y)
                          	tmp = 0.0
                          	if (t_1 <= -50.0)
                          		tmp = t_0;
                          	elseif (t_1 <= 5e+17)
                          		tmp = 4.0;
                          	elseif (t_1 <= 1e+171)
                          		tmp = t_0;
                          	else
                          		tmp = Float64(fma(z, -4.0, y) / y);
                          	end
                          	return tmp
                          end
                          
                          code[x_, y_, z_] := Block[{t$95$0 = N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(4.0 * N[(N[(x + N[(y * 0.75), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]}, If[LessEqual[t$95$1, -50.0], t$95$0, If[LessEqual[t$95$1, 5e+17], 4.0, If[LessEqual[t$95$1, 1e+171], t$95$0, N[(N[(z * -4.0 + y), $MachinePrecision] / y), $MachinePrecision]]]]]]
                          
                          f(x, y, z):
                          	x in [-inf, +inf],
                          	y in [-inf, +inf],
                          	z in [-inf, +inf]
                          code: THEORY
                          BEGIN
                          f(x, y, z: real): real =
                          	LET t_0 = ((4) * (x / y)) IN
                          		LET t_1 = (((4) * ((x + (y * (75e-2))) - z)) / y) IN
                          			LET tmp_2 = IF (t_1 <= (999999999999999953972206729656870211732987713739100709830741553196290713284945813208338477706166412373726001850053663010587168093173889073910282723323583537144858509574144)) THEN t_0 ELSE (((z * (-4)) + y) / y) ENDIF IN
                          			LET tmp_1 = IF (t_1 <= (5e17)) THEN (4) ELSE tmp_2 ENDIF IN
                          			LET tmp = IF (t_1 <= (-50)) THEN t_0 ELSE tmp_1 ENDIF IN
                          	tmp
                          END code
                          \begin{array}{l}
                          t_0 := 4 \cdot \frac{x}{y}\\
                          t_1 := \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y}\\
                          \mathbf{if}\;t\_1 \leq -50:\\
                          \;\;\;\;t\_0\\
                          
                          \mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+17}:\\
                          \;\;\;\;4\\
                          
                          \mathbf{elif}\;t\_1 \leq 10^{+171}:\\
                          \;\;\;\;t\_0\\
                          
                          \mathbf{else}:\\
                          \;\;\;\;\frac{\mathsf{fma}\left(z, -4, y\right)}{y}\\
                          
                          
                          \end{array}
                          
                          Derivation
                          1. Split input into 3 regimes
                          2. if (/.f64 (*.f64 #s(literal 4 binary64) (-.f64 (+.f64 x (*.f64 y #s(literal 3/4 binary64))) z)) y) < -50 or 5e17 < (/.f64 (*.f64 #s(literal 4 binary64) (-.f64 (+.f64 x (*.f64 y #s(literal 3/4 binary64))) z)) y) < 9.9999999999999995e170

                            1. Initial program 99.7%

                              \[1 + \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y} \]
                            2. Step-by-step derivation
                              1. Applied rewrites99.7%

                                \[\leadsto \mathsf{fma}\left(z - \mathsf{fma}\left(0.75, y, x\right), \frac{-4}{y}, 1\right) \]
                              2. Taylor expanded in y around 0

                                \[\leadsto -4 \cdot \frac{z - x}{y} \]
                              3. Step-by-step derivation
                                1. Applied rewrites67.0%

                                  \[\leadsto -4 \cdot \frac{z - x}{y} \]
                                2. Step-by-step derivation
                                  1. Applied rewrites66.9%

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

                                    \[\leadsto 4 \cdot \frac{x}{y} \]
                                  3. Step-by-step derivation
                                    1. Applied rewrites35.7%

                                      \[\leadsto 4 \cdot \frac{x}{y} \]

                                    if -50 < (/.f64 (*.f64 #s(literal 4 binary64) (-.f64 (+.f64 x (*.f64 y #s(literal 3/4 binary64))) z)) y) < 5e17

                                    1. Initial program 99.7%

                                      \[1 + \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y} \]
                                    2. Taylor expanded in y around inf

                                      \[\leadsto 4 \]
                                    3. Step-by-step derivation
                                      1. Applied rewrites34.2%

                                        \[\leadsto 4 \]

                                      if 9.9999999999999995e170 < (/.f64 (*.f64 #s(literal 4 binary64) (-.f64 (+.f64 x (*.f64 y #s(literal 3/4 binary64))) z)) y)

                                      1. Initial program 99.7%

                                        \[1 + \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y} \]
                                      2. Step-by-step derivation
                                        1. Applied rewrites99.7%

                                          \[\leadsto \mathsf{fma}\left(z - \mathsf{fma}\left(0.75, y, x\right), \frac{-4}{y}, 1\right) \]
                                        2. Taylor expanded in y around 0

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

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

                                            \[\leadsto \mathsf{fma}\left(z, \frac{-4}{y}, 1\right) \]
                                          3. Step-by-step derivation
                                            1. Applied rewrites40.1%

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

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

                                            Alternative 6: 66.2% accurate, 0.3× speedup?

                                            \[\begin{array}{l} t_0 := 4 \cdot \frac{x}{y}\\ t_1 := \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y}\\ \mathbf{if}\;t\_1 \leq -50:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+17}:\\ \;\;\;\;4\\ \mathbf{elif}\;t\_1 \leq 10^{+171}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;-4 \cdot \frac{z}{y}\\ \end{array} \]
                                            (FPCore (x y z)
                                              :precision binary64
                                              :pre TRUE
                                              (let* ((t_0 (* 4.0 (/ x y)))
                                                   (t_1 (/ (* 4.0 (- (+ x (* y 0.75)) z)) y)))
                                              (if (<= t_1 -50.0)
                                                t_0
                                                (if (<= t_1 5e+17)
                                                  4.0
                                                  (if (<= t_1 1e+171) t_0 (* -4.0 (/ z y)))))))
                                            double code(double x, double y, double z) {
                                            	double t_0 = 4.0 * (x / y);
                                            	double t_1 = (4.0 * ((x + (y * 0.75)) - z)) / y;
                                            	double tmp;
                                            	if (t_1 <= -50.0) {
                                            		tmp = t_0;
                                            	} else if (t_1 <= 5e+17) {
                                            		tmp = 4.0;
                                            	} else if (t_1 <= 1e+171) {
                                            		tmp = t_0;
                                            	} else {
                                            		tmp = -4.0 * (z / y);
                                            	}
                                            	return tmp;
                                            }
                                            
                                            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 = 4.0d0 * (x / y)
                                                t_1 = (4.0d0 * ((x + (y * 0.75d0)) - z)) / y
                                                if (t_1 <= (-50.0d0)) then
                                                    tmp = t_0
                                                else if (t_1 <= 5d+17) then
                                                    tmp = 4.0d0
                                                else if (t_1 <= 1d+171) then
                                                    tmp = t_0
                                                else
                                                    tmp = (-4.0d0) * (z / y)
                                                end if
                                                code = tmp
                                            end function
                                            
                                            public static double code(double x, double y, double z) {
                                            	double t_0 = 4.0 * (x / y);
                                            	double t_1 = (4.0 * ((x + (y * 0.75)) - z)) / y;
                                            	double tmp;
                                            	if (t_1 <= -50.0) {
                                            		tmp = t_0;
                                            	} else if (t_1 <= 5e+17) {
                                            		tmp = 4.0;
                                            	} else if (t_1 <= 1e+171) {
                                            		tmp = t_0;
                                            	} else {
                                            		tmp = -4.0 * (z / y);
                                            	}
                                            	return tmp;
                                            }
                                            
                                            def code(x, y, z):
                                            	t_0 = 4.0 * (x / y)
                                            	t_1 = (4.0 * ((x + (y * 0.75)) - z)) / y
                                            	tmp = 0
                                            	if t_1 <= -50.0:
                                            		tmp = t_0
                                            	elif t_1 <= 5e+17:
                                            		tmp = 4.0
                                            	elif t_1 <= 1e+171:
                                            		tmp = t_0
                                            	else:
                                            		tmp = -4.0 * (z / y)
                                            	return tmp
                                            
                                            function code(x, y, z)
                                            	t_0 = Float64(4.0 * Float64(x / y))
                                            	t_1 = Float64(Float64(4.0 * Float64(Float64(x + Float64(y * 0.75)) - z)) / y)
                                            	tmp = 0.0
                                            	if (t_1 <= -50.0)
                                            		tmp = t_0;
                                            	elseif (t_1 <= 5e+17)
                                            		tmp = 4.0;
                                            	elseif (t_1 <= 1e+171)
                                            		tmp = t_0;
                                            	else
                                            		tmp = Float64(-4.0 * Float64(z / y));
                                            	end
                                            	return tmp
                                            end
                                            
                                            function tmp_2 = code(x, y, z)
                                            	t_0 = 4.0 * (x / y);
                                            	t_1 = (4.0 * ((x + (y * 0.75)) - z)) / y;
                                            	tmp = 0.0;
                                            	if (t_1 <= -50.0)
                                            		tmp = t_0;
                                            	elseif (t_1 <= 5e+17)
                                            		tmp = 4.0;
                                            	elseif (t_1 <= 1e+171)
                                            		tmp = t_0;
                                            	else
                                            		tmp = -4.0 * (z / y);
                                            	end
                                            	tmp_2 = tmp;
                                            end
                                            
                                            code[x_, y_, z_] := Block[{t$95$0 = N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(4.0 * N[(N[(x + N[(y * 0.75), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]}, If[LessEqual[t$95$1, -50.0], t$95$0, If[LessEqual[t$95$1, 5e+17], 4.0, If[LessEqual[t$95$1, 1e+171], t$95$0, N[(-4.0 * N[(z / y), $MachinePrecision]), $MachinePrecision]]]]]]
                                            
                                            f(x, y, z):
                                            	x in [-inf, +inf],
                                            	y in [-inf, +inf],
                                            	z in [-inf, +inf]
                                            code: THEORY
                                            BEGIN
                                            f(x, y, z: real): real =
                                            	LET t_0 = ((4) * (x / y)) IN
                                            		LET t_1 = (((4) * ((x + (y * (75e-2))) - z)) / y) IN
                                            			LET tmp_2 = IF (t_1 <= (999999999999999953972206729656870211732987713739100709830741553196290713284945813208338477706166412373726001850053663010587168093173889073910282723323583537144858509574144)) THEN t_0 ELSE ((-4) * (z / y)) ENDIF IN
                                            			LET tmp_1 = IF (t_1 <= (5e17)) THEN (4) ELSE tmp_2 ENDIF IN
                                            			LET tmp = IF (t_1 <= (-50)) THEN t_0 ELSE tmp_1 ENDIF IN
                                            	tmp
                                            END code
                                            \begin{array}{l}
                                            t_0 := 4 \cdot \frac{x}{y}\\
                                            t_1 := \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y}\\
                                            \mathbf{if}\;t\_1 \leq -50:\\
                                            \;\;\;\;t\_0\\
                                            
                                            \mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+17}:\\
                                            \;\;\;\;4\\
                                            
                                            \mathbf{elif}\;t\_1 \leq 10^{+171}:\\
                                            \;\;\;\;t\_0\\
                                            
                                            \mathbf{else}:\\
                                            \;\;\;\;-4 \cdot \frac{z}{y}\\
                                            
                                            
                                            \end{array}
                                            
                                            Derivation
                                            1. Split input into 3 regimes
                                            2. if (/.f64 (*.f64 #s(literal 4 binary64) (-.f64 (+.f64 x (*.f64 y #s(literal 3/4 binary64))) z)) y) < -50 or 5e17 < (/.f64 (*.f64 #s(literal 4 binary64) (-.f64 (+.f64 x (*.f64 y #s(literal 3/4 binary64))) z)) y) < 9.9999999999999995e170

                                              1. Initial program 99.7%

                                                \[1 + \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y} \]
                                              2. Step-by-step derivation
                                                1. Applied rewrites99.7%

                                                  \[\leadsto \mathsf{fma}\left(z - \mathsf{fma}\left(0.75, y, x\right), \frac{-4}{y}, 1\right) \]
                                                2. Taylor expanded in y around 0

                                                  \[\leadsto -4 \cdot \frac{z - x}{y} \]
                                                3. Step-by-step derivation
                                                  1. Applied rewrites67.0%

                                                    \[\leadsto -4 \cdot \frac{z - x}{y} \]
                                                  2. Step-by-step derivation
                                                    1. Applied rewrites66.9%

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

                                                      \[\leadsto 4 \cdot \frac{x}{y} \]
                                                    3. Step-by-step derivation
                                                      1. Applied rewrites35.7%

                                                        \[\leadsto 4 \cdot \frac{x}{y} \]

                                                      if -50 < (/.f64 (*.f64 #s(literal 4 binary64) (-.f64 (+.f64 x (*.f64 y #s(literal 3/4 binary64))) z)) y) < 5e17

                                                      1. Initial program 99.7%

                                                        \[1 + \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y} \]
                                                      2. Taylor expanded in y around inf

                                                        \[\leadsto 4 \]
                                                      3. Step-by-step derivation
                                                        1. Applied rewrites34.2%

                                                          \[\leadsto 4 \]

                                                        if 9.9999999999999995e170 < (/.f64 (*.f64 #s(literal 4 binary64) (-.f64 (+.f64 x (*.f64 y #s(literal 3/4 binary64))) z)) y)

                                                        1. Initial program 99.7%

                                                          \[1 + \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y} \]
                                                        2. Step-by-step derivation
                                                          1. Applied rewrites99.7%

                                                            \[\leadsto \mathsf{fma}\left(z - \mathsf{fma}\left(0.75, y, x\right), \frac{-4}{y}, 1\right) \]
                                                          2. Taylor expanded in y around 0

                                                            \[\leadsto -4 \cdot \frac{z - x}{y} \]
                                                          3. Step-by-step derivation
                                                            1. Applied rewrites67.0%

                                                              \[\leadsto -4 \cdot \frac{z - x}{y} \]
                                                            2. Taylor expanded in x around 0

                                                              \[\leadsto -4 \cdot \frac{z}{y} \]
                                                            3. Step-by-step derivation
                                                              1. Applied rewrites35.5%

                                                                \[\leadsto -4 \cdot \frac{z}{y} \]
                                                            4. Recombined 3 regimes into one program.
                                                            5. Add Preprocessing

                                                            Alternative 7: 66.2% accurate, 0.4× speedup?

                                                            \[\begin{array}{l} t_0 := 4 \cdot \frac{x}{y}\\ t_1 := \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y}\\ \mathbf{if}\;t\_1 \leq -50:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+17}:\\ \;\;\;\;4\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \]
                                                            (FPCore (x y z)
                                                              :precision binary64
                                                              :pre TRUE
                                                              (let* ((t_0 (* 4.0 (/ x y)))
                                                                   (t_1 (/ (* 4.0 (- (+ x (* y 0.75)) z)) y)))
                                                              (if (<= t_1 -50.0) t_0 (if (<= t_1 5e+17) 4.0 t_0))))
                                                            double code(double x, double y, double z) {
                                                            	double t_0 = 4.0 * (x / y);
                                                            	double t_1 = (4.0 * ((x + (y * 0.75)) - z)) / y;
                                                            	double tmp;
                                                            	if (t_1 <= -50.0) {
                                                            		tmp = t_0;
                                                            	} else if (t_1 <= 5e+17) {
                                                            		tmp = 4.0;
                                                            	} else {
                                                            		tmp = t_0;
                                                            	}
                                                            	return tmp;
                                                            }
                                                            
                                                            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 = 4.0d0 * (x / y)
                                                                t_1 = (4.0d0 * ((x + (y * 0.75d0)) - z)) / y
                                                                if (t_1 <= (-50.0d0)) then
                                                                    tmp = t_0
                                                                else if (t_1 <= 5d+17) then
                                                                    tmp = 4.0d0
                                                                else
                                                                    tmp = t_0
                                                                end if
                                                                code = tmp
                                                            end function
                                                            
                                                            public static double code(double x, double y, double z) {
                                                            	double t_0 = 4.0 * (x / y);
                                                            	double t_1 = (4.0 * ((x + (y * 0.75)) - z)) / y;
                                                            	double tmp;
                                                            	if (t_1 <= -50.0) {
                                                            		tmp = t_0;
                                                            	} else if (t_1 <= 5e+17) {
                                                            		tmp = 4.0;
                                                            	} else {
                                                            		tmp = t_0;
                                                            	}
                                                            	return tmp;
                                                            }
                                                            
                                                            def code(x, y, z):
                                                            	t_0 = 4.0 * (x / y)
                                                            	t_1 = (4.0 * ((x + (y * 0.75)) - z)) / y
                                                            	tmp = 0
                                                            	if t_1 <= -50.0:
                                                            		tmp = t_0
                                                            	elif t_1 <= 5e+17:
                                                            		tmp = 4.0
                                                            	else:
                                                            		tmp = t_0
                                                            	return tmp
                                                            
                                                            function code(x, y, z)
                                                            	t_0 = Float64(4.0 * Float64(x / y))
                                                            	t_1 = Float64(Float64(4.0 * Float64(Float64(x + Float64(y * 0.75)) - z)) / y)
                                                            	tmp = 0.0
                                                            	if (t_1 <= -50.0)
                                                            		tmp = t_0;
                                                            	elseif (t_1 <= 5e+17)
                                                            		tmp = 4.0;
                                                            	else
                                                            		tmp = t_0;
                                                            	end
                                                            	return tmp
                                                            end
                                                            
                                                            function tmp_2 = code(x, y, z)
                                                            	t_0 = 4.0 * (x / y);
                                                            	t_1 = (4.0 * ((x + (y * 0.75)) - z)) / y;
                                                            	tmp = 0.0;
                                                            	if (t_1 <= -50.0)
                                                            		tmp = t_0;
                                                            	elseif (t_1 <= 5e+17)
                                                            		tmp = 4.0;
                                                            	else
                                                            		tmp = t_0;
                                                            	end
                                                            	tmp_2 = tmp;
                                                            end
                                                            
                                                            code[x_, y_, z_] := Block[{t$95$0 = N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(4.0 * N[(N[(x + N[(y * 0.75), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]}, If[LessEqual[t$95$1, -50.0], t$95$0, If[LessEqual[t$95$1, 5e+17], 4.0, t$95$0]]]]
                                                            
                                                            f(x, y, z):
                                                            	x in [-inf, +inf],
                                                            	y in [-inf, +inf],
                                                            	z in [-inf, +inf]
                                                            code: THEORY
                                                            BEGIN
                                                            f(x, y, z: real): real =
                                                            	LET t_0 = ((4) * (x / y)) IN
                                                            		LET t_1 = (((4) * ((x + (y * (75e-2))) - z)) / y) IN
                                                            			LET tmp_1 = IF (t_1 <= (5e17)) THEN (4) ELSE t_0 ENDIF IN
                                                            			LET tmp = IF (t_1 <= (-50)) THEN t_0 ELSE tmp_1 ENDIF IN
                                                            	tmp
                                                            END code
                                                            \begin{array}{l}
                                                            t_0 := 4 \cdot \frac{x}{y}\\
                                                            t_1 := \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y}\\
                                                            \mathbf{if}\;t\_1 \leq -50:\\
                                                            \;\;\;\;t\_0\\
                                                            
                                                            \mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+17}:\\
                                                            \;\;\;\;4\\
                                                            
                                                            \mathbf{else}:\\
                                                            \;\;\;\;t\_0\\
                                                            
                                                            
                                                            \end{array}
                                                            
                                                            Derivation
                                                            1. Split input into 2 regimes
                                                            2. if (/.f64 (*.f64 #s(literal 4 binary64) (-.f64 (+.f64 x (*.f64 y #s(literal 3/4 binary64))) z)) y) < -50 or 5e17 < (/.f64 (*.f64 #s(literal 4 binary64) (-.f64 (+.f64 x (*.f64 y #s(literal 3/4 binary64))) z)) y)

                                                              1. Initial program 99.7%

                                                                \[1 + \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y} \]
                                                              2. Step-by-step derivation
                                                                1. Applied rewrites99.7%

                                                                  \[\leadsto \mathsf{fma}\left(z - \mathsf{fma}\left(0.75, y, x\right), \frac{-4}{y}, 1\right) \]
                                                                2. Taylor expanded in y around 0

                                                                  \[\leadsto -4 \cdot \frac{z - x}{y} \]
                                                                3. Step-by-step derivation
                                                                  1. Applied rewrites67.0%

                                                                    \[\leadsto -4 \cdot \frac{z - x}{y} \]
                                                                  2. Step-by-step derivation
                                                                    1. Applied rewrites66.9%

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

                                                                      \[\leadsto 4 \cdot \frac{x}{y} \]
                                                                    3. Step-by-step derivation
                                                                      1. Applied rewrites35.7%

                                                                        \[\leadsto 4 \cdot \frac{x}{y} \]

                                                                      if -50 < (/.f64 (*.f64 #s(literal 4 binary64) (-.f64 (+.f64 x (*.f64 y #s(literal 3/4 binary64))) z)) y) < 5e17

                                                                      1. Initial program 99.7%

                                                                        \[1 + \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y} \]
                                                                      2. Taylor expanded in y around inf

                                                                        \[\leadsto 4 \]
                                                                      3. Step-by-step derivation
                                                                        1. Applied rewrites34.2%

                                                                          \[\leadsto 4 \]
                                                                      4. Recombined 2 regimes into one program.
                                                                      5. Add Preprocessing

                                                                      Alternative 8: 34.2% accurate, 18.6× speedup?

                                                                      \[4 \]
                                                                      (FPCore (x y z)
                                                                        :precision binary64
                                                                        :pre TRUE
                                                                        4.0)
                                                                      double code(double x, double y, double z) {
                                                                      	return 4.0;
                                                                      }
                                                                      
                                                                      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 = 4.0d0
                                                                      end function
                                                                      
                                                                      public static double code(double x, double y, double z) {
                                                                      	return 4.0;
                                                                      }
                                                                      
                                                                      def code(x, y, z):
                                                                      	return 4.0
                                                                      
                                                                      function code(x, y, z)
                                                                      	return 4.0
                                                                      end
                                                                      
                                                                      function tmp = code(x, y, z)
                                                                      	tmp = 4.0;
                                                                      end
                                                                      
                                                                      code[x_, y_, z_] := 4.0
                                                                      
                                                                      f(x, y, z):
                                                                      	x in [-inf, +inf],
                                                                      	y in [-inf, +inf],
                                                                      	z in [-inf, +inf]
                                                                      code: THEORY
                                                                      BEGIN
                                                                      f(x, y, z: real): real =
                                                                      	4
                                                                      END code
                                                                      4
                                                                      
                                                                      Derivation
                                                                      1. Initial program 99.7%

                                                                        \[1 + \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y} \]
                                                                      2. Taylor expanded in y around inf

                                                                        \[\leadsto 4 \]
                                                                      3. Step-by-step derivation
                                                                        1. Applied rewrites34.2%

                                                                          \[\leadsto 4 \]
                                                                        2. Add Preprocessing

                                                                        Reproduce

                                                                        ?
                                                                        herbie shell --seed 2026092 
                                                                        (FPCore (x y z)
                                                                          :name "Data.Array.Repa.Algorithms.ColorRamp:rampColorHotToCold from repa-algorithms-3.4.0.1, A"
                                                                          :precision binary64
                                                                          (+ 1.0 (/ (* 4.0 (- (+ x (* y 0.75)) z)) y)))