Graphics.Rasterific.Svg.PathConverter:arcToSegments from rasterific-svg-0.2.3.1

Percentage Accurate: 67.2% → 98.8%
Time: 13.0s
Alternatives: 6
Speedup: 1.0×

Specification

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

\\
\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t}
\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 6 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: 67.2% accurate, 1.0× speedup?

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

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

Alternative 1: 98.8% accurate, 0.1× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ \begin{array}{l} \mathbf{if}\;\frac{z\_m \cdot z\_m}{t \cdot t} \leq 10^{+292}:\\ \;\;\;\;z\_m \cdot \frac{\frac{z\_m}{t}}{t} + \frac{\frac{x}{y}}{\frac{y}{x}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot \frac{x}{y}}{y} + \frac{z\_m}{t} \cdot \left(\sqrt{z\_m} \cdot \frac{\sqrt{z\_m}}{t}\right)\\ \end{array} \end{array} \]
z_m = (fabs.f64 z)
(FPCore (x y z_m t)
 :precision binary64
 (if (<= (/ (* z_m z_m) (* t t)) 1e+292)
   (+ (* z_m (/ (/ z_m t) t)) (/ (/ x y) (/ y x)))
   (+ (/ (* x (/ x y)) y) (* (/ z_m t) (* (sqrt z_m) (/ (sqrt z_m) t))))))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
	double tmp;
	if (((z_m * z_m) / (t * t)) <= 1e+292) {
		tmp = (z_m * ((z_m / t) / t)) + ((x / y) / (y / x));
	} else {
		tmp = ((x * (x / y)) / y) + ((z_m / t) * (sqrt(z_m) * (sqrt(z_m) / t)));
	}
	return tmp;
}
z_m = abs(z)
real(8) function code(x, y, z_m, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z_m
    real(8), intent (in) :: t
    real(8) :: tmp
    if (((z_m * z_m) / (t * t)) <= 1d+292) then
        tmp = (z_m * ((z_m / t) / t)) + ((x / y) / (y / x))
    else
        tmp = ((x * (x / y)) / y) + ((z_m / t) * (sqrt(z_m) * (sqrt(z_m) / t)))
    end if
    code = tmp
end function
z_m = Math.abs(z);
public static double code(double x, double y, double z_m, double t) {
	double tmp;
	if (((z_m * z_m) / (t * t)) <= 1e+292) {
		tmp = (z_m * ((z_m / t) / t)) + ((x / y) / (y / x));
	} else {
		tmp = ((x * (x / y)) / y) + ((z_m / t) * (Math.sqrt(z_m) * (Math.sqrt(z_m) / t)));
	}
	return tmp;
}
z_m = math.fabs(z)
def code(x, y, z_m, t):
	tmp = 0
	if ((z_m * z_m) / (t * t)) <= 1e+292:
		tmp = (z_m * ((z_m / t) / t)) + ((x / y) / (y / x))
	else:
		tmp = ((x * (x / y)) / y) + ((z_m / t) * (math.sqrt(z_m) * (math.sqrt(z_m) / t)))
	return tmp
z_m = abs(z)
function code(x, y, z_m, t)
	tmp = 0.0
	if (Float64(Float64(z_m * z_m) / Float64(t * t)) <= 1e+292)
		tmp = Float64(Float64(z_m * Float64(Float64(z_m / t) / t)) + Float64(Float64(x / y) / Float64(y / x)));
	else
		tmp = Float64(Float64(Float64(x * Float64(x / y)) / y) + Float64(Float64(z_m / t) * Float64(sqrt(z_m) * Float64(sqrt(z_m) / t))));
	end
	return tmp
end
z_m = abs(z);
function tmp_2 = code(x, y, z_m, t)
	tmp = 0.0;
	if (((z_m * z_m) / (t * t)) <= 1e+292)
		tmp = (z_m * ((z_m / t) / t)) + ((x / y) / (y / x));
	else
		tmp = ((x * (x / y)) / y) + ((z_m / t) * (sqrt(z_m) * (sqrt(z_m) / t)));
	end
	tmp_2 = tmp;
end
z_m = N[Abs[z], $MachinePrecision]
code[x_, y_, z$95$m_, t_] := If[LessEqual[N[(N[(z$95$m * z$95$m), $MachinePrecision] / N[(t * t), $MachinePrecision]), $MachinePrecision], 1e+292], N[(N[(z$95$m * N[(N[(z$95$m / t), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] + N[(N[(x / y), $MachinePrecision] / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * N[(x / y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision] + N[(N[(z$95$m / t), $MachinePrecision] * N[(N[Sqrt[z$95$m], $MachinePrecision] * N[(N[Sqrt[z$95$m], $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|

\\
\begin{array}{l}
\mathbf{if}\;\frac{z\_m \cdot z\_m}{t \cdot t} \leq 10^{+292}:\\
\;\;\;\;z\_m \cdot \frac{\frac{z\_m}{t}}{t} + \frac{\frac{x}{y}}{\frac{y}{x}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (*.f64 z z) (*.f64 t t)) < 1e292

    1. Initial program 73.5%

      \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
    2. Step-by-step derivation
      1. associate-/l*79.1%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, \frac{x}{y \cdot y}, \frac{z \cdot z}{t \cdot t}\right)} \]
      3. associate-/l*81.7%

        \[\leadsto \mathsf{fma}\left(x, \frac{x}{y \cdot y}, \color{blue}{z \cdot \frac{z}{t \cdot t}}\right) \]
    3. Simplified81.7%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, \frac{x}{y \cdot y}, z \cdot \frac{z}{t \cdot t}\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-undefine81.7%

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

        \[\leadsto \color{blue}{\frac{x \cdot x}{y \cdot y}} + z \cdot \frac{z}{t \cdot t} \]
      3. +-commutative75.9%

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

        \[\leadsto z \cdot \color{blue}{\frac{\frac{z}{t}}{t}} + \frac{x \cdot x}{y \cdot y} \]
      5. associate-/l*84.4%

        \[\leadsto z \cdot \frac{\frac{z}{t}}{t} + \color{blue}{x \cdot \frac{x}{y \cdot y}} \]
    6. Applied egg-rr84.4%

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

        \[\leadsto z \cdot \frac{\frac{z}{t}}{t} + \color{blue}{\frac{x \cdot x}{y \cdot y}} \]
      2. frac-times99.6%

        \[\leadsto z \cdot \frac{\frac{z}{t}}{t} + \color{blue}{\frac{x}{y} \cdot \frac{x}{y}} \]
      3. clear-num99.6%

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

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

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

    if 1e292 < (/.f64 (*.f64 z z) (*.f64 t t))

    1. Initial program 55.3%

      \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-sqr-sqrt55.3%

        \[\leadsto \frac{x \cdot x}{y \cdot y} + \color{blue}{\sqrt{\frac{z \cdot z}{t \cdot t}} \cdot \sqrt{\frac{z \cdot z}{t \cdot t}}} \]
      2. associate-*r/55.3%

        \[\leadsto \frac{x \cdot x}{y \cdot y} + \sqrt{\color{blue}{z \cdot \frac{z}{t \cdot t}}} \cdot \sqrt{\frac{z \cdot z}{t \cdot t}} \]
      3. times-frac69.5%

        \[\leadsto \frac{x \cdot x}{y \cdot y} + \sqrt{z \cdot \frac{z}{t \cdot t}} \cdot \sqrt{\color{blue}{\frac{z}{t} \cdot \frac{z}{t}}} \]
      4. sqrt-prod36.8%

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

        \[\leadsto \frac{x \cdot x}{y \cdot y} + \sqrt{z \cdot \frac{z}{t \cdot t}} \cdot \color{blue}{\frac{z}{t}} \]
      6. associate-*r/38.9%

        \[\leadsto \frac{x \cdot x}{y \cdot y} + \color{blue}{\frac{\sqrt{z \cdot \frac{z}{t \cdot t}} \cdot z}{t}} \]
      7. associate-*r/28.9%

        \[\leadsto \frac{x \cdot x}{y \cdot y} + \frac{\sqrt{\color{blue}{\frac{z \cdot z}{t \cdot t}}} \cdot z}{t} \]
      8. times-frac49.9%

        \[\leadsto \frac{x \cdot x}{y \cdot y} + \frac{\sqrt{\color{blue}{\frac{z}{t} \cdot \frac{z}{t}}} \cdot z}{t} \]
      9. sqrt-prod43.5%

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

        \[\leadsto \frac{x \cdot x}{y \cdot y} + \frac{\color{blue}{\frac{z}{t}} \cdot z}{t} \]
    4. Applied egg-rr82.0%

      \[\leadsto \frac{x \cdot x}{y \cdot y} + \color{blue}{\frac{\frac{z}{t} \cdot z}{t}} \]
    5. Step-by-step derivation
      1. add-sqr-sqrt81.9%

        \[\leadsto \color{blue}{\sqrt{\frac{x \cdot x}{y \cdot y}} \cdot \sqrt{\frac{x \cdot x}{y \cdot y}}} + \frac{\frac{z}{t} \cdot z}{t} \]
      2. times-frac81.9%

        \[\leadsto \sqrt{\frac{x \cdot x}{y \cdot y}} \cdot \sqrt{\color{blue}{\frac{x}{y} \cdot \frac{x}{y}}} + \frac{\frac{z}{t} \cdot z}{t} \]
      3. sqrt-prod48.8%

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

        \[\leadsto \sqrt{\frac{x \cdot x}{y \cdot y}} \cdot \color{blue}{\frac{x}{y}} + \frac{\frac{z}{t} \cdot z}{t} \]
      5. associate-*r/66.3%

        \[\leadsto \color{blue}{\frac{\sqrt{\frac{x \cdot x}{y \cdot y}} \cdot x}{y}} + \frac{\frac{z}{t} \cdot z}{t} \]
      6. times-frac79.8%

        \[\leadsto \frac{\sqrt{\color{blue}{\frac{x}{y} \cdot \frac{x}{y}}} \cdot x}{y} + \frac{\frac{z}{t} \cdot z}{t} \]
      7. sqrt-prod56.2%

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

        \[\leadsto \frac{\color{blue}{\frac{x}{y}} \cdot x}{y} + \frac{\frac{z}{t} \cdot z}{t} \]
    6. Applied egg-rr97.2%

      \[\leadsto \color{blue}{\frac{\frac{x}{y} \cdot x}{y}} + \frac{\frac{z}{t} \cdot z}{t} \]
    7. Step-by-step derivation
      1. *-commutative97.2%

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

        \[\leadsto \frac{\frac{x}{y} \cdot x}{y} + \color{blue}{z \cdot \frac{\frac{z}{t}}{t}} \]
      3. add-sqr-sqrt92.3%

        \[\leadsto \frac{\frac{x}{y} \cdot x}{y} + \color{blue}{\sqrt{z \cdot \frac{\frac{z}{t}}{t}} \cdot \sqrt{z \cdot \frac{\frac{z}{t}}{t}}} \]
      4. sqrt-prod88.3%

        \[\leadsto \frac{\frac{x}{y} \cdot x}{y} + \color{blue}{\sqrt{\left(z \cdot \frac{\frac{z}{t}}{t}\right) \cdot \left(z \cdot \frac{\frac{z}{t}}{t}\right)}} \]
      5. associate-*r*85.8%

        \[\leadsto \frac{\frac{x}{y} \cdot x}{y} + \sqrt{\color{blue}{z \cdot \left(\frac{\frac{z}{t}}{t} \cdot \left(z \cdot \frac{\frac{z}{t}}{t}\right)\right)}} \]
      6. *-commutative85.8%

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

        \[\leadsto \frac{\frac{x}{y} \cdot x}{y} + \color{blue}{\sqrt{\frac{\frac{z}{t}}{t} \cdot \left(z \cdot \frac{\frac{z}{t}}{t}\right)} \cdot \sqrt{z}} \]
    8. Applied egg-rr48.6%

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

        \[\leadsto \frac{\frac{x}{y} \cdot x}{y} + \color{blue}{\frac{z}{t} \cdot \left(\frac{\sqrt{z}}{t} \cdot \sqrt{z}\right)} \]
    10. Simplified50.2%

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

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

Alternative 2: 98.6% accurate, 0.5× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ \begin{array}{l} \mathbf{if}\;\frac{z\_m \cdot z\_m}{t \cdot t} \leq 5 \cdot 10^{-22}:\\ \;\;\;\;z\_m \cdot \frac{\frac{z\_m}{t}}{t} + \frac{\frac{x}{y}}{\frac{y}{x}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot \frac{x}{y}}{y} + \frac{1}{\frac{t}{z\_m} \cdot \frac{t}{z\_m}}\\ \end{array} \end{array} \]
z_m = (fabs.f64 z)
(FPCore (x y z_m t)
 :precision binary64
 (if (<= (/ (* z_m z_m) (* t t)) 5e-22)
   (+ (* z_m (/ (/ z_m t) t)) (/ (/ x y) (/ y x)))
   (+ (/ (* x (/ x y)) y) (/ 1.0 (* (/ t z_m) (/ t z_m))))))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
	double tmp;
	if (((z_m * z_m) / (t * t)) <= 5e-22) {
		tmp = (z_m * ((z_m / t) / t)) + ((x / y) / (y / x));
	} else {
		tmp = ((x * (x / y)) / y) + (1.0 / ((t / z_m) * (t / z_m)));
	}
	return tmp;
}
z_m = abs(z)
real(8) function code(x, y, z_m, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z_m
    real(8), intent (in) :: t
    real(8) :: tmp
    if (((z_m * z_m) / (t * t)) <= 5d-22) then
        tmp = (z_m * ((z_m / t) / t)) + ((x / y) / (y / x))
    else
        tmp = ((x * (x / y)) / y) + (1.0d0 / ((t / z_m) * (t / z_m)))
    end if
    code = tmp
end function
z_m = Math.abs(z);
public static double code(double x, double y, double z_m, double t) {
	double tmp;
	if (((z_m * z_m) / (t * t)) <= 5e-22) {
		tmp = (z_m * ((z_m / t) / t)) + ((x / y) / (y / x));
	} else {
		tmp = ((x * (x / y)) / y) + (1.0 / ((t / z_m) * (t / z_m)));
	}
	return tmp;
}
z_m = math.fabs(z)
def code(x, y, z_m, t):
	tmp = 0
	if ((z_m * z_m) / (t * t)) <= 5e-22:
		tmp = (z_m * ((z_m / t) / t)) + ((x / y) / (y / x))
	else:
		tmp = ((x * (x / y)) / y) + (1.0 / ((t / z_m) * (t / z_m)))
	return tmp
z_m = abs(z)
function code(x, y, z_m, t)
	tmp = 0.0
	if (Float64(Float64(z_m * z_m) / Float64(t * t)) <= 5e-22)
		tmp = Float64(Float64(z_m * Float64(Float64(z_m / t) / t)) + Float64(Float64(x / y) / Float64(y / x)));
	else
		tmp = Float64(Float64(Float64(x * Float64(x / y)) / y) + Float64(1.0 / Float64(Float64(t / z_m) * Float64(t / z_m))));
	end
	return tmp
end
z_m = abs(z);
function tmp_2 = code(x, y, z_m, t)
	tmp = 0.0;
	if (((z_m * z_m) / (t * t)) <= 5e-22)
		tmp = (z_m * ((z_m / t) / t)) + ((x / y) / (y / x));
	else
		tmp = ((x * (x / y)) / y) + (1.0 / ((t / z_m) * (t / z_m)));
	end
	tmp_2 = tmp;
end
z_m = N[Abs[z], $MachinePrecision]
code[x_, y_, z$95$m_, t_] := If[LessEqual[N[(N[(z$95$m * z$95$m), $MachinePrecision] / N[(t * t), $MachinePrecision]), $MachinePrecision], 5e-22], N[(N[(z$95$m * N[(N[(z$95$m / t), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] + N[(N[(x / y), $MachinePrecision] / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * N[(x / y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision] + N[(1.0 / N[(N[(t / z$95$m), $MachinePrecision] * N[(t / z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|

\\
\begin{array}{l}
\mathbf{if}\;\frac{z\_m \cdot z\_m}{t \cdot t} \leq 5 \cdot 10^{-22}:\\
\;\;\;\;z\_m \cdot \frac{\frac{z\_m}{t}}{t} + \frac{\frac{x}{y}}{\frac{y}{x}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (*.f64 z z) (*.f64 t t)) < 4.99999999999999954e-22

    1. Initial program 74.6%

      \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
    2. Step-by-step derivation
      1. associate-/l*79.3%

        \[\leadsto \color{blue}{x \cdot \frac{x}{y \cdot y}} + \frac{z \cdot z}{t \cdot t} \]
      2. fma-define79.3%

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, \frac{x}{y \cdot y}, \frac{z \cdot z}{t \cdot t}\right)} \]
      3. associate-/l*82.4%

        \[\leadsto \mathsf{fma}\left(x, \frac{x}{y \cdot y}, \color{blue}{z \cdot \frac{z}{t \cdot t}}\right) \]
    3. Simplified82.4%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, \frac{x}{y \cdot y}, z \cdot \frac{z}{t \cdot t}\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-undefine82.4%

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

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

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

        \[\leadsto z \cdot \color{blue}{\frac{\frac{z}{t}}{t}} + \frac{x \cdot x}{y \cdot y} \]
      5. associate-/l*84.9%

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

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

        \[\leadsto z \cdot \frac{\frac{z}{t}}{t} + \color{blue}{\frac{x \cdot x}{y \cdot y}} \]
      2. frac-times99.6%

        \[\leadsto z \cdot \frac{\frac{z}{t}}{t} + \color{blue}{\frac{x}{y} \cdot \frac{x}{y}} \]
      3. clear-num99.7%

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

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

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

    if 4.99999999999999954e-22 < (/.f64 (*.f64 z z) (*.f64 t t))

    1. Initial program 57.1%

      \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-sqr-sqrt57.1%

        \[\leadsto \frac{x \cdot x}{y \cdot y} + \color{blue}{\sqrt{\frac{z \cdot z}{t \cdot t}} \cdot \sqrt{\frac{z \cdot z}{t \cdot t}}} \]
      2. associate-*r/57.1%

        \[\leadsto \frac{x \cdot x}{y \cdot y} + \sqrt{\color{blue}{z \cdot \frac{z}{t \cdot t}}} \cdot \sqrt{\frac{z \cdot z}{t \cdot t}} \]
      3. times-frac69.1%

        \[\leadsto \frac{x \cdot x}{y \cdot y} + \sqrt{z \cdot \frac{z}{t \cdot t}} \cdot \sqrt{\color{blue}{\frac{z}{t} \cdot \frac{z}{t}}} \]
      4. sqrt-prod34.1%

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

        \[\leadsto \frac{x \cdot x}{y \cdot y} + \sqrt{z \cdot \frac{z}{t \cdot t}} \cdot \color{blue}{\frac{z}{t}} \]
      6. associate-*r/40.4%

        \[\leadsto \frac{x \cdot x}{y \cdot y} + \color{blue}{\frac{\sqrt{z \cdot \frac{z}{t \cdot t}} \cdot z}{t}} \]
      7. associate-*r/31.9%

        \[\leadsto \frac{x \cdot x}{y \cdot y} + \frac{\sqrt{\color{blue}{\frac{z \cdot z}{t \cdot t}}} \cdot z}{t} \]
      8. times-frac49.6%

        \[\leadsto \frac{x \cdot x}{y \cdot y} + \frac{\sqrt{\color{blue}{\frac{z}{t} \cdot \frac{z}{t}}} \cdot z}{t} \]
      9. sqrt-prod39.8%

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

        \[\leadsto \frac{x \cdot x}{y \cdot y} + \frac{\color{blue}{\frac{z}{t}} \cdot z}{t} \]
    4. Applied egg-rr79.6%

      \[\leadsto \frac{x \cdot x}{y \cdot y} + \color{blue}{\frac{\frac{z}{t} \cdot z}{t}} \]
    5. Step-by-step derivation
      1. add-sqr-sqrt79.6%

        \[\leadsto \color{blue}{\sqrt{\frac{x \cdot x}{y \cdot y}} \cdot \sqrt{\frac{x \cdot x}{y \cdot y}}} + \frac{\frac{z}{t} \cdot z}{t} \]
      2. times-frac79.6%

        \[\leadsto \sqrt{\frac{x \cdot x}{y \cdot y}} \cdot \sqrt{\color{blue}{\frac{x}{y} \cdot \frac{x}{y}}} + \frac{\frac{z}{t} \cdot z}{t} \]
      3. sqrt-prod46.4%

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

        \[\leadsto \sqrt{\frac{x \cdot x}{y \cdot y}} \cdot \color{blue}{\frac{x}{y}} + \frac{\frac{z}{t} \cdot z}{t} \]
      5. associate-*r/64.1%

        \[\leadsto \color{blue}{\frac{\sqrt{\frac{x \cdot x}{y \cdot y}} \cdot x}{y}} + \frac{\frac{z}{t} \cdot z}{t} \]
      6. times-frac78.7%

        \[\leadsto \frac{\sqrt{\color{blue}{\frac{x}{y} \cdot \frac{x}{y}}} \cdot x}{y} + \frac{\frac{z}{t} \cdot z}{t} \]
      7. sqrt-prod54.9%

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

        \[\leadsto \frac{\color{blue}{\frac{x}{y}} \cdot x}{y} + \frac{\frac{z}{t} \cdot z}{t} \]
    6. Applied egg-rr97.5%

      \[\leadsto \color{blue}{\frac{\frac{x}{y} \cdot x}{y}} + \frac{\frac{z}{t} \cdot z}{t} \]
    7. Step-by-step derivation
      1. clear-num97.5%

        \[\leadsto \frac{\frac{x}{y} \cdot x}{y} + \color{blue}{\frac{1}{\frac{t}{\frac{z}{t} \cdot z}}} \]
      2. *-un-lft-identity97.5%

        \[\leadsto \frac{\frac{x}{y} \cdot x}{y} + \frac{1}{\frac{\color{blue}{1 \cdot t}}{\frac{z}{t} \cdot z}} \]
      3. times-frac99.6%

        \[\leadsto \frac{\frac{x}{y} \cdot x}{y} + \frac{1}{\color{blue}{\frac{1}{\frac{z}{t}} \cdot \frac{t}{z}}} \]
      4. clear-num99.6%

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

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

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

Alternative 3: 97.6% accurate, 0.7× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ \begin{array}{l} \mathbf{if}\;t \leq 2 \cdot 10^{-199}:\\ \;\;\;\;\frac{x}{y} \cdot \frac{x}{y} + \frac{z\_m \cdot \frac{z\_m}{t}}{t}\\ \mathbf{else}:\\ \;\;\;\;z\_m \cdot \frac{\frac{z\_m}{t}}{t} + \frac{\frac{x}{y}}{\frac{y}{x}}\\ \end{array} \end{array} \]
z_m = (fabs.f64 z)
(FPCore (x y z_m t)
 :precision binary64
 (if (<= t 2e-199)
   (+ (* (/ x y) (/ x y)) (/ (* z_m (/ z_m t)) t))
   (+ (* z_m (/ (/ z_m t) t)) (/ (/ x y) (/ y x)))))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
	double tmp;
	if (t <= 2e-199) {
		tmp = ((x / y) * (x / y)) + ((z_m * (z_m / t)) / t);
	} else {
		tmp = (z_m * ((z_m / t) / t)) + ((x / y) / (y / x));
	}
	return tmp;
}
z_m = abs(z)
real(8) function code(x, y, z_m, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z_m
    real(8), intent (in) :: t
    real(8) :: tmp
    if (t <= 2d-199) then
        tmp = ((x / y) * (x / y)) + ((z_m * (z_m / t)) / t)
    else
        tmp = (z_m * ((z_m / t) / t)) + ((x / y) / (y / x))
    end if
    code = tmp
end function
z_m = Math.abs(z);
public static double code(double x, double y, double z_m, double t) {
	double tmp;
	if (t <= 2e-199) {
		tmp = ((x / y) * (x / y)) + ((z_m * (z_m / t)) / t);
	} else {
		tmp = (z_m * ((z_m / t) / t)) + ((x / y) / (y / x));
	}
	return tmp;
}
z_m = math.fabs(z)
def code(x, y, z_m, t):
	tmp = 0
	if t <= 2e-199:
		tmp = ((x / y) * (x / y)) + ((z_m * (z_m / t)) / t)
	else:
		tmp = (z_m * ((z_m / t) / t)) + ((x / y) / (y / x))
	return tmp
z_m = abs(z)
function code(x, y, z_m, t)
	tmp = 0.0
	if (t <= 2e-199)
		tmp = Float64(Float64(Float64(x / y) * Float64(x / y)) + Float64(Float64(z_m * Float64(z_m / t)) / t));
	else
		tmp = Float64(Float64(z_m * Float64(Float64(z_m / t) / t)) + Float64(Float64(x / y) / Float64(y / x)));
	end
	return tmp
end
z_m = abs(z);
function tmp_2 = code(x, y, z_m, t)
	tmp = 0.0;
	if (t <= 2e-199)
		tmp = ((x / y) * (x / y)) + ((z_m * (z_m / t)) / t);
	else
		tmp = (z_m * ((z_m / t) / t)) + ((x / y) / (y / x));
	end
	tmp_2 = tmp;
end
z_m = N[Abs[z], $MachinePrecision]
code[x_, y_, z$95$m_, t_] := If[LessEqual[t, 2e-199], N[(N[(N[(x / y), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision] + N[(N[(z$95$m * N[(z$95$m / t), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(N[(z$95$m * N[(N[(z$95$m / t), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] + N[(N[(x / y), $MachinePrecision] / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|

\\
\begin{array}{l}
\mathbf{if}\;t \leq 2 \cdot 10^{-199}:\\
\;\;\;\;\frac{x}{y} \cdot \frac{x}{y} + \frac{z\_m \cdot \frac{z\_m}{t}}{t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < 1.99999999999999996e-199

    1. Initial program 61.5%

      \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-sqr-sqrt61.5%

        \[\leadsto \frac{x \cdot x}{y \cdot y} + \color{blue}{\sqrt{\frac{z \cdot z}{t \cdot t}} \cdot \sqrt{\frac{z \cdot z}{t \cdot t}}} \]
      2. associate-*r/61.5%

        \[\leadsto \frac{x \cdot x}{y \cdot y} + \sqrt{\color{blue}{z \cdot \frac{z}{t \cdot t}}} \cdot \sqrt{\frac{z \cdot z}{t \cdot t}} \]
      3. times-frac70.7%

        \[\leadsto \frac{x \cdot x}{y \cdot y} + \sqrt{z \cdot \frac{z}{t \cdot t}} \cdot \sqrt{\color{blue}{\frac{z}{t} \cdot \frac{z}{t}}} \]
      4. sqrt-prod40.6%

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

        \[\leadsto \frac{x \cdot x}{y \cdot y} + \sqrt{z \cdot \frac{z}{t \cdot t}} \cdot \color{blue}{\frac{z}{t}} \]
      6. associate-*r/52.3%

        \[\leadsto \frac{x \cdot x}{y \cdot y} + \color{blue}{\frac{\sqrt{z \cdot \frac{z}{t \cdot t}} \cdot z}{t}} \]
      7. associate-*r/46.5%

        \[\leadsto \frac{x \cdot x}{y \cdot y} + \frac{\sqrt{\color{blue}{\frac{z \cdot z}{t \cdot t}}} \cdot z}{t} \]
      8. times-frac60.1%

        \[\leadsto \frac{x \cdot x}{y \cdot y} + \frac{\sqrt{\color{blue}{\frac{z}{t} \cdot \frac{z}{t}}} \cdot z}{t} \]
      9. sqrt-prod45.3%

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

        \[\leadsto \frac{x \cdot x}{y \cdot y} + \frac{\color{blue}{\frac{z}{t}} \cdot z}{t} \]
    4. Applied egg-rr76.6%

      \[\leadsto \frac{x \cdot x}{y \cdot y} + \color{blue}{\frac{\frac{z}{t} \cdot z}{t}} \]
    5. Step-by-step derivation
      1. times-frac97.3%

        \[\leadsto \color{blue}{\frac{x}{y} \cdot \frac{x}{y}} + \frac{\frac{z}{t} \cdot z}{t} \]
    6. Applied egg-rr97.3%

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

    if 1.99999999999999996e-199 < t

    1. Initial program 71.9%

      \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
    2. Step-by-step derivation
      1. associate-/l*76.3%

        \[\leadsto \color{blue}{x \cdot \frac{x}{y \cdot y}} + \frac{z \cdot z}{t \cdot t} \]
      2. fma-define76.3%

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, \frac{x}{y \cdot y}, \frac{z \cdot z}{t \cdot t}\right)} \]
      3. associate-/l*81.6%

        \[\leadsto \mathsf{fma}\left(x, \frac{x}{y \cdot y}, \color{blue}{z \cdot \frac{z}{t \cdot t}}\right) \]
    3. Simplified81.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, \frac{x}{y \cdot y}, z \cdot \frac{z}{t \cdot t}\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-undefine81.6%

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

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

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

        \[\leadsto z \cdot \color{blue}{\frac{\frac{z}{t}}{t}} + \frac{x \cdot x}{y \cdot y} \]
      5. associate-/l*88.7%

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

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

        \[\leadsto z \cdot \frac{\frac{z}{t}}{t} + \color{blue}{\frac{x \cdot x}{y \cdot y}} \]
      2. frac-times99.7%

        \[\leadsto z \cdot \frac{\frac{z}{t}}{t} + \color{blue}{\frac{x}{y} \cdot \frac{x}{y}} \]
      3. clear-num99.7%

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

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

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

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

Alternative 4: 96.7% accurate, 1.0× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ z\_m \cdot \frac{\frac{z\_m}{t}}{t} + \frac{\frac{x}{y}}{\frac{y}{x}} \end{array} \]
z_m = (fabs.f64 z)
(FPCore (x y z_m t)
 :precision binary64
 (+ (* z_m (/ (/ z_m t) t)) (/ (/ x y) (/ y x))))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
	return (z_m * ((z_m / t) / t)) + ((x / y) / (y / x));
}
z_m = abs(z)
real(8) function code(x, y, z_m, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z_m
    real(8), intent (in) :: t
    code = (z_m * ((z_m / t) / t)) + ((x / y) / (y / x))
end function
z_m = Math.abs(z);
public static double code(double x, double y, double z_m, double t) {
	return (z_m * ((z_m / t) / t)) + ((x / y) / (y / x));
}
z_m = math.fabs(z)
def code(x, y, z_m, t):
	return (z_m * ((z_m / t) / t)) + ((x / y) / (y / x))
z_m = abs(z)
function code(x, y, z_m, t)
	return Float64(Float64(z_m * Float64(Float64(z_m / t) / t)) + Float64(Float64(x / y) / Float64(y / x)))
end
z_m = abs(z);
function tmp = code(x, y, z_m, t)
	tmp = (z_m * ((z_m / t) / t)) + ((x / y) / (y / x));
end
z_m = N[Abs[z], $MachinePrecision]
code[x_, y_, z$95$m_, t_] := N[(N[(z$95$m * N[(N[(z$95$m / t), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] + N[(N[(x / y), $MachinePrecision] / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|

\\
z\_m \cdot \frac{\frac{z\_m}{t}}{t} + \frac{\frac{x}{y}}{\frac{y}{x}}
\end{array}
Derivation
  1. Initial program 65.3%

    \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
  2. Step-by-step derivation
    1. associate-/l*72.7%

      \[\leadsto \color{blue}{x \cdot \frac{x}{y \cdot y}} + \frac{z \cdot z}{t \cdot t} \]
    2. fma-define72.7%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, \frac{x}{y \cdot y}, \frac{z \cdot z}{t \cdot t}\right)} \]
    3. associate-/l*80.6%

      \[\leadsto \mathsf{fma}\left(x, \frac{x}{y \cdot y}, \color{blue}{z \cdot \frac{z}{t \cdot t}}\right) \]
  3. Simplified80.6%

    \[\leadsto \color{blue}{\mathsf{fma}\left(x, \frac{x}{y \cdot y}, z \cdot \frac{z}{t \cdot t}\right)} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. fma-undefine80.6%

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

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

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

      \[\leadsto z \cdot \color{blue}{\frac{\frac{z}{t}}{t}} + \frac{x \cdot x}{y \cdot y} \]
    5. associate-/l*86.9%

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

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

      \[\leadsto z \cdot \frac{\frac{z}{t}}{t} + \color{blue}{\frac{x \cdot x}{y \cdot y}} \]
    2. frac-times96.4%

      \[\leadsto z \cdot \frac{\frac{z}{t}}{t} + \color{blue}{\frac{x}{y} \cdot \frac{x}{y}} \]
    3. clear-num96.4%

      \[\leadsto z \cdot \frac{\frac{z}{t}}{t} + \frac{x}{y} \cdot \color{blue}{\frac{1}{\frac{y}{x}}} \]
    4. un-div-inv96.5%

      \[\leadsto z \cdot \frac{\frac{z}{t}}{t} + \color{blue}{\frac{\frac{x}{y}}{\frac{y}{x}}} \]
  8. Applied egg-rr96.5%

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

Alternative 5: 87.3% accurate, 1.0× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ z\_m \cdot \frac{\frac{z\_m}{t}}{t} + x \cdot \frac{x}{y \cdot y} \end{array} \]
z_m = (fabs.f64 z)
(FPCore (x y z_m t)
 :precision binary64
 (+ (* z_m (/ (/ z_m t) t)) (* x (/ x (* y y)))))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
	return (z_m * ((z_m / t) / t)) + (x * (x / (y * y)));
}
z_m = abs(z)
real(8) function code(x, y, z_m, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z_m
    real(8), intent (in) :: t
    code = (z_m * ((z_m / t) / t)) + (x * (x / (y * y)))
end function
z_m = Math.abs(z);
public static double code(double x, double y, double z_m, double t) {
	return (z_m * ((z_m / t) / t)) + (x * (x / (y * y)));
}
z_m = math.fabs(z)
def code(x, y, z_m, t):
	return (z_m * ((z_m / t) / t)) + (x * (x / (y * y)))
z_m = abs(z)
function code(x, y, z_m, t)
	return Float64(Float64(z_m * Float64(Float64(z_m / t) / t)) + Float64(x * Float64(x / Float64(y * y))))
end
z_m = abs(z);
function tmp = code(x, y, z_m, t)
	tmp = (z_m * ((z_m / t) / t)) + (x * (x / (y * y)));
end
z_m = N[Abs[z], $MachinePrecision]
code[x_, y_, z$95$m_, t_] := N[(N[(z$95$m * N[(N[(z$95$m / t), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] + N[(x * N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|

\\
z\_m \cdot \frac{\frac{z\_m}{t}}{t} + x \cdot \frac{x}{y \cdot y}
\end{array}
Derivation
  1. Initial program 65.3%

    \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
  2. Step-by-step derivation
    1. associate-/l*72.7%

      \[\leadsto \color{blue}{x \cdot \frac{x}{y \cdot y}} + \frac{z \cdot z}{t \cdot t} \]
    2. fma-define72.7%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, \frac{x}{y \cdot y}, \frac{z \cdot z}{t \cdot t}\right)} \]
    3. associate-/l*80.6%

      \[\leadsto \mathsf{fma}\left(x, \frac{x}{y \cdot y}, \color{blue}{z \cdot \frac{z}{t \cdot t}}\right) \]
  3. Simplified80.6%

    \[\leadsto \color{blue}{\mathsf{fma}\left(x, \frac{x}{y \cdot y}, z \cdot \frac{z}{t \cdot t}\right)} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. fma-undefine80.6%

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

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

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

      \[\leadsto z \cdot \color{blue}{\frac{\frac{z}{t}}{t}} + \frac{x \cdot x}{y \cdot y} \]
    5. associate-/l*86.9%

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

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

Alternative 6: 81.0% accurate, 1.0× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ x \cdot \frac{x}{y \cdot y} + z\_m \cdot \frac{z\_m}{t \cdot t} \end{array} \]
z_m = (fabs.f64 z)
(FPCore (x y z_m t)
 :precision binary64
 (+ (* x (/ x (* y y))) (* z_m (/ z_m (* t t)))))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
	return (x * (x / (y * y))) + (z_m * (z_m / (t * t)));
}
z_m = abs(z)
real(8) function code(x, y, z_m, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z_m
    real(8), intent (in) :: t
    code = (x * (x / (y * y))) + (z_m * (z_m / (t * t)))
end function
z_m = Math.abs(z);
public static double code(double x, double y, double z_m, double t) {
	return (x * (x / (y * y))) + (z_m * (z_m / (t * t)));
}
z_m = math.fabs(z)
def code(x, y, z_m, t):
	return (x * (x / (y * y))) + (z_m * (z_m / (t * t)))
z_m = abs(z)
function code(x, y, z_m, t)
	return Float64(Float64(x * Float64(x / Float64(y * y))) + Float64(z_m * Float64(z_m / Float64(t * t))))
end
z_m = abs(z);
function tmp = code(x, y, z_m, t)
	tmp = (x * (x / (y * y))) + (z_m * (z_m / (t * t)));
end
z_m = N[Abs[z], $MachinePrecision]
code[x_, y_, z$95$m_, t_] := N[(N[(x * N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(z$95$m * N[(z$95$m / N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|

\\
x \cdot \frac{x}{y \cdot y} + z\_m \cdot \frac{z\_m}{t \cdot t}
\end{array}
Derivation
  1. Initial program 65.3%

    \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
  2. Step-by-step derivation
    1. associate-/l*72.7%

      \[\leadsto \color{blue}{x \cdot \frac{x}{y \cdot y}} + \frac{z \cdot z}{t \cdot t} \]
    2. fma-define72.7%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, \frac{x}{y \cdot y}, \frac{z \cdot z}{t \cdot t}\right)} \]
    3. associate-/l*80.6%

      \[\leadsto \mathsf{fma}\left(x, \frac{x}{y \cdot y}, \color{blue}{z \cdot \frac{z}{t \cdot t}}\right) \]
  3. Simplified80.6%

    \[\leadsto \color{blue}{\mathsf{fma}\left(x, \frac{x}{y \cdot y}, z \cdot \frac{z}{t \cdot t}\right)} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. fma-undefine80.6%

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

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

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

      \[\leadsto z \cdot \color{blue}{\frac{\frac{z}{t}}{t}} + \frac{x \cdot x}{y \cdot y} \]
    5. associate-/l*86.9%

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

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

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

    \[\leadsto z \cdot \color{blue}{\frac{z}{t \cdot t}} + x \cdot \frac{x}{y \cdot y} \]
  9. Final simplification80.6%

    \[\leadsto x \cdot \frac{x}{y \cdot y} + z \cdot \frac{z}{t \cdot t} \]
  10. Add Preprocessing

Developer target: 99.7% accurate, 0.1× speedup?

\[\begin{array}{l} \\ {\left(\frac{x}{y}\right)}^{2} + {\left(\frac{z}{t}\right)}^{2} \end{array} \]
(FPCore (x y z t) :precision binary64 (+ (pow (/ x y) 2.0) (pow (/ z t) 2.0)))
double code(double x, double y, double z, double t) {
	return pow((x / y), 2.0) + pow((z / t), 2.0);
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = ((x / y) ** 2.0d0) + ((z / t) ** 2.0d0)
end function
public static double code(double x, double y, double z, double t) {
	return Math.pow((x / y), 2.0) + Math.pow((z / t), 2.0);
}
def code(x, y, z, t):
	return math.pow((x / y), 2.0) + math.pow((z / t), 2.0)
function code(x, y, z, t)
	return Float64((Float64(x / y) ^ 2.0) + (Float64(z / t) ^ 2.0))
end
function tmp = code(x, y, z, t)
	tmp = ((x / y) ^ 2.0) + ((z / t) ^ 2.0);
end
code[x_, y_, z_, t_] := N[(N[Power[N[(x / y), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(z / t), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
{\left(\frac{x}{y}\right)}^{2} + {\left(\frac{z}{t}\right)}^{2}
\end{array}

Reproduce

?
herbie shell --seed 2024097 
(FPCore (x y z t)
  :name "Graphics.Rasterific.Svg.PathConverter:arcToSegments from rasterific-svg-0.2.3.1"
  :precision binary64

  :alt
  (+ (pow (/ x y) 2.0) (pow (/ z t) 2.0))

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