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

Percentage Accurate: 66.3% → 96.5%
Time: 9.3s
Alternatives: 8
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 8 alternatives:

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

Initial Program: 66.3% 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: 96.5% accurate, 1.0× speedup?

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

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

    \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
  2. Step-by-step derivation
    1. +-lowering-+.f64N/A

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

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

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

      \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\left(x \cdot \frac{x}{y}\right), y\right), \left(\frac{\color{blue}{z} \cdot z}{t \cdot t}\right)\right) \]
    5. *-lowering-*.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \left(\frac{x}{y}\right)\right), y\right), \left(\frac{\color{blue}{z} \cdot z}{t \cdot t}\right)\right) \]
    6. /-lowering-/.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \mathsf{/.f64}\left(x, y\right)\right), y\right), \left(\frac{z \cdot z}{t \cdot t}\right)\right) \]
    7. associate-/l*N/A

      \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \mathsf{/.f64}\left(x, y\right)\right), y\right), \left(z \cdot \color{blue}{\frac{z}{t \cdot t}}\right)\right) \]
    8. *-lowering-*.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \mathsf{/.f64}\left(x, y\right)\right), y\right), \mathsf{*.f64}\left(z, \color{blue}{\left(\frac{z}{t \cdot t}\right)}\right)\right) \]
    9. /-lowering-/.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \mathsf{/.f64}\left(x, y\right)\right), y\right), \mathsf{*.f64}\left(z, \mathsf{/.f64}\left(z, \color{blue}{\left(t \cdot t\right)}\right)\right)\right) \]
    10. *-lowering-*.f6488.7%

      \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \mathsf{/.f64}\left(x, y\right)\right), y\right), \mathsf{*.f64}\left(z, \mathsf{/.f64}\left(z, \mathsf{*.f64}\left(t, \color{blue}{t}\right)\right)\right)\right) \]
  3. Simplified88.7%

    \[\leadsto \color{blue}{\frac{x \cdot \frac{x}{y}}{y} + z \cdot \frac{z}{t \cdot t}} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. associate-*r/N/A

      \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \mathsf{/.f64}\left(x, y\right)\right), y\right), \left(\frac{z \cdot z}{\color{blue}{t \cdot t}}\right)\right) \]
    2. times-fracN/A

      \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \mathsf{/.f64}\left(x, y\right)\right), y\right), \left(\frac{z}{t} \cdot \color{blue}{\frac{z}{t}}\right)\right) \]
    3. *-lowering-*.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \mathsf{/.f64}\left(x, y\right)\right), y\right), \mathsf{*.f64}\left(\left(\frac{z}{t}\right), \color{blue}{\left(\frac{z}{t}\right)}\right)\right) \]
    4. /-lowering-/.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \mathsf{/.f64}\left(x, y\right)\right), y\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(z, t\right), \left(\frac{\color{blue}{z}}{t}\right)\right)\right) \]
    5. /-lowering-/.f6497.2%

      \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \mathsf{/.f64}\left(x, y\right)\right), y\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(z, t\right), \mathsf{/.f64}\left(z, \color{blue}{t}\right)\right)\right) \]
  6. Applied egg-rr97.2%

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

Alternative 2: 94.2% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\frac{z \cdot z}{t \cdot t} \leq 0:\\
\;\;\;\;\frac{\frac{x}{y}}{\frac{y}{x}}\\

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


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

    1. Initial program 64.0%

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

      \[\leadsto \color{blue}{\frac{{x}^{2}}{{y}^{2}}} \]
    4. Step-by-step derivation
      1. unpow2N/A

        \[\leadsto \frac{x \cdot x}{{\color{blue}{y}}^{2}} \]
      2. associate-/l*N/A

        \[\leadsto x \cdot \color{blue}{\frac{x}{{y}^{2}}} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{\left(\frac{x}{{y}^{2}}\right)}\right) \]
      4. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(x, \left(\frac{x}{y \cdot \color{blue}{y}}\right)\right) \]
      5. associate-/r*N/A

        \[\leadsto \mathsf{*.f64}\left(x, \left(\frac{\frac{x}{y}}{\color{blue}{y}}\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(\left(\frac{x}{y}\right), \color{blue}{y}\right)\right) \]
      7. /-lowering-/.f6481.8%

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(\mathsf{/.f64}\left(x, y\right), y\right)\right) \]
    5. Simplified81.8%

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

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

        \[\leadsto \frac{x}{y} \cdot \color{blue}{\frac{x}{y}} \]
      3. clear-numN/A

        \[\leadsto \frac{x}{y} \cdot \frac{1}{\color{blue}{\frac{y}{x}}} \]
      4. un-div-invN/A

        \[\leadsto \frac{\frac{x}{y}}{\color{blue}{\frac{y}{x}}} \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{x}{y}\right), \color{blue}{\left(\frac{y}{x}\right)}\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(x, y\right), \left(\frac{\color{blue}{y}}{x}\right)\right) \]
      7. /-lowering-/.f6491.0%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(x, y\right), \mathsf{/.f64}\left(y, \color{blue}{x}\right)\right) \]
    7. Applied egg-rr91.0%

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

    if 0.0 < (/.f64 (*.f64 z z) (*.f64 t t))

    1. Initial program 69.3%

      \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*r/N/A

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

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

        \[\leadsto \mathsf{+.f64}\left(\left(z \cdot \frac{z}{t \cdot t}\right), \color{blue}{\left(\frac{x \cdot x}{y \cdot y}\right)}\right) \]
      4. clear-numN/A

        \[\leadsto \mathsf{+.f64}\left(\left(z \cdot \frac{1}{\frac{t \cdot t}{z}}\right), \left(\frac{x \cdot \color{blue}{x}}{y \cdot y}\right)\right) \]
      5. un-div-invN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{z}{\frac{t \cdot t}{z}}\right), \left(\frac{\color{blue}{x \cdot x}}{y \cdot y}\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(z, \left(\frac{t \cdot t}{z}\right)\right), \left(\frac{\color{blue}{x \cdot x}}{y \cdot y}\right)\right) \]
      7. clear-numN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(z, \left(\frac{1}{\frac{z}{t \cdot t}}\right)\right), \left(\frac{x \cdot \color{blue}{x}}{y \cdot y}\right)\right) \]
      8. associate-/r*N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(z, \left(\frac{1}{\frac{\frac{z}{t}}{t}}\right)\right), \left(\frac{x \cdot x}{y \cdot y}\right)\right) \]
      9. clear-numN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(z, \left(\frac{t}{\frac{z}{t}}\right)\right), \left(\frac{x \cdot \color{blue}{x}}{y \cdot y}\right)\right) \]
      10. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(z, \mathsf{/.f64}\left(t, \left(\frac{z}{t}\right)\right)\right), \left(\frac{x \cdot \color{blue}{x}}{y \cdot y}\right)\right) \]
      11. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(z, \mathsf{/.f64}\left(t, \mathsf{/.f64}\left(z, t\right)\right)\right), \left(\frac{x \cdot x}{y \cdot y}\right)\right) \]
      12. times-fracN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(z, \mathsf{/.f64}\left(t, \mathsf{/.f64}\left(z, t\right)\right)\right), \left(\frac{x}{y} \cdot \color{blue}{\frac{x}{y}}\right)\right) \]
      13. clear-numN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(z, \mathsf{/.f64}\left(t, \mathsf{/.f64}\left(z, t\right)\right)\right), \left(\frac{1}{\frac{y}{x}} \cdot \frac{\color{blue}{x}}{y}\right)\right) \]
      14. frac-timesN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(z, \mathsf{/.f64}\left(t, \mathsf{/.f64}\left(z, t\right)\right)\right), \left(\frac{1 \cdot x}{\color{blue}{\frac{y}{x} \cdot y}}\right)\right) \]
      15. *-lft-identityN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(z, \mathsf{/.f64}\left(t, \mathsf{/.f64}\left(z, t\right)\right)\right), \left(\frac{x}{\color{blue}{\frac{y}{x}} \cdot y}\right)\right) \]
      16. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(z, \mathsf{/.f64}\left(t, \mathsf{/.f64}\left(z, t\right)\right)\right), \mathsf{/.f64}\left(x, \color{blue}{\left(\frac{y}{x} \cdot y\right)}\right)\right) \]
      17. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(z, \mathsf{/.f64}\left(t, \mathsf{/.f64}\left(z, t\right)\right)\right), \mathsf{/.f64}\left(x, \mathsf{*.f64}\left(\left(\frac{y}{x}\right), \color{blue}{y}\right)\right)\right) \]
      18. /-lowering-/.f6496.7%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(z, \mathsf{/.f64}\left(t, \mathsf{/.f64}\left(z, t\right)\right)\right), \mathsf{/.f64}\left(x, \mathsf{*.f64}\left(\mathsf{/.f64}\left(y, x\right), y\right)\right)\right) \]
    4. Applied egg-rr96.7%

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

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

Alternative 3: 87.9% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\frac{z \cdot z}{t \cdot t} \leq 0:\\
\;\;\;\;\frac{\frac{x}{y}}{\frac{y}{x}}\\

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


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

    1. Initial program 64.0%

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

      \[\leadsto \color{blue}{\frac{{x}^{2}}{{y}^{2}}} \]
    4. Step-by-step derivation
      1. unpow2N/A

        \[\leadsto \frac{x \cdot x}{{\color{blue}{y}}^{2}} \]
      2. associate-/l*N/A

        \[\leadsto x \cdot \color{blue}{\frac{x}{{y}^{2}}} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{\left(\frac{x}{{y}^{2}}\right)}\right) \]
      4. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(x, \left(\frac{x}{y \cdot \color{blue}{y}}\right)\right) \]
      5. associate-/r*N/A

        \[\leadsto \mathsf{*.f64}\left(x, \left(\frac{\frac{x}{y}}{\color{blue}{y}}\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(\left(\frac{x}{y}\right), \color{blue}{y}\right)\right) \]
      7. /-lowering-/.f6481.8%

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(\mathsf{/.f64}\left(x, y\right), y\right)\right) \]
    5. Simplified81.8%

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

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

        \[\leadsto \frac{x}{y} \cdot \color{blue}{\frac{x}{y}} \]
      3. clear-numN/A

        \[\leadsto \frac{x}{y} \cdot \frac{1}{\color{blue}{\frac{y}{x}}} \]
      4. un-div-invN/A

        \[\leadsto \frac{\frac{x}{y}}{\color{blue}{\frac{y}{x}}} \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{x}{y}\right), \color{blue}{\left(\frac{y}{x}\right)}\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(x, y\right), \left(\frac{\color{blue}{y}}{x}\right)\right) \]
      7. /-lowering-/.f6491.0%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(x, y\right), \mathsf{/.f64}\left(y, \color{blue}{x}\right)\right) \]
    7. Applied egg-rr91.0%

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

    if 0.0 < (/.f64 (*.f64 z z) (*.f64 t t))

    1. Initial program 69.3%

      \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\left(x \cdot \frac{x}{y}\right), y\right), \left(\frac{\color{blue}{z} \cdot z}{t \cdot t}\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \left(\frac{x}{y}\right)\right), y\right), \left(\frac{\color{blue}{z} \cdot z}{t \cdot t}\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \mathsf{/.f64}\left(x, y\right)\right), y\right), \left(\frac{z \cdot z}{t \cdot t}\right)\right) \]
      7. associate-/l*N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \mathsf{/.f64}\left(x, y\right)\right), y\right), \left(z \cdot \color{blue}{\frac{z}{t \cdot t}}\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \mathsf{/.f64}\left(x, y\right)\right), y\right), \mathsf{*.f64}\left(z, \color{blue}{\left(\frac{z}{t \cdot t}\right)}\right)\right) \]
      9. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \mathsf{/.f64}\left(x, y\right)\right), y\right), \mathsf{*.f64}\left(z, \mathsf{/.f64}\left(z, \color{blue}{\left(t \cdot t\right)}\right)\right)\right) \]
      10. *-lowering-*.f6489.0%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \mathsf{/.f64}\left(x, y\right)\right), y\right), \mathsf{*.f64}\left(z, \mathsf{/.f64}\left(z, \mathsf{*.f64}\left(t, \color{blue}{t}\right)\right)\right)\right) \]
    3. Simplified89.0%

      \[\leadsto \color{blue}{\frac{x \cdot \frac{x}{y}}{y} + z \cdot \frac{z}{t \cdot t}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. associate-/l*N/A

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

        \[\leadsto \mathsf{+.f64}\left(\left(x \cdot \frac{x}{y \cdot y}\right), \mathsf{*.f64}\left(z, \mathsf{/.f64}\left(z, \mathsf{*.f64}\left(t, t\right)\right)\right)\right) \]
      3. clear-numN/A

        \[\leadsto \mathsf{+.f64}\left(\left(x \cdot \frac{1}{\frac{y \cdot y}{x}}\right), \mathsf{*.f64}\left(z, \mathsf{/.f64}\left(z, \mathsf{*.f64}\left(t, t\right)\right)\right)\right) \]
      4. un-div-invN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{x}{\frac{y \cdot y}{x}}\right), \mathsf{*.f64}\left(\color{blue}{z}, \mathsf{/.f64}\left(z, \mathsf{*.f64}\left(t, t\right)\right)\right)\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(x, \left(\frac{y \cdot y}{x}\right)\right), \mathsf{*.f64}\left(\color{blue}{z}, \mathsf{/.f64}\left(z, \mathsf{*.f64}\left(t, t\right)\right)\right)\right) \]
      6. clear-numN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(x, \left(\frac{1}{\frac{x}{y \cdot y}}\right)\right), \mathsf{*.f64}\left(z, \mathsf{/.f64}\left(z, \mathsf{*.f64}\left(t, t\right)\right)\right)\right) \]
      7. associate-/r*N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(x, \left(\frac{1}{\frac{\frac{x}{y}}{y}}\right)\right), \mathsf{*.f64}\left(z, \mathsf{/.f64}\left(z, \mathsf{*.f64}\left(t, t\right)\right)\right)\right) \]
      8. clear-numN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(x, \left(\frac{y}{\frac{x}{y}}\right)\right), \mathsf{*.f64}\left(z, \mathsf{/.f64}\left(z, \mathsf{*.f64}\left(t, t\right)\right)\right)\right) \]
      9. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(x, \mathsf{/.f64}\left(y, \left(\frac{x}{y}\right)\right)\right), \mathsf{*.f64}\left(z, \mathsf{/.f64}\left(z, \mathsf{*.f64}\left(t, t\right)\right)\right)\right) \]
      10. /-lowering-/.f6488.3%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(x, \mathsf{/.f64}\left(y, \mathsf{/.f64}\left(x, y\right)\right)\right), \mathsf{*.f64}\left(z, \mathsf{/.f64}\left(z, \mathsf{*.f64}\left(t, t\right)\right)\right)\right) \]
    6. Applied egg-rr88.3%

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

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

Alternative 4: 90.9% accurate, 0.7× speedup?

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

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

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


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

    1. Initial program 67.2%

      \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\left(x \cdot \frac{x}{y}\right), y\right), \left(\frac{\color{blue}{z} \cdot z}{t \cdot t}\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \left(\frac{x}{y}\right)\right), y\right), \left(\frac{\color{blue}{z} \cdot z}{t \cdot t}\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \mathsf{/.f64}\left(x, y\right)\right), y\right), \left(\frac{z \cdot z}{t \cdot t}\right)\right) \]
      7. associate-/l*N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \mathsf{/.f64}\left(x, y\right)\right), y\right), \left(z \cdot \color{blue}{\frac{z}{t \cdot t}}\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \mathsf{/.f64}\left(x, y\right)\right), y\right), \mathsf{*.f64}\left(z, \color{blue}{\left(\frac{z}{t \cdot t}\right)}\right)\right) \]
      9. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \mathsf{/.f64}\left(x, y\right)\right), y\right), \mathsf{*.f64}\left(z, \mathsf{/.f64}\left(z, \color{blue}{\left(t \cdot t\right)}\right)\right)\right) \]
      10. *-lowering-*.f6489.6%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \mathsf{/.f64}\left(x, y\right)\right), y\right), \mathsf{*.f64}\left(z, \mathsf{/.f64}\left(z, \mathsf{*.f64}\left(t, \color{blue}{t}\right)\right)\right)\right) \]
    3. Simplified89.6%

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

    if 6.90000000000000034e-218 < y

    1. Initial program 67.8%

      \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*r/N/A

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

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

        \[\leadsto \mathsf{+.f64}\left(\left(z \cdot \frac{z}{t \cdot t}\right), \color{blue}{\left(\frac{x \cdot x}{y \cdot y}\right)}\right) \]
      4. clear-numN/A

        \[\leadsto \mathsf{+.f64}\left(\left(z \cdot \frac{1}{\frac{t \cdot t}{z}}\right), \left(\frac{x \cdot \color{blue}{x}}{y \cdot y}\right)\right) \]
      5. un-div-invN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{z}{\frac{t \cdot t}{z}}\right), \left(\frac{\color{blue}{x \cdot x}}{y \cdot y}\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(z, \left(\frac{t \cdot t}{z}\right)\right), \left(\frac{\color{blue}{x \cdot x}}{y \cdot y}\right)\right) \]
      7. clear-numN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(z, \left(\frac{1}{\frac{z}{t \cdot t}}\right)\right), \left(\frac{x \cdot \color{blue}{x}}{y \cdot y}\right)\right) \]
      8. associate-/r*N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(z, \left(\frac{1}{\frac{\frac{z}{t}}{t}}\right)\right), \left(\frac{x \cdot x}{y \cdot y}\right)\right) \]
      9. clear-numN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(z, \left(\frac{t}{\frac{z}{t}}\right)\right), \left(\frac{x \cdot \color{blue}{x}}{y \cdot y}\right)\right) \]
      10. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(z, \mathsf{/.f64}\left(t, \left(\frac{z}{t}\right)\right)\right), \left(\frac{x \cdot \color{blue}{x}}{y \cdot y}\right)\right) \]
      11. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(z, \mathsf{/.f64}\left(t, \mathsf{/.f64}\left(z, t\right)\right)\right), \left(\frac{x \cdot x}{y \cdot y}\right)\right) \]
      12. times-fracN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(z, \mathsf{/.f64}\left(t, \mathsf{/.f64}\left(z, t\right)\right)\right), \left(\frac{x}{y} \cdot \color{blue}{\frac{x}{y}}\right)\right) \]
      13. clear-numN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(z, \mathsf{/.f64}\left(t, \mathsf{/.f64}\left(z, t\right)\right)\right), \left(\frac{1}{\frac{y}{x}} \cdot \frac{\color{blue}{x}}{y}\right)\right) \]
      14. frac-timesN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(z, \mathsf{/.f64}\left(t, \mathsf{/.f64}\left(z, t\right)\right)\right), \left(\frac{1 \cdot x}{\color{blue}{\frac{y}{x} \cdot y}}\right)\right) \]
      15. *-lft-identityN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(z, \mathsf{/.f64}\left(t, \mathsf{/.f64}\left(z, t\right)\right)\right), \left(\frac{x}{\color{blue}{\frac{y}{x}} \cdot y}\right)\right) \]
      16. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(z, \mathsf{/.f64}\left(t, \mathsf{/.f64}\left(z, t\right)\right)\right), \mathsf{/.f64}\left(x, \color{blue}{\left(\frac{y}{x} \cdot y\right)}\right)\right) \]
      17. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(z, \mathsf{/.f64}\left(t, \mathsf{/.f64}\left(z, t\right)\right)\right), \mathsf{/.f64}\left(x, \mathsf{*.f64}\left(\left(\frac{y}{x}\right), \color{blue}{y}\right)\right)\right) \]
      18. /-lowering-/.f6494.5%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(z, \mathsf{/.f64}\left(t, \mathsf{/.f64}\left(z, t\right)\right)\right), \mathsf{/.f64}\left(x, \mathsf{*.f64}\left(\mathsf{/.f64}\left(y, x\right), y\right)\right)\right) \]
    4. Applied egg-rr94.5%

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

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

Alternative 5: 80.7% accurate, 0.8× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\frac{z}{\frac{t}{\frac{z}{t}}}\\


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

    1. Initial program 65.9%

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

      \[\leadsto \color{blue}{\frac{{x}^{2}}{{y}^{2}}} \]
    4. Step-by-step derivation
      1. unpow2N/A

        \[\leadsto \frac{x \cdot x}{{\color{blue}{y}}^{2}} \]
      2. associate-/l*N/A

        \[\leadsto x \cdot \color{blue}{\frac{x}{{y}^{2}}} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{\left(\frac{x}{{y}^{2}}\right)}\right) \]
      4. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(x, \left(\frac{x}{y \cdot \color{blue}{y}}\right)\right) \]
      5. associate-/r*N/A

        \[\leadsto \mathsf{*.f64}\left(x, \left(\frac{\frac{x}{y}}{\color{blue}{y}}\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(\left(\frac{x}{y}\right), \color{blue}{y}\right)\right) \]
      7. /-lowering-/.f6477.1%

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(\mathsf{/.f64}\left(x, y\right), y\right)\right) \]
    5. Simplified77.1%

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

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

        \[\leadsto \frac{x}{y} \cdot \color{blue}{\frac{x}{y}} \]
      3. clear-numN/A

        \[\leadsto \frac{x}{y} \cdot \frac{1}{\color{blue}{\frac{y}{x}}} \]
      4. un-div-invN/A

        \[\leadsto \frac{\frac{x}{y}}{\color{blue}{\frac{y}{x}}} \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{x}{y}\right), \color{blue}{\left(\frac{y}{x}\right)}\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(x, y\right), \left(\frac{\color{blue}{y}}{x}\right)\right) \]
      7. /-lowering-/.f6486.3%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(x, y\right), \mathsf{/.f64}\left(y, \color{blue}{x}\right)\right) \]
    7. Applied egg-rr86.3%

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

    if 3.9999999999999998e61 < (/.f64 (*.f64 z z) (*.f64 t t))

    1. Initial program 68.8%

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

      \[\leadsto \color{blue}{\frac{{z}^{2}}{{t}^{2}}} \]
    4. Step-by-step derivation
      1. unpow2N/A

        \[\leadsto \frac{{z}^{2}}{t \cdot \color{blue}{t}} \]
      2. associate-/r*N/A

        \[\leadsto \frac{\frac{{z}^{2}}{t}}{\color{blue}{t}} \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{{z}^{2}}{t}\right), \color{blue}{t}\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left({z}^{2}\right), t\right), t\right) \]
      5. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(z \cdot z\right), t\right), t\right) \]
      6. *-lowering-*.f6475.7%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(z, z\right), t\right), t\right) \]
    5. Simplified75.7%

      \[\leadsto \color{blue}{\frac{\frac{z \cdot z}{t}}{t}} \]
    6. Step-by-step derivation
      1. associate-/l/N/A

        \[\leadsto \frac{z \cdot z}{\color{blue}{t \cdot t}} \]
      2. frac-timesN/A

        \[\leadsto \frac{z}{t} \cdot \color{blue}{\frac{z}{t}} \]
      3. associate-/r/N/A

        \[\leadsto \frac{z}{\color{blue}{\frac{t}{\frac{z}{t}}}} \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(z, \color{blue}{\left(\frac{t}{\frac{z}{t}}\right)}\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(z, \mathsf{/.f64}\left(t, \color{blue}{\left(\frac{z}{t}\right)}\right)\right) \]
      6. /-lowering-/.f6484.2%

        \[\leadsto \mathsf{/.f64}\left(z, \mathsf{/.f64}\left(t, \mathsf{/.f64}\left(z, \color{blue}{t}\right)\right)\right) \]
    7. Applied egg-rr84.2%

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

Alternative 6: 80.6% accurate, 0.8× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\frac{z}{\frac{t}{\frac{z}{t}}}\\


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

    1. Initial program 65.9%

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

      \[\leadsto \color{blue}{\frac{{x}^{2}}{{y}^{2}}} \]
    4. Step-by-step derivation
      1. unpow2N/A

        \[\leadsto \frac{x \cdot x}{{\color{blue}{y}}^{2}} \]
      2. associate-/l*N/A

        \[\leadsto x \cdot \color{blue}{\frac{x}{{y}^{2}}} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{\left(\frac{x}{{y}^{2}}\right)}\right) \]
      4. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(x, \left(\frac{x}{y \cdot \color{blue}{y}}\right)\right) \]
      5. associate-/r*N/A

        \[\leadsto \mathsf{*.f64}\left(x, \left(\frac{\frac{x}{y}}{\color{blue}{y}}\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(\left(\frac{x}{y}\right), \color{blue}{y}\right)\right) \]
      7. /-lowering-/.f6477.1%

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(\mathsf{/.f64}\left(x, y\right), y\right)\right) \]
    5. Simplified77.1%

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

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

        \[\leadsto \frac{x}{y} \cdot \color{blue}{\frac{x}{y}} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{x}{y}\right), \color{blue}{\left(\frac{x}{y}\right)}\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(x, y\right), \left(\frac{\color{blue}{x}}{y}\right)\right) \]
      5. /-lowering-/.f6486.1%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(x, y\right), \mathsf{/.f64}\left(x, \color{blue}{y}\right)\right) \]
    7. Applied egg-rr86.1%

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

    if 3.9999999999999998e61 < (/.f64 (*.f64 z z) (*.f64 t t))

    1. Initial program 68.8%

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

      \[\leadsto \color{blue}{\frac{{z}^{2}}{{t}^{2}}} \]
    4. Step-by-step derivation
      1. unpow2N/A

        \[\leadsto \frac{{z}^{2}}{t \cdot \color{blue}{t}} \]
      2. associate-/r*N/A

        \[\leadsto \frac{\frac{{z}^{2}}{t}}{\color{blue}{t}} \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{{z}^{2}}{t}\right), \color{blue}{t}\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left({z}^{2}\right), t\right), t\right) \]
      5. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(z \cdot z\right), t\right), t\right) \]
      6. *-lowering-*.f6475.7%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(z, z\right), t\right), t\right) \]
    5. Simplified75.7%

      \[\leadsto \color{blue}{\frac{\frac{z \cdot z}{t}}{t}} \]
    6. Step-by-step derivation
      1. associate-/l/N/A

        \[\leadsto \frac{z \cdot z}{\color{blue}{t \cdot t}} \]
      2. frac-timesN/A

        \[\leadsto \frac{z}{t} \cdot \color{blue}{\frac{z}{t}} \]
      3. associate-/r/N/A

        \[\leadsto \frac{z}{\color{blue}{\frac{t}{\frac{z}{t}}}} \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(z, \color{blue}{\left(\frac{t}{\frac{z}{t}}\right)}\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(z, \mathsf{/.f64}\left(t, \color{blue}{\left(\frac{z}{t}\right)}\right)\right) \]
      6. /-lowering-/.f6484.2%

        \[\leadsto \mathsf{/.f64}\left(z, \mathsf{/.f64}\left(t, \mathsf{/.f64}\left(z, \color{blue}{t}\right)\right)\right) \]
    7. Applied egg-rr84.2%

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

Alternative 7: 59.1% accurate, 2.1× speedup?

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

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

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

    \[\leadsto \color{blue}{\frac{{x}^{2}}{{y}^{2}}} \]
  4. Step-by-step derivation
    1. unpow2N/A

      \[\leadsto \frac{x \cdot x}{{\color{blue}{y}}^{2}} \]
    2. associate-/l*N/A

      \[\leadsto x \cdot \color{blue}{\frac{x}{{y}^{2}}} \]
    3. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{\left(\frac{x}{{y}^{2}}\right)}\right) \]
    4. unpow2N/A

      \[\leadsto \mathsf{*.f64}\left(x, \left(\frac{x}{y \cdot \color{blue}{y}}\right)\right) \]
    5. associate-/r*N/A

      \[\leadsto \mathsf{*.f64}\left(x, \left(\frac{\frac{x}{y}}{\color{blue}{y}}\right)\right) \]
    6. /-lowering-/.f64N/A

      \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(\left(\frac{x}{y}\right), \color{blue}{y}\right)\right) \]
    7. /-lowering-/.f6457.9%

      \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(\mathsf{/.f64}\left(x, y\right), y\right)\right) \]
  5. Simplified57.9%

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

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

      \[\leadsto \frac{x}{y} \cdot \color{blue}{\frac{x}{y}} \]
    3. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\left(\frac{x}{y}\right), \color{blue}{\left(\frac{x}{y}\right)}\right) \]
    4. /-lowering-/.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(x, y\right), \left(\frac{\color{blue}{x}}{y}\right)\right) \]
    5. /-lowering-/.f6461.1%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(x, y\right), \mathsf{/.f64}\left(x, \color{blue}{y}\right)\right) \]
  7. Applied egg-rr61.1%

    \[\leadsto \color{blue}{\frac{x}{y} \cdot \frac{x}{y}} \]
  8. Add Preprocessing

Alternative 8: 56.9% accurate, 2.1× speedup?

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

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

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

    \[\leadsto \color{blue}{\frac{{x}^{2}}{{y}^{2}}} \]
  4. Step-by-step derivation
    1. unpow2N/A

      \[\leadsto \frac{x \cdot x}{{\color{blue}{y}}^{2}} \]
    2. associate-/l*N/A

      \[\leadsto x \cdot \color{blue}{\frac{x}{{y}^{2}}} \]
    3. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{\left(\frac{x}{{y}^{2}}\right)}\right) \]
    4. unpow2N/A

      \[\leadsto \mathsf{*.f64}\left(x, \left(\frac{x}{y \cdot \color{blue}{y}}\right)\right) \]
    5. associate-/r*N/A

      \[\leadsto \mathsf{*.f64}\left(x, \left(\frac{\frac{x}{y}}{\color{blue}{y}}\right)\right) \]
    6. /-lowering-/.f64N/A

      \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(\left(\frac{x}{y}\right), \color{blue}{y}\right)\right) \]
    7. /-lowering-/.f6457.9%

      \[\leadsto \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(\mathsf{/.f64}\left(x, y\right), y\right)\right) \]
  5. Simplified57.9%

    \[\leadsto \color{blue}{x \cdot \frac{\frac{x}{y}}{y}} \]
  6. Add Preprocessing

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

  :alt
  (! :herbie-platform default (+ (pow (/ x y) 2) (pow (/ z t) 2)))

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