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

Percentage Accurate: 66.2% → 99.7%
Time: 10.4s
Alternatives: 5
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 5 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: 66.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: 99.7% accurate, 1.0× speedup?

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

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

    \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
  2. Step-by-step derivation
    1. times-frac82.4%

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

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

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

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

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

Alternative 2: 57.3% accurate, 1.0× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 6.40000000000000046e192

    1. Initial program 66.2%

      \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
    2. Step-by-step derivation
      1. +-commutative66.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(z \cdot \frac{z}{t}, \frac{y}{\frac{x}{y}}, t \cdot x\right)}{t \cdot \frac{y}{\frac{x}{y}}}} \]
    6. Step-by-step derivation
      1. associate-*r/53.5%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{x \cdot t}}{t \cdot \left(y \cdot \frac{y}{x}\right)} \]
    10. Simplified58.4%

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

        \[\leadsto \frac{x \cdot t}{t \cdot \color{blue}{\frac{y \cdot y}{x}}} \]
    12. Applied egg-rr54.5%

      \[\leadsto \frac{x \cdot t}{t \cdot \color{blue}{\frac{y \cdot y}{x}}} \]
    13. Step-by-step derivation
      1. *-commutative54.5%

        \[\leadsto \frac{x \cdot t}{\color{blue}{\frac{y \cdot y}{x} \cdot t}} \]
      2. times-frac56.8%

        \[\leadsto \color{blue}{\frac{x}{\frac{y \cdot y}{x}} \cdot \frac{t}{t}} \]
      3. associate-/l*65.1%

        \[\leadsto \frac{x}{\color{blue}{\frac{y}{\frac{x}{y}}}} \cdot \frac{t}{t} \]
      4. div-inv65.1%

        \[\leadsto \frac{x}{\color{blue}{y \cdot \frac{1}{\frac{x}{y}}}} \cdot \frac{t}{t} \]
      5. clear-num65.1%

        \[\leadsto \frac{x}{y \cdot \color{blue}{\frac{y}{x}}} \cdot \frac{t}{t} \]
      6. *-inverses65.1%

        \[\leadsto \frac{x}{y \cdot \frac{y}{x}} \cdot \color{blue}{1} \]
    14. Applied egg-rr65.1%

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

    if 6.40000000000000046e192 < z

    1. Initial program 51.0%

      \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
    2. Step-by-step derivation
      1. +-commutative51.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(z \cdot \frac{z}{t}, \frac{y}{\frac{x}{y}}, t \cdot x\right)}{t \cdot \frac{y}{\frac{x}{y}}}} \]
    6. Step-by-step derivation
      1. associate-*r/46.0%

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{t \cdot x}}{t \cdot \left(y \cdot \frac{y}{x}\right)} \]
    9. Step-by-step derivation
      1. *-commutative26.5%

        \[\leadsto \frac{\color{blue}{x \cdot t}}{t \cdot \left(y \cdot \frac{y}{x}\right)} \]
    10. Simplified26.5%

      \[\leadsto \frac{\color{blue}{x \cdot t}}{t \cdot \left(y \cdot \frac{y}{x}\right)} \]
    11. Step-by-step derivation
      1. div-inv26.5%

        \[\leadsto \color{blue}{\left(x \cdot t\right) \cdot \frac{1}{t \cdot \left(y \cdot \frac{y}{x}\right)}} \]
      2. *-commutative26.5%

        \[\leadsto \color{blue}{\left(t \cdot x\right)} \cdot \frac{1}{t \cdot \left(y \cdot \frac{y}{x}\right)} \]
      3. associate-*l*41.5%

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

        \[\leadsto t \cdot \left(x \cdot \frac{1}{t \cdot \color{blue}{\frac{y \cdot y}{x}}}\right) \]
      5. associate-*r/51.2%

        \[\leadsto t \cdot \left(x \cdot \frac{1}{\color{blue}{\frac{t \cdot \left(y \cdot y\right)}{x}}}\right) \]
    12. Applied egg-rr51.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 6.4 \cdot 10^{+192}:\\ \;\;\;\;\frac{x}{y \cdot \frac{y}{x}}\\ \mathbf{else}:\\ \;\;\;\;t \cdot \left(x \cdot \frac{1}{\frac{t \cdot \left(y \cdot y\right)}{x}}\right)\\ \end{array} \]

Alternative 3: 56.0% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq 10^{-9}:\\
\;\;\;\;\frac{x}{y \cdot t} \cdot \frac{t}{\frac{y}{x}}\\

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


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

    1. Initial program 65.7%

      \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
    2. Step-by-step derivation
      1. +-commutative65.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(z \cdot \frac{z}{t}, \frac{y}{\frac{x}{y}}, t \cdot x\right)}{t \cdot \frac{y}{\frac{x}{y}}}} \]
    6. Step-by-step derivation
      1. associate-*r/57.0%

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{t \cdot x}}{t \cdot \left(y \cdot \frac{y}{x}\right)} \]
    9. Step-by-step derivation
      1. *-commutative55.5%

        \[\leadsto \frac{\color{blue}{x \cdot t}}{t \cdot \left(y \cdot \frac{y}{x}\right)} \]
    10. Simplified55.5%

      \[\leadsto \frac{\color{blue}{x \cdot t}}{t \cdot \left(y \cdot \frac{y}{x}\right)} \]
    11. Step-by-step derivation
      1. associate-*r*55.4%

        \[\leadsto \frac{x \cdot t}{\color{blue}{\left(t \cdot y\right) \cdot \frac{y}{x}}} \]
      2. times-frac60.3%

        \[\leadsto \color{blue}{\frac{x}{t \cdot y} \cdot \frac{t}{\frac{y}{x}}} \]
    12. Applied egg-rr60.3%

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

    if 1.00000000000000006e-9 < t

    1. Initial program 63.0%

      \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
    2. Step-by-step derivation
      1. +-commutative63.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(z \cdot \frac{z}{t}, \frac{y}{\frac{x}{y}}, t \cdot x\right)}{t \cdot \frac{y}{\frac{x}{y}}}} \]
    6. Step-by-step derivation
      1. associate-*r/41.7%

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{t \cdot x}}{t \cdot \left(y \cdot \frac{y}{x}\right)} \]
    9. Step-by-step derivation
      1. *-commutative57.2%

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

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

        \[\leadsto \frac{x \cdot t}{t \cdot \color{blue}{\frac{y \cdot y}{x}}} \]
    12. Applied egg-rr56.4%

      \[\leadsto \frac{x \cdot t}{t \cdot \color{blue}{\frac{y \cdot y}{x}}} \]
    13. Step-by-step derivation
      1. *-commutative56.4%

        \[\leadsto \frac{x \cdot t}{\color{blue}{\frac{y \cdot y}{x} \cdot t}} \]
      2. times-frac58.2%

        \[\leadsto \color{blue}{\frac{x}{\frac{y \cdot y}{x}} \cdot \frac{t}{t}} \]
      3. associate-/l*68.8%

        \[\leadsto \frac{x}{\color{blue}{\frac{y}{\frac{x}{y}}}} \cdot \frac{t}{t} \]
      4. div-inv68.7%

        \[\leadsto \frac{x}{\color{blue}{y \cdot \frac{1}{\frac{x}{y}}}} \cdot \frac{t}{t} \]
      5. clear-num68.7%

        \[\leadsto \frac{x}{y \cdot \color{blue}{\frac{y}{x}}} \cdot \frac{t}{t} \]
      6. *-inverses68.7%

        \[\leadsto \frac{x}{y \cdot \frac{y}{x}} \cdot \color{blue}{1} \]
    14. Applied egg-rr68.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq 10^{-9}:\\ \;\;\;\;\frac{x}{y \cdot t} \cdot \frac{t}{\frac{y}{x}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot \frac{y}{x}}\\ \end{array} \]

Alternative 4: 56.8% accurate, 1.7× speedup?

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

\\
\frac{1}{y} \cdot \left(x \cdot \frac{x}{y}\right)
\end{array}
Derivation
  1. Initial program 65.0%

    \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
  2. Step-by-step derivation
    1. +-commutative65.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(z \cdot \frac{z}{t}, \frac{y}{\frac{x}{y}}, t \cdot x\right)}{t \cdot \frac{y}{\frac{x}{y}}}} \]
  6. Step-by-step derivation
    1. associate-*r/52.9%

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

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

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

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

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

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

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

    \[\leadsto \frac{\color{blue}{t \cdot x}}{t \cdot \left(y \cdot \frac{y}{x}\right)} \]
  9. Step-by-step derivation
    1. *-commutative55.9%

      \[\leadsto \frac{\color{blue}{x \cdot t}}{t \cdot \left(y \cdot \frac{y}{x}\right)} \]
  10. Simplified55.9%

    \[\leadsto \frac{\color{blue}{x \cdot t}}{t \cdot \left(y \cdot \frac{y}{x}\right)} \]
  11. Step-by-step derivation
    1. *-commutative55.9%

      \[\leadsto \frac{\color{blue}{t \cdot x}}{t \cdot \left(y \cdot \frac{y}{x}\right)} \]
    2. associate-*r*55.9%

      \[\leadsto \frac{t \cdot x}{\color{blue}{\left(t \cdot y\right) \cdot \frac{y}{x}}} \]
    3. times-frac57.1%

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

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

      \[\leadsto \frac{t}{t \cdot y} \cdot \left(x \cdot \color{blue}{\frac{x}{y}}\right) \]
  12. Applied egg-rr57.1%

    \[\leadsto \color{blue}{\frac{t}{t \cdot y} \cdot \left(x \cdot \frac{x}{y}\right)} \]
  13. Taylor expanded in t around 0 57.5%

    \[\leadsto \color{blue}{\frac{1}{y}} \cdot \left(x \cdot \frac{x}{y}\right) \]
  14. Final simplification57.5%

    \[\leadsto \frac{1}{y} \cdot \left(x \cdot \frac{x}{y}\right) \]

Alternative 5: 56.7% accurate, 2.1× speedup?

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

\\
\frac{x}{y \cdot \frac{y}{x}}
\end{array}
Derivation
  1. Initial program 65.0%

    \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
  2. Step-by-step derivation
    1. +-commutative65.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(z \cdot \frac{z}{t}, \frac{y}{\frac{x}{y}}, t \cdot x\right)}{t \cdot \frac{y}{\frac{x}{y}}}} \]
  6. Step-by-step derivation
    1. associate-*r/52.9%

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

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

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

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

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

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

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

    \[\leadsto \frac{\color{blue}{t \cdot x}}{t \cdot \left(y \cdot \frac{y}{x}\right)} \]
  9. Step-by-step derivation
    1. *-commutative55.9%

      \[\leadsto \frac{\color{blue}{x \cdot t}}{t \cdot \left(y \cdot \frac{y}{x}\right)} \]
  10. Simplified55.9%

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

      \[\leadsto \frac{x \cdot t}{t \cdot \color{blue}{\frac{y \cdot y}{x}}} \]
  12. Applied egg-rr52.3%

    \[\leadsto \frac{x \cdot t}{t \cdot \color{blue}{\frac{y \cdot y}{x}}} \]
  13. Step-by-step derivation
    1. *-commutative52.3%

      \[\leadsto \frac{x \cdot t}{\color{blue}{\frac{y \cdot y}{x} \cdot t}} \]
    2. times-frac55.6%

      \[\leadsto \color{blue}{\frac{x}{\frac{y \cdot y}{x}} \cdot \frac{t}{t}} \]
    3. associate-/l*62.2%

      \[\leadsto \frac{x}{\color{blue}{\frac{y}{\frac{x}{y}}}} \cdot \frac{t}{t} \]
    4. div-inv62.1%

      \[\leadsto \frac{x}{\color{blue}{y \cdot \frac{1}{\frac{x}{y}}}} \cdot \frac{t}{t} \]
    5. clear-num62.2%

      \[\leadsto \frac{x}{y \cdot \color{blue}{\frac{y}{x}}} \cdot \frac{t}{t} \]
    6. *-inverses62.2%

      \[\leadsto \frac{x}{y \cdot \frac{y}{x}} \cdot \color{blue}{1} \]
  14. Applied egg-rr62.2%

    \[\leadsto \color{blue}{\frac{x}{y \cdot \frac{y}{x}} \cdot 1} \]
  15. Final simplification62.2%

    \[\leadsto \frac{x}{y \cdot \frac{y}{x}} \]

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 2023293 
(FPCore (x y z t)
  :name "Graphics.Rasterific.Svg.PathConverter:arcToSegments from rasterific-svg-0.2.3.1"
  :precision binary64

  :herbie-target
  (+ (pow (/ x y) 2.0) (pow (/ z t) 2.0))

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