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

Percentage Accurate: 88.1% → 99.5%
Time: 9.5s
Alternatives: 12
Speedup: 0.5×

Specification

?
\[\begin{array}{l} \\ \frac{x + y \cdot \left(z - x\right)}{z} \end{array} \]
(FPCore (x y z) :precision binary64 (/ (+ 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)
    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]
\begin{array}{l}

\\
\frac{x + y \cdot \left(z - x\right)}{z}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 12 alternatives:

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

Initial Program: 88.1% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{x + y \cdot \left(z - x\right)}{z} \end{array} \]
(FPCore (x y z) :precision binary64 (/ (+ 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)
    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]
\begin{array}{l}

\\
\frac{x + y \cdot \left(z - x\right)}{z}
\end{array}

Alternative 1: 99.5% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x + y \cdot \left(z - x\right)}{z}\\ \mathbf{if}\;t\_0 \leq -4 \cdot 10^{+293} \lor \neg \left(t\_0 \leq 2 \cdot 10^{+300}\right):\\ \;\;\;\;y + x \cdot \left(\frac{1}{z} - \frac{y}{z}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z} + y \cdot \left(1 - \frac{x}{z}\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (/ (+ x (* y (- z x))) z)))
   (if (or (<= t_0 -4e+293) (not (<= t_0 2e+300)))
     (+ y (* x (- (/ 1.0 z) (/ y z))))
     (+ (/ x z) (* y (- 1.0 (/ x z)))))))
double code(double x, double y, double z) {
	double t_0 = (x + (y * (z - x))) / z;
	double tmp;
	if ((t_0 <= -4e+293) || !(t_0 <= 2e+300)) {
		tmp = y + (x * ((1.0 / z) - (y / z)));
	} else {
		tmp = (x / z) + (y * (1.0 - (x / z)));
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (x + (y * (z - x))) / z
    if ((t_0 <= (-4d+293)) .or. (.not. (t_0 <= 2d+300))) then
        tmp = y + (x * ((1.0d0 / z) - (y / z)))
    else
        tmp = (x / z) + (y * (1.0d0 - (x / z)))
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = (x + (y * (z - x))) / z;
	double tmp;
	if ((t_0 <= -4e+293) || !(t_0 <= 2e+300)) {
		tmp = y + (x * ((1.0 / z) - (y / z)));
	} else {
		tmp = (x / z) + (y * (1.0 - (x / z)));
	}
	return tmp;
}
def code(x, y, z):
	t_0 = (x + (y * (z - x))) / z
	tmp = 0
	if (t_0 <= -4e+293) or not (t_0 <= 2e+300):
		tmp = y + (x * ((1.0 / z) - (y / z)))
	else:
		tmp = (x / z) + (y * (1.0 - (x / z)))
	return tmp
function code(x, y, z)
	t_0 = Float64(Float64(x + Float64(y * Float64(z - x))) / z)
	tmp = 0.0
	if ((t_0 <= -4e+293) || !(t_0 <= 2e+300))
		tmp = Float64(y + Float64(x * Float64(Float64(1.0 / z) - Float64(y / z))));
	else
		tmp = Float64(Float64(x / z) + Float64(y * Float64(1.0 - Float64(x / z))));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = (x + (y * (z - x))) / z;
	tmp = 0.0;
	if ((t_0 <= -4e+293) || ~((t_0 <= 2e+300)))
		tmp = y + (x * ((1.0 / z) - (y / z)));
	else
		tmp = (x / z) + (y * (1.0 - (x / z)));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x + N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -4e+293], N[Not[LessEqual[t$95$0, 2e+300]], $MachinePrecision]], N[(y + N[(x * N[(N[(1.0 / z), $MachinePrecision] - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / z), $MachinePrecision] + N[(y * N[(1.0 - N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{else}:\\
\;\;\;\;\frac{x}{z} + y \cdot \left(1 - \frac{x}{z}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (+.f64 x (*.f64 y (-.f64 z x))) z) < -3.9999999999999997e293 or 2.0000000000000001e300 < (/.f64 (+.f64 x (*.f64 y (-.f64 z x))) z)

    1. Initial program 70.7%

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

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

    if -3.9999999999999997e293 < (/.f64 (+.f64 x (*.f64 y (-.f64 z x))) z) < 2.0000000000000001e300

    1. Initial program 99.9%

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

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

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

Alternative 2: 76.7% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := z \cdot \frac{y}{z}\\ \mathbf{if}\;y \leq -1.7 \cdot 10^{+274}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq -6.3 \cdot 10^{+174}:\\ \;\;\;\;y \cdot \frac{-x}{z}\\ \mathbf{elif}\;y \leq 8:\\ \;\;\;\;y + \frac{x}{z}\\ \mathbf{elif}\;y \leq 1.26 \cdot 10^{+92} \lor \neg \left(y \leq 2.6 \cdot 10^{+210}\right):\\ \;\;\;\;\frac{x \cdot y}{-z}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* z (/ y z))))
   (if (<= y -1.7e+274)
     t_0
     (if (<= y -6.3e+174)
       (* y (/ (- x) z))
       (if (<= y 8.0)
         (+ y (/ x z))
         (if (or (<= y 1.26e+92) (not (<= y 2.6e+210)))
           (/ (* x y) (- z))
           t_0))))))
double code(double x, double y, double z) {
	double t_0 = z * (y / z);
	double tmp;
	if (y <= -1.7e+274) {
		tmp = t_0;
	} else if (y <= -6.3e+174) {
		tmp = y * (-x / z);
	} else if (y <= 8.0) {
		tmp = y + (x / z);
	} else if ((y <= 1.26e+92) || !(y <= 2.6e+210)) {
		tmp = (x * y) / -z;
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(x, y, z)
    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.7d+274)) then
        tmp = t_0
    else if (y <= (-6.3d+174)) then
        tmp = y * (-x / z)
    else if (y <= 8.0d0) then
        tmp = y + (x / z)
    else if ((y <= 1.26d+92) .or. (.not. (y <= 2.6d+210))) then
        tmp = (x * y) / -z
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = z * (y / z);
	double tmp;
	if (y <= -1.7e+274) {
		tmp = t_0;
	} else if (y <= -6.3e+174) {
		tmp = y * (-x / z);
	} else if (y <= 8.0) {
		tmp = y + (x / z);
	} else if ((y <= 1.26e+92) || !(y <= 2.6e+210)) {
		tmp = (x * y) / -z;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = z * (y / z)
	tmp = 0
	if y <= -1.7e+274:
		tmp = t_0
	elif y <= -6.3e+174:
		tmp = y * (-x / z)
	elif y <= 8.0:
		tmp = y + (x / z)
	elif (y <= 1.26e+92) or not (y <= 2.6e+210):
		tmp = (x * y) / -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.7e+274)
		tmp = t_0;
	elseif (y <= -6.3e+174)
		tmp = Float64(y * Float64(Float64(-x) / z));
	elseif (y <= 8.0)
		tmp = Float64(y + Float64(x / z));
	elseif ((y <= 1.26e+92) || !(y <= 2.6e+210))
		tmp = Float64(Float64(x * y) / Float64(-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.7e+274)
		tmp = t_0;
	elseif (y <= -6.3e+174)
		tmp = y * (-x / z);
	elseif (y <= 8.0)
		tmp = y + (x / z);
	elseif ((y <= 1.26e+92) || ~((y <= 2.6e+210)))
		tmp = (x * y) / -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.7e+274], t$95$0, If[LessEqual[y, -6.3e+174], N[(y * N[((-x) / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 8.0], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, 1.26e+92], N[Not[LessEqual[y, 2.6e+210]], $MachinePrecision]], N[(N[(x * y), $MachinePrecision] / (-z)), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := z \cdot \frac{y}{z}\\
\mathbf{if}\;y \leq -1.7 \cdot 10^{+274}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;y \leq -6.3 \cdot 10^{+174}:\\
\;\;\;\;y \cdot \frac{-x}{z}\\

\mathbf{elif}\;y \leq 8:\\
\;\;\;\;y + \frac{x}{z}\\

\mathbf{elif}\;y \leq 1.26 \cdot 10^{+92} \lor \neg \left(y \leq 2.6 \cdot 10^{+210}\right):\\
\;\;\;\;\frac{x \cdot y}{-z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -1.7e274 or 1.26e92 < y < 2.5999999999999999e210

    1. Initial program 59.2%

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

      \[\leadsto \frac{x + \color{blue}{y \cdot z}}{z} \]
    4. Taylor expanded in x around 0 30.0%

      \[\leadsto \frac{\color{blue}{y \cdot z}}{z} \]
    5. Step-by-step derivation
      1. *-commutative30.0%

        \[\leadsto \frac{\color{blue}{z \cdot y}}{z} \]
    6. Simplified30.0%

      \[\leadsto \frac{\color{blue}{z \cdot y}}{z} \]
    7. Step-by-step derivation
      1. associate-/l*74.9%

        \[\leadsto \color{blue}{z \cdot \frac{y}{z}} \]
      2. *-commutative74.9%

        \[\leadsto \color{blue}{\frac{y}{z} \cdot z} \]
    8. Applied egg-rr74.9%

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

    if -1.7e274 < y < -6.3000000000000001e174

    1. Initial program 84.4%

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

      \[\leadsto \color{blue}{\frac{y \cdot \left(z - x\right)}{z}} \]
    4. Step-by-step derivation
      1. associate-/l*100.0%

        \[\leadsto \color{blue}{y \cdot \frac{z - x}{z}} \]
    5. Simplified100.0%

      \[\leadsto \color{blue}{y \cdot \frac{z - x}{z}} \]
    6. Taylor expanded in z around 0 81.6%

      \[\leadsto y \cdot \frac{\color{blue}{-1 \cdot x}}{z} \]
    7. Step-by-step derivation
      1. neg-mul-181.6%

        \[\leadsto y \cdot \frac{\color{blue}{-x}}{z} \]
    8. Simplified81.6%

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

    if -6.3000000000000001e174 < y < 8

    1. Initial program 94.4%

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

      \[\leadsto \frac{x + \color{blue}{y \cdot z}}{z} \]
    4. Taylor expanded in x around 0 91.5%

      \[\leadsto \color{blue}{y + \frac{x}{z}} \]
    5. Step-by-step derivation
      1. +-commutative91.5%

        \[\leadsto \color{blue}{\frac{x}{z} + y} \]
    6. Simplified91.5%

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

    if 8 < y < 1.26e92 or 2.5999999999999999e210 < y

    1. Initial program 93.6%

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

      \[\leadsto \color{blue}{\frac{y \cdot \left(z - x\right)}{z}} \]
    4. Step-by-step derivation
      1. associate-/l*97.4%

        \[\leadsto \color{blue}{y \cdot \frac{z - x}{z}} \]
      2. div-sub97.4%

        \[\leadsto y \cdot \color{blue}{\left(\frac{z}{z} - \frac{x}{z}\right)} \]
      3. *-inverses97.4%

        \[\leadsto y \cdot \left(\color{blue}{1} - \frac{x}{z}\right) \]
    5. Simplified97.4%

      \[\leadsto \color{blue}{y \cdot \left(1 - \frac{x}{z}\right)} \]
    6. Taylor expanded in x around inf 74.1%

      \[\leadsto \color{blue}{-1 \cdot \frac{x \cdot y}{z}} \]
    7. Step-by-step derivation
      1. mul-1-neg74.1%

        \[\leadsto \color{blue}{-\frac{x \cdot y}{z}} \]
      2. *-commutative74.1%

        \[\leadsto -\frac{\color{blue}{y \cdot x}}{z} \]
      3. distribute-frac-neg274.1%

        \[\leadsto \color{blue}{\frac{y \cdot x}{-z}} \]
    8. Simplified74.1%

      \[\leadsto \color{blue}{\frac{y \cdot x}{-z}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification85.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.7 \cdot 10^{+274}:\\ \;\;\;\;z \cdot \frac{y}{z}\\ \mathbf{elif}\;y \leq -6.3 \cdot 10^{+174}:\\ \;\;\;\;y \cdot \frac{-x}{z}\\ \mathbf{elif}\;y \leq 8:\\ \;\;\;\;y + \frac{x}{z}\\ \mathbf{elif}\;y \leq 1.26 \cdot 10^{+92} \lor \neg \left(y \leq 2.6 \cdot 10^{+210}\right):\\ \;\;\;\;\frac{x \cdot y}{-z}\\ \mathbf{else}:\\ \;\;\;\;z \cdot \frac{y}{z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 77.2% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := z \cdot \frac{y}{z}\\ t_1 := y \cdot \frac{-x}{z}\\ \mathbf{if}\;y \leq -2.6 \cdot 10^{+269}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq -4.8 \cdot 10^{+173}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq 9:\\ \;\;\;\;y + \frac{x}{z}\\ \mathbf{elif}\;y \leq 1.08 \cdot 10^{+92} \lor \neg \left(y \leq 8.8 \cdot 10^{+207}\right):\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* z (/ y z))) (t_1 (* y (/ (- x) z))))
   (if (<= y -2.6e+269)
     t_0
     (if (<= y -4.8e+173)
       t_1
       (if (<= y 9.0)
         (+ y (/ x z))
         (if (or (<= y 1.08e+92) (not (<= y 8.8e+207))) t_1 t_0))))))
double code(double x, double y, double z) {
	double t_0 = z * (y / z);
	double t_1 = y * (-x / z);
	double tmp;
	if (y <= -2.6e+269) {
		tmp = t_0;
	} else if (y <= -4.8e+173) {
		tmp = t_1;
	} else if (y <= 9.0) {
		tmp = y + (x / z);
	} else if ((y <= 1.08e+92) || !(y <= 8.8e+207)) {
		tmp = t_1;
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(x, y, z)
    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 = z * (y / z)
    t_1 = y * (-x / z)
    if (y <= (-2.6d+269)) then
        tmp = t_0
    else if (y <= (-4.8d+173)) then
        tmp = t_1
    else if (y <= 9.0d0) then
        tmp = y + (x / z)
    else if ((y <= 1.08d+92) .or. (.not. (y <= 8.8d+207))) then
        tmp = t_1
    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 t_1 = y * (-x / z);
	double tmp;
	if (y <= -2.6e+269) {
		tmp = t_0;
	} else if (y <= -4.8e+173) {
		tmp = t_1;
	} else if (y <= 9.0) {
		tmp = y + (x / z);
	} else if ((y <= 1.08e+92) || !(y <= 8.8e+207)) {
		tmp = t_1;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = z * (y / z)
	t_1 = y * (-x / z)
	tmp = 0
	if y <= -2.6e+269:
		tmp = t_0
	elif y <= -4.8e+173:
		tmp = t_1
	elif y <= 9.0:
		tmp = y + (x / z)
	elif (y <= 1.08e+92) or not (y <= 8.8e+207):
		tmp = t_1
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(z * Float64(y / z))
	t_1 = Float64(y * Float64(Float64(-x) / z))
	tmp = 0.0
	if (y <= -2.6e+269)
		tmp = t_0;
	elseif (y <= -4.8e+173)
		tmp = t_1;
	elseif (y <= 9.0)
		tmp = Float64(y + Float64(x / z));
	elseif ((y <= 1.08e+92) || !(y <= 8.8e+207))
		tmp = t_1;
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = z * (y / z);
	t_1 = y * (-x / z);
	tmp = 0.0;
	if (y <= -2.6e+269)
		tmp = t_0;
	elseif (y <= -4.8e+173)
		tmp = t_1;
	elseif (y <= 9.0)
		tmp = y + (x / z);
	elseif ((y <= 1.08e+92) || ~((y <= 8.8e+207)))
		tmp = t_1;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(y / z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(y * N[((-x) / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.6e+269], t$95$0, If[LessEqual[y, -4.8e+173], t$95$1, If[LessEqual[y, 9.0], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, 1.08e+92], N[Not[LessEqual[y, 8.8e+207]], $MachinePrecision]], t$95$1, t$95$0]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq -4.8 \cdot 10^{+173}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;y \leq 9:\\
\;\;\;\;y + \frac{x}{z}\\

\mathbf{elif}\;y \leq 1.08 \cdot 10^{+92} \lor \neg \left(y \leq 8.8 \cdot 10^{+207}\right):\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -2.6e269 or 1.08e92 < y < 8.80000000000000034e207

    1. Initial program 59.2%

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

      \[\leadsto \frac{x + \color{blue}{y \cdot z}}{z} \]
    4. Taylor expanded in x around 0 30.0%

      \[\leadsto \frac{\color{blue}{y \cdot z}}{z} \]
    5. Step-by-step derivation
      1. *-commutative30.0%

        \[\leadsto \frac{\color{blue}{z \cdot y}}{z} \]
    6. Simplified30.0%

      \[\leadsto \frac{\color{blue}{z \cdot y}}{z} \]
    7. Step-by-step derivation
      1. associate-/l*74.9%

        \[\leadsto \color{blue}{z \cdot \frac{y}{z}} \]
      2. *-commutative74.9%

        \[\leadsto \color{blue}{\frac{y}{z} \cdot z} \]
    8. Applied egg-rr74.9%

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

    if -2.6e269 < y < -4.7999999999999998e173 or 9 < y < 1.08e92 or 8.80000000000000034e207 < y

    1. Initial program 90.9%

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

      \[\leadsto \color{blue}{\frac{y \cdot \left(z - x\right)}{z}} \]
    4. Step-by-step derivation
      1. associate-/l*98.2%

        \[\leadsto \color{blue}{y \cdot \frac{z - x}{z}} \]
    5. Simplified98.2%

      \[\leadsto \color{blue}{y \cdot \frac{z - x}{z}} \]
    6. Taylor expanded in z around 0 76.2%

      \[\leadsto y \cdot \frac{\color{blue}{-1 \cdot x}}{z} \]
    7. Step-by-step derivation
      1. neg-mul-176.2%

        \[\leadsto y \cdot \frac{\color{blue}{-x}}{z} \]
    8. Simplified76.2%

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

    if -4.7999999999999998e173 < y < 9

    1. Initial program 94.4%

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

      \[\leadsto \frac{x + \color{blue}{y \cdot z}}{z} \]
    4. Taylor expanded in x around 0 91.5%

      \[\leadsto \color{blue}{y + \frac{x}{z}} \]
    5. Step-by-step derivation
      1. +-commutative91.5%

        \[\leadsto \color{blue}{\frac{x}{z} + y} \]
    6. Simplified91.5%

      \[\leadsto \color{blue}{\frac{x}{z} + y} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification85.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.6 \cdot 10^{+269}:\\ \;\;\;\;z \cdot \frac{y}{z}\\ \mathbf{elif}\;y \leq -4.8 \cdot 10^{+173}:\\ \;\;\;\;y \cdot \frac{-x}{z}\\ \mathbf{elif}\;y \leq 9:\\ \;\;\;\;y + \frac{x}{z}\\ \mathbf{elif}\;y \leq 1.08 \cdot 10^{+92} \lor \neg \left(y \leq 8.8 \cdot 10^{+207}\right):\\ \;\;\;\;y \cdot \frac{-x}{z}\\ \mathbf{else}:\\ \;\;\;\;z \cdot \frac{y}{z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 77.9% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 5.5:\\ \;\;\;\;y + \frac{x}{z}\\ \mathbf{elif}\;y \leq 1.02 \cdot 10^{+92} \lor \neg \left(y \leq 1.6 \cdot 10^{+211}\right):\\ \;\;\;\;x \cdot \frac{-y}{z}\\ \mathbf{else}:\\ \;\;\;\;z \cdot \frac{y}{z}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= y 5.5)
   (+ y (/ x z))
   (if (or (<= y 1.02e+92) (not (<= y 1.6e+211)))
     (* x (/ (- y) z))
     (* z (/ y z)))))
double code(double x, double y, double z) {
	double tmp;
	if (y <= 5.5) {
		tmp = y + (x / z);
	} else if ((y <= 1.02e+92) || !(y <= 1.6e+211)) {
		tmp = x * (-y / z);
	} else {
		tmp = z * (y / z);
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (y <= 5.5d0) then
        tmp = y + (x / z)
    else if ((y <= 1.02d+92) .or. (.not. (y <= 1.6d+211))) then
        tmp = x * (-y / z)
    else
        tmp = z * (y / z)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (y <= 5.5) {
		tmp = y + (x / z);
	} else if ((y <= 1.02e+92) || !(y <= 1.6e+211)) {
		tmp = x * (-y / z);
	} else {
		tmp = z * (y / z);
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if y <= 5.5:
		tmp = y + (x / z)
	elif (y <= 1.02e+92) or not (y <= 1.6e+211):
		tmp = x * (-y / z)
	else:
		tmp = z * (y / z)
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (y <= 5.5)
		tmp = Float64(y + Float64(x / z));
	elseif ((y <= 1.02e+92) || !(y <= 1.6e+211))
		tmp = Float64(x * Float64(Float64(-y) / z));
	else
		tmp = Float64(z * Float64(y / z));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (y <= 5.5)
		tmp = y + (x / z);
	elseif ((y <= 1.02e+92) || ~((y <= 1.6e+211)))
		tmp = x * (-y / z);
	else
		tmp = z * (y / z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[y, 5.5], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, 1.02e+92], N[Not[LessEqual[y, 1.6e+211]], $MachinePrecision]], N[(x * N[((-y) / z), $MachinePrecision]), $MachinePrecision], N[(z * N[(y / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq 5.5:\\
\;\;\;\;y + \frac{x}{z}\\

\mathbf{elif}\;y \leq 1.02 \cdot 10^{+92} \lor \neg \left(y \leq 1.6 \cdot 10^{+211}\right):\\
\;\;\;\;x \cdot \frac{-y}{z}\\

\mathbf{else}:\\
\;\;\;\;z \cdot \frac{y}{z}\\


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

    1. Initial program 91.7%

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

      \[\leadsto \frac{x + \color{blue}{y \cdot z}}{z} \]
    4. Taylor expanded in x around 0 86.5%

      \[\leadsto \color{blue}{y + \frac{x}{z}} \]
    5. Step-by-step derivation
      1. +-commutative86.5%

        \[\leadsto \color{blue}{\frac{x}{z} + y} \]
    6. Simplified86.5%

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

    if 5.5 < y < 1.02000000000000003e92 or 1.59999999999999988e211 < y

    1. Initial program 93.6%

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

      \[\leadsto \color{blue}{\frac{x \cdot \left(1 + -1 \cdot y\right)}{z}} \]
    4. Step-by-step derivation
      1. associate-/l*70.4%

        \[\leadsto \color{blue}{x \cdot \frac{1 + -1 \cdot y}{z}} \]
      2. mul-1-neg70.4%

        \[\leadsto x \cdot \frac{1 + \color{blue}{\left(-y\right)}}{z} \]
      3. unsub-neg70.4%

        \[\leadsto x \cdot \frac{\color{blue}{1 - y}}{z} \]
    5. Simplified70.4%

      \[\leadsto \color{blue}{x \cdot \frac{1 - y}{z}} \]
    6. Taylor expanded in y around inf 68.6%

      \[\leadsto x \cdot \frac{\color{blue}{-1 \cdot y}}{z} \]
    7. Step-by-step derivation
      1. neg-mul-168.6%

        \[\leadsto x \cdot \frac{\color{blue}{-y}}{z} \]
    8. Simplified68.6%

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

    if 1.02000000000000003e92 < y < 1.59999999999999988e211

    1. Initial program 59.7%

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

      \[\leadsto \frac{x + \color{blue}{y \cdot z}}{z} \]
    4. Taylor expanded in x around 0 31.5%

      \[\leadsto \frac{\color{blue}{y \cdot z}}{z} \]
    5. Step-by-step derivation
      1. *-commutative31.5%

        \[\leadsto \frac{\color{blue}{z \cdot y}}{z} \]
    6. Simplified31.5%

      \[\leadsto \frac{\color{blue}{z \cdot y}}{z} \]
    7. Step-by-step derivation
      1. associate-/l*68.9%

        \[\leadsto \color{blue}{z \cdot \frac{y}{z}} \]
      2. *-commutative68.9%

        \[\leadsto \color{blue}{\frac{y}{z} \cdot z} \]
    8. Applied egg-rr68.9%

      \[\leadsto \color{blue}{\frac{y}{z} \cdot z} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification81.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 5.5:\\ \;\;\;\;y + \frac{x}{z}\\ \mathbf{elif}\;y \leq 1.02 \cdot 10^{+92} \lor \neg \left(y \leq 1.6 \cdot 10^{+211}\right):\\ \;\;\;\;x \cdot \frac{-y}{z}\\ \mathbf{else}:\\ \;\;\;\;z \cdot \frac{y}{z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 99.9% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -1 \cdot 10^{-25} \lor \neg \left(z \leq 3 \cdot 10^{-36}\right):\\ \;\;\;\;\frac{x}{z} + y \cdot \left(1 - \frac{x}{z}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x + y \cdot \left(z - x\right)}{z}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= z -1e-25) (not (<= z 3e-36)))
   (+ (/ x z) (* y (- 1.0 (/ x z))))
   (/ (+ x (* y (- z x))) z)))
double code(double x, double y, double z) {
	double tmp;
	if ((z <= -1e-25) || !(z <= 3e-36)) {
		tmp = (x / z) + (y * (1.0 - (x / z)));
	} else {
		tmp = (x + (y * (z - x))) / z;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if ((z <= (-1d-25)) .or. (.not. (z <= 3d-36))) then
        tmp = (x / z) + (y * (1.0d0 - (x / z)))
    else
        tmp = (x + (y * (z - x))) / z
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if ((z <= -1e-25) || !(z <= 3e-36)) {
		tmp = (x / z) + (y * (1.0 - (x / z)));
	} else {
		tmp = (x + (y * (z - x))) / z;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (z <= -1e-25) or not (z <= 3e-36):
		tmp = (x / z) + (y * (1.0 - (x / z)))
	else:
		tmp = (x + (y * (z - x))) / z
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((z <= -1e-25) || !(z <= 3e-36))
		tmp = Float64(Float64(x / z) + Float64(y * Float64(1.0 - Float64(x / z))));
	else
		tmp = Float64(Float64(x + Float64(y * Float64(z - x))) / z);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((z <= -1e-25) || ~((z <= 3e-36)))
		tmp = (x / z) + (y * (1.0 - (x / z)));
	else
		tmp = (x + (y * (z - x))) / z;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[z, -1e-25], N[Not[LessEqual[z, 3e-36]], $MachinePrecision]], N[(N[(x / z), $MachinePrecision] + N[(y * N[(1.0 - N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \cdot 10^{-25} \lor \neg \left(z \leq 3 \cdot 10^{-36}\right):\\
\;\;\;\;\frac{x}{z} + y \cdot \left(1 - \frac{x}{z}\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{x + y \cdot \left(z - x\right)}{z}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.00000000000000004e-25 or 3.0000000000000002e-36 < z

    1. Initial program 77.0%

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

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

    if -1.00000000000000004e-25 < z < 3.0000000000000002e-36

    1. Initial program 99.9%

      \[\frac{x + y \cdot \left(z - x\right)}{z} \]
    2. Add Preprocessing
  3. Recombined 2 regimes into one program.
  4. Final simplification99.9%

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

Alternative 6: 99.4% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -2.8 \cdot 10^{+31} \lor \neg \left(y \leq 3 \cdot 10^{+75}\right):\\ \;\;\;\;y \cdot \left(1 - \frac{x}{z}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x + y \cdot \left(z - x\right)}{z}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= y -2.8e+31) (not (<= y 3e+75)))
   (* y (- 1.0 (/ x z)))
   (/ (+ x (* y (- z x))) z)))
double code(double x, double y, double z) {
	double tmp;
	if ((y <= -2.8e+31) || !(y <= 3e+75)) {
		tmp = y * (1.0 - (x / z));
	} else {
		tmp = (x + (y * (z - x))) / z;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if ((y <= (-2.8d+31)) .or. (.not. (y <= 3d+75))) then
        tmp = y * (1.0d0 - (x / z))
    else
        tmp = (x + (y * (z - x))) / z
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if ((y <= -2.8e+31) || !(y <= 3e+75)) {
		tmp = y * (1.0 - (x / z));
	} else {
		tmp = (x + (y * (z - x))) / z;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (y <= -2.8e+31) or not (y <= 3e+75):
		tmp = y * (1.0 - (x / z))
	else:
		tmp = (x + (y * (z - x))) / z
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((y <= -2.8e+31) || !(y <= 3e+75))
		tmp = Float64(y * Float64(1.0 - Float64(x / z)));
	else
		tmp = Float64(Float64(x + Float64(y * Float64(z - x))) / z);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((y <= -2.8e+31) || ~((y <= 3e+75)))
		tmp = y * (1.0 - (x / z));
	else
		tmp = (x + (y * (z - x))) / z;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[y, -2.8e+31], N[Not[LessEqual[y, 3e+75]], $MachinePrecision]], N[(y * N[(1.0 - N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.8 \cdot 10^{+31} \lor \neg \left(y \leq 3 \cdot 10^{+75}\right):\\
\;\;\;\;y \cdot \left(1 - \frac{x}{z}\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{x + y \cdot \left(z - x\right)}{z}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.80000000000000017e31 or 3e75 < y

    1. Initial program 74.1%

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

      \[\leadsto \color{blue}{\frac{y \cdot \left(z - x\right)}{z}} \]
    4. Step-by-step derivation
      1. associate-/l*99.9%

        \[\leadsto \color{blue}{y \cdot \frac{z - x}{z}} \]
      2. div-sub99.9%

        \[\leadsto y \cdot \color{blue}{\left(\frac{z}{z} - \frac{x}{z}\right)} \]
      3. *-inverses99.9%

        \[\leadsto y \cdot \left(\color{blue}{1} - \frac{x}{z}\right) \]
    5. Simplified99.9%

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

    if -2.80000000000000017e31 < y < 3e75

    1. Initial program 99.9%

      \[\frac{x + y \cdot \left(z - x\right)}{z} \]
    2. Add Preprocessing
  3. Recombined 2 regimes into one program.
  4. Final simplification99.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.8 \cdot 10^{+31} \lor \neg \left(y \leq 3 \cdot 10^{+75}\right):\\ \;\;\;\;y \cdot \left(1 - \frac{x}{z}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x + y \cdot \left(z - x\right)}{z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 99.1% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -23500000 \lor \neg \left(y \leq 0.0052\right):\\ \;\;\;\;y \cdot \left(1 - \frac{x}{z}\right)\\ \mathbf{else}:\\ \;\;\;\;y + \frac{x}{z}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= y -23500000.0) (not (<= y 0.0052)))
   (* y (- 1.0 (/ x z)))
   (+ y (/ x z))))
double code(double x, double y, double z) {
	double tmp;
	if ((y <= -23500000.0) || !(y <= 0.0052)) {
		tmp = y * (1.0 - (x / z));
	} else {
		tmp = y + (x / z);
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if ((y <= (-23500000.0d0)) .or. (.not. (y <= 0.0052d0))) then
        tmp = y * (1.0d0 - (x / z))
    else
        tmp = y + (x / z)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if ((y <= -23500000.0) || !(y <= 0.0052)) {
		tmp = y * (1.0 - (x / z));
	} else {
		tmp = y + (x / z);
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (y <= -23500000.0) or not (y <= 0.0052):
		tmp = y * (1.0 - (x / z))
	else:
		tmp = y + (x / z)
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((y <= -23500000.0) || !(y <= 0.0052))
		tmp = Float64(y * Float64(1.0 - Float64(x / z)));
	else
		tmp = Float64(y + Float64(x / z));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((y <= -23500000.0) || ~((y <= 0.0052)))
		tmp = y * (1.0 - (x / z));
	else
		tmp = y + (x / z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[y, -23500000.0], N[Not[LessEqual[y, 0.0052]], $MachinePrecision]], N[(y * N[(1.0 - N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -23500000 \lor \neg \left(y \leq 0.0052\right):\\
\;\;\;\;y \cdot \left(1 - \frac{x}{z}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.35e7 or 0.0051999999999999998 < y

    1. Initial program 78.0%

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

      \[\leadsto \color{blue}{\frac{y \cdot \left(z - x\right)}{z}} \]
    4. Step-by-step derivation
      1. associate-/l*99.1%

        \[\leadsto \color{blue}{y \cdot \frac{z - x}{z}} \]
      2. div-sub99.1%

        \[\leadsto y \cdot \color{blue}{\left(\frac{z}{z} - \frac{x}{z}\right)} \]
      3. *-inverses99.1%

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

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

    if -2.35e7 < y < 0.0051999999999999998

    1. Initial program 99.9%

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

      \[\leadsto \frac{x + \color{blue}{y \cdot z}}{z} \]
    4. Taylor expanded in x around 0 98.0%

      \[\leadsto \color{blue}{y + \frac{x}{z}} \]
    5. Step-by-step derivation
      1. +-commutative98.0%

        \[\leadsto \color{blue}{\frac{x}{z} + y} \]
    6. Simplified98.0%

      \[\leadsto \color{blue}{\frac{x}{z} + y} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification98.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -23500000 \lor \neg \left(y \leq 0.0052\right):\\ \;\;\;\;y \cdot \left(1 - \frac{x}{z}\right)\\ \mathbf{else}:\\ \;\;\;\;y + \frac{x}{z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 84.9% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1.2 \lor \neg \left(x \leq 3.5 \cdot 10^{+137}\right):\\ \;\;\;\;x \cdot \frac{1 - y}{z}\\ \mathbf{else}:\\ \;\;\;\;y + \frac{x}{z}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= x -1.2) (not (<= x 3.5e+137)))
   (* x (/ (- 1.0 y) z))
   (+ y (/ x z))))
double code(double x, double y, double z) {
	double tmp;
	if ((x <= -1.2) || !(x <= 3.5e+137)) {
		tmp = x * ((1.0 - y) / z);
	} else {
		tmp = y + (x / z);
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if ((x <= (-1.2d0)) .or. (.not. (x <= 3.5d+137))) then
        tmp = x * ((1.0d0 - y) / z)
    else
        tmp = y + (x / z)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if ((x <= -1.2) || !(x <= 3.5e+137)) {
		tmp = x * ((1.0 - y) / z);
	} else {
		tmp = y + (x / z);
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (x <= -1.2) or not (x <= 3.5e+137):
		tmp = x * ((1.0 - y) / z)
	else:
		tmp = y + (x / z)
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((x <= -1.2) || !(x <= 3.5e+137))
		tmp = Float64(x * Float64(Float64(1.0 - y) / z));
	else
		tmp = Float64(y + Float64(x / z));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((x <= -1.2) || ~((x <= 3.5e+137)))
		tmp = x * ((1.0 - y) / z);
	else
		tmp = y + (x / z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.2], N[Not[LessEqual[x, 3.5e+137]], $MachinePrecision]], N[(x * N[(N[(1.0 - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.2 \lor \neg \left(x \leq 3.5 \cdot 10^{+137}\right):\\
\;\;\;\;x \cdot \frac{1 - y}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.19999999999999996 or 3.5000000000000001e137 < x

    1. Initial program 89.0%

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

      \[\leadsto \color{blue}{\frac{x \cdot \left(1 + -1 \cdot y\right)}{z}} \]
    4. Step-by-step derivation
      1. associate-/l*89.5%

        \[\leadsto \color{blue}{x \cdot \frac{1 + -1 \cdot y}{z}} \]
      2. mul-1-neg89.5%

        \[\leadsto x \cdot \frac{1 + \color{blue}{\left(-y\right)}}{z} \]
      3. unsub-neg89.5%

        \[\leadsto x \cdot \frac{\color{blue}{1 - y}}{z} \]
    5. Simplified89.5%

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

    if -1.19999999999999996 < x < 3.5000000000000001e137

    1. Initial program 86.9%

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

      \[\leadsto \frac{x + \color{blue}{y \cdot z}}{z} \]
    4. Taylor expanded in x around 0 82.9%

      \[\leadsto \color{blue}{y + \frac{x}{z}} \]
    5. Step-by-step derivation
      1. +-commutative82.9%

        \[\leadsto \color{blue}{\frac{x}{z} + y} \]
    6. Simplified82.9%

      \[\leadsto \color{blue}{\frac{x}{z} + y} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification86.2%

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

Alternative 9: 62.9% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -0.0095 \lor \neg \left(y \leq 0.00195\right):\\ \;\;\;\;z \cdot \frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= y -0.0095) (not (<= y 0.00195))) (* z (/ y z)) (/ x z)))
double code(double x, double y, double z) {
	double tmp;
	if ((y <= -0.0095) || !(y <= 0.00195)) {
		tmp = z * (y / z);
	} else {
		tmp = x / z;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if ((y <= (-0.0095d0)) .or. (.not. (y <= 0.00195d0))) then
        tmp = z * (y / z)
    else
        tmp = x / z
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if ((y <= -0.0095) || !(y <= 0.00195)) {
		tmp = z * (y / z);
	} else {
		tmp = x / z;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (y <= -0.0095) or not (y <= 0.00195):
		tmp = z * (y / z)
	else:
		tmp = x / z
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((y <= -0.0095) || !(y <= 0.00195))
		tmp = Float64(z * Float64(y / z));
	else
		tmp = Float64(x / z);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((y <= -0.0095) || ~((y <= 0.00195)))
		tmp = z * (y / z);
	else
		tmp = x / z;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[y, -0.0095], N[Not[LessEqual[y, 0.00195]], $MachinePrecision]], N[(z * N[(y / z), $MachinePrecision]), $MachinePrecision], N[(x / z), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.0095 \lor \neg \left(y \leq 0.00195\right):\\
\;\;\;\;z \cdot \frac{y}{z}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{z}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -0.00949999999999999976 or 0.0019499999999999999 < y

    1. Initial program 78.3%

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

      \[\leadsto \frac{x + \color{blue}{y \cdot z}}{z} \]
    4. Taylor expanded in x around 0 28.8%

      \[\leadsto \frac{\color{blue}{y \cdot z}}{z} \]
    5. Step-by-step derivation
      1. *-commutative28.8%

        \[\leadsto \frac{\color{blue}{z \cdot y}}{z} \]
    6. Simplified28.8%

      \[\leadsto \frac{\color{blue}{z \cdot y}}{z} \]
    7. Step-by-step derivation
      1. associate-/l*55.0%

        \[\leadsto \color{blue}{z \cdot \frac{y}{z}} \]
      2. *-commutative55.0%

        \[\leadsto \color{blue}{\frac{y}{z} \cdot z} \]
    8. Applied egg-rr55.0%

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

    if -0.00949999999999999976 < y < 0.0019499999999999999

    1. Initial program 99.9%

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

      \[\leadsto \color{blue}{\frac{x}{z}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification65.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -0.0095 \lor \neg \left(y \leq 0.00195\right):\\ \;\;\;\;z \cdot \frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 61.2% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -0.0056:\\ \;\;\;\;y\\ \mathbf{elif}\;y \leq 0.00145:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= y -0.0056) y (if (<= y 0.00145) (/ x z) y)))
double code(double x, double y, double z) {
	double tmp;
	if (y <= -0.0056) {
		tmp = y;
	} else if (y <= 0.00145) {
		tmp = x / z;
	} else {
		tmp = y;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (y <= (-0.0056d0)) then
        tmp = y
    else if (y <= 0.00145d0) 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 <= -0.0056) {
		tmp = y;
	} else if (y <= 0.00145) {
		tmp = x / z;
	} else {
		tmp = y;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if y <= -0.0056:
		tmp = y
	elif y <= 0.00145:
		tmp = x / z
	else:
		tmp = y
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (y <= -0.0056)
		tmp = y;
	elseif (y <= 0.00145)
		tmp = Float64(x / z);
	else
		tmp = y;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (y <= -0.0056)
		tmp = y;
	elseif (y <= 0.00145)
		tmp = x / z;
	else
		tmp = y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[y, -0.0056], y, If[LessEqual[y, 0.00145], N[(x / z), $MachinePrecision], y]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.0056:\\
\;\;\;\;y\\

\mathbf{elif}\;y \leq 0.00145:\\
\;\;\;\;\frac{x}{z}\\

\mathbf{else}:\\
\;\;\;\;y\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -0.00559999999999999994 or 0.00145 < y

    1. Initial program 78.3%

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

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

    if -0.00559999999999999994 < y < 0.00145

    1. Initial program 99.9%

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

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

Alternative 11: 79.2% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 1:\\ \;\;\;\;y + \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;z \cdot \frac{y}{z}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= y 1.0) (+ y (/ x z)) (* z (/ y z))))
double code(double x, double y, double z) {
	double tmp;
	if (y <= 1.0) {
		tmp = y + (x / z);
	} else {
		tmp = z * (y / z);
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (y <= 1.0d0) then
        tmp = y + (x / z)
    else
        tmp = z * (y / z)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (y <= 1.0) {
		tmp = y + (x / z);
	} else {
		tmp = z * (y / z);
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if y <= 1.0:
		tmp = y + (x / z)
	else:
		tmp = z * (y / z)
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (y <= 1.0)
		tmp = Float64(y + Float64(x / z));
	else
		tmp = Float64(z * Float64(y / z));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (y <= 1.0)
		tmp = y + (x / z);
	else
		tmp = z * (y / z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[y, 1.0], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision], N[(z * N[(y / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq 1:\\
\;\;\;\;y + \frac{x}{z}\\

\mathbf{else}:\\
\;\;\;\;z \cdot \frac{y}{z}\\


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

    1. Initial program 91.7%

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

      \[\leadsto \frac{x + \color{blue}{y \cdot z}}{z} \]
    4. Taylor expanded in x around 0 86.5%

      \[\leadsto \color{blue}{y + \frac{x}{z}} \]
    5. Step-by-step derivation
      1. +-commutative86.5%

        \[\leadsto \color{blue}{\frac{x}{z} + y} \]
    6. Simplified86.5%

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

    if 1 < y

    1. Initial program 78.7%

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

      \[\leadsto \frac{x + \color{blue}{y \cdot z}}{z} \]
    4. Taylor expanded in x around 0 24.5%

      \[\leadsto \frac{\color{blue}{y \cdot z}}{z} \]
    5. Step-by-step derivation
      1. *-commutative24.5%

        \[\leadsto \frac{\color{blue}{z \cdot y}}{z} \]
    6. Simplified24.5%

      \[\leadsto \frac{\color{blue}{z \cdot y}}{z} \]
    7. Step-by-step derivation
      1. associate-/l*48.8%

        \[\leadsto \color{blue}{z \cdot \frac{y}{z}} \]
      2. *-commutative48.8%

        \[\leadsto \color{blue}{\frac{y}{z} \cdot z} \]
    8. Applied egg-rr48.8%

      \[\leadsto \color{blue}{\frac{y}{z} \cdot z} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification75.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 1:\\ \;\;\;\;y + \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;z \cdot \frac{y}{z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 41.0% accurate, 9.0× speedup?

\[\begin{array}{l} \\ y \end{array} \]
(FPCore (x y z) :precision binary64 y)
double code(double x, double y, double z) {
	return y;
}
real(8) function code(x, y, z)
    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
\begin{array}{l}

\\
y
\end{array}
Derivation
  1. Initial program 87.9%

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

    \[\leadsto \color{blue}{y} \]
  4. Add Preprocessing

Developer Target 1: 94.2% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \left(y + \frac{x}{z}\right) - \frac{y}{\frac{z}{x}} \end{array} \]
(FPCore (x y z) :precision binary64 (- (+ y (/ x z)) (/ y (/ z x))))
double code(double x, double y, double z) {
	return (y + (x / z)) - (y / (z / x));
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (y + (x / z)) - (y / (z / x))
end function
public static double code(double x, double y, double z) {
	return (y + (x / z)) - (y / (z / x));
}
def code(x, y, z):
	return (y + (x / z)) - (y / (z / x))
function code(x, y, z)
	return Float64(Float64(y + Float64(x / z)) - Float64(y / Float64(z / x)))
end
function tmp = code(x, y, z)
	tmp = (y + (x / z)) - (y / (z / x));
end
code[x_, y_, z_] := N[(N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision] - N[(y / N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(y + \frac{x}{z}\right) - \frac{y}{\frac{z}{x}}
\end{array}

Reproduce

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

  :alt
  (! :herbie-platform default (- (+ y (/ x z)) (/ y (/ z x))))

  (/ (+ x (* y (- z x))) z))