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

Percentage Accurate: 66.3% → 97.1%
Time: 3.9s
Alternatives: 9
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ \frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (+ (/ (* x x) (* y y)) (/ (* z z) (* t t))))
double code(double x, double y, double z, double t) {
	return ((x * x) / (y * y)) + ((z * z) / (t * t));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

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

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

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 9 alternatives:

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

Initial Program: 66.3% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (+ (/ (* x x) (* y y)) (/ (* z z) (* t t))))
double code(double x, double y, double z, double t) {
	return ((x * x) / (y * y)) + ((z * z) / (t * t));
}
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: 97.1% accurate, 0.6× speedup?

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

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

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


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

    1. Initial program 66.3%

      \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
    2. 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. times-fracN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.0000000000000001e270 < (/.f64 (*.f64 z z) (*.f64 t t))

    1. Initial program 66.3%

      \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
    2. 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. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 96.8% accurate, 1.0× speedup?

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

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

    \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
  2. 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. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 95.9% accurate, 0.6× speedup?

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

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

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


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

    1. Initial program 66.3%

      \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
    2. 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. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1e176 < (/.f64 (*.f64 x x) (*.f64 y y))

    1. Initial program 66.3%

      \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
    2. 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. times-fracN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 92.4% accurate, 0.6× speedup?

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

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

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


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

    1. Initial program 66.3%

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

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

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

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

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

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

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

        \[\leadsto \frac{z}{t \cdot t} \cdot z \]
      7. lift-*.f6452.1

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

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

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

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

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

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

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

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

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

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

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

    if 4.9999999999999996e-199 < (/.f64 (*.f64 x x) (*.f64 y y))

    1. Initial program 66.3%

      \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
    2. 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. times-fracN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 90.2% accurate, 0.6× speedup?

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

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

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


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

    1. Initial program 66.3%

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

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

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

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

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

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

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

        \[\leadsto \frac{z}{t \cdot t} \cdot z \]
      7. lift-*.f6452.1

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

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

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

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

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

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

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

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

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

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

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

    if 4.9999999999999996e-199 < (/.f64 (*.f64 x x) (*.f64 y y))

    1. Initial program 66.3%

      \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
    2. 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. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 85.8% accurate, 0.5× speedup?

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

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

\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{t \cdot t}, z, \frac{x}{y \cdot y} \cdot x\right)\\

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


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

    1. Initial program 66.3%

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

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

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

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

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

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

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

        \[\leadsto \frac{z}{t \cdot t} \cdot z \]
      7. lift-*.f6452.1

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

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

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

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

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

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

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

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

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

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

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

    if 4.9999999999999996e-199 < (/.f64 (*.f64 x x) (*.f64 y y)) < +inf.0

    1. Initial program 66.3%

      \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
    2. 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. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 79.4% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\

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


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

    1. Initial program 66.3%

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

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

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

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

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

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

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

        \[\leadsto \frac{z}{t \cdot t} \cdot z \]
      7. lift-*.f6452.1

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

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

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

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

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

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

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

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

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

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

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

    if 3.6999999999999998e-62 < (/.f64 (*.f64 x x) (*.f64 y y)) < +inf.0

    1. Initial program 66.3%

      \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
    2. 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. times-fracN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{{x}^{2}}{{y}^{2}}} \]
    7. Step-by-step derivation
      1. Applied rewrites48.3%

        \[\leadsto \color{blue}{\frac{x \cdot x}{y \cdot y}} \]
    8. Recombined 2 regimes into one program.
    9. Add Preprocessing

    Alternative 8: 69.9% accurate, 0.6× speedup?

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

      1. Initial program 66.3%

        \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
      2. 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. times-fracN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{{x}^{2}}{{y}^{2}}} \]
      7. Step-by-step derivation
        1. Applied rewrites48.3%

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

        if 1.00000000000000004e-134 < (/.f64 (*.f64 z z) (*.f64 t t)) < +inf.0

        1. Initial program 66.3%

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

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

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

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

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

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

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

            \[\leadsto \frac{z}{t \cdot t} \cdot z \]
          7. lift-*.f6452.1

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

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

      Alternative 9: 52.1% accurate, 2.2× speedup?

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

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

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

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

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

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

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

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

          \[\leadsto \frac{z}{t \cdot t} \cdot z \]
        7. lift-*.f6452.1

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

        \[\leadsto \color{blue}{\frac{z}{t \cdot t} \cdot z} \]
      5. Add Preprocessing

      Reproduce

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