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

Percentage Accurate: 87.9% → 99.9%
Time: 7.5s
Alternatives: 10
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 10 alternatives:

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

Initial Program: 87.9% 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.9% accurate, 0.5× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -5e52 or 1.00000000000000001e43 < y

    1. Initial program 74.8%

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

      \[\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. sub-neg99.9%

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

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

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

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

    if -5e52 < y < 1.00000000000000001e43

    1. Initial program 98.6%

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

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

        \[\leadsto y + x \cdot \color{blue}{\left(\frac{1}{z} + -1 \cdot \frac{y}{z}\right)} \]
      2. mul-1-neg99.7%

        \[\leadsto y + x \cdot \left(\frac{1}{z} + \color{blue}{\left(-\frac{y}{z}\right)}\right) \]
      3. sub-neg99.7%

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

        \[\leadsto y + x \cdot \color{blue}{\frac{1 - y}{z}} \]
      5. clear-num99.7%

        \[\leadsto y + x \cdot \color{blue}{\frac{1}{\frac{z}{1 - y}}} \]
      6. un-div-inv100.0%

        \[\leadsto y + \color{blue}{\frac{x}{\frac{z}{1 - y}}} \]
    5. Applied egg-rr100.0%

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

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

Alternative 2: 60.0% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -5 \cdot 10^{-10}:\\ \;\;\;\;y\\ \mathbf{elif}\;y \leq 3.6 \cdot 10^{-12}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;y \leq 2.8 \cdot 10^{+292}:\\ \;\;\;\;y\\ \mathbf{else}:\\ \;\;\;\;\frac{-x}{z}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= y -5e-10)
   y
   (if (<= y 3.6e-12) (/ x z) (if (<= y 2.8e+292) y (/ (- x) z)))))
double code(double x, double y, double z) {
	double tmp;
	if (y <= -5e-10) {
		tmp = y;
	} else if (y <= 3.6e-12) {
		tmp = x / z;
	} else if (y <= 2.8e+292) {
		tmp = y;
	} 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 <= (-5d-10)) then
        tmp = y
    else if (y <= 3.6d-12) then
        tmp = x / z
    else if (y <= 2.8d+292) then
        tmp = y
    else
        tmp = -x / z
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (y <= -5e-10) {
		tmp = y;
	} else if (y <= 3.6e-12) {
		tmp = x / z;
	} else if (y <= 2.8e+292) {
		tmp = y;
	} else {
		tmp = -x / z;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if y <= -5e-10:
		tmp = y
	elif y <= 3.6e-12:
		tmp = x / z
	elif y <= 2.8e+292:
		tmp = y
	else:
		tmp = -x / z
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (y <= -5e-10)
		tmp = y;
	elseif (y <= 3.6e-12)
		tmp = Float64(x / z);
	elseif (y <= 2.8e+292)
		tmp = y;
	else
		tmp = Float64(Float64(-x) / z);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (y <= -5e-10)
		tmp = y;
	elseif (y <= 3.6e-12)
		tmp = x / z;
	elseif (y <= 2.8e+292)
		tmp = y;
	else
		tmp = -x / z;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[y, -5e-10], y, If[LessEqual[y, 3.6e-12], N[(x / z), $MachinePrecision], If[LessEqual[y, 2.8e+292], y, N[((-x) / z), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -5 \cdot 10^{-10}:\\
\;\;\;\;y\\

\mathbf{elif}\;y \leq 3.6 \cdot 10^{-12}:\\
\;\;\;\;\frac{x}{z}\\

\mathbf{elif}\;y \leq 2.8 \cdot 10^{+292}:\\
\;\;\;\;y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -5.00000000000000031e-10 or 3.6e-12 < y < 2.8000000000000002e292

    1. Initial program 76.0%

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

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

    if -5.00000000000000031e-10 < y < 3.6e-12

    1. Initial program 100.0%

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

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

    if 2.8000000000000002e292 < y

    1. Initial program 91.0%

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

      \[\leadsto \color{blue}{\frac{x}{z}} \]
    4. Step-by-step derivation
      1. div-inv0.3%

        \[\leadsto \color{blue}{x \cdot \frac{1}{z}} \]
    5. Applied egg-rr0.3%

      \[\leadsto \color{blue}{x \cdot \frac{1}{z}} \]
    6. Step-by-step derivation
      1. un-div-inv0.3%

        \[\leadsto \color{blue}{\frac{x}{z}} \]
      2. frac-2neg0.3%

        \[\leadsto \color{blue}{\frac{-x}{-z}} \]
      3. add-sqr-sqrt0.2%

        \[\leadsto \frac{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}}{-z} \]
      4. sqrt-unprod20.6%

        \[\leadsto \frac{\color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}}}{-z} \]
      5. sqr-neg20.6%

        \[\leadsto \frac{\sqrt{\color{blue}{x \cdot x}}}{-z} \]
      6. sqrt-unprod10.9%

        \[\leadsto \frac{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}{-z} \]
      7. add-sqr-sqrt52.0%

        \[\leadsto \frac{\color{blue}{x}}{-z} \]
    7. Applied egg-rr52.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -5 \cdot 10^{-10}:\\ \;\;\;\;y\\ \mathbf{elif}\;y \leq 3.6 \cdot 10^{-12}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;y \leq 2.8 \cdot 10^{+292}:\\ \;\;\;\;y\\ \mathbf{else}:\\ \;\;\;\;\frac{-x}{z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 98.5% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -2.55 \cdot 10^{+20} \lor \neg \left(y \leq 5.5 \cdot 10^{-9}\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 -2.55e+20) (not (<= y 5.5e-9)))
   (* y (- 1.0 (/ x z)))
   (+ y (/ x z))))
double code(double x, double y, double z) {
	double tmp;
	if ((y <= -2.55e+20) || !(y <= 5.5e-9)) {
		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 <= (-2.55d+20)) .or. (.not. (y <= 5.5d-9))) 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 <= -2.55e+20) || !(y <= 5.5e-9)) {
		tmp = y * (1.0 - (x / z));
	} else {
		tmp = y + (x / z);
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (y <= -2.55e+20) or not (y <= 5.5e-9):
		tmp = y * (1.0 - (x / z))
	else:
		tmp = y + (x / z)
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((y <= -2.55e+20) || !(y <= 5.5e-9))
		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 <= -2.55e+20) || ~((y <= 5.5e-9)))
		tmp = y * (1.0 - (x / z));
	else
		tmp = y + (x / z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[y, -2.55e+20], N[Not[LessEqual[y, 5.5e-9]], $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 -2.55 \cdot 10^{+20} \lor \neg \left(y \leq 5.5 \cdot 10^{-9}\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.55e20 or 5.4999999999999996e-9 < y

    1. Initial program 76.6%

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

      \[\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. sub-neg99.9%

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

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

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

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

    if -2.55e20 < y < 5.4999999999999996e-9

    1. Initial program 100.0%

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

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

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

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

Alternative 4: 80.0% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 5.5 \cdot 10^{-9}:\\ \;\;\;\;y + \frac{x}{z}\\ \mathbf{elif}\;y \leq 1.35 \cdot 10^{+251}:\\ \;\;\;\;y - \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{y \cdot \left(-x\right)}{z}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= y 5.5e-9)
   (+ y (/ x z))
   (if (<= y 1.35e+251) (- y (/ x z)) (/ (* y (- x)) z))))
double code(double x, double y, double z) {
	double tmp;
	if (y <= 5.5e-9) {
		tmp = y + (x / z);
	} else if (y <= 1.35e+251) {
		tmp = y - (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 <= 5.5d-9) then
        tmp = y + (x / z)
    else if (y <= 1.35d+251) then
        tmp = y - (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 <= 5.5e-9) {
		tmp = y + (x / z);
	} else if (y <= 1.35e+251) {
		tmp = y - (x / z);
	} else {
		tmp = (y * -x) / z;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if y <= 5.5e-9:
		tmp = y + (x / z)
	elif y <= 1.35e+251:
		tmp = y - (x / z)
	else:
		tmp = (y * -x) / z
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (y <= 5.5e-9)
		tmp = Float64(y + Float64(x / z));
	elseif (y <= 1.35e+251)
		tmp = Float64(y - Float64(x / z));
	else
		tmp = Float64(Float64(y * Float64(-x)) / z);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (y <= 5.5e-9)
		tmp = y + (x / z);
	elseif (y <= 1.35e+251)
		tmp = y - (x / z);
	else
		tmp = (y * -x) / z;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[y, 5.5e-9], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.35e+251], N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision], N[(N[(y * (-x)), $MachinePrecision] / z), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq 5.5 \cdot 10^{-9}:\\
\;\;\;\;y + \frac{x}{z}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < 5.4999999999999996e-9

    1. Initial program 90.2%

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

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

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

    if 5.4999999999999996e-9 < y < 1.3500000000000001e251

    1. Initial program 78.2%

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

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

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

        \[\leadsto y + \frac{x}{\color{blue}{\sqrt{z} \cdot \sqrt{z}}} \]
      2. sqrt-unprod48.2%

        \[\leadsto y + \frac{x}{\color{blue}{\sqrt{z \cdot z}}} \]
      3. sqr-neg48.2%

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

        \[\leadsto y + \frac{x}{\color{blue}{\sqrt{-z} \cdot \sqrt{-z}}} \]
      5. add-sqr-sqrt66.4%

        \[\leadsto y + \frac{x}{\color{blue}{-z}} \]
      6. distribute-frac-neg266.4%

        \[\leadsto y + \color{blue}{\left(-\frac{x}{z}\right)} \]
      7. sub-neg66.4%

        \[\leadsto \color{blue}{y - \frac{x}{z}} \]
    6. Applied egg-rr66.4%

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

    if 1.3500000000000001e251 < y

    1. Initial program 87.9%

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

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

      \[\leadsto \frac{\color{blue}{-1 \cdot \left(x \cdot y\right)}}{z} \]
    5. Step-by-step derivation
      1. mul-1-neg86.9%

        \[\leadsto \frac{\color{blue}{-x \cdot y}}{z} \]
      2. distribute-lft-neg-out86.9%

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

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

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

Alternative 5: 80.1% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 5.5 \cdot 10^{-9}:\\ \;\;\;\;y + \frac{x}{z}\\ \mathbf{elif}\;y \leq 2.2 \cdot 10^{+250}:\\ \;\;\;\;y - \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{-x}{z}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= y 5.5e-9)
   (+ y (/ x z))
   (if (<= y 2.2e+250) (- y (/ x z)) (* y (/ (- x) z)))))
double code(double x, double y, double z) {
	double tmp;
	if (y <= 5.5e-9) {
		tmp = y + (x / z);
	} else if (y <= 2.2e+250) {
		tmp = y - (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 <= 5.5d-9) then
        tmp = y + (x / z)
    else if (y <= 2.2d+250) then
        tmp = y - (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 <= 5.5e-9) {
		tmp = y + (x / z);
	} else if (y <= 2.2e+250) {
		tmp = y - (x / z);
	} else {
		tmp = y * (-x / z);
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if y <= 5.5e-9:
		tmp = y + (x / z)
	elif y <= 2.2e+250:
		tmp = y - (x / z)
	else:
		tmp = y * (-x / z)
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (y <= 5.5e-9)
		tmp = Float64(y + Float64(x / z));
	elseif (y <= 2.2e+250)
		tmp = Float64(y - Float64(x / z));
	else
		tmp = Float64(y * Float64(Float64(-x) / z));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (y <= 5.5e-9)
		tmp = y + (x / z);
	elseif (y <= 2.2e+250)
		tmp = y - (x / z);
	else
		tmp = y * (-x / z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[y, 5.5e-9], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.2e+250], N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision], N[(y * N[((-x) / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq 5.5 \cdot 10^{-9}:\\
\;\;\;\;y + \frac{x}{z}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < 5.4999999999999996e-9

    1. Initial program 90.2%

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

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

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

    if 5.4999999999999996e-9 < y < 2.20000000000000014e250

    1. Initial program 78.2%

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

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

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

        \[\leadsto y + \frac{x}{\color{blue}{\sqrt{z} \cdot \sqrt{z}}} \]
      2. sqrt-unprod48.2%

        \[\leadsto y + \frac{x}{\color{blue}{\sqrt{z \cdot z}}} \]
      3. sqr-neg48.2%

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

        \[\leadsto y + \frac{x}{\color{blue}{\sqrt{-z} \cdot \sqrt{-z}}} \]
      5. add-sqr-sqrt66.4%

        \[\leadsto y + \frac{x}{\color{blue}{-z}} \]
      6. distribute-frac-neg266.4%

        \[\leadsto y + \color{blue}{\left(-\frac{x}{z}\right)} \]
      7. sub-neg66.4%

        \[\leadsto \color{blue}{y - \frac{x}{z}} \]
    6. Applied egg-rr66.4%

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

    if 2.20000000000000014e250 < y

    1. Initial program 87.9%

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

      \[\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}} \]
      2. div-sub100.0%

        \[\leadsto y \cdot \color{blue}{\left(\frac{z}{z} - \frac{x}{z}\right)} \]
      3. sub-neg100.0%

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

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

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

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

      \[\leadsto y \cdot \color{blue}{\left(-1 \cdot \frac{x}{z}\right)} \]
    7. Step-by-step derivation
      1. mul-1-neg86.9%

        \[\leadsto y \cdot \color{blue}{\left(-\frac{x}{z}\right)} \]
      2. distribute-frac-neg286.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 5.5 \cdot 10^{-9}:\\ \;\;\;\;y + \frac{x}{z}\\ \mathbf{elif}\;y \leq 2.2 \cdot 10^{+250}:\\ \;\;\;\;y - \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{-x}{z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 61.5% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -4.2 \cdot 10^{-8}:\\ \;\;\;\;y\\ \mathbf{elif}\;y \leq 4.1 \cdot 10^{-10}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;z \cdot \frac{y}{z}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= y -4.2e-8) y (if (<= y 4.1e-10) (/ x z) (* z (/ y z)))))
double code(double x, double y, double z) {
	double tmp;
	if (y <= -4.2e-8) {
		tmp = y;
	} else if (y <= 4.1e-10) {
		tmp = 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 <= (-4.2d-8)) then
        tmp = y
    else if (y <= 4.1d-10) then
        tmp = 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 <= -4.2e-8) {
		tmp = y;
	} else if (y <= 4.1e-10) {
		tmp = x / z;
	} else {
		tmp = z * (y / z);
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if y <= -4.2e-8:
		tmp = y
	elif y <= 4.1e-10:
		tmp = x / z
	else:
		tmp = z * (y / z)
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (y <= -4.2e-8)
		tmp = y;
	elseif (y <= 4.1e-10)
		tmp = 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 <= -4.2e-8)
		tmp = y;
	elseif (y <= 4.1e-10)
		tmp = x / z;
	else
		tmp = z * (y / z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[y, -4.2e-8], y, If[LessEqual[y, 4.1e-10], N[(x / z), $MachinePrecision], N[(z * N[(y / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.2 \cdot 10^{-8}:\\
\;\;\;\;y\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -4.19999999999999989e-8

    1. Initial program 74.2%

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

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

    if -4.19999999999999989e-8 < y < 4.0999999999999998e-10

    1. Initial program 100.0%

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

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

    if 4.0999999999999998e-10 < y

    1. Initial program 80.5%

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

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

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

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

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

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

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

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

Alternative 7: 60.4% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -6.5 \cdot 10^{-11}:\\ \;\;\;\;y\\ \mathbf{elif}\;y \leq 1.1 \cdot 10^{-9}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= y -6.5e-11) y (if (<= y 1.1e-9) (/ x z) y)))
double code(double x, double y, double z) {
	double tmp;
	if (y <= -6.5e-11) {
		tmp = y;
	} else if (y <= 1.1e-9) {
		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 <= (-6.5d-11)) then
        tmp = y
    else if (y <= 1.1d-9) 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 <= -6.5e-11) {
		tmp = y;
	} else if (y <= 1.1e-9) {
		tmp = x / z;
	} else {
		tmp = y;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if y <= -6.5e-11:
		tmp = y
	elif y <= 1.1e-9:
		tmp = x / z
	else:
		tmp = y
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (y <= -6.5e-11)
		tmp = y;
	elseif (y <= 1.1e-9)
		tmp = Float64(x / z);
	else
		tmp = y;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (y <= -6.5e-11)
		tmp = y;
	elseif (y <= 1.1e-9)
		tmp = x / z;
	else
		tmp = y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[y, -6.5e-11], y, If[LessEqual[y, 1.1e-9], N[(x / z), $MachinePrecision], y]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.5 \cdot 10^{-11}:\\
\;\;\;\;y\\

\mathbf{elif}\;y \leq 1.1 \cdot 10^{-9}:\\
\;\;\;\;\frac{x}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -6.49999999999999953e-11 or 1.0999999999999999e-9 < y

    1. Initial program 77.1%

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

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

    if -6.49999999999999953e-11 < y < 1.0999999999999999e-9

    1. Initial program 100.0%

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

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

Alternative 8: 80.9% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 5.5 \cdot 10^{-9}:\\ \;\;\;\;y + \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;y - \frac{x}{z}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= y 5.5e-9) (+ y (/ x z)) (- y (/ x z))))
double code(double x, double y, double z) {
	double tmp;
	if (y <= 5.5e-9) {
		tmp = y + (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 <= 5.5d-9) then
        tmp = y + (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 <= 5.5e-9) {
		tmp = y + (x / z);
	} else {
		tmp = y - (x / z);
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if y <= 5.5e-9:
		tmp = y + (x / z)
	else:
		tmp = y - (x / z)
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (y <= 5.5e-9)
		tmp = Float64(y + 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 <= 5.5e-9)
		tmp = y + (x / z);
	else
		tmp = y - (x / z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[y, 5.5e-9], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision], N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq 5.5 \cdot 10^{-9}:\\
\;\;\;\;y + \frac{x}{z}\\

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


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

    1. Initial program 90.2%

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

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

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

    if 5.4999999999999996e-9 < y

    1. Initial program 80.5%

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

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

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

        \[\leadsto y + \frac{x}{\color{blue}{\sqrt{z} \cdot \sqrt{z}}} \]
      2. sqrt-unprod51.0%

        \[\leadsto y + \frac{x}{\color{blue}{\sqrt{z \cdot z}}} \]
      3. sqr-neg51.0%

        \[\leadsto y + \frac{x}{\sqrt{\color{blue}{\left(-z\right) \cdot \left(-z\right)}}} \]
      4. sqrt-unprod25.9%

        \[\leadsto y + \frac{x}{\color{blue}{\sqrt{-z} \cdot \sqrt{-z}}} \]
      5. add-sqr-sqrt62.2%

        \[\leadsto y + \frac{x}{\color{blue}{-z}} \]
      6. distribute-frac-neg262.2%

        \[\leadsto y + \color{blue}{\left(-\frac{x}{z}\right)} \]
      7. sub-neg62.2%

        \[\leadsto \color{blue}{y - \frac{x}{z}} \]
    6. Applied egg-rr62.2%

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

Alternative 9: 78.2% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 8 \cdot 10^{+172}:\\ \;\;\;\;y + \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;z \cdot \frac{y}{z}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= y 8e+172) (+ y (/ x z)) (* z (/ y z))))
double code(double x, double y, double z) {
	double tmp;
	if (y <= 8e+172) {
		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 <= 8d+172) 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 <= 8e+172) {
		tmp = y + (x / z);
	} else {
		tmp = z * (y / z);
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if y <= 8e+172:
		tmp = y + (x / z)
	else:
		tmp = z * (y / z)
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (y <= 8e+172)
		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 <= 8e+172)
		tmp = y + (x / z);
	else
		tmp = z * (y / z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[y, 8e+172], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision], N[(z * N[(y / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq 8 \cdot 10^{+172}:\\
\;\;\;\;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 < 8.0000000000000007e172

    1. Initial program 89.1%

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

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

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

    if 8.0000000000000007e172 < y

    1. Initial program 78.9%

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

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

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

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

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

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

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

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

Alternative 10: 41.1% 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.8%

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

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

Developer Target 1: 93.9% 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 2024157 
(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))