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

Percentage Accurate: 88.5% → 99.8%
Time: 9.0s
Alternatives: 10
Speedup: 0.9×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 10 alternatives:

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

Initial Program: 88.5% 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.8% accurate, 0.9× speedup?

\[\begin{array}{l} \\ y + \frac{y + -1}{\frac{-z}{x}} \end{array} \]
(FPCore (x y z) :precision binary64 (+ y (/ (+ y -1.0) (/ (- z) x))))
double code(double x, double y, double z) {
	return y + ((y + -1.0) / (-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 + ((y + (-1.0d0)) / (-z / x))
end function
public static double code(double x, double y, double z) {
	return y + ((y + -1.0) / (-z / x));
}
def code(x, y, z):
	return y + ((y + -1.0) / (-z / x))
function code(x, y, z)
	return Float64(y + Float64(Float64(y + -1.0) / Float64(Float64(-z) / x)))
end
function tmp = code(x, y, z)
	tmp = y + ((y + -1.0) / (-z / x));
end
code[x_, y_, z_] := N[(y + N[(N[(y + -1.0), $MachinePrecision] / N[((-z) / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
y + \frac{y + -1}{\frac{-z}{x}}
\end{array}
Derivation
  1. Initial program 90.8%

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

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

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

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

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

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

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

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

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

    \[\leadsto y + \color{blue}{\frac{-1 + y}{\frac{-z}{x}}} \]
  7. Final simplification99.8%

    \[\leadsto y + \frac{y + -1}{\frac{-z}{x}} \]

Alternative 2: 96.0% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.5 \cdot 10^{+102} \lor \neg \left(z \leq 1.5 \cdot 10^{+143}\right):\\
\;\;\;\;y + \frac{x}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -6.5000000000000004e102 or 1.5e143 < z

    1. Initial program 72.5%

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

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

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

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

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

    if -6.5000000000000004e102 < z < 1.5e143

    1. Initial program 99.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -6.5 \cdot 10^{+102} \lor \neg \left(z \leq 1.5 \cdot 10^{+143}\right):\\ \;\;\;\;y + \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + y \cdot \left(z - x\right)}{z}\\ \end{array} \]

Alternative 3: 85.1% accurate, 0.8× speedup?

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

    1. Initial program 92.3%

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

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

        \[\leadsto \color{blue}{\frac{1 + -1 \cdot y}{\frac{z}{x}}} \]
      2. associate-/r/87.1%

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

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

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

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

    if -8.9999999999999995e-15 < x < 1.02e34

    1. Initial program 89.3%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -9 \cdot 10^{-15} \lor \neg \left(x \leq 1.02 \cdot 10^{+34}\right):\\ \;\;\;\;x \cdot \frac{1 - y}{z}\\ \mathbf{else}:\\ \;\;\;\;y + \frac{x}{z}\\ \end{array} \]

Alternative 4: 95.2% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1 \lor \neg \left(y \leq 1\right):\\ \;\;\;\;y - x \cdot \frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;y + \frac{x}{z}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= y -1.0) (not (<= y 1.0))) (- y (* x (/ y z))) (+ y (/ x z))))
double code(double x, double y, double z) {
	double tmp;
	if ((y <= -1.0) || !(y <= 1.0)) {
		tmp = y - (x * (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 ((y <= (-1.0d0)) .or. (.not. (y <= 1.0d0))) then
        tmp = y - (x * (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 ((y <= -1.0) || !(y <= 1.0)) {
		tmp = y - (x * (y / z));
	} else {
		tmp = y + (x / z);
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (y <= -1.0) or not (y <= 1.0):
		tmp = y - (x * (y / z))
	else:
		tmp = y + (x / z)
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((y <= -1.0) || !(y <= 1.0))
		tmp = Float64(y - Float64(x * Float64(y / 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 <= 1.0)))
		tmp = y - (x * (y / 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, 1.0]], $MachinePrecision]], N[(y - N[(x * N[(y / 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 1\right):\\
\;\;\;\;y - x \cdot \frac{y}{z}\\

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


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

    1. Initial program 80.7%

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

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

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

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

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

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

        \[\leadsto y \cdot 1 + \color{blue}{\frac{y \cdot x}{z}} \cdot -1 \]
      5. *-commutative92.6%

        \[\leadsto y \cdot 1 + \color{blue}{-1 \cdot \frac{y \cdot x}{z}} \]
      6. *-rgt-identity92.6%

        \[\leadsto \color{blue}{y} + -1 \cdot \frac{y \cdot x}{z} \]
      7. mul-1-neg92.6%

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

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

        \[\leadsto y - \color{blue}{\frac{y}{z} \cdot x} \]
      10. *-commutative90.4%

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

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

    if -1 < y < 1

    1. Initial program 100.0%

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

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

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

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

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

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

Alternative 5: 95.5% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1 \lor \neg \left(y \leq 1\right):\\ \;\;\;\;y - \frac{y \cdot x}{z}\\ \mathbf{else}:\\ \;\;\;\;y + \frac{x}{z}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= y -1.0) (not (<= y 1.0))) (- y (/ (* y x) z)) (+ y (/ x z))))
double code(double x, double y, double z) {
	double tmp;
	if ((y <= -1.0) || !(y <= 1.0)) {
		tmp = y - ((y * x) / z);
	} else {
		tmp = y + (x / z);
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if ((y <= (-1.0d0)) .or. (.not. (y <= 1.0d0))) then
        tmp = y - ((y * x) / z)
    else
        tmp = y + (x / z)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if ((y <= -1.0) || !(y <= 1.0)) {
		tmp = y - ((y * x) / z);
	} else {
		tmp = y + (x / z);
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (y <= -1.0) or not (y <= 1.0):
		tmp = y - ((y * x) / z)
	else:
		tmp = y + (x / z)
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((y <= -1.0) || !(y <= 1.0))
		tmp = Float64(y - Float64(Float64(y * 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 <= 1.0)))
		tmp = y - ((y * 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, 1.0]], $MachinePrecision]], N[(y - N[(N[(y * x), $MachinePrecision] / z), $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 1\right):\\
\;\;\;\;y - \frac{y \cdot x}{z}\\

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


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

    1. Initial program 80.7%

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

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

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

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

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

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

        \[\leadsto y \cdot 1 + \color{blue}{\frac{y \cdot x}{z}} \cdot -1 \]
      5. *-commutative92.6%

        \[\leadsto y \cdot 1 + \color{blue}{-1 \cdot \frac{y \cdot x}{z}} \]
      6. *-rgt-identity92.6%

        \[\leadsto \color{blue}{y} + -1 \cdot \frac{y \cdot x}{z} \]
      7. mul-1-neg92.6%

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

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

        \[\leadsto y - \color{blue}{\frac{y}{z} \cdot x} \]
      10. *-commutative90.4%

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

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

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

    if -1 < y < 1

    1. Initial program 100.0%

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

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

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

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

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

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

Alternative 6: 79.8% accurate, 0.9× speedup?

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

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

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

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


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

    1. Initial program 94.1%

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

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

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

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

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

    if 30 < y < 8.6000000000000004e162

    1. Initial program 86.1%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{x}{\frac{\color{blue}{-z}}{y}} \]
    7. Simplified54.3%

      \[\leadsto \frac{x}{\color{blue}{\frac{-z}{y}}} \]
    8. Step-by-step derivation
      1. frac-2neg54.3%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-\frac{y}{z} \cdot x} \]
      3. associate-/r/63.2%

        \[\leadsto -\color{blue}{\frac{y}{\frac{z}{x}}} \]
      4. distribute-neg-frac63.2%

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

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

    if 8.6000000000000004e162 < y

    1. Initial program 73.7%

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

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

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

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

      \[\leadsto \color{blue}{\frac{x}{z} + y} \]
    6. Step-by-step derivation
      1. div-inv51.2%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, \frac{1}{z}, y\right)} \]
      3. frac-2neg51.2%

        \[\leadsto \mathsf{fma}\left(x, \color{blue}{\frac{-1}{-z}}, y\right) \]
      4. metadata-eval51.2%

        \[\leadsto \mathsf{fma}\left(x, \frac{\color{blue}{-1}}{-z}, y\right) \]
      5. add-sqr-sqrt22.4%

        \[\leadsto \mathsf{fma}\left(x, \frac{-1}{\color{blue}{\sqrt{-z} \cdot \sqrt{-z}}}, y\right) \]
      6. sqrt-unprod54.6%

        \[\leadsto \mathsf{fma}\left(x, \frac{-1}{\color{blue}{\sqrt{\left(-z\right) \cdot \left(-z\right)}}}, y\right) \]
      7. sqr-neg54.6%

        \[\leadsto \mathsf{fma}\left(x, \frac{-1}{\sqrt{\color{blue}{z \cdot z}}}, y\right) \]
      8. sqrt-unprod32.4%

        \[\leadsto \mathsf{fma}\left(x, \frac{-1}{\color{blue}{\sqrt{z} \cdot \sqrt{z}}}, y\right) \]
      9. add-sqr-sqrt69.1%

        \[\leadsto \mathsf{fma}\left(x, \frac{-1}{\color{blue}{z}}, y\right) \]
    7. Applied egg-rr69.1%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, \frac{-1}{z}, y\right)} \]
    8. Step-by-step derivation
      1. fma-udef69.1%

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

        \[\leadsto \color{blue}{\frac{-1}{z} \cdot x} + y \]
      3. associate-*l/69.1%

        \[\leadsto \color{blue}{\frac{-1 \cdot x}{z}} + y \]
      4. associate-*r/69.1%

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

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

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

        \[\leadsto \color{blue}{y - \frac{x}{z}} \]
    9. Simplified69.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 30:\\ \;\;\;\;y + \frac{x}{z}\\ \mathbf{elif}\;y \leq 8.6 \cdot 10^{+162}:\\ \;\;\;\;\frac{-y}{\frac{z}{x}}\\ \mathbf{else}:\\ \;\;\;\;y - \frac{x}{z}\\ \end{array} \]

Alternative 7: 57.0% accurate, 1.3× speedup?

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

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

\mathbf{elif}\;z \leq 8.4 \cdot 10^{+82}:\\
\;\;\;\;\frac{x}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -4.5e8 or 8.4000000000000001e82 < z

    1. Initial program 79.3%

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

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

    if -4.5e8 < z < 8.4000000000000001e82

    1. Initial program 99.3%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -450000000:\\ \;\;\;\;y\\ \mathbf{elif}\;z \leq 8.4 \cdot 10^{+82}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array} \]

Alternative 8: 81.4% accurate, 1.3× speedup?

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

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

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


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

    1. Initial program 94.1%

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

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

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

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

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

    if 1 < y

    1. Initial program 80.6%

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

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

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

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

      \[\leadsto \color{blue}{\frac{x}{z} + y} \]
    6. Step-by-step derivation
      1. div-inv41.2%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, \frac{1}{z}, y\right)} \]
      3. frac-2neg41.2%

        \[\leadsto \mathsf{fma}\left(x, \color{blue}{\frac{-1}{-z}}, y\right) \]
      4. metadata-eval41.2%

        \[\leadsto \mathsf{fma}\left(x, \frac{\color{blue}{-1}}{-z}, y\right) \]
      5. add-sqr-sqrt23.3%

        \[\leadsto \mathsf{fma}\left(x, \frac{-1}{\color{blue}{\sqrt{-z} \cdot \sqrt{-z}}}, y\right) \]
      6. sqrt-unprod47.7%

        \[\leadsto \mathsf{fma}\left(x, \frac{-1}{\color{blue}{\sqrt{\left(-z\right) \cdot \left(-z\right)}}}, y\right) \]
      7. sqr-neg47.7%

        \[\leadsto \mathsf{fma}\left(x, \frac{-1}{\sqrt{\color{blue}{z \cdot z}}}, y\right) \]
      8. sqrt-unprod22.1%

        \[\leadsto \mathsf{fma}\left(x, \frac{-1}{\color{blue}{\sqrt{z} \cdot \sqrt{z}}}, y\right) \]
      9. add-sqr-sqrt58.6%

        \[\leadsto \mathsf{fma}\left(x, \frac{-1}{\color{blue}{z}}, y\right) \]
    7. Applied egg-rr58.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, \frac{-1}{z}, y\right)} \]
    8. Step-by-step derivation
      1. fma-udef58.6%

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

        \[\leadsto \color{blue}{\frac{-1}{z} \cdot x} + y \]
      3. associate-*l/58.6%

        \[\leadsto \color{blue}{\frac{-1 \cdot x}{z}} + y \]
      4. associate-*r/58.6%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 1:\\ \;\;\;\;y + \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;y - \frac{x}{z}\\ \end{array} \]

Alternative 9: 78.0% accurate, 1.8× speedup?

\[\begin{array}{l} \\ y + \frac{x}{z} \end{array} \]
(FPCore (x y z) :precision binary64 (+ y (/ x z)))
double code(double x, double y, double z) {
	return y + (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 = y + (x / z)
end function
public static double code(double x, double y, double z) {
	return y + (x / z);
}
def code(x, y, z):
	return y + (x / z)
function code(x, y, z)
	return Float64(y + Float64(x / z))
end
function tmp = code(x, y, z)
	tmp = y + (x / z);
end
code[x_, y_, z_] := N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
y + \frac{x}{z}
\end{array}
Derivation
  1. Initial program 90.8%

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

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

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

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

    \[\leadsto \color{blue}{\frac{x}{z} + y} \]
  6. Final simplification78.1%

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

Alternative 10: 41.3% 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 90.8%

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

    \[\leadsto \color{blue}{y} \]
  3. Final simplification40.2%

    \[\leadsto y \]

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

  :herbie-target
  (- (+ y (/ x z)) (/ y (/ z x)))

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