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

Percentage Accurate: 88.0% → 97.8%
Time: 6.8s
Alternatives: 11
Speedup: 0.6×

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 11 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.0% 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: 97.8% accurate, 0.6× speedup?

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

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

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


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

    1. Initial program 74.6%

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

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

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

        \[\leadsto x \cdot \left(\color{blue}{\left(\frac{1}{z} + -1 \cdot \frac{y}{z}\right)} + \frac{y}{x}\right) \]
      3. mul-1-neg77.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto y + \color{blue}{\frac{x}{z} \cdot \left(-y\right)} \]
    12. Step-by-step derivation
      1. distribute-rgt-neg-out99.9%

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

        \[\leadsto y + \color{blue}{\left(-\frac{x}{z}\right) \cdot y} \]
      3. add-sqr-sqrt0.0%

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

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

        \[\leadsto y + \left(-\frac{x}{z}\right) \cdot \sqrt{\color{blue}{\left(-y\right) \cdot \left(-y\right)}} \]
      6. sqrt-unprod52.7%

        \[\leadsto y + \left(-\frac{x}{z}\right) \cdot \color{blue}{\left(\sqrt{-y} \cdot \sqrt{-y}\right)} \]
      7. add-sqr-sqrt52.7%

        \[\leadsto y + \left(-\frac{x}{z}\right) \cdot \color{blue}{\left(-y\right)} \]
      8. cancel-sign-sub-inv52.7%

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

        \[\leadsto y - \color{blue}{\left(-y\right) \cdot \frac{x}{z}} \]
      10. clear-num52.7%

        \[\leadsto y - \left(-y\right) \cdot \color{blue}{\frac{1}{\frac{z}{x}}} \]
      11. un-div-inv52.7%

        \[\leadsto y - \color{blue}{\frac{-y}{\frac{z}{x}}} \]
      12. add-sqr-sqrt52.7%

        \[\leadsto y - \frac{\color{blue}{\sqrt{-y} \cdot \sqrt{-y}}}{\frac{z}{x}} \]
      13. sqrt-unprod22.4%

        \[\leadsto y - \frac{\color{blue}{\sqrt{\left(-y\right) \cdot \left(-y\right)}}}{\frac{z}{x}} \]
      14. sqr-neg22.4%

        \[\leadsto y - \frac{\sqrt{\color{blue}{y \cdot y}}}{\frac{z}{x}} \]
      15. sqrt-unprod0.0%

        \[\leadsto y - \frac{\color{blue}{\sqrt{y} \cdot \sqrt{y}}}{\frac{z}{x}} \]
      16. add-sqr-sqrt99.9%

        \[\leadsto y - \frac{\color{blue}{y}}{\frac{z}{x}} \]
    13. Applied egg-rr99.9%

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

    if -4.0000000000000001e27 < y

    1. Initial program 91.8%

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

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

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

        \[\leadsto x \cdot \left(\color{blue}{\left(\frac{1}{z} + -1 \cdot \frac{y}{z}\right)} + \frac{y}{x}\right) \]
      3. mul-1-neg90.6%

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

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

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

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

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

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

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

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

Alternative 2: 61.1% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := y \cdot \frac{x}{-z}\\ \mathbf{if}\;y \leq -5.2 \cdot 10^{+229}:\\ \;\;\;\;y\\ \mathbf{elif}\;y \leq -7.2 \cdot 10^{+199}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq -5 \cdot 10^{+93}:\\ \;\;\;\;\frac{z}{\frac{z}{y}}\\ \mathbf{elif}\;y \leq -2600000000:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq -1.45 \cdot 10^{-14}:\\ \;\;\;\;y\\ \mathbf{elif}\;y \leq 9.5 \cdot 10^{-15}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;y \leq 3.6 \cdot 10^{+228}:\\ \;\;\;\;y\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{-z}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* y (/ x (- z)))))
   (if (<= y -5.2e+229)
     y
     (if (<= y -7.2e+199)
       t_0
       (if (<= y -5e+93)
         (/ z (/ z y))
         (if (<= y -2600000000.0)
           t_0
           (if (<= y -1.45e-14)
             y
             (if (<= y 9.5e-15)
               (/ x z)
               (if (<= y 3.6e+228) y (* x (/ y (- z))))))))))))
double code(double x, double y, double z) {
	double t_0 = y * (x / -z);
	double tmp;
	if (y <= -5.2e+229) {
		tmp = y;
	} else if (y <= -7.2e+199) {
		tmp = t_0;
	} else if (y <= -5e+93) {
		tmp = z / (z / y);
	} else if (y <= -2600000000.0) {
		tmp = t_0;
	} else if (y <= -1.45e-14) {
		tmp = y;
	} else if (y <= 9.5e-15) {
		tmp = x / z;
	} else if (y <= 3.6e+228) {
		tmp = y;
	} else {
		tmp = x * (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) :: t_0
    real(8) :: tmp
    t_0 = y * (x / -z)
    if (y <= (-5.2d+229)) then
        tmp = y
    else if (y <= (-7.2d+199)) then
        tmp = t_0
    else if (y <= (-5d+93)) then
        tmp = z / (z / y)
    else if (y <= (-2600000000.0d0)) then
        tmp = t_0
    else if (y <= (-1.45d-14)) then
        tmp = y
    else if (y <= 9.5d-15) then
        tmp = x / z
    else if (y <= 3.6d+228) then
        tmp = y
    else
        tmp = x * (y / -z)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = y * (x / -z);
	double tmp;
	if (y <= -5.2e+229) {
		tmp = y;
	} else if (y <= -7.2e+199) {
		tmp = t_0;
	} else if (y <= -5e+93) {
		tmp = z / (z / y);
	} else if (y <= -2600000000.0) {
		tmp = t_0;
	} else if (y <= -1.45e-14) {
		tmp = y;
	} else if (y <= 9.5e-15) {
		tmp = x / z;
	} else if (y <= 3.6e+228) {
		tmp = y;
	} else {
		tmp = x * (y / -z);
	}
	return tmp;
}
def code(x, y, z):
	t_0 = y * (x / -z)
	tmp = 0
	if y <= -5.2e+229:
		tmp = y
	elif y <= -7.2e+199:
		tmp = t_0
	elif y <= -5e+93:
		tmp = z / (z / y)
	elif y <= -2600000000.0:
		tmp = t_0
	elif y <= -1.45e-14:
		tmp = y
	elif y <= 9.5e-15:
		tmp = x / z
	elif y <= 3.6e+228:
		tmp = y
	else:
		tmp = x * (y / -z)
	return tmp
function code(x, y, z)
	t_0 = Float64(y * Float64(x / Float64(-z)))
	tmp = 0.0
	if (y <= -5.2e+229)
		tmp = y;
	elseif (y <= -7.2e+199)
		tmp = t_0;
	elseif (y <= -5e+93)
		tmp = Float64(z / Float64(z / y));
	elseif (y <= -2600000000.0)
		tmp = t_0;
	elseif (y <= -1.45e-14)
		tmp = y;
	elseif (y <= 9.5e-15)
		tmp = Float64(x / z);
	elseif (y <= 3.6e+228)
		tmp = y;
	else
		tmp = Float64(x * Float64(y / Float64(-z)));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = y * (x / -z);
	tmp = 0.0;
	if (y <= -5.2e+229)
		tmp = y;
	elseif (y <= -7.2e+199)
		tmp = t_0;
	elseif (y <= -5e+93)
		tmp = z / (z / y);
	elseif (y <= -2600000000.0)
		tmp = t_0;
	elseif (y <= -1.45e-14)
		tmp = y;
	elseif (y <= 9.5e-15)
		tmp = x / z;
	elseif (y <= 3.6e+228)
		tmp = y;
	else
		tmp = x * (y / -z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[(x / (-z)), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -5.2e+229], y, If[LessEqual[y, -7.2e+199], t$95$0, If[LessEqual[y, -5e+93], N[(z / N[(z / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -2600000000.0], t$95$0, If[LessEqual[y, -1.45e-14], y, If[LessEqual[y, 9.5e-15], N[(x / z), $MachinePrecision], If[LessEqual[y, 3.6e+228], y, N[(x * N[(y / (-z)), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := y \cdot \frac{x}{-z}\\
\mathbf{if}\;y \leq -5.2 \cdot 10^{+229}:\\
\;\;\;\;y\\

\mathbf{elif}\;y \leq -7.2 \cdot 10^{+199}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;y \leq -5 \cdot 10^{+93}:\\
\;\;\;\;\frac{z}{\frac{z}{y}}\\

\mathbf{elif}\;y \leq -2600000000:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;y \leq -1.45 \cdot 10^{-14}:\\
\;\;\;\;y\\

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

\mathbf{elif}\;y \leq 3.6 \cdot 10^{+228}:\\
\;\;\;\;y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if y < -5.2e229 or -2.6e9 < y < -1.4500000000000001e-14 or 9.5000000000000005e-15 < y < 3.6e228

    1. Initial program 79.5%

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

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

    if -5.2e229 < y < -7.20000000000000002e199 or -5.0000000000000001e93 < y < -2.6e9

    1. Initial program 88.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -7.20000000000000002e199 < y < -5.0000000000000001e93

    1. Initial program 61.8%

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

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

        \[\leadsto \frac{\color{blue}{z \cdot y}}{z} \]
      2. associate-/l*71.6%

        \[\leadsto \color{blue}{z \cdot \frac{y}{z}} \]
    5. Applied egg-rr71.6%

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

        \[\leadsto z \cdot \color{blue}{\frac{1}{\frac{z}{y}}} \]
      2. un-div-inv71.7%

        \[\leadsto \color{blue}{\frac{z}{\frac{z}{y}}} \]
    7. Applied egg-rr71.7%

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

    if -1.4500000000000001e-14 < y < 9.5000000000000005e-15

    1. Initial program 100.0%

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

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

    if 3.6e228 < y

    1. Initial program 74.8%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -5.2 \cdot 10^{+229}:\\ \;\;\;\;y\\ \mathbf{elif}\;y \leq -7.2 \cdot 10^{+199}:\\ \;\;\;\;y \cdot \frac{x}{-z}\\ \mathbf{elif}\;y \leq -5 \cdot 10^{+93}:\\ \;\;\;\;\frac{z}{\frac{z}{y}}\\ \mathbf{elif}\;y \leq -2600000000:\\ \;\;\;\;y \cdot \frac{x}{-z}\\ \mathbf{elif}\;y \leq -1.45 \cdot 10^{-14}:\\ \;\;\;\;y\\ \mathbf{elif}\;y \leq 9.5 \cdot 10^{-15}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;y \leq 3.6 \cdot 10^{+228}:\\ \;\;\;\;y\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{-z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 60.5% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \frac{y}{-z}\\ \mathbf{if}\;y \leq -4.8 \cdot 10^{+93}:\\ \;\;\;\;y\\ \mathbf{elif}\;y \leq -30000000000:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq -5.6 \cdot 10^{-16}:\\ \;\;\;\;y\\ \mathbf{elif}\;y \leq 1.3 \cdot 10^{-25}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;y \leq 1.75 \cdot 10^{+226}:\\ \;\;\;\;y\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* x (/ y (- z)))))
   (if (<= y -4.8e+93)
     y
     (if (<= y -30000000000.0)
       t_0
       (if (<= y -5.6e-16)
         y
         (if (<= y 1.3e-25) (/ x z) (if (<= y 1.75e+226) y t_0)))))))
double code(double x, double y, double z) {
	double t_0 = x * (y / -z);
	double tmp;
	if (y <= -4.8e+93) {
		tmp = y;
	} else if (y <= -30000000000.0) {
		tmp = t_0;
	} else if (y <= -5.6e-16) {
		tmp = y;
	} else if (y <= 1.3e-25) {
		tmp = x / z;
	} else if (y <= 1.75e+226) {
		tmp = y;
	} 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 = x * (y / -z)
    if (y <= (-4.8d+93)) then
        tmp = y
    else if (y <= (-30000000000.0d0)) then
        tmp = t_0
    else if (y <= (-5.6d-16)) then
        tmp = y
    else if (y <= 1.3d-25) then
        tmp = x / z
    else if (y <= 1.75d+226) then
        tmp = y
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = x * (y / -z);
	double tmp;
	if (y <= -4.8e+93) {
		tmp = y;
	} else if (y <= -30000000000.0) {
		tmp = t_0;
	} else if (y <= -5.6e-16) {
		tmp = y;
	} else if (y <= 1.3e-25) {
		tmp = x / z;
	} else if (y <= 1.75e+226) {
		tmp = y;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = x * (y / -z)
	tmp = 0
	if y <= -4.8e+93:
		tmp = y
	elif y <= -30000000000.0:
		tmp = t_0
	elif y <= -5.6e-16:
		tmp = y
	elif y <= 1.3e-25:
		tmp = x / z
	elif y <= 1.75e+226:
		tmp = y
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(x * Float64(y / Float64(-z)))
	tmp = 0.0
	if (y <= -4.8e+93)
		tmp = y;
	elseif (y <= -30000000000.0)
		tmp = t_0;
	elseif (y <= -5.6e-16)
		tmp = y;
	elseif (y <= 1.3e-25)
		tmp = Float64(x / z);
	elseif (y <= 1.75e+226)
		tmp = y;
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = x * (y / -z);
	tmp = 0.0;
	if (y <= -4.8e+93)
		tmp = y;
	elseif (y <= -30000000000.0)
		tmp = t_0;
	elseif (y <= -5.6e-16)
		tmp = y;
	elseif (y <= 1.3e-25)
		tmp = x / z;
	elseif (y <= 1.75e+226)
		tmp = y;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(y / (-z)), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -4.8e+93], y, If[LessEqual[y, -30000000000.0], t$95$0, If[LessEqual[y, -5.6e-16], y, If[LessEqual[y, 1.3e-25], N[(x / z), $MachinePrecision], If[LessEqual[y, 1.75e+226], y, t$95$0]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := x \cdot \frac{y}{-z}\\
\mathbf{if}\;y \leq -4.8 \cdot 10^{+93}:\\
\;\;\;\;y\\

\mathbf{elif}\;y \leq -30000000000:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;y \leq -5.6 \cdot 10^{-16}:\\
\;\;\;\;y\\

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

\mathbf{elif}\;y \leq 1.75 \cdot 10^{+226}:\\
\;\;\;\;y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -4.80000000000000021e93 or -3e10 < y < -5.6000000000000003e-16 or 1.3e-25 < y < 1.7499999999999999e226

    1. Initial program 77.1%

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

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

    if -4.80000000000000021e93 < y < -3e10 or 1.7499999999999999e226 < y

    1. Initial program 80.0%

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

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

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

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

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

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

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

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

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

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

    if -5.6000000000000003e-16 < y < 1.3e-25

    1. Initial program 100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -4.8 \cdot 10^{+93}:\\ \;\;\;\;y\\ \mathbf{elif}\;y \leq -30000000000:\\ \;\;\;\;x \cdot \frac{y}{-z}\\ \mathbf{elif}\;y \leq -5.6 \cdot 10^{-16}:\\ \;\;\;\;y\\ \mathbf{elif}\;y \leq 1.3 \cdot 10^{-25}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;y \leq 1.75 \cdot 10^{+226}:\\ \;\;\;\;y\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{-z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 70.9% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \frac{1 - y}{z}\\ \mathbf{if}\;z \leq -4.5 \cdot 10^{+109}:\\ \;\;\;\;y\\ \mathbf{elif}\;z \leq -3.6 \cdot 10^{+31}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq -2.75 \cdot 10^{-14}:\\ \;\;\;\;\frac{y \cdot z}{z}\\ \mathbf{elif}\;z \leq 3.4 \cdot 10^{+120}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* x (/ (- 1.0 y) z))))
   (if (<= z -4.5e+109)
     y
     (if (<= z -3.6e+31)
       t_0
       (if (<= z -2.75e-14) (/ (* y z) z) (if (<= z 3.4e+120) t_0 y))))))
double code(double x, double y, double z) {
	double t_0 = x * ((1.0 - y) / z);
	double tmp;
	if (z <= -4.5e+109) {
		tmp = y;
	} else if (z <= -3.6e+31) {
		tmp = t_0;
	} else if (z <= -2.75e-14) {
		tmp = (y * z) / z;
	} else if (z <= 3.4e+120) {
		tmp = t_0;
	} 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) :: t_0
    real(8) :: tmp
    t_0 = x * ((1.0d0 - y) / z)
    if (z <= (-4.5d+109)) then
        tmp = y
    else if (z <= (-3.6d+31)) then
        tmp = t_0
    else if (z <= (-2.75d-14)) then
        tmp = (y * z) / z
    else if (z <= 3.4d+120) then
        tmp = t_0
    else
        tmp = y
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = x * ((1.0 - y) / z);
	double tmp;
	if (z <= -4.5e+109) {
		tmp = y;
	} else if (z <= -3.6e+31) {
		tmp = t_0;
	} else if (z <= -2.75e-14) {
		tmp = (y * z) / z;
	} else if (z <= 3.4e+120) {
		tmp = t_0;
	} else {
		tmp = y;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = x * ((1.0 - y) / z)
	tmp = 0
	if z <= -4.5e+109:
		tmp = y
	elif z <= -3.6e+31:
		tmp = t_0
	elif z <= -2.75e-14:
		tmp = (y * z) / z
	elif z <= 3.4e+120:
		tmp = t_0
	else:
		tmp = y
	return tmp
function code(x, y, z)
	t_0 = Float64(x * Float64(Float64(1.0 - y) / z))
	tmp = 0.0
	if (z <= -4.5e+109)
		tmp = y;
	elseif (z <= -3.6e+31)
		tmp = t_0;
	elseif (z <= -2.75e-14)
		tmp = Float64(Float64(y * z) / z);
	elseif (z <= 3.4e+120)
		tmp = t_0;
	else
		tmp = y;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = x * ((1.0 - y) / z);
	tmp = 0.0;
	if (z <= -4.5e+109)
		tmp = y;
	elseif (z <= -3.6e+31)
		tmp = t_0;
	elseif (z <= -2.75e-14)
		tmp = (y * z) / z;
	elseif (z <= 3.4e+120)
		tmp = t_0;
	else
		tmp = y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(N[(1.0 - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4.5e+109], y, If[LessEqual[z, -3.6e+31], t$95$0, If[LessEqual[z, -2.75e-14], N[(N[(y * z), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[z, 3.4e+120], t$95$0, y]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := x \cdot \frac{1 - y}{z}\\
\mathbf{if}\;z \leq -4.5 \cdot 10^{+109}:\\
\;\;\;\;y\\

\mathbf{elif}\;z \leq -3.6 \cdot 10^{+31}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq -2.75 \cdot 10^{-14}:\\
\;\;\;\;\frac{y \cdot z}{z}\\

\mathbf{elif}\;z \leq 3.4 \cdot 10^{+120}:\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -4.4999999999999996e109 or 3.39999999999999999e120 < z

    1. Initial program 63.6%

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

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

    if -4.4999999999999996e109 < z < -3.59999999999999996e31 or -2.74999999999999996e-14 < z < 3.39999999999999999e120

    1. Initial program 97.1%

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

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

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

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

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

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

    if -3.59999999999999996e31 < z < -2.74999999999999996e-14

    1. Initial program 99.7%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -4.5 \cdot 10^{+109}:\\ \;\;\;\;y\\ \mathbf{elif}\;z \leq -3.6 \cdot 10^{+31}:\\ \;\;\;\;x \cdot \frac{1 - y}{z}\\ \mathbf{elif}\;z \leq -2.75 \cdot 10^{-14}:\\ \;\;\;\;\frac{y \cdot z}{z}\\ \mathbf{elif}\;z \leq 3.4 \cdot 10^{+120}:\\ \;\;\;\;x \cdot \frac{1 - y}{z}\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 85.0% accurate, 0.5× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -6.50000000000000012e-36 or 9.80000000000000024e-17 < y

    1. Initial program 78.2%

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

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

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

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

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

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

    if -6.50000000000000012e-36 < y < 9.80000000000000024e-17

    1. Initial program 100.0%

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

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

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

Alternative 6: 85.0% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.5 \cdot 10^{-35}:\\
\;\;\;\;y - \frac{y}{\frac{z}{x}}\\

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

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


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

    1. Initial program 78.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto y + \color{blue}{\frac{x}{z} \cdot \left(-y\right)} \]
    12. Step-by-step derivation
      1. distribute-rgt-neg-out98.4%

        \[\leadsto y + \color{blue}{\left(-\frac{x}{z} \cdot y\right)} \]
      2. distribute-lft-neg-in98.4%

        \[\leadsto y + \color{blue}{\left(-\frac{x}{z}\right) \cdot y} \]
      3. add-sqr-sqrt0.0%

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

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

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

        \[\leadsto y + \left(-\frac{x}{z}\right) \cdot \color{blue}{\left(\sqrt{-y} \cdot \sqrt{-y}\right)} \]
      7. add-sqr-sqrt53.5%

        \[\leadsto y + \left(-\frac{x}{z}\right) \cdot \color{blue}{\left(-y\right)} \]
      8. cancel-sign-sub-inv53.5%

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

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

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

        \[\leadsto y - \color{blue}{\frac{-y}{\frac{z}{x}}} \]
      12. add-sqr-sqrt53.5%

        \[\leadsto y - \frac{\color{blue}{\sqrt{-y} \cdot \sqrt{-y}}}{\frac{z}{x}} \]
      13. sqrt-unprod27.6%

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

        \[\leadsto y - \frac{\sqrt{\color{blue}{y \cdot y}}}{\frac{z}{x}} \]
      15. sqrt-unprod0.0%

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

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

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

    if -1.49999999999999994e-35 < y < 2.5500000000000001e-17

    1. Initial program 100.0%

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

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

    if 2.5500000000000001e-17 < y

    1. Initial program 78.2%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.5 \cdot 10^{-35}:\\ \;\;\;\;y - \frac{y}{\frac{z}{x}}\\ \mathbf{elif}\;y \leq 2.55 \cdot 10^{-17}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(1 - \frac{x}{z}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 84.9% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -8 \cdot 10^{-32}:\\
\;\;\;\;y - \frac{y}{\frac{z}{x}}\\

\mathbf{elif}\;y \leq 2.4 \cdot 10^{-18}:\\
\;\;\;\;\frac{x \cdot \left(1 - y\right)}{z}\\

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


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

    1. Initial program 78.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto y + \color{blue}{\frac{x}{z} \cdot \left(-y\right)} \]
    12. Step-by-step derivation
      1. distribute-rgt-neg-out98.4%

        \[\leadsto y + \color{blue}{\left(-\frac{x}{z} \cdot y\right)} \]
      2. distribute-lft-neg-in98.4%

        \[\leadsto y + \color{blue}{\left(-\frac{x}{z}\right) \cdot y} \]
      3. add-sqr-sqrt0.0%

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

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

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

        \[\leadsto y + \left(-\frac{x}{z}\right) \cdot \color{blue}{\left(\sqrt{-y} \cdot \sqrt{-y}\right)} \]
      7. add-sqr-sqrt53.5%

        \[\leadsto y + \left(-\frac{x}{z}\right) \cdot \color{blue}{\left(-y\right)} \]
      8. cancel-sign-sub-inv53.5%

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

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

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

        \[\leadsto y - \color{blue}{\frac{-y}{\frac{z}{x}}} \]
      12. add-sqr-sqrt53.5%

        \[\leadsto y - \frac{\color{blue}{\sqrt{-y} \cdot \sqrt{-y}}}{\frac{z}{x}} \]
      13. sqrt-unprod27.6%

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

        \[\leadsto y - \frac{\sqrt{\color{blue}{y \cdot y}}}{\frac{z}{x}} \]
      15. sqrt-unprod0.0%

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

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

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

    if -8.00000000000000045e-32 < y < 2.39999999999999994e-18

    1. Initial program 100.0%

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

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

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

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

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

    if 2.39999999999999994e-18 < y

    1. Initial program 78.2%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -8 \cdot 10^{-32}:\\ \;\;\;\;y - \frac{y}{\frac{z}{x}}\\ \mathbf{elif}\;y \leq 2.4 \cdot 10^{-18}:\\ \;\;\;\;\frac{x \cdot \left(1 - y\right)}{z}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(1 - \frac{x}{z}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 63.2% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.1 \cdot 10^{-16} \lor \neg \left(y \leq 1.6 \cdot 10^{-23}\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 < -4.10000000000000006e-16 or 1.59999999999999988e-23 < y

    1. Initial program 77.9%

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

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

        \[\leadsto \frac{\color{blue}{z \cdot y}}{z} \]
      2. associate-/l*53.5%

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

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

    if -4.10000000000000006e-16 < y < 1.59999999999999988e-23

    1. Initial program 100.0%

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

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

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

Alternative 9: 63.1% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.7 \cdot 10^{-13} \lor \neg \left(y \leq 1.08 \cdot 10^{-14}\right):\\
\;\;\;\;\frac{z}{\frac{z}{y}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.70000000000000008e-13 or 1.08000000000000004e-14 < y

    1. Initial program 77.9%

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

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

        \[\leadsto \frac{\color{blue}{z \cdot y}}{z} \]
      2. associate-/l*53.5%

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

      \[\leadsto \color{blue}{z \cdot \frac{y}{z}} \]
    6. Step-by-step derivation
      1. clear-num53.4%

        \[\leadsto z \cdot \color{blue}{\frac{1}{\frac{z}{y}}} \]
      2. un-div-inv53.6%

        \[\leadsto \color{blue}{\frac{z}{\frac{z}{y}}} \]
    7. Applied egg-rr53.6%

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

    if -1.70000000000000008e-13 < y < 1.08000000000000004e-14

    1. Initial program 100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.7 \cdot 10^{-13} \lor \neg \left(y \leq 1.08 \cdot 10^{-14}\right):\\ \;\;\;\;\frac{z}{\frac{z}{y}}\\ \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 -2.7 \cdot 10^{-16}:\\ \;\;\;\;y\\ \mathbf{elif}\;y \leq 5.8 \cdot 10^{-18}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= y -2.7e-16) y (if (<= y 5.8e-18) (/ x z) y)))
double code(double x, double y, double z) {
	double tmp;
	if (y <= -2.7e-16) {
		tmp = y;
	} else if (y <= 5.8e-18) {
		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 <= (-2.7d-16)) then
        tmp = y
    else if (y <= 5.8d-18) 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 <= -2.7e-16) {
		tmp = y;
	} else if (y <= 5.8e-18) {
		tmp = x / z;
	} else {
		tmp = y;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if y <= -2.7e-16:
		tmp = y
	elif y <= 5.8e-18:
		tmp = x / z
	else:
		tmp = y
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (y <= -2.7e-16)
		tmp = y;
	elseif (y <= 5.8e-18)
		tmp = Float64(x / z);
	else
		tmp = y;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (y <= -2.7e-16)
		tmp = y;
	elseif (y <= 5.8e-18)
		tmp = x / z;
	else
		tmp = y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[y, -2.7e-16], y, If[LessEqual[y, 5.8e-18], N[(x / z), $MachinePrecision], y]]
\begin{array}{l}

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.69999999999999999e-16 or 5.8e-18 < y

    1. Initial program 77.9%

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

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

    if -2.69999999999999999e-16 < y < 5.8e-18

    1. Initial program 100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.7 \cdot 10^{-16}:\\ \;\;\;\;y\\ \mathbf{elif}\;y \leq 5.8 \cdot 10^{-18}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 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.1%

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

    \[\leadsto \color{blue}{y} \]
  4. Final simplification41.0%

    \[\leadsto y \]
  5. Add Preprocessing

Developer target: 94.3% 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 2024073 
(FPCore (x y z)
  :name "Diagrams.Backend.Rasterific:rasterificRadialGradient from diagrams-rasterific-1.3.1.3"
  :precision binary64

  :alt
  (- (+ y (/ x z)) (/ y (/ z x)))

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