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

Percentage Accurate: 65.7% → 96.4%
Time: 4.2s
Alternatives: 14
Speedup: 0.9×

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}

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 14 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: 65.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.4% accurate, 0.3× speedup?

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{x \cdot x}{y \cdot y} + \color{blue}{\frac{z \cdot z}{t \cdot t}} \]
    8. pow2N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(\frac{\frac{x}{y}}{y}, x, {\color{blue}{\left(\frac{z}{t}\right)}}^{2}\right) \]
  4. Applied rewrites97.8%

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

Alternative 2: 84.7% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
t_1 := \frac{x \cdot x}{y \cdot y}\\
\mathbf{if}\;t\_1 \leq 10^{-316} \lor \neg \left(t\_1 \leq \infty\right):\\
\;\;\;\;\frac{z}{t} \cdot \frac{z}{t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (*.f64 x x) (*.f64 y y)) < 9.999999837e-317 or +inf.0 < (/.f64 (*.f64 x x) (*.f64 y y))

    1. Initial program 58.6%

      \[\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. pow2N/A

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

        \[\leadsto \frac{z \cdot z}{t \cdot \color{blue}{t}} \]
      3. times-fracN/A

        \[\leadsto \frac{z}{t} \cdot \color{blue}{\frac{z}{t}} \]
      4. pow2N/A

        \[\leadsto {\left(\frac{z}{t}\right)}^{\color{blue}{2}} \]
      5. lower-pow.f64N/A

        \[\leadsto {\left(\frac{z}{t}\right)}^{\color{blue}{2}} \]
      6. lower-/.f6487.1

        \[\leadsto {\left(\frac{z}{t}\right)}^{2} \]
    5. Applied rewrites87.1%

      \[\leadsto \color{blue}{{\left(\frac{z}{t}\right)}^{2}} \]
    6. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto {\left(\frac{z}{t}\right)}^{2} \]
      2. lift-pow.f64N/A

        \[\leadsto {\left(\frac{z}{t}\right)}^{\color{blue}{2}} \]
      3. unpow2N/A

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

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

        \[\leadsto \frac{z}{t} \cdot \frac{\color{blue}{z}}{t} \]
      6. lift-/.f6487.1

        \[\leadsto \frac{z}{t} \cdot \frac{z}{\color{blue}{t}} \]
    7. Applied rewrites87.1%

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

    if 9.999999837e-317 < (/.f64 (*.f64 x x) (*.f64 y y)) < +inf.0

    1. Initial program 71.1%

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

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

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

        \[\leadsto \frac{x \cdot x}{y \cdot y} + \color{blue}{\frac{z \cdot z}{t \cdot t}} \]
      4. pow2N/A

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

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

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

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

        \[\leadsto \frac{x \cdot x}{y \cdot y} + \frac{z}{\color{blue}{t \cdot t}} \cdot z \]
      9. associate-/r*N/A

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

        \[\leadsto \frac{x \cdot x}{y \cdot y} + \color{blue}{\frac{\frac{z}{t}}{t}} \cdot z \]
      11. lower-/.f6490.0

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

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

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

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

        \[\leadsto \frac{x \cdot x}{y \cdot y} + \color{blue}{\frac{z}{t \cdot t}} \cdot z \]
      4. pow2N/A

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

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

        \[\leadsto \frac{x \cdot x}{y \cdot y} + \frac{z}{\color{blue}{t \cdot t}} \cdot z \]
      7. lift-*.f6485.2

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

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

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

Alternative 3: 78.6% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
t_1 := \frac{x \cdot x}{y \cdot y}\\
\mathbf{if}\;t\_1 \leq 10^{+31} \lor \neg \left(t\_1 \leq \infty\right):\\
\;\;\;\;\frac{z}{t} \cdot \frac{z}{t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (*.f64 x x) (*.f64 y y)) < 9.9999999999999996e30 or +inf.0 < (/.f64 (*.f64 x x) (*.f64 y y))

    1. Initial program 61.3%

      \[\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. pow2N/A

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

        \[\leadsto \frac{z \cdot z}{t \cdot \color{blue}{t}} \]
      3. times-fracN/A

        \[\leadsto \frac{z}{t} \cdot \color{blue}{\frac{z}{t}} \]
      4. pow2N/A

        \[\leadsto {\left(\frac{z}{t}\right)}^{\color{blue}{2}} \]
      5. lower-pow.f64N/A

        \[\leadsto {\left(\frac{z}{t}\right)}^{\color{blue}{2}} \]
      6. lower-/.f6484.2

        \[\leadsto {\left(\frac{z}{t}\right)}^{2} \]
    5. Applied rewrites84.2%

      \[\leadsto \color{blue}{{\left(\frac{z}{t}\right)}^{2}} \]
    6. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto {\left(\frac{z}{t}\right)}^{2} \]
      2. lift-pow.f64N/A

        \[\leadsto {\left(\frac{z}{t}\right)}^{\color{blue}{2}} \]
      3. unpow2N/A

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

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

        \[\leadsto \frac{z}{t} \cdot \frac{\color{blue}{z}}{t} \]
      6. lift-/.f6484.2

        \[\leadsto \frac{z}{t} \cdot \frac{z}{\color{blue}{t}} \]
    7. Applied rewrites84.2%

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

    if 9.9999999999999996e30 < (/.f64 (*.f64 x x) (*.f64 y y)) < +inf.0

    1. Initial program 70.6%

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

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

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

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

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

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

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

        \[\leadsto \frac{x \cdot x}{y \cdot y} + \color{blue}{\frac{z \cdot z}{t \cdot t}} \]
      8. pow2N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{z \cdot z}{t \cdot t} + \frac{\frac{x}{y}}{y} \cdot x} \]
      9. pow2N/A

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{{z}^{2}}{t} \cdot y + t \cdot \frac{x \cdot x}{y}}{t \cdot y}} \]
    6. Applied rewrites85.8%

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

      \[\leadsto \frac{\color{blue}{\frac{t \cdot {x}^{2}}{y}}}{t \cdot y} \]
    8. Step-by-step derivation
      1. lower-/.f64N/A

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

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

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

        \[\leadsto \frac{\frac{\left(x \cdot x\right) \cdot t}{y}}{t \cdot y} \]
      5. lower-*.f6477.8

        \[\leadsto \frac{\frac{\left(x \cdot x\right) \cdot t}{y}}{t \cdot y} \]
    9. Applied rewrites77.8%

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

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

Alternative 4: 93.6% accurate, 0.6× speedup?

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

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

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


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

    1. Initial program 78.8%

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

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

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

        \[\leadsto \frac{x \cdot x}{y \cdot y} + \color{blue}{\frac{z \cdot z}{t \cdot t}} \]
      4. pow2N/A

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

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

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

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

        \[\leadsto \frac{x \cdot x}{y \cdot y} + \frac{z}{\color{blue}{t \cdot t}} \cdot z \]
      9. associate-/r*N/A

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

        \[\leadsto \frac{x \cdot x}{y \cdot y} + \color{blue}{\frac{\frac{z}{t}}{t}} \cdot z \]
      11. lower-/.f6481.7

        \[\leadsto \frac{x \cdot x}{y \cdot y} + \frac{\color{blue}{\frac{z}{t}}}{t} \cdot z \]
    4. Applied rewrites81.7%

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

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

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

        \[\leadsto \frac{x \cdot x}{y \cdot y} + \color{blue}{\frac{z}{t \cdot t}} \cdot z \]
      4. pow2N/A

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

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

        \[\leadsto \frac{x \cdot x}{y \cdot y} + \frac{z}{\color{blue}{t \cdot t}} \cdot z \]
      7. lift-*.f6481.0

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

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

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

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

        \[\leadsto \color{blue}{\frac{x \cdot x}{y \cdot y}} + \frac{z}{t \cdot t} \cdot z \]
      4. pow2N/A

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{x}{y}}{y}} \cdot x + \frac{z}{t \cdot t} \cdot z \]
      10. lift-/.f6496.8

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

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

    if 1.00000000000000005e236 < (/.f64 (*.f64 z z) (*.f64 t t))

    1. Initial program 53.3%

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

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

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

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

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

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

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

        \[\leadsto \frac{x \cdot x}{y \cdot y} + \color{blue}{\frac{z \cdot z}{t \cdot t}} \]
      8. pow2N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{\frac{x}{y}}{y}, x, {\color{blue}{\left(\frac{z}{t}\right)}}^{2}\right) \]
    4. Applied rewrites97.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 93.7% accurate, 0.6× speedup?

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

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

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


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

    1. Initial program 72.7%

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

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

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

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

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

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

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

        \[\leadsto \frac{x \cdot x}{y \cdot y} + \color{blue}{\frac{z \cdot z}{t \cdot t}} \]
      8. pow2N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if +inf.0 < (/.f64 (*.f64 x x) (*.f64 y y))

    1. Initial program 0.0%

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

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

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

        \[\leadsto \color{blue}{\frac{x \cdot x}{y \cdot y}} + \frac{z \cdot z}{t \cdot t} \]
      4. times-fracN/A

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

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

        \[\leadsto \color{blue}{\frac{x}{y}} \cdot \frac{x}{y} + \frac{z \cdot z}{t \cdot t} \]
      7. lower-/.f6479.2

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

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

Alternative 6: 92.4% accurate, 0.6× speedup?

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

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

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


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

    1. Initial program 72.7%

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

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

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

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

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

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

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

        \[\leadsto \frac{x \cdot x}{y \cdot y} + \color{blue}{\frac{z \cdot z}{t \cdot t}} \]
      8. pow2N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if +inf.0 < (/.f64 (*.f64 x x) (*.f64 y y))

    1. Initial program 0.0%

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

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

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

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

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

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

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

        \[\leadsto \frac{x \cdot x}{y \cdot y} + \color{blue}{\frac{z \cdot z}{t \cdot t}} \]
      8. pow2N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{\frac{x}{y}}{y}, x, {\color{blue}{\left(\frac{z}{t}\right)}}^{2}\right) \]
    4. Applied rewrites93.9%

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

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

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

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

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

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

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

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

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

Alternative 7: 90.1% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
t_1 := \frac{z}{t} \cdot \frac{z}{t}\\
\mathbf{if}\;\frac{x \cdot x}{y \cdot y} \leq \infty:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{y \cdot y}, x, t\_1\right)\\

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


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

    1. Initial program 72.7%

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

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

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

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

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

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

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

        \[\leadsto \frac{x \cdot x}{y \cdot y} + \color{blue}{\frac{z \cdot z}{t \cdot t}} \]
      8. pow2N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if +inf.0 < (/.f64 (*.f64 x x) (*.f64 y y))

    1. Initial program 0.0%

      \[\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. pow2N/A

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

        \[\leadsto \frac{z \cdot z}{t \cdot \color{blue}{t}} \]
      3. times-fracN/A

        \[\leadsto \frac{z}{t} \cdot \color{blue}{\frac{z}{t}} \]
      4. pow2N/A

        \[\leadsto {\left(\frac{z}{t}\right)}^{\color{blue}{2}} \]
      5. lower-pow.f64N/A

        \[\leadsto {\left(\frac{z}{t}\right)}^{\color{blue}{2}} \]
      6. lower-/.f6465.0

        \[\leadsto {\left(\frac{z}{t}\right)}^{2} \]
    5. Applied rewrites65.0%

      \[\leadsto \color{blue}{{\left(\frac{z}{t}\right)}^{2}} \]
    6. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto {\left(\frac{z}{t}\right)}^{2} \]
      2. lift-pow.f64N/A

        \[\leadsto {\left(\frac{z}{t}\right)}^{\color{blue}{2}} \]
      3. unpow2N/A

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

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

        \[\leadsto \frac{z}{t} \cdot \frac{\color{blue}{z}}{t} \]
      6. lift-/.f6465.0

        \[\leadsto \frac{z}{t} \cdot \frac{z}{\color{blue}{t}} \]
    7. Applied rewrites65.0%

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

Alternative 8: 76.6% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{z \cdot z}{t \cdot t}\\ \mathbf{if}\;t\_1 \leq \infty:\\ \;\;\;\;\mathsf{fma}\left(\frac{x}{y \cdot y}, x, t\_1\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\left(x \cdot x\right) \cdot t}{y}}{t \cdot y}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (/ (* z z) (* t t))))
   (if (<= t_1 INFINITY)
     (fma (/ x (* y y)) x t_1)
     (/ (/ (* (* x x) t) y) (* t y)))))
double code(double x, double y, double z, double t) {
	double t_1 = (z * z) / (t * t);
	double tmp;
	if (t_1 <= ((double) INFINITY)) {
		tmp = fma((x / (y * y)), x, t_1);
	} else {
		tmp = (((x * x) * t) / y) / (t * y);
	}
	return tmp;
}
function code(x, y, z, t)
	t_1 = Float64(Float64(z * z) / Float64(t * t))
	tmp = 0.0
	if (t_1 <= Inf)
		tmp = fma(Float64(x / Float64(y * y)), x, t_1);
	else
		tmp = Float64(Float64(Float64(Float64(x * x) * t) / y) / Float64(t * y));
	end
	return 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, Infinity], N[(N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision] * x + t$95$1), $MachinePrecision], N[(N[(N[(N[(x * x), $MachinePrecision] * t), $MachinePrecision] / y), $MachinePrecision] / N[(t * y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \frac{z \cdot z}{t \cdot t}\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{y \cdot y}, x, t\_1\right)\\

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


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

    1. Initial program 78.5%

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

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

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

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

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

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

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

        \[\leadsto \frac{x \cdot x}{y \cdot y} + \color{blue}{\frac{z \cdot z}{t \cdot t}} \]
      8. pow2N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{\frac{x}{y}}{y}, x, {\color{blue}{\left(\frac{z}{t}\right)}}^{2}\right) \]
    4. Applied rewrites97.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    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. Add Preprocessing
    3. Step-by-step derivation
      1. lift-+.f64N/A

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

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

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

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

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

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

        \[\leadsto \frac{x \cdot x}{y \cdot y} + \color{blue}{\frac{z \cdot z}{t \cdot t}} \]
      8. pow2N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{z \cdot z}{t \cdot t} + \frac{\frac{x}{y}}{y} \cdot x} \]
      9. pow2N/A

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{{z}^{2}}{t} \cdot y + t \cdot \frac{x \cdot x}{y}}{t \cdot y}} \]
    6. Applied rewrites62.7%

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

      \[\leadsto \frac{\color{blue}{\frac{t \cdot {x}^{2}}{y}}}{t \cdot y} \]
    8. Step-by-step derivation
      1. lower-/.f64N/A

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

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

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

        \[\leadsto \frac{\frac{\left(x \cdot x\right) \cdot t}{y}}{t \cdot y} \]
      5. lower-*.f6450.9

        \[\leadsto \frac{\frac{\left(x \cdot x\right) \cdot t}{y}}{t \cdot y} \]
    9. Applied rewrites50.9%

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

Alternative 9: 94.2% accurate, 0.7× speedup?

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

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

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


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

    1. Initial program 67.4%

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

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

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

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

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

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

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

        \[\leadsto \frac{x \cdot x}{y \cdot y} + \color{blue}{\frac{z \cdot z}{t \cdot t}} \]
      8. pow2N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{\frac{x}{y}}{y}, x, {\color{blue}{\left(\frac{z}{t}\right)}}^{2}\right) \]
    4. Applied rewrites97.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.19999999999999997e178 < z

    1. Initial program 52.2%

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

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

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

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

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

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

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

        \[\leadsto \frac{x \cdot x}{y \cdot y} + \color{blue}{\frac{z \cdot z}{t \cdot t}} \]
      8. pow2N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 71.1% accurate, 0.9× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 9.00000000000000024e-125

    1. Initial program 64.4%

      \[\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. pow2N/A

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

        \[\leadsto \frac{z \cdot z}{t \cdot \color{blue}{t}} \]
      3. times-fracN/A

        \[\leadsto \frac{z}{t} \cdot \color{blue}{\frac{z}{t}} \]
      4. pow2N/A

        \[\leadsto {\left(\frac{z}{t}\right)}^{\color{blue}{2}} \]
      5. lower-pow.f64N/A

        \[\leadsto {\left(\frac{z}{t}\right)}^{\color{blue}{2}} \]
      6. lower-/.f6460.0

        \[\leadsto {\left(\frac{z}{t}\right)}^{2} \]
    5. Applied rewrites60.0%

      \[\leadsto \color{blue}{{\left(\frac{z}{t}\right)}^{2}} \]
    6. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto {\left(\frac{z}{t}\right)}^{2} \]
      2. lift-pow.f64N/A

        \[\leadsto {\left(\frac{z}{t}\right)}^{\color{blue}{2}} \]
      3. unpow2N/A

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

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

        \[\leadsto \frac{z}{t} \cdot \frac{\color{blue}{z}}{t} \]
      6. lift-/.f6460.0

        \[\leadsto \frac{z}{t} \cdot \frac{z}{\color{blue}{t}} \]
    7. Applied rewrites60.0%

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

    if 9.00000000000000024e-125 < x

    1. Initial program 69.1%

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

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

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

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

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

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

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

        \[\leadsto \frac{x \cdot x}{y \cdot y} + \color{blue}{\frac{z \cdot z}{t \cdot t}} \]
      8. pow2N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{x}{y \cdot y}, x, \color{blue}{\frac{z \cdot z}{t \cdot t}}\right) \]
      6. sqr-abs-revN/A

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{x}{y \cdot y}, x, \left|z\right| \cdot \frac{\left|z\right|}{\color{blue}{t \cdot t}}\right) \]
    10. Applied rewrites89.2%

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

Alternative 11: 58.7% accurate, 1.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.35 \cdot 10^{+70}:\\
\;\;\;\;\frac{z}{t} \cdot \frac{z}{t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 1.35e70

    1. Initial program 67.5%

      \[\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. pow2N/A

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

        \[\leadsto \frac{z \cdot z}{t \cdot \color{blue}{t}} \]
      3. times-fracN/A

        \[\leadsto \frac{z}{t} \cdot \color{blue}{\frac{z}{t}} \]
      4. pow2N/A

        \[\leadsto {\left(\frac{z}{t}\right)}^{\color{blue}{2}} \]
      5. lower-pow.f64N/A

        \[\leadsto {\left(\frac{z}{t}\right)}^{\color{blue}{2}} \]
      6. lower-/.f6460.5

        \[\leadsto {\left(\frac{z}{t}\right)}^{2} \]
    5. Applied rewrites60.5%

      \[\leadsto \color{blue}{{\left(\frac{z}{t}\right)}^{2}} \]
    6. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto {\left(\frac{z}{t}\right)}^{2} \]
      2. lift-pow.f64N/A

        \[\leadsto {\left(\frac{z}{t}\right)}^{\color{blue}{2}} \]
      3. unpow2N/A

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

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

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

        \[\leadsto \frac{z}{t} \cdot \frac{z}{\color{blue}{t}} \]
    7. Applied rewrites60.5%

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

    if 1.35e70 < x

    1. Initial program 58.5%

      \[\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. pow2N/A

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

        \[\leadsto \frac{z \cdot z}{t \cdot \color{blue}{t}} \]
      3. times-fracN/A

        \[\leadsto \frac{z}{t} \cdot \color{blue}{\frac{z}{t}} \]
      4. pow2N/A

        \[\leadsto {\left(\frac{z}{t}\right)}^{\color{blue}{2}} \]
      5. lower-pow.f64N/A

        \[\leadsto {\left(\frac{z}{t}\right)}^{\color{blue}{2}} \]
      6. lower-/.f6437.9

        \[\leadsto {\left(\frac{z}{t}\right)}^{2} \]
    5. Applied rewrites37.9%

      \[\leadsto \color{blue}{{\left(\frac{z}{t}\right)}^{2}} \]
    6. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto {\left(\frac{z}{t}\right)}^{2} \]
      2. lift-pow.f64N/A

        \[\leadsto {\left(\frac{z}{t}\right)}^{\color{blue}{2}} \]
      3. unpow2N/A

        \[\leadsto \frac{z}{t} \cdot \color{blue}{\frac{z}{t}} \]
      4. times-fracN/A

        \[\leadsto \frac{z \cdot z}{\color{blue}{t \cdot t}} \]
      5. pow2N/A

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

        \[\leadsto \frac{{z}^{2}}{{t}^{\color{blue}{2}}} \]
      7. pow2N/A

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

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

        \[\leadsto \frac{\frac{{z}^{2}}{t}}{\color{blue}{t}} \]
      10. pow2N/A

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

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

        \[\leadsto \frac{\frac{z}{t} \cdot z}{t} \]
      13. lift-/.f6442.0

        \[\leadsto \frac{\frac{z}{t} \cdot z}{t} \]
    7. Applied rewrites42.0%

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

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

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

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

        \[\leadsto \frac{\frac{{z}^{2}}{t}}{t} \]
      5. lower-/.f64N/A

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

        \[\leadsto \frac{\frac{z \cdot z}{t}}{t} \]
      7. lift-*.f6452.8

        \[\leadsto \frac{\frac{z \cdot z}{t}}{t} \]
    9. Applied rewrites52.8%

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

Alternative 12: 58.5% accurate, 1.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq 8 \cdot 10^{+148}:\\
\;\;\;\;\frac{z}{t} \cdot \frac{z}{t}\\

\mathbf{else}:\\
\;\;\;\;\left|z\right| \cdot \frac{\left|z\right|}{t \cdot t}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 8.0000000000000004e148

    1. Initial program 67.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. pow2N/A

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

        \[\leadsto \frac{z \cdot z}{t \cdot \color{blue}{t}} \]
      3. times-fracN/A

        \[\leadsto \frac{z}{t} \cdot \color{blue}{\frac{z}{t}} \]
      4. pow2N/A

        \[\leadsto {\left(\frac{z}{t}\right)}^{\color{blue}{2}} \]
      5. lower-pow.f64N/A

        \[\leadsto {\left(\frac{z}{t}\right)}^{\color{blue}{2}} \]
      6. lower-/.f6459.5

        \[\leadsto {\left(\frac{z}{t}\right)}^{2} \]
    5. Applied rewrites59.5%

      \[\leadsto \color{blue}{{\left(\frac{z}{t}\right)}^{2}} \]
    6. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto {\left(\frac{z}{t}\right)}^{2} \]
      2. lift-pow.f64N/A

        \[\leadsto {\left(\frac{z}{t}\right)}^{\color{blue}{2}} \]
      3. unpow2N/A

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

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

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

        \[\leadsto \frac{z}{t} \cdot \frac{z}{\color{blue}{t}} \]
    7. Applied rewrites59.5%

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

    if 8.0000000000000004e148 < x

    1. Initial program 52.5%

      \[\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. pow2N/A

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

        \[\leadsto \frac{z \cdot z}{t \cdot \color{blue}{t}} \]
      3. times-fracN/A

        \[\leadsto \frac{z}{t} \cdot \color{blue}{\frac{z}{t}} \]
      4. pow2N/A

        \[\leadsto {\left(\frac{z}{t}\right)}^{\color{blue}{2}} \]
      5. lower-pow.f64N/A

        \[\leadsto {\left(\frac{z}{t}\right)}^{\color{blue}{2}} \]
      6. lower-/.f6434.8

        \[\leadsto {\left(\frac{z}{t}\right)}^{2} \]
    5. Applied rewrites34.8%

      \[\leadsto \color{blue}{{\left(\frac{z}{t}\right)}^{2}} \]
    6. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto {\left(\frac{z}{t}\right)}^{2} \]
      2. lift-pow.f64N/A

        \[\leadsto {\left(\frac{z}{t}\right)}^{\color{blue}{2}} \]
      3. unpow2N/A

        \[\leadsto \frac{z}{t} \cdot \color{blue}{\frac{z}{t}} \]
      4. times-fracN/A

        \[\leadsto \frac{z \cdot z}{\color{blue}{t \cdot t}} \]
      5. sqr-abs-revN/A

        \[\leadsto \frac{\left|z\right| \cdot \left|z\right|}{\color{blue}{t} \cdot t} \]
      6. pow2N/A

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

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

        \[\leadsto \left|z\right| \cdot \color{blue}{\frac{\left|z\right|}{{t}^{2}}} \]
      9. lower-fabs.f64N/A

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

        \[\leadsto \left|z\right| \cdot \frac{\left|z\right|}{\color{blue}{{t}^{2}}} \]
      11. lower-fabs.f64N/A

        \[\leadsto \left|z\right| \cdot \frac{\left|z\right|}{{\color{blue}{t}}^{2}} \]
      12. pow2N/A

        \[\leadsto \left|z\right| \cdot \frac{\left|z\right|}{t \cdot \color{blue}{t}} \]
      13. lift-*.f6446.8

        \[\leadsto \left|z\right| \cdot \frac{\left|z\right|}{t \cdot \color{blue}{t}} \]
    7. Applied rewrites46.8%

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

Alternative 13: 51.3% accurate, 1.8× speedup?

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

\\
\left|z\right| \cdot \frac{\left|z\right|}{t \cdot t}
\end{array}
Derivation
  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 0

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

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

      \[\leadsto \frac{z \cdot z}{t \cdot \color{blue}{t}} \]
    3. times-fracN/A

      \[\leadsto \frac{z}{t} \cdot \color{blue}{\frac{z}{t}} \]
    4. pow2N/A

      \[\leadsto {\left(\frac{z}{t}\right)}^{\color{blue}{2}} \]
    5. lower-pow.f64N/A

      \[\leadsto {\left(\frac{z}{t}\right)}^{\color{blue}{2}} \]
    6. lower-/.f6456.5

      \[\leadsto {\left(\frac{z}{t}\right)}^{2} \]
  5. Applied rewrites56.5%

    \[\leadsto \color{blue}{{\left(\frac{z}{t}\right)}^{2}} \]
  6. Step-by-step derivation
    1. lift-/.f64N/A

      \[\leadsto {\left(\frac{z}{t}\right)}^{2} \]
    2. lift-pow.f64N/A

      \[\leadsto {\left(\frac{z}{t}\right)}^{\color{blue}{2}} \]
    3. unpow2N/A

      \[\leadsto \frac{z}{t} \cdot \color{blue}{\frac{z}{t}} \]
    4. times-fracN/A

      \[\leadsto \frac{z \cdot z}{\color{blue}{t \cdot t}} \]
    5. sqr-abs-revN/A

      \[\leadsto \frac{\left|z\right| \cdot \left|z\right|}{\color{blue}{t} \cdot t} \]
    6. pow2N/A

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

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

      \[\leadsto \left|z\right| \cdot \color{blue}{\frac{\left|z\right|}{{t}^{2}}} \]
    9. lower-fabs.f64N/A

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

      \[\leadsto \left|z\right| \cdot \frac{\left|z\right|}{\color{blue}{{t}^{2}}} \]
    11. lower-fabs.f64N/A

      \[\leadsto \left|z\right| \cdot \frac{\left|z\right|}{{\color{blue}{t}}^{2}} \]
    12. pow2N/A

      \[\leadsto \left|z\right| \cdot \frac{\left|z\right|}{t \cdot \color{blue}{t}} \]
    13. lift-*.f6451.5

      \[\leadsto \left|z\right| \cdot \frac{\left|z\right|}{t \cdot \color{blue}{t}} \]
  7. Applied rewrites51.5%

    \[\leadsto \left|z\right| \cdot \color{blue}{\frac{\left|z\right|}{t \cdot t}} \]
  8. Add Preprocessing

Alternative 14: 47.5% accurate, 2.1× speedup?

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

\\
\frac{z \cdot z}{t \cdot t}
\end{array}
Derivation
  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 0

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

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

      \[\leadsto \frac{z \cdot z}{t \cdot \color{blue}{t}} \]
    3. times-fracN/A

      \[\leadsto \frac{z}{t} \cdot \color{blue}{\frac{z}{t}} \]
    4. pow2N/A

      \[\leadsto {\left(\frac{z}{t}\right)}^{\color{blue}{2}} \]
    5. lower-pow.f64N/A

      \[\leadsto {\left(\frac{z}{t}\right)}^{\color{blue}{2}} \]
    6. lower-/.f6456.5

      \[\leadsto {\left(\frac{z}{t}\right)}^{2} \]
  5. Applied rewrites56.5%

    \[\leadsto \color{blue}{{\left(\frac{z}{t}\right)}^{2}} \]
  6. Step-by-step derivation
    1. lift-/.f64N/A

      \[\leadsto {\left(\frac{z}{t}\right)}^{2} \]
    2. lift-pow.f64N/A

      \[\leadsto {\left(\frac{z}{t}\right)}^{\color{blue}{2}} \]
    3. unpow2N/A

      \[\leadsto \frac{z}{t} \cdot \color{blue}{\frac{z}{t}} \]
    4. times-fracN/A

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

      \[\leadsto \frac{z \cdot z}{\color{blue}{t \cdot t}} \]
    6. lift-*.f64N/A

      \[\leadsto \frac{z \cdot z}{\color{blue}{t} \cdot t} \]
    7. lift-*.f6448.8

      \[\leadsto \frac{z \cdot z}{t \cdot \color{blue}{t}} \]
  7. Applied rewrites48.8%

    \[\leadsto \frac{z \cdot z}{\color{blue}{t \cdot t}} \]
  8. Add Preprocessing

Developer Target 1: 99.6% accurate, 0.2× 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);
}
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) ** 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 2025064 
(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))))