Diagrams.Backend.Rasterific:rasterificRadialGradient from diagrams-rasterific-1.3.1.3

Percentage Accurate: 87.8% → 99.9%
Time: 3.7s
Alternatives: 8
Speedup: 1.0×

Specification

?
\[\frac{x + y \cdot \left(z - x\right)}{z} \]
(FPCore (x y z)
  :precision binary64
  :pre TRUE
  (/ (+ x (* y (- z x))) z))
double code(double x, double y, double z) {
	return (x + (y * (z - x))) / z;
}
real(8) function code(x, y, z)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (x + (y * (z - x))) / z
end function
public static double code(double x, double y, double z) {
	return (x + (y * (z - x))) / z;
}
def code(x, y, z):
	return (x + (y * (z - x))) / z
function code(x, y, z)
	return Float64(Float64(x + Float64(y * Float64(z - x))) / z)
end
function tmp = code(x, y, z)
	tmp = (x + (y * (z - x))) / z;
end
code[x_, y_, z_] := N[(N[(x + N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $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 + (y * (z - x))) / z
END code
\frac{x + y \cdot \left(z - x\right)}{z}

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 8 alternatives:

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

Initial Program: 87.8% accurate, 1.0× speedup?

\[\frac{x + y \cdot \left(z - x\right)}{z} \]
(FPCore (x y z)
  :precision binary64
  :pre TRUE
  (/ (+ x (* y (- z x))) z))
double code(double x, double y, double z) {
	return (x + (y * (z - x))) / z;
}
real(8) function code(x, y, z)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (x + (y * (z - x))) / z
end function
public static double code(double x, double y, double z) {
	return (x + (y * (z - x))) / z;
}
def code(x, y, z):
	return (x + (y * (z - x))) / z
function code(x, y, z)
	return Float64(Float64(x + Float64(y * Float64(z - x))) / z)
end
function tmp = code(x, y, z)
	tmp = (x + (y * (z - x))) / z;
end
code[x_, y_, z_] := N[(N[(x + N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $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 + (y * (z - x))) / z
END code
\frac{x + y \cdot \left(z - x\right)}{z}

Alternative 1: 99.9% accurate, 1.0× speedup?

\[\mathsf{fma}\left(1 - y, \frac{x}{z}, y\right) \]
(FPCore (x y z)
  :precision binary64
  :pre TRUE
  (fma (- 1.0 y) (/ x z) y))
double code(double x, double y, double z) {
	return fma((1.0 - y), (x / z), y);
}
function code(x, y, z)
	return fma(Float64(1.0 - y), Float64(x / z), y)
end
code[x_, y_, z_] := N[(N[(1.0 - y), $MachinePrecision] * N[(x / z), $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 =
	(((1) - y) * (x / z)) + y
END code
\mathsf{fma}\left(1 - y, \frac{x}{z}, y\right)
Derivation
  1. Initial program 87.8%

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

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

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

    Alternative 2: 99.7% accurate, 0.7× speedup?

    \[\begin{array}{l} t_0 := y \cdot \frac{z - x}{z}\\ \mathbf{if}\;y \leq -83405507.39250578:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq 254.09303055021542:\\ \;\;\;\;\frac{\mathsf{fma}\left(z - x, y, x\right)}{z}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \]
    (FPCore (x y z)
      :precision binary64
      :pre TRUE
      (let* ((t_0 (* y (/ (- z x) z))))
      (if (<= y -83405507.39250578)
        t_0
        (if (<= y 254.09303055021542) (/ (fma (- z x) y x) z) t_0))))
    double code(double x, double y, double z) {
    	double t_0 = y * ((z - x) / z);
    	double tmp;
    	if (y <= -83405507.39250578) {
    		tmp = t_0;
    	} else if (y <= 254.09303055021542) {
    		tmp = fma((z - x), y, x) / z;
    	} else {
    		tmp = t_0;
    	}
    	return tmp;
    }
    
    function code(x, y, z)
    	t_0 = Float64(y * Float64(Float64(z - x) / z))
    	tmp = 0.0
    	if (y <= -83405507.39250578)
    		tmp = t_0;
    	elseif (y <= 254.09303055021542)
    		tmp = Float64(fma(Float64(z - x), y, x) / z);
    	else
    		tmp = t_0;
    	end
    	return tmp
    end
    
    code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[(N[(z - x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -83405507.39250578], t$95$0, If[LessEqual[y, 254.09303055021542], N[(N[(N[(z - x), $MachinePrecision] * y + x), $MachinePrecision] / z), $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 = (y * ((z - x) / z)) IN
    		LET tmp_1 = IF (y <= (254093030550215416951687075197696685791015625e-42)) THEN ((((z - x) * y) + x) / z) ELSE t_0 ENDIF IN
    		LET tmp = IF (y <= (-8340550739250577986240386962890625e-26)) THEN t_0 ELSE tmp_1 ENDIF IN
    	tmp
    END code
    \begin{array}{l}
    t_0 := y \cdot \frac{z - x}{z}\\
    \mathbf{if}\;y \leq -83405507.39250578:\\
    \;\;\;\;t\_0\\
    
    \mathbf{elif}\;y \leq 254.09303055021542:\\
    \;\;\;\;\frac{\mathsf{fma}\left(z - x, y, x\right)}{z}\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_0\\
    
    
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if y < -83405507.39250578 or 254.09303055021542 < y

      1. Initial program 87.8%

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

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

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

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

          if -83405507.39250578 < y < 254.09303055021542

          1. Initial program 87.8%

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

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

          Alternative 3: 99.0% accurate, 0.7× speedup?

          \[\begin{array}{l} t_0 := y \cdot \frac{z - x}{z}\\ \mathbf{if}\;y \leq -2509.0653284185646:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq 3925.6693208389647:\\ \;\;\;\;\mathsf{fma}\left(y, 1, \frac{x}{z}\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \]
          (FPCore (x y z)
            :precision binary64
            :pre TRUE
            (let* ((t_0 (* y (/ (- z x) z))))
            (if (<= y -2509.0653284185646)
              t_0
              (if (<= y 3925.6693208389647) (fma y 1.0 (/ x z)) t_0))))
          double code(double x, double y, double z) {
          	double t_0 = y * ((z - x) / z);
          	double tmp;
          	if (y <= -2509.0653284185646) {
          		tmp = t_0;
          	} else if (y <= 3925.6693208389647) {
          		tmp = fma(y, 1.0, (x / z));
          	} else {
          		tmp = t_0;
          	}
          	return tmp;
          }
          
          function code(x, y, z)
          	t_0 = Float64(y * Float64(Float64(z - x) / z))
          	tmp = 0.0
          	if (y <= -2509.0653284185646)
          		tmp = t_0;
          	elseif (y <= 3925.6693208389647)
          		tmp = fma(y, 1.0, Float64(x / z));
          	else
          		tmp = t_0;
          	end
          	return tmp
          end
          
          code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[(N[(z - x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2509.0653284185646], t$95$0, If[LessEqual[y, 3925.6693208389647], N[(y * 1.0 + N[(x / z), $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 = (y * ((z - x) / z)) IN
          		LET tmp_1 = IF (y <= (392566932083896472249762155115604400634765625e-41)) THEN ((y * (1)) + (x / z)) ELSE t_0 ENDIF IN
          		LET tmp = IF (y <= (-250906532841856460436247289180755615234375e-38)) THEN t_0 ELSE tmp_1 ENDIF IN
          	tmp
          END code
          \begin{array}{l}
          t_0 := y \cdot \frac{z - x}{z}\\
          \mathbf{if}\;y \leq -2509.0653284185646:\\
          \;\;\;\;t\_0\\
          
          \mathbf{elif}\;y \leq 3925.6693208389647:\\
          \;\;\;\;\mathsf{fma}\left(y, 1, \frac{x}{z}\right)\\
          
          \mathbf{else}:\\
          \;\;\;\;t\_0\\
          
          
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if y < -2509.0653284185646 or 3925.6693208389647 < y

            1. Initial program 87.8%

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

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

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

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

                if -2509.0653284185646 < y < 3925.6693208389647

                1. Initial program 87.8%

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

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

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

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

                  Alternative 4: 95.5% accurate, 1.0× speedup?

                  \[\mathsf{fma}\left(x, \frac{1 - y}{z}, y\right) \]
                  (FPCore (x y z)
                    :precision binary64
                    :pre TRUE
                    (fma x (/ (- 1.0 y) z) y))
                  double code(double x, double y, double z) {
                  	return fma(x, ((1.0 - y) / z), y);
                  }
                  
                  function code(x, y, z)
                  	return fma(x, Float64(Float64(1.0 - y) / z), y)
                  end
                  
                  code[x_, y_, z_] := N[(x * N[(N[(1.0 - y), $MachinePrecision] / z), $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 =
                  	(x * (((1) - y) / z)) + y
                  END code
                  \mathsf{fma}\left(x, \frac{1 - y}{z}, y\right)
                  
                  Derivation
                  1. Initial program 87.8%

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

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

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

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

                      Alternative 5: 78.7% accurate, 1.0× speedup?

                      \[\begin{array}{l} \mathbf{if}\;y \leq 2.5235973101497354 \cdot 10^{+178}:\\ \;\;\;\;\mathsf{fma}\left(y, 1, \frac{x}{z}\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \frac{y}{z}\\ \end{array} \]
                      (FPCore (x y z)
                        :precision binary64
                        :pre TRUE
                        (if (<= y 2.5235973101497354e+178) (fma y 1.0 (/ x z)) (* z (/ y z))))
                      double code(double x, double y, double z) {
                      	double tmp;
                      	if (y <= 2.5235973101497354e+178) {
                      		tmp = fma(y, 1.0, (x / z));
                      	} else {
                      		tmp = z * (y / z);
                      	}
                      	return tmp;
                      }
                      
                      function code(x, y, z)
                      	tmp = 0.0
                      	if (y <= 2.5235973101497354e+178)
                      		tmp = fma(y, 1.0, Float64(x / z));
                      	else
                      		tmp = Float64(z * Float64(y / z));
                      	end
                      	return tmp
                      end
                      
                      code[x_, y_, z_] := If[LessEqual[y, 2.5235973101497354e+178], N[(y * 1.0 + N[(x / z), $MachinePrecision]), $MachinePrecision], N[(z * N[(y / z), $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 tmp = IF (y <= (25235973101497354482214954917900760340524771587181319724948153287136140190976829088846080717156719018215736973452903454574359277303968890614466637516791816677995228882765573259264)) THEN ((y * (1)) + (x / z)) ELSE (z * (y / z)) ENDIF IN
                      	tmp
                      END code
                      \begin{array}{l}
                      \mathbf{if}\;y \leq 2.5235973101497354 \cdot 10^{+178}:\\
                      \;\;\;\;\mathsf{fma}\left(y, 1, \frac{x}{z}\right)\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;z \cdot \frac{y}{z}\\
                      
                      
                      \end{array}
                      
                      Derivation
                      1. Split input into 2 regimes
                      2. if y < 2.5235973101497354e178

                        1. Initial program 87.8%

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

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

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

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

                            if 2.5235973101497354e178 < y

                            1. Initial program 87.8%

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

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

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

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

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

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

                                Alternative 6: 63.1% accurate, 0.8× speedup?

                                \[\begin{array}{l} t_0 := z \cdot \frac{y}{z}\\ \mathbf{if}\;y \leq -1.3808892104572836:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq 5.71392951001371 \cdot 10^{-24}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \]
                                (FPCore (x y z)
                                  :precision binary64
                                  :pre TRUE
                                  (let* ((t_0 (* z (/ y z))))
                                  (if (<= y -1.3808892104572836)
                                    t_0
                                    (if (<= y 5.71392951001371e-24) (/ x z) t_0))))
                                double code(double x, double y, double z) {
                                	double t_0 = z * (y / z);
                                	double tmp;
                                	if (y <= -1.3808892104572836) {
                                		tmp = t_0;
                                	} else if (y <= 5.71392951001371e-24) {
                                		tmp = x / z;
                                	} 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) :: tmp
                                    t_0 = z * (y / z)
                                    if (y <= (-1.3808892104572836d0)) then
                                        tmp = t_0
                                    else if (y <= 5.71392951001371d-24) then
                                        tmp = x / z
                                    else
                                        tmp = t_0
                                    end if
                                    code = tmp
                                end function
                                
                                public static double code(double x, double y, double z) {
                                	double t_0 = z * (y / z);
                                	double tmp;
                                	if (y <= -1.3808892104572836) {
                                		tmp = t_0;
                                	} else if (y <= 5.71392951001371e-24) {
                                		tmp = x / z;
                                	} else {
                                		tmp = t_0;
                                	}
                                	return tmp;
                                }
                                
                                def code(x, y, z):
                                	t_0 = z * (y / z)
                                	tmp = 0
                                	if y <= -1.3808892104572836:
                                		tmp = t_0
                                	elif y <= 5.71392951001371e-24:
                                		tmp = x / z
                                	else:
                                		tmp = t_0
                                	return tmp
                                
                                function code(x, y, z)
                                	t_0 = Float64(z * Float64(y / z))
                                	tmp = 0.0
                                	if (y <= -1.3808892104572836)
                                		tmp = t_0;
                                	elseif (y <= 5.71392951001371e-24)
                                		tmp = Float64(x / z);
                                	else
                                		tmp = t_0;
                                	end
                                	return tmp
                                end
                                
                                function tmp_2 = code(x, y, z)
                                	t_0 = z * (y / z);
                                	tmp = 0.0;
                                	if (y <= -1.3808892104572836)
                                		tmp = t_0;
                                	elseif (y <= 5.71392951001371e-24)
                                		tmp = x / z;
                                	else
                                		tmp = t_0;
                                	end
                                	tmp_2 = tmp;
                                end
                                
                                code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(y / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.3808892104572836], t$95$0, If[LessEqual[y, 5.71392951001371e-24], N[(x / z), $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 = (z * (y / z)) IN
                                		LET tmp_1 = IF (y <= (5713929510013710309954588345103281388526423837570695643911942366958978123392398629221133887767791748046875e-129)) THEN (x / z) ELSE t_0 ENDIF IN
                                		LET tmp = IF (y <= (-13808892104572836334597241148003377020359039306640625e-52)) THEN t_0 ELSE tmp_1 ENDIF IN
                                	tmp
                                END code
                                \begin{array}{l}
                                t_0 := z \cdot \frac{y}{z}\\
                                \mathbf{if}\;y \leq -1.3808892104572836:\\
                                \;\;\;\;t\_0\\
                                
                                \mathbf{elif}\;y \leq 5.71392951001371 \cdot 10^{-24}:\\
                                \;\;\;\;\frac{x}{z}\\
                                
                                \mathbf{else}:\\
                                \;\;\;\;t\_0\\
                                
                                
                                \end{array}
                                
                                Derivation
                                1. Split input into 2 regimes
                                2. if y < -1.3808892104572836 or 5.7139295100137103e-24 < y

                                  1. Initial program 87.8%

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

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

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

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

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

                                          \[\leadsto z \cdot \frac{y}{z} \]

                                        if -1.3808892104572836 < y < 5.7139295100137103e-24

                                        1. Initial program 87.8%

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

                                          \[\leadsto \frac{x}{z} \]
                                        3. Step-by-step derivation
                                          1. Applied rewrites39.8%

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

                                        Alternative 7: 60.3% accurate, 1.0× speedup?

                                        \[\begin{array}{l} \mathbf{if}\;y \leq -4.396452877645846 \cdot 10^{-84}:\\ \;\;\;\;y\\ \mathbf{elif}\;y \leq 5.71392951001371 \cdot 10^{-24}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array} \]
                                        (FPCore (x y z)
                                          :precision binary64
                                          :pre TRUE
                                          (if (<= y -4.396452877645846e-84)
                                          y
                                          (if (<= y 5.71392951001371e-24) (/ x z) y)))
                                        double code(double x, double y, double z) {
                                        	double tmp;
                                        	if (y <= -4.396452877645846e-84) {
                                        		tmp = y;
                                        	} else if (y <= 5.71392951001371e-24) {
                                        		tmp = x / z;
                                        	} else {
                                        		tmp = 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) :: tmp
                                            if (y <= (-4.396452877645846d-84)) then
                                                tmp = y
                                            else if (y <= 5.71392951001371d-24) then
                                                tmp = x / z
                                            else
                                                tmp = y
                                            end if
                                            code = tmp
                                        end function
                                        
                                        public static double code(double x, double y, double z) {
                                        	double tmp;
                                        	if (y <= -4.396452877645846e-84) {
                                        		tmp = y;
                                        	} else if (y <= 5.71392951001371e-24) {
                                        		tmp = x / z;
                                        	} else {
                                        		tmp = y;
                                        	}
                                        	return tmp;
                                        }
                                        
                                        def code(x, y, z):
                                        	tmp = 0
                                        	if y <= -4.396452877645846e-84:
                                        		tmp = y
                                        	elif y <= 5.71392951001371e-24:
                                        		tmp = x / z
                                        	else:
                                        		tmp = y
                                        	return tmp
                                        
                                        function code(x, y, z)
                                        	tmp = 0.0
                                        	if (y <= -4.396452877645846e-84)
                                        		tmp = y;
                                        	elseif (y <= 5.71392951001371e-24)
                                        		tmp = Float64(x / z);
                                        	else
                                        		tmp = y;
                                        	end
                                        	return tmp
                                        end
                                        
                                        function tmp_2 = code(x, y, z)
                                        	tmp = 0.0;
                                        	if (y <= -4.396452877645846e-84)
                                        		tmp = y;
                                        	elseif (y <= 5.71392951001371e-24)
                                        		tmp = x / z;
                                        	else
                                        		tmp = y;
                                        	end
                                        	tmp_2 = tmp;
                                        end
                                        
                                        code[x_, y_, z_] := If[LessEqual[y, -4.396452877645846e-84], y, If[LessEqual[y, 5.71392951001371e-24], N[(x / z), $MachinePrecision], y]]
                                        
                                        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 tmp_1 = IF (y <= (5713929510013710309954588345103281388526423837570695643911942366958978123392398629221133887767791748046875e-129)) THEN (x / z) ELSE y ENDIF IN
                                        	LET tmp = IF (y <= (-43964528776458464081694827798763004894182085276933175051225769637393906829390866746776185321362175168060435304308169415223731245090346098651524509615456527276516670822493343078795340840138714666963115911164916571607363948714919388294219970703125e-328)) THEN y ELSE tmp_1 ENDIF IN
                                        	tmp
                                        END code
                                        \begin{array}{l}
                                        \mathbf{if}\;y \leq -4.396452877645846 \cdot 10^{-84}:\\
                                        \;\;\;\;y\\
                                        
                                        \mathbf{elif}\;y \leq 5.71392951001371 \cdot 10^{-24}:\\
                                        \;\;\;\;\frac{x}{z}\\
                                        
                                        \mathbf{else}:\\
                                        \;\;\;\;y\\
                                        
                                        
                                        \end{array}
                                        
                                        Derivation
                                        1. Split input into 2 regimes
                                        2. if y < -4.3964528776458464e-84 or 5.7139295100137103e-24 < y

                                          1. Initial program 87.8%

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

                                            \[\leadsto y \]
                                          3. Step-by-step derivation
                                            1. Applied rewrites40.8%

                                              \[\leadsto y \]

                                            if -4.3964528776458464e-84 < y < 5.7139295100137103e-24

                                            1. Initial program 87.8%

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

                                              \[\leadsto \frac{x}{z} \]
                                            3. Step-by-step derivation
                                              1. Applied rewrites39.8%

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

                                            Alternative 8: 40.8% accurate, 13.0× speedup?

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

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

                                              \[\leadsto y \]
                                            3. Step-by-step derivation
                                              1. Applied rewrites40.8%

                                                \[\leadsto y \]
                                              2. Add Preprocessing

                                              Reproduce

                                              ?
                                              herbie shell --seed 2026092 
                                              (FPCore (x y z)
                                                :name "Diagrams.Backend.Rasterific:rasterificRadialGradient from diagrams-rasterific-1.3.1.3"
                                                :precision binary64
                                                (/ (+ x (* y (- z x))) z))