Numeric.SpecFunctions:choose from math-functions-0.1.5.2

Percentage Accurate: 84.4% → 96.6%
Time: 6.5s
Alternatives: 7
Speedup: 1.1×

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 7 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: 84.4% 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: 96.6% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 2 \cdot 10^{-78}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y}{z}, x, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{x}{z}, y, x\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= y 2e-78) (fma (/ y z) x x) (fma (/ x z) y x)))
double code(double x, double y, double z) {
	double tmp;
	if (y <= 2e-78) {
		tmp = fma((y / z), x, x);
	} else {
		tmp = fma((x / z), y, x);
	}
	return tmp;
}
function code(x, y, z)
	tmp = 0.0
	if (y <= 2e-78)
		tmp = fma(Float64(y / z), x, x);
	else
		tmp = fma(Float64(x / z), y, x);
	end
	return tmp
end
code[x_, y_, z_] := If[LessEqual[y, 2e-78], N[(N[(y / z), $MachinePrecision] * x + x), $MachinePrecision], N[(N[(x / z), $MachinePrecision] * y + x), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq 2 \cdot 10^{-78}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{z}, x, x\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{z}, y, x\right)\\


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

    1. Initial program 82.2%

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

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

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

        \[\leadsto \color{blue}{\frac{y + z}{z} \cdot x} \]
      3. +-commutativeN/A

        \[\leadsto \frac{\color{blue}{z + y}}{z} \cdot x \]
      4. div-addN/A

        \[\leadsto \color{blue}{\left(\frac{z}{z} + \frac{y}{z}\right)} \cdot x \]
      5. *-inversesN/A

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

        \[\leadsto \color{blue}{\left(\frac{y}{z} + 1\right)} \cdot x \]
      7. distribute-lft1-inN/A

        \[\leadsto \color{blue}{\frac{y}{z} \cdot x + x} \]
      8. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y}{z}, x, x\right)} \]
      9. lower-/.f6498.3

        \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{y}{z}}, x, x\right) \]
    5. Applied rewrites98.3%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y}{z}, x, x\right)} \]

    if 2e-78 < y

    1. Initial program 89.3%

      \[\frac{x \cdot \left(y + z\right)}{z} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{x \cdot \left(y + z\right)}{z}} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{x \cdot \left(y + z\right)}}{z} \]
      3. lift-+.f64N/A

        \[\leadsto \frac{x \cdot \color{blue}{\left(y + z\right)}}{z} \]
      4. +-commutativeN/A

        \[\leadsto \frac{x \cdot \color{blue}{\left(z + y\right)}}{z} \]
      5. distribute-rgt-inN/A

        \[\leadsto \frac{\color{blue}{z \cdot x + y \cdot x}}{z} \]
      6. div-addN/A

        \[\leadsto \color{blue}{\frac{z \cdot x}{z} + \frac{y \cdot x}{z}} \]
      7. frac-addN/A

        \[\leadsto \color{blue}{\frac{\left(z \cdot x\right) \cdot z + z \cdot \left(y \cdot x\right)}{z \cdot z}} \]
      8. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{\left(z \cdot x\right) \cdot z + z \cdot \left(y \cdot x\right)}{z \cdot z}} \]
      9. lower-fma.f64N/A

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(z \cdot x, z, z \cdot \left(y \cdot x\right)\right)}}{z \cdot z} \]
      10. lower-*.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{z \cdot x}, z, z \cdot \left(y \cdot x\right)\right)}{z \cdot z} \]
      11. lower-*.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(z \cdot x, z, \color{blue}{z \cdot \left(y \cdot x\right)}\right)}{z \cdot z} \]
      12. lower-*.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(z \cdot x, z, z \cdot \color{blue}{\left(y \cdot x\right)}\right)}{z \cdot z} \]
      13. lower-*.f6460.5

        \[\leadsto \frac{\mathsf{fma}\left(z \cdot x, z, z \cdot \left(y \cdot x\right)\right)}{\color{blue}{z \cdot z}} \]
    4. Applied rewrites60.5%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(z \cdot x, z, z \cdot \left(y \cdot x\right)\right)}{z \cdot z}} \]
    5. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\frac{x \cdot \left(y \cdot z + {z}^{2}\right)}{{z}^{2}}} \]
    6. Step-by-step derivation
      1. associate-/l*N/A

        \[\leadsto \color{blue}{x \cdot \frac{y \cdot z + {z}^{2}}{{z}^{2}}} \]
      2. unpow2N/A

        \[\leadsto x \cdot \frac{y \cdot z + \color{blue}{z \cdot z}}{{z}^{2}} \]
      3. distribute-rgt-outN/A

        \[\leadsto x \cdot \frac{\color{blue}{z \cdot \left(y + z\right)}}{{z}^{2}} \]
      4. unpow2N/A

        \[\leadsto x \cdot \frac{z \cdot \left(y + z\right)}{\color{blue}{z \cdot z}} \]
      5. times-fracN/A

        \[\leadsto x \cdot \color{blue}{\left(\frac{z}{z} \cdot \frac{y + z}{z}\right)} \]
      6. *-inversesN/A

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

        \[\leadsto \color{blue}{\left(x \cdot 1\right) \cdot \frac{y + z}{z}} \]
      8. *-rgt-identityN/A

        \[\leadsto \color{blue}{x} \cdot \frac{y + z}{z} \]
      9. div-addN/A

        \[\leadsto x \cdot \color{blue}{\left(\frac{y}{z} + \frac{z}{z}\right)} \]
      10. distribute-lft-inN/A

        \[\leadsto \color{blue}{x \cdot \frac{y}{z} + x \cdot \frac{z}{z}} \]
      11. *-inversesN/A

        \[\leadsto x \cdot \frac{y}{z} + x \cdot \color{blue}{1} \]
      12. associate-/l*N/A

        \[\leadsto \color{blue}{\frac{x \cdot y}{z}} + x \cdot 1 \]
      13. associate-*l/N/A

        \[\leadsto \color{blue}{\frac{x}{z} \cdot y} + x \cdot 1 \]
      14. *-rgt-identityN/A

        \[\leadsto \frac{x}{z} \cdot y + \color{blue}{x} \]
      15. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{x}{z}, y, x\right)} \]
      16. lower-/.f6498.6

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{x}{z}, y, x\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification98.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 2 \cdot 10^{-78}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y}{z}, x, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{x}{z}, y, x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 50.8% accurate, 0.3× speedup?

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

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

\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+296}:\\
\;\;\;\;\frac{z \cdot x}{z}\\

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


\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 82.1%

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

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

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

        \[\leadsto \color{blue}{\frac{y + z}{z} \cdot x} \]
      3. +-commutativeN/A

        \[\leadsto \frac{\color{blue}{z + y}}{z} \cdot x \]
      4. div-addN/A

        \[\leadsto \color{blue}{\left(\frac{z}{z} + \frac{y}{z}\right)} \cdot x \]
      5. *-inversesN/A

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

        \[\leadsto \color{blue}{\left(\frac{y}{z} + 1\right)} \cdot x \]
      7. distribute-lft1-inN/A

        \[\leadsto \color{blue}{\frac{y}{z} \cdot x + x} \]
      8. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y}{z}, x, x\right)} \]
      9. lower-/.f6495.6

        \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{y}{z}}, x, x\right) \]
    5. Applied rewrites95.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y}{z}, x, x\right)} \]
    6. Taylor expanded in y around inf

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

        \[\leadsto \color{blue}{\frac{x}{z} \cdot y} \]
      2. lower-*.f64N/A

        \[\leadsto \color{blue}{\frac{x}{z} \cdot y} \]
      3. lower-/.f6450.3

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

      \[\leadsto \color{blue}{\frac{x}{z} \cdot y} \]
    9. Step-by-step derivation
      1. Applied rewrites48.5%

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

      if 0.0 < (/.f64 (*.f64 x (+.f64 y z)) z) < 1.99999999999999996e296

      1. Initial program 98.9%

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

        \[\leadsto \frac{\color{blue}{x \cdot z}}{z} \]
      4. Step-by-step derivation
        1. *-commutativeN/A

          \[\leadsto \frac{\color{blue}{z \cdot x}}{z} \]
        2. lower-*.f6462.6

          \[\leadsto \frac{\color{blue}{z \cdot x}}{z} \]
      5. Applied rewrites62.6%

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

      if 1.99999999999999996e296 < (/.f64 (*.f64 x (+.f64 y z)) z)

      1. Initial program 61.7%

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

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

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

          \[\leadsto \color{blue}{\frac{y + z}{z} \cdot x} \]
        3. +-commutativeN/A

          \[\leadsto \frac{\color{blue}{z + y}}{z} \cdot x \]
        4. div-addN/A

          \[\leadsto \color{blue}{\left(\frac{z}{z} + \frac{y}{z}\right)} \cdot x \]
        5. *-inversesN/A

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

          \[\leadsto \color{blue}{\left(\frac{y}{z} + 1\right)} \cdot x \]
        7. distribute-lft1-inN/A

          \[\leadsto \color{blue}{\frac{y}{z} \cdot x + x} \]
        8. lower-fma.f64N/A

          \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y}{z}, x, x\right)} \]
        9. lower-/.f64100.0

          \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{y}{z}}, x, x\right) \]
      5. Applied rewrites100.0%

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

          \[\leadsto z \cdot \color{blue}{\mathsf{fma}\left(\frac{x}{z}, \frac{y}{z}, 1 \cdot \frac{x}{z}\right)} \]
        2. Taylor expanded in y around inf

          \[\leadsto z \cdot \frac{x \cdot y}{\color{blue}{{z}^{2}}} \]
        3. Step-by-step derivation
          1. Applied rewrites60.0%

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

            \[\leadsto z \cdot \frac{x}{\color{blue}{z}} \]
          3. Step-by-step derivation
            1. Applied rewrites42.5%

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

          Alternative 3: 65.1% accurate, 0.7× speedup?

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

            1. Initial program 88.9%

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

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

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

                \[\leadsto \color{blue}{\frac{y + z}{z} \cdot x} \]
              3. +-commutativeN/A

                \[\leadsto \frac{\color{blue}{z + y}}{z} \cdot x \]
              4. div-addN/A

                \[\leadsto \color{blue}{\left(\frac{z}{z} + \frac{y}{z}\right)} \cdot x \]
              5. *-inversesN/A

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

                \[\leadsto \color{blue}{\left(\frac{y}{z} + 1\right)} \cdot x \]
              7. distribute-lft1-inN/A

                \[\leadsto \color{blue}{\frac{y}{z} \cdot x + x} \]
              8. lower-fma.f64N/A

                \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y}{z}, x, x\right)} \]
              9. lower-/.f6493.0

                \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{y}{z}}, x, x\right) \]
            5. Applied rewrites93.0%

              \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y}{z}, x, x\right)} \]
            6. Taylor expanded in y around inf

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

                \[\leadsto \color{blue}{\frac{x}{z} \cdot y} \]
              2. lower-*.f64N/A

                \[\leadsto \color{blue}{\frac{x}{z} \cdot y} \]
              3. lower-/.f6469.6

                \[\leadsto \color{blue}{\frac{x}{z}} \cdot y \]
            8. Applied rewrites69.6%

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

            if -4.50000000000000025e-126 < y < 7.8000000000000002e48

            1. Initial program 79.1%

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

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

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

                \[\leadsto \color{blue}{\frac{y + z}{z} \cdot x} \]
              3. +-commutativeN/A

                \[\leadsto \frac{\color{blue}{z + y}}{z} \cdot x \]
              4. div-addN/A

                \[\leadsto \color{blue}{\left(\frac{z}{z} + \frac{y}{z}\right)} \cdot x \]
              5. *-inversesN/A

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

                \[\leadsto \color{blue}{\left(\frac{y}{z} + 1\right)} \cdot x \]
              7. distribute-lft1-inN/A

                \[\leadsto \color{blue}{\frac{y}{z} \cdot x + x} \]
              8. lower-fma.f64N/A

                \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y}{z}, x, x\right)} \]
              9. lower-/.f6499.9

                \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{y}{z}}, x, x\right) \]
            5. Applied rewrites99.9%

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

                \[\leadsto z \cdot \color{blue}{\mathsf{fma}\left(\frac{x}{z}, \frac{y}{z}, 1 \cdot \frac{x}{z}\right)} \]
              2. Taylor expanded in y around inf

                \[\leadsto z \cdot \frac{x \cdot y}{\color{blue}{{z}^{2}}} \]
              3. Step-by-step derivation
                1. Applied rewrites15.3%

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

                  \[\leadsto z \cdot \frac{x}{\color{blue}{z}} \]
                3. Step-by-step derivation
                  1. Applied rewrites69.3%

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

                  \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -4.5 \cdot 10^{-126} \lor \neg \left(y \leq 7.8 \cdot 10^{+48}\right):\\ \;\;\;\;\frac{x}{z} \cdot y\\ \mathbf{else}:\\ \;\;\;\;z \cdot \frac{x}{z}\\ \end{array} \]
                6. Add Preprocessing

                Alternative 4: 65.8% accurate, 0.7× speedup?

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

                  1. Initial program 88.3%

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

                    \[\leadsto \frac{\color{blue}{x \cdot y}}{z} \]
                  4. Step-by-step derivation
                    1. *-commutativeN/A

                      \[\leadsto \frac{\color{blue}{y \cdot x}}{z} \]
                    2. lower-*.f6472.9

                      \[\leadsto \frac{\color{blue}{y \cdot x}}{z} \]
                  5. Applied rewrites72.9%

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

                  if -2e-78 < y < 7.8000000000000002e48

                  1. Initial program 78.6%

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

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

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

                      \[\leadsto \color{blue}{\frac{y + z}{z} \cdot x} \]
                    3. +-commutativeN/A

                      \[\leadsto \frac{\color{blue}{z + y}}{z} \cdot x \]
                    4. div-addN/A

                      \[\leadsto \color{blue}{\left(\frac{z}{z} + \frac{y}{z}\right)} \cdot x \]
                    5. *-inversesN/A

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

                      \[\leadsto \color{blue}{\left(\frac{y}{z} + 1\right)} \cdot x \]
                    7. distribute-lft1-inN/A

                      \[\leadsto \color{blue}{\frac{y}{z} \cdot x + x} \]
                    8. lower-fma.f64N/A

                      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y}{z}, x, x\right)} \]
                    9. lower-/.f6499.9

                      \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{y}{z}}, x, x\right) \]
                  5. Applied rewrites99.9%

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

                      \[\leadsto z \cdot \color{blue}{\mathsf{fma}\left(\frac{x}{z}, \frac{y}{z}, 1 \cdot \frac{x}{z}\right)} \]
                    2. Taylor expanded in y around inf

                      \[\leadsto z \cdot \frac{x \cdot y}{\color{blue}{{z}^{2}}} \]
                    3. Step-by-step derivation
                      1. Applied rewrites15.6%

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

                        \[\leadsto z \cdot \frac{x}{\color{blue}{z}} \]
                      3. Step-by-step derivation
                        1. Applied rewrites67.7%

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

                        if 7.8000000000000002e48 < y

                        1. Initial program 92.3%

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

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

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

                            \[\leadsto \color{blue}{\frac{y + z}{z} \cdot x} \]
                          3. +-commutativeN/A

                            \[\leadsto \frac{\color{blue}{z + y}}{z} \cdot x \]
                          4. div-addN/A

                            \[\leadsto \color{blue}{\left(\frac{z}{z} + \frac{y}{z}\right)} \cdot x \]
                          5. *-inversesN/A

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

                            \[\leadsto \color{blue}{\left(\frac{y}{z} + 1\right)} \cdot x \]
                          7. distribute-lft1-inN/A

                            \[\leadsto \color{blue}{\frac{y}{z} \cdot x + x} \]
                          8. lower-fma.f64N/A

                            \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y}{z}, x, x\right)} \]
                          9. lower-/.f6486.5

                            \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{y}{z}}, x, x\right) \]
                        5. Applied rewrites86.5%

                          \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y}{z}, x, x\right)} \]
                        6. Taylor expanded in y around inf

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

                            \[\leadsto \color{blue}{\frac{x}{z} \cdot y} \]
                          2. lower-*.f64N/A

                            \[\leadsto \color{blue}{\frac{x}{z} \cdot y} \]
                          3. lower-/.f6470.9

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

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

                      Alternative 5: 64.2% accurate, 0.7× speedup?

                      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -4 \cdot 10^{-126}:\\ \;\;\;\;\frac{y}{z} \cdot x\\ \mathbf{elif}\;y \leq 7.8 \cdot 10^{+48}:\\ \;\;\;\;z \cdot \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z} \cdot y\\ \end{array} \end{array} \]
                      (FPCore (x y z)
                       :precision binary64
                       (if (<= y -4e-126)
                         (* (/ y z) x)
                         (if (<= y 7.8e+48) (* z (/ x z)) (* (/ x z) y))))
                      double code(double x, double y, double z) {
                      	double tmp;
                      	if (y <= -4e-126) {
                      		tmp = (y / z) * x;
                      	} else if (y <= 7.8e+48) {
                      		tmp = z * (x / z);
                      	} else {
                      		tmp = (x / z) * 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 <= (-4d-126)) then
                              tmp = (y / z) * x
                          else if (y <= 7.8d+48) then
                              tmp = z * (x / z)
                          else
                              tmp = (x / z) * y
                          end if
                          code = tmp
                      end function
                      
                      public static double code(double x, double y, double z) {
                      	double tmp;
                      	if (y <= -4e-126) {
                      		tmp = (y / z) * x;
                      	} else if (y <= 7.8e+48) {
                      		tmp = z * (x / z);
                      	} else {
                      		tmp = (x / z) * y;
                      	}
                      	return tmp;
                      }
                      
                      def code(x, y, z):
                      	tmp = 0
                      	if y <= -4e-126:
                      		tmp = (y / z) * x
                      	elif y <= 7.8e+48:
                      		tmp = z * (x / z)
                      	else:
                      		tmp = (x / z) * y
                      	return tmp
                      
                      function code(x, y, z)
                      	tmp = 0.0
                      	if (y <= -4e-126)
                      		tmp = Float64(Float64(y / z) * x);
                      	elseif (y <= 7.8e+48)
                      		tmp = Float64(z * Float64(x / z));
                      	else
                      		tmp = Float64(Float64(x / z) * y);
                      	end
                      	return tmp
                      end
                      
                      function tmp_2 = code(x, y, z)
                      	tmp = 0.0;
                      	if (y <= -4e-126)
                      		tmp = (y / z) * x;
                      	elseif (y <= 7.8e+48)
                      		tmp = z * (x / z);
                      	else
                      		tmp = (x / z) * y;
                      	end
                      	tmp_2 = tmp;
                      end
                      
                      code[x_, y_, z_] := If[LessEqual[y, -4e-126], N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[y, 7.8e+48], N[(z * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(N[(x / z), $MachinePrecision] * y), $MachinePrecision]]]
                      
                      \begin{array}{l}
                      
                      \\
                      \begin{array}{l}
                      \mathbf{if}\;y \leq -4 \cdot 10^{-126}:\\
                      \;\;\;\;\frac{y}{z} \cdot x\\
                      
                      \mathbf{elif}\;y \leq 7.8 \cdot 10^{+48}:\\
                      \;\;\;\;z \cdot \frac{x}{z}\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;\frac{x}{z} \cdot y\\
                      
                      
                      \end{array}
                      \end{array}
                      
                      Derivation
                      1. Split input into 3 regimes
                      2. if y < -3.9999999999999998e-126

                        1. Initial program 86.9%

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

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

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

                            \[\leadsto \color{blue}{\frac{y + z}{z} \cdot x} \]
                          3. +-commutativeN/A

                            \[\leadsto \frac{\color{blue}{z + y}}{z} \cdot x \]
                          4. div-addN/A

                            \[\leadsto \color{blue}{\left(\frac{z}{z} + \frac{y}{z}\right)} \cdot x \]
                          5. *-inversesN/A

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

                            \[\leadsto \color{blue}{\left(\frac{y}{z} + 1\right)} \cdot x \]
                          7. distribute-lft1-inN/A

                            \[\leadsto \color{blue}{\frac{y}{z} \cdot x + x} \]
                          8. lower-fma.f64N/A

                            \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y}{z}, x, x\right)} \]
                          9. lower-/.f6496.7

                            \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{y}{z}}, x, x\right) \]
                        5. Applied rewrites96.7%

                          \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y}{z}, x, x\right)} \]
                        6. Taylor expanded in y around inf

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

                            \[\leadsto \color{blue}{\frac{x}{z} \cdot y} \]
                          2. lower-*.f64N/A

                            \[\leadsto \color{blue}{\frac{x}{z} \cdot y} \]
                          3. lower-/.f6468.9

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

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

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

                          if -3.9999999999999998e-126 < y < 7.8000000000000002e48

                          1. Initial program 79.1%

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

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

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

                              \[\leadsto \color{blue}{\frac{y + z}{z} \cdot x} \]
                            3. +-commutativeN/A

                              \[\leadsto \frac{\color{blue}{z + y}}{z} \cdot x \]
                            4. div-addN/A

                              \[\leadsto \color{blue}{\left(\frac{z}{z} + \frac{y}{z}\right)} \cdot x \]
                            5. *-inversesN/A

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

                              \[\leadsto \color{blue}{\left(\frac{y}{z} + 1\right)} \cdot x \]
                            7. distribute-lft1-inN/A

                              \[\leadsto \color{blue}{\frac{y}{z} \cdot x + x} \]
                            8. lower-fma.f64N/A

                              \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y}{z}, x, x\right)} \]
                            9. lower-/.f6499.9

                              \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{y}{z}}, x, x\right) \]
                          5. Applied rewrites99.9%

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

                              \[\leadsto z \cdot \color{blue}{\mathsf{fma}\left(\frac{x}{z}, \frac{y}{z}, 1 \cdot \frac{x}{z}\right)} \]
                            2. Taylor expanded in y around inf

                              \[\leadsto z \cdot \frac{x \cdot y}{\color{blue}{{z}^{2}}} \]
                            3. Step-by-step derivation
                              1. Applied rewrites15.3%

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

                                \[\leadsto z \cdot \frac{x}{\color{blue}{z}} \]
                              3. Step-by-step derivation
                                1. Applied rewrites69.3%

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

                                if 7.8000000000000002e48 < y

                                1. Initial program 92.3%

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

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

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

                                    \[\leadsto \color{blue}{\frac{y + z}{z} \cdot x} \]
                                  3. +-commutativeN/A

                                    \[\leadsto \frac{\color{blue}{z + y}}{z} \cdot x \]
                                  4. div-addN/A

                                    \[\leadsto \color{blue}{\left(\frac{z}{z} + \frac{y}{z}\right)} \cdot x \]
                                  5. *-inversesN/A

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

                                    \[\leadsto \color{blue}{\left(\frac{y}{z} + 1\right)} \cdot x \]
                                  7. distribute-lft1-inN/A

                                    \[\leadsto \color{blue}{\frac{y}{z} \cdot x + x} \]
                                  8. lower-fma.f64N/A

                                    \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y}{z}, x, x\right)} \]
                                  9. lower-/.f6486.5

                                    \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{y}{z}}, x, x\right) \]
                                5. Applied rewrites86.5%

                                  \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y}{z}, x, x\right)} \]
                                6. Taylor expanded in y around inf

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

                                    \[\leadsto \color{blue}{\frac{x}{z} \cdot y} \]
                                  2. lower-*.f64N/A

                                    \[\leadsto \color{blue}{\frac{x}{z} \cdot y} \]
                                  3. lower-/.f6470.9

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

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

                              Alternative 6: 96.0% accurate, 1.1× speedup?

                              \[\begin{array}{l} \\ \mathsf{fma}\left(\frac{y}{z}, x, x\right) \end{array} \]
                              (FPCore (x y z) :precision binary64 (fma (/ y z) x x))
                              double code(double x, double y, double z) {
                              	return fma((y / z), x, x);
                              }
                              
                              function code(x, y, z)
                              	return fma(Float64(y / z), x, x)
                              end
                              
                              code[x_, y_, z_] := N[(N[(y / z), $MachinePrecision] * x + x), $MachinePrecision]
                              
                              \begin{array}{l}
                              
                              \\
                              \mathsf{fma}\left(\frac{y}{z}, x, x\right)
                              \end{array}
                              
                              Derivation
                              1. Initial program 84.4%

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

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

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

                                  \[\leadsto \color{blue}{\frac{y + z}{z} \cdot x} \]
                                3. +-commutativeN/A

                                  \[\leadsto \frac{\color{blue}{z + y}}{z} \cdot x \]
                                4. div-addN/A

                                  \[\leadsto \color{blue}{\left(\frac{z}{z} + \frac{y}{z}\right)} \cdot x \]
                                5. *-inversesN/A

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

                                  \[\leadsto \color{blue}{\left(\frac{y}{z} + 1\right)} \cdot x \]
                                7. distribute-lft1-inN/A

                                  \[\leadsto \color{blue}{\frac{y}{z} \cdot x + x} \]
                                8. lower-fma.f64N/A

                                  \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y}{z}, x, x\right)} \]
                                9. lower-/.f6496.2

                                  \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{y}{z}}, x, x\right) \]
                              5. Applied rewrites96.2%

                                \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y}{z}, x, x\right)} \]
                              6. Add Preprocessing

                              Alternative 7: 43.8% accurate, 1.2× speedup?

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

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

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

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

                                  \[\leadsto \color{blue}{\frac{y + z}{z} \cdot x} \]
                                3. +-commutativeN/A

                                  \[\leadsto \frac{\color{blue}{z + y}}{z} \cdot x \]
                                4. div-addN/A

                                  \[\leadsto \color{blue}{\left(\frac{z}{z} + \frac{y}{z}\right)} \cdot x \]
                                5. *-inversesN/A

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

                                  \[\leadsto \color{blue}{\left(\frac{y}{z} + 1\right)} \cdot x \]
                                7. distribute-lft1-inN/A

                                  \[\leadsto \color{blue}{\frac{y}{z} \cdot x + x} \]
                                8. lower-fma.f64N/A

                                  \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y}{z}, x, x\right)} \]
                                9. lower-/.f6496.2

                                  \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{y}{z}}, x, x\right) \]
                              5. Applied rewrites96.2%

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

                                  \[\leadsto z \cdot \color{blue}{\mathsf{fma}\left(\frac{x}{z}, \frac{y}{z}, 1 \cdot \frac{x}{z}\right)} \]
                                2. Taylor expanded in y around inf

                                  \[\leadsto z \cdot \frac{x \cdot y}{\color{blue}{{z}^{2}}} \]
                                3. Step-by-step derivation
                                  1. Applied rewrites36.7%

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

                                    \[\leadsto z \cdot \frac{x}{\color{blue}{z}} \]
                                  3. Step-by-step derivation
                                    1. Applied rewrites43.5%

                                      \[\leadsto z \cdot \frac{x}{\color{blue}{z}} \]
                                    2. Add Preprocessing

                                    Developer Target 1: 96.3% accurate, 0.8× 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 2024329 
                                    (FPCore (x y z)
                                      :name "Numeric.SpecFunctions:choose from math-functions-0.1.5.2"
                                      :precision binary64
                                    
                                      :alt
                                      (! :herbie-platform default (/ x (/ z (+ y z))))
                                    
                                      (/ (* x (+ y z)) z))