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

Percentage Accurate: 66.7% → 96.7%
Time: 8.4s
Alternatives: 11
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));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y, z, t)
use fmin_fmax_functions
    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}

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 11 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.7% 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));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y, z, t)
use fmin_fmax_functions
    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.7% accurate, 1.0× speedup?

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

\\
\mathsf{fma}\left(\frac{x}{y}, \frac{x}{y}, \frac{\frac{z}{t} \cdot z}{t}\right)
\end{array}
Derivation
  1. Initial program 66.7%

    \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
  2. Applied rewrites88.9%

    \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{x}{y}, \frac{x}{y}, \frac{z}{t \cdot t} \cdot z\right)} \]
  3. Step-by-step derivation
    1. lift-*.f64N/A

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

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

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

      \[\leadsto \mathsf{fma}\left(\frac{x}{y}, \frac{x}{y}, \color{blue}{\frac{z \cdot z}{t \cdot t}}\right) \]
    5. pow2N/A

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

      \[\leadsto \mathsf{fma}\left(\frac{x}{y}, \frac{x}{y}, \color{blue}{\frac{\frac{{z}^{2}}{t}}{t}}\right) \]
    7. lower-/.f64N/A

      \[\leadsto \mathsf{fma}\left(\frac{x}{y}, \frac{x}{y}, \color{blue}{\frac{\frac{{z}^{2}}{t}}{t}}\right) \]
    8. pow2N/A

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

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

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

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

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

Alternative 2: 96.5% accurate, 1.0× speedup?

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

\\
\mathsf{fma}\left(\frac{x}{y}, \frac{x}{y}, \frac{\frac{z}{t}}{t} \cdot z\right)
\end{array}
Derivation
  1. Initial program 66.7%

    \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
  2. Applied rewrites88.9%

    \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{x}{y}, \frac{x}{y}, \frac{z}{t \cdot t} \cdot z\right)} \]
  3. Step-by-step derivation
    1. lift-*.f64N/A

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

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

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

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

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

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

Alternative 3: 96.5% accurate, 0.6× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (*.f64 x x) (*.f64 y y)) < 1.99999999999999991e283

    1. Initial program 73.6%

      \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
    2. Applied rewrites97.6%

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

    if 1.99999999999999991e283 < (/.f64 (*.f64 x x) (*.f64 y y))

    1. Initial program 58.7%

      \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
    2. Applied rewrites95.4%

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

Alternative 4: 91.1% accurate, 0.6× speedup?

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

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

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


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

    1. Initial program 70.7%

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

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

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

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

        \[\leadsto \frac{z}{{t}^{2}} \cdot \color{blue}{z} \]
      4. lower-/.f64N/A

        \[\leadsto \frac{z}{{t}^{2}} \cdot z \]
      5. pow2N/A

        \[\leadsto \frac{z}{t \cdot t} \cdot z \]
      6. lift-*.f6475.5

        \[\leadsto \frac{z}{t \cdot t} \cdot z \]
    4. Applied rewrites75.5%

      \[\leadsto \color{blue}{\frac{z}{t \cdot t} \cdot z} \]
    5. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{z}{t \cdot t} \cdot z \]
      2. lift-/.f64N/A

        \[\leadsto \frac{z}{t \cdot t} \cdot z \]
      3. pow2N/A

        \[\leadsto \frac{z}{{t}^{2}} \cdot z \]
      4. frac-2negN/A

        \[\leadsto \frac{\mathsf{neg}\left(z\right)}{\mathsf{neg}\left({t}^{2}\right)} \cdot z \]
      5. frac-2negN/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(z\right)\right)\right)}{\mathsf{neg}\left(\left(\mathsf{neg}\left({t}^{2}\right)\right)\right)} \cdot z \]
      6. remove-double-negN/A

        \[\leadsto \frac{z}{\mathsf{neg}\left(\left(\mathsf{neg}\left({t}^{2}\right)\right)\right)} \cdot z \]
      7. *-lft-identityN/A

        \[\leadsto \frac{1 \cdot z}{\mathsf{neg}\left(\left(\mathsf{neg}\left({t}^{2}\right)\right)\right)} \cdot z \]
      8. remove-double-negN/A

        \[\leadsto \frac{1 \cdot z}{{t}^{2}} \cdot z \]
      9. associate-*l/N/A

        \[\leadsto \left(\frac{1}{{t}^{2}} \cdot z\right) \cdot z \]
      10. pow2N/A

        \[\leadsto \left(\frac{1}{t \cdot t} \cdot z\right) \cdot z \]
      11. associate-/r*N/A

        \[\leadsto \left(\frac{\frac{1}{t}}{t} \cdot z\right) \cdot z \]
      12. associate-*l/N/A

        \[\leadsto \frac{\frac{1}{t} \cdot z}{t} \cdot z \]
      13. lower-/.f64N/A

        \[\leadsto \frac{\frac{1}{t} \cdot z}{t} \cdot z \]
      14. lower-*.f64N/A

        \[\leadsto \frac{\frac{1}{t} \cdot z}{t} \cdot z \]
      15. lower-/.f6488.1

        \[\leadsto \frac{\frac{1}{t} \cdot z}{t} \cdot z \]
    6. Applied rewrites88.1%

      \[\leadsto \frac{\frac{1}{t} \cdot z}{t} \cdot z \]

    if 0.0 < (/.f64 (*.f64 x x) (*.f64 y y))

    1. Initial program 64.6%

      \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
    2. Applied rewrites92.7%

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

Alternative 5: 81.3% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq 7.5 \cdot 10^{-158}:\\
\;\;\;\;\left(\frac{1}{y} \cdot \frac{x}{y}\right) \cdot x\\

\mathbf{elif}\;y \leq 1.25 \cdot 10^{+154}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{t \cdot t}, z, \frac{x}{y \cdot y} \cdot x\right)\\

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


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

    1. Initial program 65.2%

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

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

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

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

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

        \[\leadsto \frac{x}{{y}^{2}} \cdot x \]
      5. pow2N/A

        \[\leadsto \frac{x}{y \cdot y} \cdot x \]
      6. lift-*.f6456.4

        \[\leadsto \frac{x}{y \cdot y} \cdot x \]
    4. Applied rewrites56.4%

      \[\leadsto \color{blue}{\frac{x}{y \cdot y} \cdot x} \]
    5. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{x}{y \cdot y} \cdot x \]
      2. lift-/.f64N/A

        \[\leadsto \frac{x}{y \cdot y} \cdot x \]
      3. remove-double-negN/A

        \[\leadsto \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\frac{x}{y \cdot y}\right)\right)\right)\right) \cdot x \]
      4. pow2N/A

        \[\leadsto \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\frac{x}{{y}^{2}}\right)\right)\right)\right) \cdot x \]
      5. distribute-neg-frac2N/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{x}{\mathsf{neg}\left({y}^{2}\right)}\right)\right) \cdot x \]
      6. *-lft-identityN/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{1 \cdot x}{\mathsf{neg}\left({y}^{2}\right)}\right)\right) \cdot x \]
      7. distribute-neg-frac2N/A

        \[\leadsto \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\frac{1 \cdot x}{{y}^{2}}\right)\right)\right)\right) \cdot x \]
      8. pow2N/A

        \[\leadsto \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\frac{1 \cdot x}{y \cdot y}\right)\right)\right)\right) \cdot x \]
      9. frac-timesN/A

        \[\leadsto \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\frac{1}{y} \cdot \frac{x}{y}\right)\right)\right)\right) \cdot x \]
      10. lift-/.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\frac{1}{y} \cdot \frac{x}{y}\right)\right)\right)\right) \cdot x \]
      11. distribute-rgt-neg-inN/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{1}{y} \cdot \left(\mathsf{neg}\left(\frac{x}{y}\right)\right)\right)\right) \cdot x \]
      12. distribute-rgt-neg-outN/A

        \[\leadsto \left(\frac{1}{y} \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\frac{x}{y}\right)\right)\right)\right)\right) \cdot x \]
      13. remove-double-negN/A

        \[\leadsto \left(\frac{1}{y} \cdot \frac{x}{y}\right) \cdot x \]
      14. lower-*.f64N/A

        \[\leadsto \left(\frac{1}{y} \cdot \frac{x}{y}\right) \cdot x \]
      15. lift-/.f6460.8

        \[\leadsto \left(\frac{1}{y} \cdot \frac{x}{y}\right) \cdot x \]
    6. Applied rewrites60.8%

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

    if 7.5e-158 < y < 1.25000000000000001e154

    1. Initial program 76.5%

      \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
    2. Applied rewrites88.7%

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

    if 1.25000000000000001e154 < y

    1. Initial program 54.0%

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

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

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

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

        \[\leadsto \frac{z}{{t}^{2}} \cdot \color{blue}{z} \]
      4. lower-/.f64N/A

        \[\leadsto \frac{z}{{t}^{2}} \cdot z \]
      5. pow2N/A

        \[\leadsto \frac{z}{t \cdot t} \cdot z \]
      6. lift-*.f6468.2

        \[\leadsto \frac{z}{t \cdot t} \cdot z \]
    4. Applied rewrites68.2%

      \[\leadsto \color{blue}{\frac{z}{t \cdot t} \cdot z} \]
    5. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{z}{t \cdot t} \cdot z \]
      2. lift-/.f64N/A

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

        \[\leadsto \frac{\frac{z}{t}}{t} \cdot z \]
      4. lift-/.f64N/A

        \[\leadsto \frac{\frac{z}{t}}{t} \cdot z \]
      5. lift-/.f6479.6

        \[\leadsto \frac{\frac{z}{t}}{t} \cdot z \]
    6. Applied rewrites79.6%

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

Alternative 6: 81.3% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{z \cdot z}{t \cdot t}\\ \mathbf{if}\;t\_1 \leq 2 \cdot 10^{+80}:\\ \;\;\;\;\frac{x}{y} \cdot \frac{x}{y}\\ \mathbf{elif}\;t\_1 \leq \infty:\\ \;\;\;\;\frac{\frac{1}{t} \cdot z}{t} \cdot z\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y} \cdot x\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (/ (* z z) (* t t))))
   (if (<= t_1 2e+80)
     (* (/ x y) (/ x y))
     (if (<= t_1 INFINITY) (* (/ (* (/ 1.0 t) z) t) z) (* (/ (/ x y) y) x)))))
double code(double x, double y, double z, double t) {
	double t_1 = (z * z) / (t * t);
	double tmp;
	if (t_1 <= 2e+80) {
		tmp = (x / y) * (x / y);
	} else if (t_1 <= ((double) INFINITY)) {
		tmp = (((1.0 / t) * z) / t) * z;
	} else {
		tmp = ((x / y) / y) * x;
	}
	return tmp;
}
public static double code(double x, double y, double z, double t) {
	double t_1 = (z * z) / (t * t);
	double tmp;
	if (t_1 <= 2e+80) {
		tmp = (x / y) * (x / y);
	} else if (t_1 <= Double.POSITIVE_INFINITY) {
		tmp = (((1.0 / t) * z) / t) * z;
	} else {
		tmp = ((x / y) / y) * x;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = (z * z) / (t * t)
	tmp = 0
	if t_1 <= 2e+80:
		tmp = (x / y) * (x / y)
	elif t_1 <= math.inf:
		tmp = (((1.0 / t) * z) / t) * z
	else:
		tmp = ((x / y) / y) * x
	return tmp
function code(x, y, z, t)
	t_1 = Float64(Float64(z * z) / Float64(t * t))
	tmp = 0.0
	if (t_1 <= 2e+80)
		tmp = Float64(Float64(x / y) * Float64(x / y));
	elseif (t_1 <= Inf)
		tmp = Float64(Float64(Float64(Float64(1.0 / t) * z) / t) * z);
	else
		tmp = Float64(Float64(Float64(x / y) / y) * x);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = (z * z) / (t * t);
	tmp = 0.0;
	if (t_1 <= 2e+80)
		tmp = (x / y) * (x / y);
	elseif (t_1 <= Inf)
		tmp = (((1.0 / t) * z) / t) * z;
	else
		tmp = ((x / y) / y) * x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z * z), $MachinePrecision] / N[(t * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 2e+80], N[(N[(x / y), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(N[(N[(N[(1.0 / t), $MachinePrecision] * z), $MachinePrecision] / t), $MachinePrecision] * z), $MachinePrecision], N[(N[(N[(x / y), $MachinePrecision] / y), $MachinePrecision] * x), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \frac{z \cdot z}{t \cdot t}\\
\mathbf{if}\;t\_1 \leq 2 \cdot 10^{+80}:\\
\;\;\;\;\frac{x}{y} \cdot \frac{x}{y}\\

\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\frac{\frac{1}{t} \cdot z}{t} \cdot z\\

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


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

    1. Initial program 73.8%

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

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

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

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

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

        \[\leadsto \frac{x}{{y}^{2}} \cdot x \]
      5. pow2N/A

        \[\leadsto \frac{x}{y \cdot y} \cdot x \]
      6. lift-*.f6469.3

        \[\leadsto \frac{x}{y \cdot y} \cdot x \]
    4. Applied rewrites69.3%

      \[\leadsto \color{blue}{\frac{x}{y \cdot y} \cdot x} \]
    5. Step-by-step derivation
      1. lift-*.f64N/A

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

        \[\leadsto \frac{x}{y \cdot y} \cdot x \]
      3. lift-/.f64N/A

        \[\leadsto \frac{x}{y \cdot y} \cdot x \]
      4. pow2N/A

        \[\leadsto \frac{x}{{y}^{2}} \cdot x \]
      5. pow2N/A

        \[\leadsto \frac{x}{y \cdot y} \cdot x \]
      6. associate-/r*N/A

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

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

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

        \[\leadsto \frac{x}{y} \cdot \color{blue}{\frac{x}{y}} \]
      10. lift-/.f64N/A

        \[\leadsto \frac{x}{y} \cdot \frac{\color{blue}{x}}{y} \]
      11. lift-/.f6484.7

        \[\leadsto \frac{x}{y} \cdot \frac{x}{\color{blue}{y}} \]
    6. Applied rewrites84.7%

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

    if 2e80 < (/.f64 (*.f64 z z) (*.f64 t t)) < +inf.0

    1. Initial program 78.7%

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

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

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

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

        \[\leadsto \frac{z}{{t}^{2}} \cdot \color{blue}{z} \]
      4. lower-/.f64N/A

        \[\leadsto \frac{z}{{t}^{2}} \cdot z \]
      5. pow2N/A

        \[\leadsto \frac{z}{t \cdot t} \cdot z \]
      6. lift-*.f6486.4

        \[\leadsto \frac{z}{t \cdot t} \cdot z \]
    4. Applied rewrites86.4%

      \[\leadsto \color{blue}{\frac{z}{t \cdot t} \cdot z} \]
    5. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{z}{t \cdot t} \cdot z \]
      2. lift-/.f64N/A

        \[\leadsto \frac{z}{t \cdot t} \cdot z \]
      3. pow2N/A

        \[\leadsto \frac{z}{{t}^{2}} \cdot z \]
      4. frac-2negN/A

        \[\leadsto \frac{\mathsf{neg}\left(z\right)}{\mathsf{neg}\left({t}^{2}\right)} \cdot z \]
      5. frac-2negN/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(z\right)\right)\right)}{\mathsf{neg}\left(\left(\mathsf{neg}\left({t}^{2}\right)\right)\right)} \cdot z \]
      6. remove-double-negN/A

        \[\leadsto \frac{z}{\mathsf{neg}\left(\left(\mathsf{neg}\left({t}^{2}\right)\right)\right)} \cdot z \]
      7. *-lft-identityN/A

        \[\leadsto \frac{1 \cdot z}{\mathsf{neg}\left(\left(\mathsf{neg}\left({t}^{2}\right)\right)\right)} \cdot z \]
      8. remove-double-negN/A

        \[\leadsto \frac{1 \cdot z}{{t}^{2}} \cdot z \]
      9. associate-*l/N/A

        \[\leadsto \left(\frac{1}{{t}^{2}} \cdot z\right) \cdot z \]
      10. pow2N/A

        \[\leadsto \left(\frac{1}{t \cdot t} \cdot z\right) \cdot z \]
      11. associate-/r*N/A

        \[\leadsto \left(\frac{\frac{1}{t}}{t} \cdot z\right) \cdot z \]
      12. associate-*l/N/A

        \[\leadsto \frac{\frac{1}{t} \cdot z}{t} \cdot z \]
      13. lower-/.f64N/A

        \[\leadsto \frac{\frac{1}{t} \cdot z}{t} \cdot z \]
      14. lower-*.f64N/A

        \[\leadsto \frac{\frac{1}{t} \cdot z}{t} \cdot z \]
      15. lower-/.f6487.8

        \[\leadsto \frac{\frac{1}{t} \cdot z}{t} \cdot z \]
    6. Applied rewrites87.8%

      \[\leadsto \frac{\frac{1}{t} \cdot z}{t} \cdot z \]

    if +inf.0 < (/.f64 (*.f64 z z) (*.f64 t t))

    1. Initial program 0.0%

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

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

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

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

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

        \[\leadsto \frac{x}{{y}^{2}} \cdot x \]
      5. pow2N/A

        \[\leadsto \frac{x}{y \cdot y} \cdot x \]
      6. lift-*.f6441.8

        \[\leadsto \frac{x}{y \cdot y} \cdot x \]
    4. Applied rewrites41.8%

      \[\leadsto \color{blue}{\frac{x}{y \cdot y} \cdot x} \]
    5. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{x}{y \cdot y} \cdot x \]
      2. lift-/.f64N/A

        \[\leadsto \frac{x}{y \cdot y} \cdot x \]
      3. associate-/r*N/A

        \[\leadsto \frac{\frac{x}{y}}{y} \cdot x \]
      4. lower-/.f64N/A

        \[\leadsto \frac{\frac{x}{y}}{y} \cdot x \]
      5. lift-/.f6447.1

        \[\leadsto \frac{\frac{x}{y}}{y} \cdot x \]
    6. Applied rewrites47.1%

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

Alternative 7: 81.1% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{z \cdot z}{t \cdot t}\\ \mathbf{if}\;t\_1 \leq 2 \cdot 10^{+80}:\\ \;\;\;\;\frac{x}{y} \cdot \frac{x}{y}\\ \mathbf{elif}\;t\_1 \leq \infty:\\ \;\;\;\;\frac{\frac{z}{t}}{t} \cdot z\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y} \cdot x\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (/ (* z z) (* t t))))
   (if (<= t_1 2e+80)
     (* (/ x y) (/ x y))
     (if (<= t_1 INFINITY) (* (/ (/ z t) t) z) (* (/ (/ x y) y) x)))))
double code(double x, double y, double z, double t) {
	double t_1 = (z * z) / (t * t);
	double tmp;
	if (t_1 <= 2e+80) {
		tmp = (x / y) * (x / y);
	} else if (t_1 <= ((double) INFINITY)) {
		tmp = ((z / t) / t) * z;
	} else {
		tmp = ((x / y) / y) * x;
	}
	return tmp;
}
public static double code(double x, double y, double z, double t) {
	double t_1 = (z * z) / (t * t);
	double tmp;
	if (t_1 <= 2e+80) {
		tmp = (x / y) * (x / y);
	} else if (t_1 <= Double.POSITIVE_INFINITY) {
		tmp = ((z / t) / t) * z;
	} else {
		tmp = ((x / y) / y) * x;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = (z * z) / (t * t)
	tmp = 0
	if t_1 <= 2e+80:
		tmp = (x / y) * (x / y)
	elif t_1 <= math.inf:
		tmp = ((z / t) / t) * z
	else:
		tmp = ((x / y) / y) * x
	return tmp
function code(x, y, z, t)
	t_1 = Float64(Float64(z * z) / Float64(t * t))
	tmp = 0.0
	if (t_1 <= 2e+80)
		tmp = Float64(Float64(x / y) * Float64(x / y));
	elseif (t_1 <= Inf)
		tmp = Float64(Float64(Float64(z / t) / t) * z);
	else
		tmp = Float64(Float64(Float64(x / y) / y) * x);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = (z * z) / (t * t);
	tmp = 0.0;
	if (t_1 <= 2e+80)
		tmp = (x / y) * (x / y);
	elseif (t_1 <= Inf)
		tmp = ((z / t) / t) * z;
	else
		tmp = ((x / y) / y) * x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z * z), $MachinePrecision] / N[(t * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 2e+80], N[(N[(x / y), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(N[(N[(z / t), $MachinePrecision] / t), $MachinePrecision] * z), $MachinePrecision], N[(N[(N[(x / y), $MachinePrecision] / y), $MachinePrecision] * x), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \frac{z \cdot z}{t \cdot t}\\
\mathbf{if}\;t\_1 \leq 2 \cdot 10^{+80}:\\
\;\;\;\;\frac{x}{y} \cdot \frac{x}{y}\\

\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\frac{\frac{z}{t}}{t} \cdot z\\

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


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

    1. Initial program 73.8%

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

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

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

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

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

        \[\leadsto \frac{x}{{y}^{2}} \cdot x \]
      5. pow2N/A

        \[\leadsto \frac{x}{y \cdot y} \cdot x \]
      6. lift-*.f6469.3

        \[\leadsto \frac{x}{y \cdot y} \cdot x \]
    4. Applied rewrites69.3%

      \[\leadsto \color{blue}{\frac{x}{y \cdot y} \cdot x} \]
    5. Step-by-step derivation
      1. lift-*.f64N/A

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

        \[\leadsto \frac{x}{y \cdot y} \cdot x \]
      3. lift-/.f64N/A

        \[\leadsto \frac{x}{y \cdot y} \cdot x \]
      4. pow2N/A

        \[\leadsto \frac{x}{{y}^{2}} \cdot x \]
      5. pow2N/A

        \[\leadsto \frac{x}{y \cdot y} \cdot x \]
      6. associate-/r*N/A

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

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

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

        \[\leadsto \frac{x}{y} \cdot \color{blue}{\frac{x}{y}} \]
      10. lift-/.f64N/A

        \[\leadsto \frac{x}{y} \cdot \frac{\color{blue}{x}}{y} \]
      11. lift-/.f6484.7

        \[\leadsto \frac{x}{y} \cdot \frac{x}{\color{blue}{y}} \]
    6. Applied rewrites84.7%

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

    if 2e80 < (/.f64 (*.f64 z z) (*.f64 t t)) < +inf.0

    1. Initial program 78.7%

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

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

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

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

        \[\leadsto \frac{z}{{t}^{2}} \cdot \color{blue}{z} \]
      4. lower-/.f64N/A

        \[\leadsto \frac{z}{{t}^{2}} \cdot z \]
      5. pow2N/A

        \[\leadsto \frac{z}{t \cdot t} \cdot z \]
      6. lift-*.f6486.4

        \[\leadsto \frac{z}{t \cdot t} \cdot z \]
    4. Applied rewrites86.4%

      \[\leadsto \color{blue}{\frac{z}{t \cdot t} \cdot z} \]
    5. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{z}{t \cdot t} \cdot z \]
      2. lift-/.f64N/A

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

        \[\leadsto \frac{\frac{z}{t}}{t} \cdot z \]
      4. lift-/.f64N/A

        \[\leadsto \frac{\frac{z}{t}}{t} \cdot z \]
      5. lift-/.f6487.9

        \[\leadsto \frac{\frac{z}{t}}{t} \cdot z \]
    6. Applied rewrites87.9%

      \[\leadsto \frac{\frac{z}{t}}{t} \cdot z \]

    if +inf.0 < (/.f64 (*.f64 z z) (*.f64 t t))

    1. Initial program 0.0%

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

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

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

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

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

        \[\leadsto \frac{x}{{y}^{2}} \cdot x \]
      5. pow2N/A

        \[\leadsto \frac{x}{y \cdot y} \cdot x \]
      6. lift-*.f6441.8

        \[\leadsto \frac{x}{y \cdot y} \cdot x \]
    4. Applied rewrites41.8%

      \[\leadsto \color{blue}{\frac{x}{y \cdot y} \cdot x} \]
    5. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{x}{y \cdot y} \cdot x \]
      2. lift-/.f64N/A

        \[\leadsto \frac{x}{y \cdot y} \cdot x \]
      3. associate-/r*N/A

        \[\leadsto \frac{\frac{x}{y}}{y} \cdot x \]
      4. lower-/.f64N/A

        \[\leadsto \frac{\frac{x}{y}}{y} \cdot x \]
      5. lift-/.f6447.1

        \[\leadsto \frac{\frac{x}{y}}{y} \cdot x \]
    6. Applied rewrites47.1%

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

Alternative 8: 80.7% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{z \cdot z}{t \cdot t}\\ \mathbf{if}\;t\_1 \leq 2 \cdot 10^{+80}:\\ \;\;\;\;\frac{x}{y} \cdot \frac{x}{y}\\ \mathbf{elif}\;t\_1 \leq \infty:\\ \;\;\;\;\frac{z}{t \cdot t} \cdot z\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y} \cdot x\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (/ (* z z) (* t t))))
   (if (<= t_1 2e+80)
     (* (/ x y) (/ x y))
     (if (<= t_1 INFINITY) (* (/ z (* t t)) z) (* (/ (/ x y) y) x)))))
double code(double x, double y, double z, double t) {
	double t_1 = (z * z) / (t * t);
	double tmp;
	if (t_1 <= 2e+80) {
		tmp = (x / y) * (x / y);
	} else if (t_1 <= ((double) INFINITY)) {
		tmp = (z / (t * t)) * z;
	} else {
		tmp = ((x / y) / y) * x;
	}
	return tmp;
}
public static double code(double x, double y, double z, double t) {
	double t_1 = (z * z) / (t * t);
	double tmp;
	if (t_1 <= 2e+80) {
		tmp = (x / y) * (x / y);
	} else if (t_1 <= Double.POSITIVE_INFINITY) {
		tmp = (z / (t * t)) * z;
	} else {
		tmp = ((x / y) / y) * x;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = (z * z) / (t * t)
	tmp = 0
	if t_1 <= 2e+80:
		tmp = (x / y) * (x / y)
	elif t_1 <= math.inf:
		tmp = (z / (t * t)) * z
	else:
		tmp = ((x / y) / y) * x
	return tmp
function code(x, y, z, t)
	t_1 = Float64(Float64(z * z) / Float64(t * t))
	tmp = 0.0
	if (t_1 <= 2e+80)
		tmp = Float64(Float64(x / y) * Float64(x / y));
	elseif (t_1 <= Inf)
		tmp = Float64(Float64(z / Float64(t * t)) * z);
	else
		tmp = Float64(Float64(Float64(x / y) / y) * x);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = (z * z) / (t * t);
	tmp = 0.0;
	if (t_1 <= 2e+80)
		tmp = (x / y) * (x / y);
	elseif (t_1 <= Inf)
		tmp = (z / (t * t)) * z;
	else
		tmp = ((x / y) / y) * x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z * z), $MachinePrecision] / N[(t * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 2e+80], N[(N[(x / y), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(N[(z / N[(t * t), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision], N[(N[(N[(x / y), $MachinePrecision] / y), $MachinePrecision] * x), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \frac{z \cdot z}{t \cdot t}\\
\mathbf{if}\;t\_1 \leq 2 \cdot 10^{+80}:\\
\;\;\;\;\frac{x}{y} \cdot \frac{x}{y}\\

\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\frac{z}{t \cdot t} \cdot z\\

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


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

    1. Initial program 73.8%

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

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

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

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

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

        \[\leadsto \frac{x}{{y}^{2}} \cdot x \]
      5. pow2N/A

        \[\leadsto \frac{x}{y \cdot y} \cdot x \]
      6. lift-*.f6469.3

        \[\leadsto \frac{x}{y \cdot y} \cdot x \]
    4. Applied rewrites69.3%

      \[\leadsto \color{blue}{\frac{x}{y \cdot y} \cdot x} \]
    5. Step-by-step derivation
      1. lift-*.f64N/A

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

        \[\leadsto \frac{x}{y \cdot y} \cdot x \]
      3. lift-/.f64N/A

        \[\leadsto \frac{x}{y \cdot y} \cdot x \]
      4. pow2N/A

        \[\leadsto \frac{x}{{y}^{2}} \cdot x \]
      5. pow2N/A

        \[\leadsto \frac{x}{y \cdot y} \cdot x \]
      6. associate-/r*N/A

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

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

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

        \[\leadsto \frac{x}{y} \cdot \color{blue}{\frac{x}{y}} \]
      10. lift-/.f64N/A

        \[\leadsto \frac{x}{y} \cdot \frac{\color{blue}{x}}{y} \]
      11. lift-/.f6484.7

        \[\leadsto \frac{x}{y} \cdot \frac{x}{\color{blue}{y}} \]
    6. Applied rewrites84.7%

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

    if 2e80 < (/.f64 (*.f64 z z) (*.f64 t t)) < +inf.0

    1. Initial program 78.7%

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

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

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

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

        \[\leadsto \frac{z}{{t}^{2}} \cdot \color{blue}{z} \]
      4. lower-/.f64N/A

        \[\leadsto \frac{z}{{t}^{2}} \cdot z \]
      5. pow2N/A

        \[\leadsto \frac{z}{t \cdot t} \cdot z \]
      6. lift-*.f6486.4

        \[\leadsto \frac{z}{t \cdot t} \cdot z \]
    4. Applied rewrites86.4%

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

    if +inf.0 < (/.f64 (*.f64 z z) (*.f64 t t))

    1. Initial program 0.0%

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

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

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

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

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

        \[\leadsto \frac{x}{{y}^{2}} \cdot x \]
      5. pow2N/A

        \[\leadsto \frac{x}{y \cdot y} \cdot x \]
      6. lift-*.f6441.8

        \[\leadsto \frac{x}{y \cdot y} \cdot x \]
    4. Applied rewrites41.8%

      \[\leadsto \color{blue}{\frac{x}{y \cdot y} \cdot x} \]
    5. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{x}{y \cdot y} \cdot x \]
      2. lift-/.f64N/A

        \[\leadsto \frac{x}{y \cdot y} \cdot x \]
      3. associate-/r*N/A

        \[\leadsto \frac{\frac{x}{y}}{y} \cdot x \]
      4. lower-/.f64N/A

        \[\leadsto \frac{\frac{x}{y}}{y} \cdot x \]
      5. lift-/.f6447.1

        \[\leadsto \frac{\frac{x}{y}}{y} \cdot x \]
    6. Applied rewrites47.1%

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

Alternative 9: 72.8% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{z \cdot z}{t \cdot t}\\ t_2 := \frac{x}{y} \cdot \frac{x}{y}\\ \mathbf{if}\;t\_1 \leq 2 \cdot 10^{+80}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t\_1 \leq \infty:\\ \;\;\;\;\frac{z}{t \cdot t} \cdot z\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (/ (* z z) (* t t))) (t_2 (* (/ x y) (/ x y))))
   (if (<= t_1 2e+80) t_2 (if (<= t_1 INFINITY) (* (/ z (* t t)) z) t_2))))
double code(double x, double y, double z, double t) {
	double t_1 = (z * z) / (t * t);
	double t_2 = (x / y) * (x / y);
	double tmp;
	if (t_1 <= 2e+80) {
		tmp = t_2;
	} else if (t_1 <= ((double) INFINITY)) {
		tmp = (z / (t * t)) * z;
	} else {
		tmp = t_2;
	}
	return tmp;
}
public static double code(double x, double y, double z, double t) {
	double t_1 = (z * z) / (t * t);
	double t_2 = (x / y) * (x / y);
	double tmp;
	if (t_1 <= 2e+80) {
		tmp = t_2;
	} else if (t_1 <= Double.POSITIVE_INFINITY) {
		tmp = (z / (t * t)) * z;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = (z * z) / (t * t)
	t_2 = (x / y) * (x / y)
	tmp = 0
	if t_1 <= 2e+80:
		tmp = t_2
	elif t_1 <= math.inf:
		tmp = (z / (t * t)) * z
	else:
		tmp = t_2
	return tmp
function code(x, y, z, t)
	t_1 = Float64(Float64(z * z) / Float64(t * t))
	t_2 = Float64(Float64(x / y) * Float64(x / y))
	tmp = 0.0
	if (t_1 <= 2e+80)
		tmp = t_2;
	elseif (t_1 <= Inf)
		tmp = Float64(Float64(z / Float64(t * t)) * z);
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = (z * z) / (t * t);
	t_2 = (x / y) * (x / y);
	tmp = 0.0;
	if (t_1 <= 2e+80)
		tmp = t_2;
	elseif (t_1 <= Inf)
		tmp = (z / (t * t)) * z;
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z * z), $MachinePrecision] / N[(t * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x / y), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 2e+80], t$95$2, If[LessEqual[t$95$1, Infinity], N[(N[(z / N[(t * t), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision], t$95$2]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \frac{z \cdot z}{t \cdot t}\\
t_2 := \frac{x}{y} \cdot \frac{x}{y}\\
\mathbf{if}\;t\_1 \leq 2 \cdot 10^{+80}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\frac{z}{t \cdot t} \cdot z\\

\mathbf{else}:\\
\;\;\;\;t\_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (*.f64 z z) (*.f64 t t)) < 2e80 or +inf.0 < (/.f64 (*.f64 z z) (*.f64 t t))

    1. Initial program 58.5%

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

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

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

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

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

        \[\leadsto \frac{x}{{y}^{2}} \cdot x \]
      5. pow2N/A

        \[\leadsto \frac{x}{y \cdot y} \cdot x \]
      6. lift-*.f6463.6

        \[\leadsto \frac{x}{y \cdot y} \cdot x \]
    4. Applied rewrites63.6%

      \[\leadsto \color{blue}{\frac{x}{y \cdot y} \cdot x} \]
    5. Step-by-step derivation
      1. lift-*.f64N/A

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

        \[\leadsto \frac{x}{y \cdot y} \cdot x \]
      3. lift-/.f64N/A

        \[\leadsto \frac{x}{y \cdot y} \cdot x \]
      4. pow2N/A

        \[\leadsto \frac{x}{{y}^{2}} \cdot x \]
      5. pow2N/A

        \[\leadsto \frac{x}{y \cdot y} \cdot x \]
      6. associate-/r*N/A

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

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

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

        \[\leadsto \frac{x}{y} \cdot \color{blue}{\frac{x}{y}} \]
      10. lift-/.f64N/A

        \[\leadsto \frac{x}{y} \cdot \frac{\color{blue}{x}}{y} \]
      11. lift-/.f6477.5

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

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

    if 2e80 < (/.f64 (*.f64 z z) (*.f64 t t)) < +inf.0

    1. Initial program 78.7%

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

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

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

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

        \[\leadsto \frac{z}{{t}^{2}} \cdot \color{blue}{z} \]
      4. lower-/.f64N/A

        \[\leadsto \frac{z}{{t}^{2}} \cdot z \]
      5. pow2N/A

        \[\leadsto \frac{z}{t \cdot t} \cdot z \]
      6. lift-*.f6486.4

        \[\leadsto \frac{z}{t \cdot t} \cdot z \]
    4. Applied rewrites86.4%

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

Alternative 10: 70.3% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{z \cdot z}{t \cdot t}\\ t_2 := \frac{x}{y \cdot y} \cdot x\\ \mathbf{if}\;t\_1 \leq 2 \cdot 10^{+80}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t\_1 \leq \infty:\\ \;\;\;\;\frac{z}{t \cdot t} \cdot z\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (/ (* z z) (* t t))) (t_2 (* (/ x (* y y)) x)))
   (if (<= t_1 2e+80) t_2 (if (<= t_1 INFINITY) (* (/ z (* t t)) z) t_2))))
double code(double x, double y, double z, double t) {
	double t_1 = (z * z) / (t * t);
	double t_2 = (x / (y * y)) * x;
	double tmp;
	if (t_1 <= 2e+80) {
		tmp = t_2;
	} else if (t_1 <= ((double) INFINITY)) {
		tmp = (z / (t * t)) * z;
	} else {
		tmp = t_2;
	}
	return tmp;
}
public static double code(double x, double y, double z, double t) {
	double t_1 = (z * z) / (t * t);
	double t_2 = (x / (y * y)) * x;
	double tmp;
	if (t_1 <= 2e+80) {
		tmp = t_2;
	} else if (t_1 <= Double.POSITIVE_INFINITY) {
		tmp = (z / (t * t)) * z;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = (z * z) / (t * t)
	t_2 = (x / (y * y)) * x
	tmp = 0
	if t_1 <= 2e+80:
		tmp = t_2
	elif t_1 <= math.inf:
		tmp = (z / (t * t)) * z
	else:
		tmp = t_2
	return tmp
function code(x, y, z, t)
	t_1 = Float64(Float64(z * z) / Float64(t * t))
	t_2 = Float64(Float64(x / Float64(y * y)) * x)
	tmp = 0.0
	if (t_1 <= 2e+80)
		tmp = t_2;
	elseif (t_1 <= Inf)
		tmp = Float64(Float64(z / Float64(t * t)) * z);
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = (z * z) / (t * t);
	t_2 = (x / (y * y)) * x;
	tmp = 0.0;
	if (t_1 <= 2e+80)
		tmp = t_2;
	elseif (t_1 <= Inf)
		tmp = (z / (t * t)) * z;
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z * z), $MachinePrecision] / N[(t * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[t$95$1, 2e+80], t$95$2, If[LessEqual[t$95$1, Infinity], N[(N[(z / N[(t * t), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision], t$95$2]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \frac{z \cdot z}{t \cdot t}\\
t_2 := \frac{x}{y \cdot y} \cdot x\\
\mathbf{if}\;t\_1 \leq 2 \cdot 10^{+80}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\frac{z}{t \cdot t} \cdot z\\

\mathbf{else}:\\
\;\;\;\;t\_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (*.f64 z z) (*.f64 t t)) < 2e80 or +inf.0 < (/.f64 (*.f64 z z) (*.f64 t t))

    1. Initial program 58.5%

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

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

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

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

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

        \[\leadsto \frac{x}{{y}^{2}} \cdot x \]
      5. pow2N/A

        \[\leadsto \frac{x}{y \cdot y} \cdot x \]
      6. lift-*.f6463.6

        \[\leadsto \frac{x}{y \cdot y} \cdot x \]
    4. Applied rewrites63.6%

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

    if 2e80 < (/.f64 (*.f64 z z) (*.f64 t t)) < +inf.0

    1. Initial program 78.7%

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

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

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

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

        \[\leadsto \frac{z}{{t}^{2}} \cdot \color{blue}{z} \]
      4. lower-/.f64N/A

        \[\leadsto \frac{z}{{t}^{2}} \cdot z \]
      5. pow2N/A

        \[\leadsto \frac{z}{t \cdot t} \cdot z \]
      6. lift-*.f6486.4

        \[\leadsto \frac{z}{t \cdot t} \cdot z \]
    4. Applied rewrites86.4%

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

Alternative 11: 52.6% accurate, 2.2× speedup?

\[\begin{array}{l} \\ \frac{x}{y \cdot y} \cdot 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;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y, z, t)
use fmin_fmax_functions
    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(Float64(x / Float64(y * y)) * x)
end
function tmp = code(x, y, z, t)
	tmp = (x / (y * y)) * x;
end
code[x_, y_, z_, t_] := N[(N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]
\begin{array}{l}

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

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

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

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

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

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

      \[\leadsto \frac{x}{{y}^{2}} \cdot x \]
    5. pow2N/A

      \[\leadsto \frac{x}{y \cdot y} \cdot x \]
    6. lift-*.f6452.6

      \[\leadsto \frac{x}{y \cdot y} \cdot x \]
  4. Applied rewrites52.6%

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

Reproduce

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