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

Percentage Accurate: 88.7% → 99.7%
Time: 7.5s
Alternatives: 14
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 14 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.7% 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.7% accurate, 0.4× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.25000000000000006e56 or 0.0050000000000000001 < x

    1. Initial program 89.6%

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

      \[\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+99.9%

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

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

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

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

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

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

    if -1.25000000000000006e56 < x < 0.0050000000000000001

    1. Initial program 85.6%

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

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

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

Alternative 2: 78.9% accurate, 0.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.55 \cdot 10^{+60}:\\
\;\;\;\;y + \frac{x}{z}\\

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

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


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

    1. Initial program 92.7%

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

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

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

    if 1.55e60 < y < 1.1e138 or 2.59999999999999987e197 < y

    1. Initial program 74.5%

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

      \[\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)} \]
    6. Taylor expanded in x around inf 63.4%

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

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

        \[\leadsto -\color{blue}{\frac{x}{z} \cdot y} \]
      3. distribute-rgt-neg-in67.2%

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

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

    if 1.1e138 < y < 2.59999999999999987e197

    1. Initial program 56.1%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 1.55 \cdot 10^{+60}:\\ \;\;\;\;y + \frac{x}{z}\\ \mathbf{elif}\;y \leq 1.1 \cdot 10^{+138} \lor \neg \left(y \leq 2.6 \cdot 10^{+197}\right):\\ \;\;\;\;y \cdot \frac{x}{-z}\\ \mathbf{else}:\\ \;\;\;\;z \cdot \frac{y}{z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 78.6% accurate, 0.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.05 \cdot 10^{+61}:\\
\;\;\;\;y + \frac{x}{z}\\

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

\mathbf{elif}\;y \leq 1.75 \cdot 10^{+195}:\\
\;\;\;\;z \cdot \frac{y}{z}\\

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


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

    1. Initial program 92.7%

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

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

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

    if 1.0500000000000001e61 < y < 6.0000000000000002e138

    1. Initial program 75.1%

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

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

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

        \[\leadsto y \cdot \color{blue}{\left(\frac{z}{z} - \frac{x}{z}\right)} \]
      3. 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)} \]
    6. Taylor expanded in x around inf 62.0%

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

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

        \[\leadsto -\color{blue}{\frac{x}{z} \cdot y} \]
      3. distribute-rgt-neg-in70.0%

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

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

    if 6.0000000000000002e138 < y < 1.7500000000000001e195

    1. Initial program 56.1%

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

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

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

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

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

    if 1.7500000000000001e195 < y

    1. Initial program 74.0%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-\frac{x \cdot y}{z}} \]
      2. distribute-frac-neg64.7%

        \[\leadsto \color{blue}{\frac{-x \cdot y}{z}} \]
      3. distribute-rgt-neg-in64.7%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 1.05 \cdot 10^{+61}:\\ \;\;\;\;y + \frac{x}{z}\\ \mathbf{elif}\;y \leq 6 \cdot 10^{+138}:\\ \;\;\;\;y \cdot \frac{x}{-z}\\ \mathbf{elif}\;y \leq 1.75 \cdot 10^{+195}:\\ \;\;\;\;z \cdot \frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot \left(-y\right)}{z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 99.7% accurate, 0.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1250000000000:\\
\;\;\;\;y - y \cdot \frac{x}{z}\\

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

\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.25e12

    1. Initial program 76.2%

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

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

        \[\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)} \]
    6. Step-by-step derivation
      1. sub-neg99.9%

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

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

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

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

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

    if -1.25e12 < y < 3.9e12

    1. Initial program 99.2%

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

      \[\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+99.8%

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

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

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

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

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

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

    if 3.9e12 < y

    1. Initial program 74.7%

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

      \[\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)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification99.9%

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

Alternative 5: 98.8% accurate, 0.5× speedup?

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

\mathbf{elif}\;y \leq 2.45 \cdot 10^{-20}:\\
\;\;\;\;\frac{x + y \cdot \left(z - x\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 < -3.50000000000000023e42

    1. Initial program 72.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.50000000000000023e42 < y < 2.4500000000000001e-20

    1. Initial program 99.9%

      \[\frac{x + y \cdot \left(z - x\right)}{z} \]
    2. Add Preprocessing

    if 2.4500000000000001e-20 < y

    1. Initial program 75.1%

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

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

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

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

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

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

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

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

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

Alternative 6: 85.7% accurate, 0.5× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2.9e10 or 8.49999999999999955e142 < x

    1. Initial program 89.9%

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

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

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

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

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

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

    if -2.9e10 < x < 8.49999999999999955e142

    1. Initial program 86.0%

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

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

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

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

Alternative 7: 98.6% accurate, 0.5× speedup?

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

    1. Initial program 75.9%

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

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

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

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

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

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

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

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

    if -1 < y < 2.4500000000000001e-20

    1. Initial program 99.9%

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

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

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

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

Alternative 8: 98.6% accurate, 0.5× speedup?

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

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

\mathbf{elif}\;y \leq 2.45 \cdot 10^{-20}:\\
\;\;\;\;y + \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

    1. Initial program 77.0%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{y \cdot \left(1 - \frac{x}{z}\right)} \]
    6. Step-by-step derivation
      1. sub-neg98.0%

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

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

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

        \[\leadsto y + \color{blue}{\frac{x}{-z}} \cdot y \]
    7. Applied egg-rr98.1%

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

    if -1 < y < 2.4500000000000001e-20

    1. Initial program 99.9%

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

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

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

    if 2.4500000000000001e-20 < y

    1. Initial program 75.1%

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

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

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

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

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

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

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

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

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

Alternative 9: 78.9% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq 7 \cdot 10^{+60}:\\
\;\;\;\;y + \frac{x}{z}\\

\mathbf{elif}\;y \leq 1.5 \cdot 10^{+128}:\\
\;\;\;\;\frac{y}{z} \cdot \left(-x\right)\\

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


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

    1. Initial program 92.7%

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

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

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

    if 7.0000000000000004e60 < y < 1.4999999999999999e128

    1. Initial program 84.0%

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

      \[\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 67.4%

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

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

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

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

    if 1.4999999999999999e128 < y

    1. Initial program 65.0%

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

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

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

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

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

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

Alternative 10: 61.5% accurate, 0.6× speedup?

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

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

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

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


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

    1. Initial program 76.2%

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

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

    if -2.55e10 < y < 3.00000000000000003e-23

    1. Initial program 99.9%

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

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

    if 3.00000000000000003e-23 < y

    1. Initial program 75.1%

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

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

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

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

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

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

Alternative 11: 60.4% accurate, 0.7× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.55e10 or 2.8000000000000002e-24 < y

    1. Initial program 75.6%

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

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

    if -2.55e10 < y < 2.8000000000000002e-24

    1. Initial program 99.9%

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

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

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

Alternative 12: 79.7% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq 4.1 \cdot 10^{+30}:\\
\;\;\;\;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 < 4.10000000000000005e30

    1. Initial program 92.5%

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

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

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

    if 4.10000000000000005e30 < y

    1. Initial program 73.6%

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

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

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

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

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

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

Alternative 13: 79.8% accurate, 0.9× speedup?

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

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

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


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

    1. Initial program 92.7%

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

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

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

    if 7.00000000000000038e-11 < 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 72.2%

      \[\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+72.2%

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

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

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

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

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

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

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

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

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

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

Alternative 14: 40.4% 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.5%

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

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

    \[\leadsto y \]
  5. Add Preprocessing

Developer target: 94.2% accurate, 0.8× speedup?

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

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

Reproduce

?
herbie shell --seed 2024095 
(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))