Numeric.SpecFunctions:choose from math-functions-0.1.5.2

Percentage Accurate: 83.9% → 97.6%
Time: 5.5s
Alternatives: 8
Speedup: 0.4×

Specification

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

\\
\frac{x \cdot \left(y + z\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 8 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: 83.9% accurate, 1.0× speedup?

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

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

Alternative 1: 97.6% accurate, 0.2× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ \begin{array}{l} t_0 := \frac{x\_m \cdot \left(y + z\right)}{z}\\ x\_s \cdot \begin{array}{l} \mathbf{if}\;t\_0 \leq 0:\\ \;\;\;\;\left(y + z\right) \cdot \frac{x\_m}{z}\\ \mathbf{elif}\;t\_0 \leq 10^{+305}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{x\_m}{\frac{z}{y + z}}\\ \end{array} \end{array} \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 1 x)
(FPCore (x_s x_m y z)
 :precision binary64
 (let* ((t_0 (/ (* x_m (+ y z)) z)))
   (*
    x_s
    (if (<= t_0 0.0)
      (* (+ y z) (/ x_m z))
      (if (<= t_0 1e+305) t_0 (/ x_m (/ z (+ y z))))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
	double t_0 = (x_m * (y + z)) / z;
	double tmp;
	if (t_0 <= 0.0) {
		tmp = (y + z) * (x_m / z);
	} else if (t_0 <= 1e+305) {
		tmp = t_0;
	} else {
		tmp = x_m / (z / (y + z));
	}
	return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
    real(8), intent (in) :: x_s
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (x_m * (y + z)) / z
    if (t_0 <= 0.0d0) then
        tmp = (y + z) * (x_m / z)
    else if (t_0 <= 1d+305) then
        tmp = t_0
    else
        tmp = x_m / (z / (y + z))
    end if
    code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
	double t_0 = (x_m * (y + z)) / z;
	double tmp;
	if (t_0 <= 0.0) {
		tmp = (y + z) * (x_m / z);
	} else if (t_0 <= 1e+305) {
		tmp = t_0;
	} else {
		tmp = x_m / (z / (y + z));
	}
	return x_s * tmp;
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
def code(x_s, x_m, y, z):
	t_0 = (x_m * (y + z)) / z
	tmp = 0
	if t_0 <= 0.0:
		tmp = (y + z) * (x_m / z)
	elif t_0 <= 1e+305:
		tmp = t_0
	else:
		tmp = x_m / (z / (y + z))
	return x_s * tmp
x\_m = abs(x)
x\_s = copysign(1.0, x)
function code(x_s, x_m, y, z)
	t_0 = Float64(Float64(x_m * Float64(y + z)) / z)
	tmp = 0.0
	if (t_0 <= 0.0)
		tmp = Float64(Float64(y + z) * Float64(x_m / z));
	elseif (t_0 <= 1e+305)
		tmp = t_0;
	else
		tmp = Float64(x_m / Float64(z / Float64(y + z)));
	end
	return Float64(x_s * tmp)
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
function tmp_2 = code(x_s, x_m, y, z)
	t_0 = (x_m * (y + z)) / z;
	tmp = 0.0;
	if (t_0 <= 0.0)
		tmp = (y + z) * (x_m / z);
	elseif (t_0 <= 1e+305)
		tmp = t_0;
	else
		tmp = x_m / (z / (y + z));
	end
	tmp_2 = x_s * tmp;
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := Block[{t$95$0 = N[(N[(x$95$m * N[(y + z), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]}, N[(x$95$s * If[LessEqual[t$95$0, 0.0], N[(N[(y + z), $MachinePrecision] * N[(x$95$m / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1e+305], t$95$0, N[(x$95$m / N[(z / N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)

\\
\begin{array}{l}
t_0 := \frac{x\_m \cdot \left(y + z\right)}{z}\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 0:\\
\;\;\;\;\left(y + z\right) \cdot \frac{x\_m}{z}\\

\mathbf{elif}\;t\_0 \leq 10^{+305}:\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 (*.f64 x (+.f64 y z)) z) < 0.0

    1. Initial program 80.3%

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

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

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

      \[\leadsto \color{blue}{\left(y + z\right) \cdot \frac{x}{z}} \]
    4. Add Preprocessing

    if 0.0 < (/.f64 (*.f64 x (+.f64 y z)) z) < 9.9999999999999994e304

    1. Initial program 99.7%

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

    if 9.9999999999999994e304 < (/.f64 (*.f64 x (+.f64 y z)) z)

    1. Initial program 57.8%

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

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

      \[\leadsto \color{blue}{x \cdot \frac{y + z}{z}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. clear-num100.0%

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

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

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

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

Alternative 2: 93.7% accurate, 0.4× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ x\_s \cdot \begin{array}{l} \mathbf{if}\;z \leq -1.6 \cdot 10^{-267} \lor \neg \left(z \leq 1.25 \cdot 10^{-81}\right):\\ \;\;\;\;x\_m \cdot \frac{y + z}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x\_m \cdot y}{z}\\ \end{array} \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 1 x)
(FPCore (x_s x_m y z)
 :precision binary64
 (*
  x_s
  (if (or (<= z -1.6e-267) (not (<= z 1.25e-81)))
    (* x_m (/ (+ y z) z))
    (/ (* x_m y) z))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
	double tmp;
	if ((z <= -1.6e-267) || !(z <= 1.25e-81)) {
		tmp = x_m * ((y + z) / z);
	} else {
		tmp = (x_m * y) / z;
	}
	return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
    real(8), intent (in) :: x_s
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if ((z <= (-1.6d-267)) .or. (.not. (z <= 1.25d-81))) then
        tmp = x_m * ((y + z) / z)
    else
        tmp = (x_m * y) / z
    end if
    code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
	double tmp;
	if ((z <= -1.6e-267) || !(z <= 1.25e-81)) {
		tmp = x_m * ((y + z) / z);
	} else {
		tmp = (x_m * y) / z;
	}
	return x_s * tmp;
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
def code(x_s, x_m, y, z):
	tmp = 0
	if (z <= -1.6e-267) or not (z <= 1.25e-81):
		tmp = x_m * ((y + z) / z)
	else:
		tmp = (x_m * y) / z
	return x_s * tmp
x\_m = abs(x)
x\_s = copysign(1.0, x)
function code(x_s, x_m, y, z)
	tmp = 0.0
	if ((z <= -1.6e-267) || !(z <= 1.25e-81))
		tmp = Float64(x_m * Float64(Float64(y + z) / z));
	else
		tmp = Float64(Float64(x_m * y) / z);
	end
	return Float64(x_s * tmp)
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
function tmp_2 = code(x_s, x_m, y, z)
	tmp = 0.0;
	if ((z <= -1.6e-267) || ~((z <= 1.25e-81)))
		tmp = x_m * ((y + z) / z);
	else
		tmp = (x_m * y) / z;
	end
	tmp_2 = x_s * tmp;
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[Or[LessEqual[z, -1.6e-267], N[Not[LessEqual[z, 1.25e-81]], $MachinePrecision]], N[(x$95$m * N[(N[(y + z), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m * y), $MachinePrecision] / z), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)

\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -1.6 \cdot 10^{-267} \lor \neg \left(z \leq 1.25 \cdot 10^{-81}\right):\\
\;\;\;\;x\_m \cdot \frac{y + z}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.59999999999999993e-267 or 1.24999999999999995e-81 < z

    1. Initial program 80.3%

      \[\frac{x \cdot \left(y + z\right)}{z} \]
    2. Step-by-step derivation
      1. associate-/l*97.5%

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

      \[\leadsto \color{blue}{x \cdot \frac{y + z}{z}} \]
    4. Add Preprocessing

    if -1.59999999999999993e-267 < z < 1.24999999999999995e-81

    1. Initial program 91.3%

      \[\frac{x \cdot \left(y + z\right)}{z} \]
    2. Step-by-step derivation
      1. associate-/l*76.2%

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

      \[\leadsto \color{blue}{x \cdot \frac{y + z}{z}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around inf 91.3%

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

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

Alternative 3: 96.2% accurate, 0.4× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ x\_s \cdot \begin{array}{l} \mathbf{if}\;z \leq -9.6 \cdot 10^{-60} \lor \neg \left(z \leq 5 \cdot 10^{-71}\right):\\ \;\;\;\;x\_m \cdot \frac{y + z}{z}\\ \mathbf{else}:\\ \;\;\;\;\left(y + z\right) \cdot \frac{x\_m}{z}\\ \end{array} \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 1 x)
(FPCore (x_s x_m y z)
 :precision binary64
 (*
  x_s
  (if (or (<= z -9.6e-60) (not (<= z 5e-71)))
    (* x_m (/ (+ y z) z))
    (* (+ y z) (/ x_m z)))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
	double tmp;
	if ((z <= -9.6e-60) || !(z <= 5e-71)) {
		tmp = x_m * ((y + z) / z);
	} else {
		tmp = (y + z) * (x_m / z);
	}
	return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
    real(8), intent (in) :: x_s
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if ((z <= (-9.6d-60)) .or. (.not. (z <= 5d-71))) then
        tmp = x_m * ((y + z) / z)
    else
        tmp = (y + z) * (x_m / z)
    end if
    code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
	double tmp;
	if ((z <= -9.6e-60) || !(z <= 5e-71)) {
		tmp = x_m * ((y + z) / z);
	} else {
		tmp = (y + z) * (x_m / z);
	}
	return x_s * tmp;
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
def code(x_s, x_m, y, z):
	tmp = 0
	if (z <= -9.6e-60) or not (z <= 5e-71):
		tmp = x_m * ((y + z) / z)
	else:
		tmp = (y + z) * (x_m / z)
	return x_s * tmp
x\_m = abs(x)
x\_s = copysign(1.0, x)
function code(x_s, x_m, y, z)
	tmp = 0.0
	if ((z <= -9.6e-60) || !(z <= 5e-71))
		tmp = Float64(x_m * Float64(Float64(y + z) / z));
	else
		tmp = Float64(Float64(y + z) * Float64(x_m / z));
	end
	return Float64(x_s * tmp)
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
function tmp_2 = code(x_s, x_m, y, z)
	tmp = 0.0;
	if ((z <= -9.6e-60) || ~((z <= 5e-71)))
		tmp = x_m * ((y + z) / z);
	else
		tmp = (y + z) * (x_m / z);
	end
	tmp_2 = x_s * tmp;
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[Or[LessEqual[z, -9.6e-60], N[Not[LessEqual[z, 5e-71]], $MachinePrecision]], N[(x$95$m * N[(N[(y + z), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(N[(y + z), $MachinePrecision] * N[(x$95$m / z), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)

\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -9.6 \cdot 10^{-60} \lor \neg \left(z \leq 5 \cdot 10^{-71}\right):\\
\;\;\;\;x\_m \cdot \frac{y + z}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -9.60000000000000038e-60 or 4.99999999999999998e-71 < z

    1. Initial program 79.2%

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

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

      \[\leadsto \color{blue}{x \cdot \frac{y + z}{z}} \]
    4. Add Preprocessing

    if -9.60000000000000038e-60 < z < 4.99999999999999998e-71

    1. Initial program 88.2%

      \[\frac{x \cdot \left(y + z\right)}{z} \]
    2. Step-by-step derivation
      1. *-commutative88.2%

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

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

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

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

Alternative 4: 96.2% accurate, 0.4× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ x\_s \cdot \begin{array}{l} \mathbf{if}\;z \leq -2.9 \cdot 10^{-62}:\\ \;\;\;\;x\_m \cdot \frac{y + z}{z}\\ \mathbf{elif}\;z \leq 1.2 \cdot 10^{-69}:\\ \;\;\;\;\left(y + z\right) \cdot \frac{x\_m}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x\_m}{\frac{z}{y + z}}\\ \end{array} \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 1 x)
(FPCore (x_s x_m y z)
 :precision binary64
 (*
  x_s
  (if (<= z -2.9e-62)
    (* x_m (/ (+ y z) z))
    (if (<= z 1.2e-69) (* (+ y z) (/ x_m z)) (/ x_m (/ z (+ y z)))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
	double tmp;
	if (z <= -2.9e-62) {
		tmp = x_m * ((y + z) / z);
	} else if (z <= 1.2e-69) {
		tmp = (y + z) * (x_m / z);
	} else {
		tmp = x_m / (z / (y + z));
	}
	return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
    real(8), intent (in) :: x_s
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (z <= (-2.9d-62)) then
        tmp = x_m * ((y + z) / z)
    else if (z <= 1.2d-69) then
        tmp = (y + z) * (x_m / z)
    else
        tmp = x_m / (z / (y + z))
    end if
    code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
	double tmp;
	if (z <= -2.9e-62) {
		tmp = x_m * ((y + z) / z);
	} else if (z <= 1.2e-69) {
		tmp = (y + z) * (x_m / z);
	} else {
		tmp = x_m / (z / (y + z));
	}
	return x_s * tmp;
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
def code(x_s, x_m, y, z):
	tmp = 0
	if z <= -2.9e-62:
		tmp = x_m * ((y + z) / z)
	elif z <= 1.2e-69:
		tmp = (y + z) * (x_m / z)
	else:
		tmp = x_m / (z / (y + z))
	return x_s * tmp
x\_m = abs(x)
x\_s = copysign(1.0, x)
function code(x_s, x_m, y, z)
	tmp = 0.0
	if (z <= -2.9e-62)
		tmp = Float64(x_m * Float64(Float64(y + z) / z));
	elseif (z <= 1.2e-69)
		tmp = Float64(Float64(y + z) * Float64(x_m / z));
	else
		tmp = Float64(x_m / Float64(z / Float64(y + z)));
	end
	return Float64(x_s * tmp)
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
function tmp_2 = code(x_s, x_m, y, z)
	tmp = 0.0;
	if (z <= -2.9e-62)
		tmp = x_m * ((y + z) / z);
	elseif (z <= 1.2e-69)
		tmp = (y + z) * (x_m / z);
	else
		tmp = x_m / (z / (y + z));
	end
	tmp_2 = x_s * tmp;
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[LessEqual[z, -2.9e-62], N[(x$95$m * N[(N[(y + z), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.2e-69], N[(N[(y + z), $MachinePrecision] * N[(x$95$m / z), $MachinePrecision]), $MachinePrecision], N[(x$95$m / N[(z / N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)

\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -2.9 \cdot 10^{-62}:\\
\;\;\;\;x\_m \cdot \frac{y + z}{z}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -2.89999999999999986e-62

    1. Initial program 80.1%

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

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

      \[\leadsto \color{blue}{x \cdot \frac{y + z}{z}} \]
    4. Add Preprocessing

    if -2.89999999999999986e-62 < z < 1.2000000000000001e-69

    1. Initial program 88.4%

      \[\frac{x \cdot \left(y + z\right)}{z} \]
    2. Step-by-step derivation
      1. *-commutative88.4%

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

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

      \[\leadsto \color{blue}{\left(y + z\right) \cdot \frac{x}{z}} \]
    4. Add Preprocessing

    if 1.2000000000000001e-69 < z

    1. Initial program 77.8%

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

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

      \[\leadsto \color{blue}{x \cdot \frac{y + z}{z}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. clear-num99.8%

        \[\leadsto x \cdot \color{blue}{\frac{1}{\frac{z}{y + z}}} \]
      2. un-div-inv99.8%

        \[\leadsto \color{blue}{\frac{x}{\frac{z}{y + z}}} \]
    6. Applied egg-rr99.8%

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

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

Alternative 5: 71.2% accurate, 0.5× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ x\_s \cdot \begin{array}{l} \mathbf{if}\;z \leq -2.1 \cdot 10^{-19}:\\ \;\;\;\;x\_m\\ \mathbf{elif}\;z \leq 1.05 \cdot 10^{+66}:\\ \;\;\;\;x\_m \cdot \frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;x\_m\\ \end{array} \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 1 x)
(FPCore (x_s x_m y z)
 :precision binary64
 (* x_s (if (<= z -2.1e-19) x_m (if (<= z 1.05e+66) (* x_m (/ y z)) x_m))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
	double tmp;
	if (z <= -2.1e-19) {
		tmp = x_m;
	} else if (z <= 1.05e+66) {
		tmp = x_m * (y / z);
	} else {
		tmp = x_m;
	}
	return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
    real(8), intent (in) :: x_s
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (z <= (-2.1d-19)) then
        tmp = x_m
    else if (z <= 1.05d+66) then
        tmp = x_m * (y / z)
    else
        tmp = x_m
    end if
    code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
	double tmp;
	if (z <= -2.1e-19) {
		tmp = x_m;
	} else if (z <= 1.05e+66) {
		tmp = x_m * (y / z);
	} else {
		tmp = x_m;
	}
	return x_s * tmp;
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
def code(x_s, x_m, y, z):
	tmp = 0
	if z <= -2.1e-19:
		tmp = x_m
	elif z <= 1.05e+66:
		tmp = x_m * (y / z)
	else:
		tmp = x_m
	return x_s * tmp
x\_m = abs(x)
x\_s = copysign(1.0, x)
function code(x_s, x_m, y, z)
	tmp = 0.0
	if (z <= -2.1e-19)
		tmp = x_m;
	elseif (z <= 1.05e+66)
		tmp = Float64(x_m * Float64(y / z));
	else
		tmp = x_m;
	end
	return Float64(x_s * tmp)
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
function tmp_2 = code(x_s, x_m, y, z)
	tmp = 0.0;
	if (z <= -2.1e-19)
		tmp = x_m;
	elseif (z <= 1.05e+66)
		tmp = x_m * (y / z);
	else
		tmp = x_m;
	end
	tmp_2 = x_s * tmp;
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[LessEqual[z, -2.1e-19], x$95$m, If[LessEqual[z, 1.05e+66], N[(x$95$m * N[(y / z), $MachinePrecision]), $MachinePrecision], x$95$m]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)

\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -2.1 \cdot 10^{-19}:\\
\;\;\;\;x\_m\\

\mathbf{elif}\;z \leq 1.05 \cdot 10^{+66}:\\
\;\;\;\;x\_m \cdot \frac{y}{z}\\

\mathbf{else}:\\
\;\;\;\;x\_m\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -2.0999999999999999e-19 or 1.05000000000000003e66 < z

    1. Initial program 74.2%

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

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

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

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

    if -2.0999999999999999e-19 < z < 1.05000000000000003e66

    1. Initial program 90.2%

      \[\frac{x \cdot \left(y + z\right)}{z} \]
    2. Step-by-step derivation
      1. associate-/l*86.6%

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

      \[\leadsto \color{blue}{x \cdot \frac{y + z}{z}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around inf 78.2%

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

        \[\leadsto \color{blue}{x \cdot \frac{y}{z}} \]
    7. Simplified70.0%

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

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

Alternative 6: 73.0% accurate, 0.5× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ x\_s \cdot \begin{array}{l} \mathbf{if}\;z \leq -7.4 \cdot 10^{-19}:\\ \;\;\;\;x\_m\\ \mathbf{elif}\;z \leq 1.1 \cdot 10^{+66}:\\ \;\;\;\;y \cdot \frac{x\_m}{z}\\ \mathbf{else}:\\ \;\;\;\;x\_m\\ \end{array} \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 1 x)
(FPCore (x_s x_m y z)
 :precision binary64
 (* x_s (if (<= z -7.4e-19) x_m (if (<= z 1.1e+66) (* y (/ x_m z)) x_m))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
	double tmp;
	if (z <= -7.4e-19) {
		tmp = x_m;
	} else if (z <= 1.1e+66) {
		tmp = y * (x_m / z);
	} else {
		tmp = x_m;
	}
	return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
    real(8), intent (in) :: x_s
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (z <= (-7.4d-19)) then
        tmp = x_m
    else if (z <= 1.1d+66) then
        tmp = y * (x_m / z)
    else
        tmp = x_m
    end if
    code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
	double tmp;
	if (z <= -7.4e-19) {
		tmp = x_m;
	} else if (z <= 1.1e+66) {
		tmp = y * (x_m / z);
	} else {
		tmp = x_m;
	}
	return x_s * tmp;
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
def code(x_s, x_m, y, z):
	tmp = 0
	if z <= -7.4e-19:
		tmp = x_m
	elif z <= 1.1e+66:
		tmp = y * (x_m / z)
	else:
		tmp = x_m
	return x_s * tmp
x\_m = abs(x)
x\_s = copysign(1.0, x)
function code(x_s, x_m, y, z)
	tmp = 0.0
	if (z <= -7.4e-19)
		tmp = x_m;
	elseif (z <= 1.1e+66)
		tmp = Float64(y * Float64(x_m / z));
	else
		tmp = x_m;
	end
	return Float64(x_s * tmp)
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
function tmp_2 = code(x_s, x_m, y, z)
	tmp = 0.0;
	if (z <= -7.4e-19)
		tmp = x_m;
	elseif (z <= 1.1e+66)
		tmp = y * (x_m / z);
	else
		tmp = x_m;
	end
	tmp_2 = x_s * tmp;
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[LessEqual[z, -7.4e-19], x$95$m, If[LessEqual[z, 1.1e+66], N[(y * N[(x$95$m / z), $MachinePrecision]), $MachinePrecision], x$95$m]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)

\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -7.4 \cdot 10^{-19}:\\
\;\;\;\;x\_m\\

\mathbf{elif}\;z \leq 1.1 \cdot 10^{+66}:\\
\;\;\;\;y \cdot \frac{x\_m}{z}\\

\mathbf{else}:\\
\;\;\;\;x\_m\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -7.40000000000000011e-19 or 1.0999999999999999e66 < z

    1. Initial program 74.2%

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

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

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

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

    if -7.40000000000000011e-19 < z < 1.0999999999999999e66

    1. Initial program 90.2%

      \[\frac{x \cdot \left(y + z\right)}{z} \]
    2. Step-by-step derivation
      1. associate-/l*86.6%

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

      \[\leadsto \color{blue}{x \cdot \frac{y + z}{z}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around inf 78.2%

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

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

        \[\leadsto \color{blue}{y \cdot \frac{x}{z}} \]
    7. Applied egg-rr78.2%

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

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

Alternative 7: 73.1% accurate, 0.5× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ x\_s \cdot \begin{array}{l} \mathbf{if}\;z \leq -7.8 \cdot 10^{-19}:\\ \;\;\;\;x\_m\\ \mathbf{elif}\;z \leq 7.3 \cdot 10^{+62}:\\ \;\;\;\;\frac{y}{\frac{z}{x\_m}}\\ \mathbf{else}:\\ \;\;\;\;x\_m\\ \end{array} \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 1 x)
(FPCore (x_s x_m y z)
 :precision binary64
 (* x_s (if (<= z -7.8e-19) x_m (if (<= z 7.3e+62) (/ y (/ z x_m)) x_m))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
	double tmp;
	if (z <= -7.8e-19) {
		tmp = x_m;
	} else if (z <= 7.3e+62) {
		tmp = y / (z / x_m);
	} else {
		tmp = x_m;
	}
	return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
    real(8), intent (in) :: x_s
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (z <= (-7.8d-19)) then
        tmp = x_m
    else if (z <= 7.3d+62) then
        tmp = y / (z / x_m)
    else
        tmp = x_m
    end if
    code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
	double tmp;
	if (z <= -7.8e-19) {
		tmp = x_m;
	} else if (z <= 7.3e+62) {
		tmp = y / (z / x_m);
	} else {
		tmp = x_m;
	}
	return x_s * tmp;
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
def code(x_s, x_m, y, z):
	tmp = 0
	if z <= -7.8e-19:
		tmp = x_m
	elif z <= 7.3e+62:
		tmp = y / (z / x_m)
	else:
		tmp = x_m
	return x_s * tmp
x\_m = abs(x)
x\_s = copysign(1.0, x)
function code(x_s, x_m, y, z)
	tmp = 0.0
	if (z <= -7.8e-19)
		tmp = x_m;
	elseif (z <= 7.3e+62)
		tmp = Float64(y / Float64(z / x_m));
	else
		tmp = x_m;
	end
	return Float64(x_s * tmp)
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
function tmp_2 = code(x_s, x_m, y, z)
	tmp = 0.0;
	if (z <= -7.8e-19)
		tmp = x_m;
	elseif (z <= 7.3e+62)
		tmp = y / (z / x_m);
	else
		tmp = x_m;
	end
	tmp_2 = x_s * tmp;
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[LessEqual[z, -7.8e-19], x$95$m, If[LessEqual[z, 7.3e+62], N[(y / N[(z / x$95$m), $MachinePrecision]), $MachinePrecision], x$95$m]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)

\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -7.8 \cdot 10^{-19}:\\
\;\;\;\;x\_m\\

\mathbf{elif}\;z \leq 7.3 \cdot 10^{+62}:\\
\;\;\;\;\frac{y}{\frac{z}{x\_m}}\\

\mathbf{else}:\\
\;\;\;\;x\_m\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -7.7999999999999999e-19 or 7.2999999999999997e62 < z

    1. Initial program 74.2%

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

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

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

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

    if -7.7999999999999999e-19 < z < 7.2999999999999997e62

    1. Initial program 90.2%

      \[\frac{x \cdot \left(y + z\right)}{z} \]
    2. Step-by-step derivation
      1. associate-/l*86.6%

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

      \[\leadsto \color{blue}{x \cdot \frac{y + z}{z}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around inf 78.2%

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

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

        \[\leadsto \color{blue}{y \cdot \frac{x}{z}} \]
    7. Applied egg-rr78.2%

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

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

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

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

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

Alternative 8: 51.1% accurate, 7.0× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ x\_s \cdot x\_m \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 1 x)
(FPCore (x_s x_m y z) :precision binary64 (* x_s x_m))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
	return x_s * x_m;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
    real(8), intent (in) :: x_s
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = x_s * x_m
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
	return x_s * x_m;
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
def code(x_s, x_m, y, z):
	return x_s * x_m
x\_m = abs(x)
x\_s = copysign(1.0, x)
function code(x_s, x_m, y, z)
	return Float64(x_s * x_m)
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
function tmp = code(x_s, x_m, y, z)
	tmp = x_s * x_m;
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * x$95$m), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)

\\
x\_s \cdot x\_m
\end{array}
Derivation
  1. Initial program 82.7%

    \[\frac{x \cdot \left(y + z\right)}{z} \]
  2. Step-by-step derivation
    1. associate-/l*92.8%

      \[\leadsto \color{blue}{x \cdot \frac{y + z}{z}} \]
  3. Simplified92.8%

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

    \[\leadsto \color{blue}{x} \]
  6. Final simplification44.5%

    \[\leadsto x \]
  7. Add Preprocessing

Developer target: 96.4% accurate, 1.0× speedup?

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

\\
\frac{x}{\frac{z}{y + z}}
\end{array}

Reproduce

?
herbie shell --seed 2024096 
(FPCore (x y z)
  :name "Numeric.SpecFunctions:choose from math-functions-0.1.5.2"
  :precision binary64

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

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