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

Percentage Accurate: 66.3% → 98.1%
Time: 4.1s
Alternatives: 14
Speedup: 0.7×

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 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: 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: 98.1% accurate, 0.3× speedup?

\[\begin{array}{l} t_m = \left|t\right| \\ \begin{array}{l} \mathbf{if}\;t\_m \leq 5 \cdot 10^{-239}:\\ \;\;\;\;\left(-x\right) \cdot \left(\frac{x}{y} \cdot \frac{-1}{y}\right) + \frac{z}{t\_m} \cdot \frac{z}{t\_m}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{\frac{z}{t\_m}}{t\_m}, z, {\left(\frac{x}{y}\right)}^{2}\right)\\ \end{array} \end{array} \]
t_m = (fabs.f64 t)
(FPCore (x y z t_m)
 :precision binary64
 (if (<= t_m 5e-239)
   (+ (* (- x) (* (/ x y) (/ -1.0 y))) (* (/ z t_m) (/ z t_m)))
   (fma (/ (/ z t_m) t_m) z (pow (/ x y) 2.0))))
t_m = fabs(t);
double code(double x, double y, double z, double t_m) {
	double tmp;
	if (t_m <= 5e-239) {
		tmp = (-x * ((x / y) * (-1.0 / y))) + ((z / t_m) * (z / t_m));
	} else {
		tmp = fma(((z / t_m) / t_m), z, pow((x / y), 2.0));
	}
	return tmp;
}
t_m = abs(t)
function code(x, y, z, t_m)
	tmp = 0.0
	if (t_m <= 5e-239)
		tmp = Float64(Float64(Float64(-x) * Float64(Float64(x / y) * Float64(-1.0 / y))) + Float64(Float64(z / t_m) * Float64(z / t_m)));
	else
		tmp = fma(Float64(Float64(z / t_m) / t_m), z, (Float64(x / y) ^ 2.0));
	end
	return tmp
end
t_m = N[Abs[t], $MachinePrecision]
code[x_, y_, z_, t$95$m_] := If[LessEqual[t$95$m, 5e-239], N[(N[((-x) * N[(N[(x / y), $MachinePrecision] * N[(-1.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(z / t$95$m), $MachinePrecision] * N[(z / t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(z / t$95$m), $MachinePrecision] / t$95$m), $MachinePrecision] * z + N[Power[N[(x / y), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
t_m = \left|t\right|

\\
\begin{array}{l}
\mathbf{if}\;t\_m \leq 5 \cdot 10^{-239}:\\
\;\;\;\;\left(-x\right) \cdot \left(\frac{x}{y} \cdot \frac{-1}{y}\right) + \frac{z}{t\_m} \cdot \frac{z}{t\_m}\\

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


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

    1. Initial program 61.9%

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

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

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

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

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

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

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

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

        \[\leadsto \left(-x\right) \cdot \frac{-x}{\color{blue}{y \cdot y}} + \frac{z \cdot z}{t \cdot t} \]
      12. lift-*.f6471.1

        \[\leadsto \left(-x\right) \cdot \frac{-x}{\color{blue}{y \cdot y}} + \frac{z \cdot z}{t \cdot t} \]
    3. Applied rewrites71.1%

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

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

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

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

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

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

        \[\leadsto \left(-x\right) \cdot \frac{-x}{y \cdot y} + \frac{z}{t} \cdot \color{blue}{\frac{z}{t}} \]
      7. lift-*.f6497.1

        \[\leadsto \left(-x\right) \cdot \frac{-x}{y \cdot y} + \color{blue}{\frac{z}{t} \cdot \frac{z}{t}} \]
    5. Applied rewrites97.1%

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

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

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

        \[\leadsto \left(-x\right) \cdot \color{blue}{\frac{\mathsf{neg}\left(x\right)}{y \cdot y}} + \frac{z}{t} \cdot \frac{z}{t} \]
      4. mul-1-negN/A

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

        \[\leadsto \left(-x\right) \cdot \frac{\color{blue}{x \cdot -1}}{y \cdot y} + \frac{z}{t} \cdot \frac{z}{t} \]
      6. times-fracN/A

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

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

        \[\leadsto \left(-x\right) \cdot \left(\color{blue}{\frac{x}{y}} \cdot \frac{-1}{y}\right) + \frac{z}{t} \cdot \frac{z}{t} \]
      9. lower-/.f6498.7

        \[\leadsto \left(-x\right) \cdot \left(\frac{x}{y} \cdot \color{blue}{\frac{-1}{y}}\right) + \frac{z}{t} \cdot \frac{z}{t} \]
    7. Applied rewrites98.7%

      \[\leadsto \left(-x\right) \cdot \color{blue}{\left(\frac{x}{y} \cdot \frac{-1}{y}\right)} + \frac{z}{t} \cdot \frac{z}{t} \]

    if 5e-239 < t

    1. Initial program 66.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 82.9% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
t_1 := \frac{x \cdot x}{y \cdot y}\\
t_2 := \frac{\frac{z}{t\_m} \cdot z}{t\_m}\\
\mathbf{if}\;t\_1 \leq 0:\\
\;\;\;\;t\_2\\

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

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


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

    1. Initial program 52.5%

      \[\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. 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. +-commutativeN/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. associate-/r*N/A

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{{z}^{2}}{t} \cdot y + t \cdot \frac{{x}^{2}}{y}}{t \cdot y}} \]
    3. Applied rewrites73.5%

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

      \[\leadsto \frac{\color{blue}{\frac{t \cdot {x}^{2}}{y}}}{t \cdot y} \]
    5. 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. lift-*.f6423.4

        \[\leadsto \frac{\frac{\left(x \cdot x\right) \cdot t}{y}}{t \cdot y} \]
    6. Applied rewrites23.4%

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

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

        \[\leadsto \color{blue}{\frac{\frac{\left(x \cdot x\right) \cdot t}{y}}{t \cdot y}} \]
      3. *-commutativeN/A

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{z}{t} \cdot z}{t} \]
      4. lift-*.f6478.3

        \[\leadsto \frac{\frac{z}{t} \cdot \color{blue}{z}}{t} \]
    11. Applied rewrites78.3%

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

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

    1. Initial program 78.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{x \cdot x}{y \cdot y} + z \cdot \frac{z}{\color{blue}{t \cdot t}} \]
      11. lower-*.f6486.8

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

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

Alternative 3: 76.5% accurate, 0.5× speedup?

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

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

\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\frac{\left(\frac{x}{y} \cdot x\right) \cdot t\_m}{t\_m \cdot y}\\

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


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

    1. Initial program 60.2%

      \[\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. 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. +-commutativeN/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. associate-/r*N/A

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{{z}^{2}}{t} \cdot y + t \cdot \frac{{x}^{2}}{y}}{t \cdot y}} \]
    3. Applied rewrites75.9%

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

      \[\leadsto \frac{\color{blue}{\frac{t \cdot {x}^{2}}{y}}}{t \cdot y} \]
    5. 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. lift-*.f6427.2

        \[\leadsto \frac{\frac{\left(x \cdot x\right) \cdot t}{y}}{t \cdot y} \]
    6. Applied rewrites27.2%

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

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

        \[\leadsto \color{blue}{\frac{\frac{\left(x \cdot x\right) \cdot t}{y}}{t \cdot y}} \]
      3. *-commutativeN/A

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{z}{t} \cdot z}{t} \]
      4. lift-*.f6470.3

        \[\leadsto \frac{\frac{z}{t} \cdot \color{blue}{z}}{t} \]
    11. Applied rewrites70.3%

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

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

    1. Initial program 77.5%

      \[\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. 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. +-commutativeN/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. associate-/r*N/A

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{\frac{t \cdot {x}^{2}}{y}}}{t \cdot y} \]
    5. 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. lift-*.f6485.0

        \[\leadsto \frac{\frac{\left(x \cdot x\right) \cdot t}{y}}{t \cdot y} \]
    6. Applied rewrites85.0%

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

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

        \[\leadsto \frac{\frac{\left(x \cdot x\right) \cdot t}{y}}{t \cdot y} \]
      3. lift-*.f64N/A

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

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

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

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

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

        \[\leadsto \frac{\left(\frac{x}{y} \cdot x\right) \cdot t}{t \cdot y} \]
      9. lift-/.f64N/A

        \[\leadsto \frac{\left(\frac{x}{y} \cdot x\right) \cdot t}{t \cdot y} \]
      10. lift-*.f6487.8

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

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

Alternative 4: 75.5% accurate, 0.5× speedup?

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

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

\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\frac{x \cdot \frac{x \cdot t\_m}{y}}{t\_m \cdot y}\\

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


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

    1. Initial program 60.2%

      \[\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. 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. +-commutativeN/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. associate-/r*N/A

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{{z}^{2}}{t} \cdot y + t \cdot \frac{{x}^{2}}{y}}{t \cdot y}} \]
    3. Applied rewrites75.9%

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

      \[\leadsto \frac{\color{blue}{\frac{t \cdot {x}^{2}}{y}}}{t \cdot y} \]
    5. 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. lift-*.f6427.2

        \[\leadsto \frac{\frac{\left(x \cdot x\right) \cdot t}{y}}{t \cdot y} \]
    6. Applied rewrites27.2%

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

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

        \[\leadsto \color{blue}{\frac{\frac{\left(x \cdot x\right) \cdot t}{y}}{t \cdot y}} \]
      3. *-commutativeN/A

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{z}{t} \cdot z}{t} \]
      4. lift-*.f6470.3

        \[\leadsto \frac{\frac{z}{t} \cdot \color{blue}{z}}{t} \]
    11. Applied rewrites70.3%

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

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

    1. Initial program 77.5%

      \[\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. 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. +-commutativeN/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. associate-/r*N/A

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{\frac{t \cdot {x}^{2}}{y}}}{t \cdot y} \]
    5. 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. lift-*.f6485.0

        \[\leadsto \frac{\frac{\left(x \cdot x\right) \cdot t}{y}}{t \cdot y} \]
    6. Applied rewrites85.0%

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

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

        \[\leadsto \frac{\frac{\left(x \cdot x\right) \cdot t}{y}}{t \cdot y} \]
      3. lift-*.f64N/A

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

        \[\leadsto \frac{\frac{x \cdot \left(x \cdot t\right)}{y}}{t \cdot y} \]
      5. associate-/l*N/A

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

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

        \[\leadsto \frac{x \cdot \frac{x \cdot t}{\color{blue}{y}}}{t \cdot y} \]
      8. lift-*.f6485.0

        \[\leadsto \frac{x \cdot \frac{x \cdot t}{y}}{t \cdot y} \]
    8. Applied rewrites85.0%

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

Alternative 5: 95.3% accurate, 0.6× speedup?

\[\begin{array}{l} t_m = \left|t\right| \\ \begin{array}{l} t_1 := \frac{z \cdot z}{t\_m \cdot t\_m}\\ \mathbf{if}\;t\_1 \leq 5 \cdot 10^{+165}:\\ \;\;\;\;\frac{x}{y} \cdot \frac{x}{y} + t\_1\\ \mathbf{else}:\\ \;\;\;\;\left(-x\right) \cdot \frac{-x}{y \cdot y} + \frac{z}{t\_m} \cdot \frac{z}{t\_m}\\ \end{array} \end{array} \]
t_m = (fabs.f64 t)
(FPCore (x y z t_m)
 :precision binary64
 (let* ((t_1 (/ (* z z) (* t_m t_m))))
   (if (<= t_1 5e+165)
     (+ (* (/ x y) (/ x y)) t_1)
     (+ (* (- x) (/ (- x) (* y y))) (* (/ z t_m) (/ z t_m))))))
t_m = fabs(t);
double code(double x, double y, double z, double t_m) {
	double t_1 = (z * z) / (t_m * t_m);
	double tmp;
	if (t_1 <= 5e+165) {
		tmp = ((x / y) * (x / y)) + t_1;
	} else {
		tmp = (-x * (-x / (y * y))) + ((z / t_m) * (z / t_m));
	}
	return tmp;
}
t_m =     private
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_m)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t_m
    real(8) :: t_1
    real(8) :: tmp
    t_1 = (z * z) / (t_m * t_m)
    if (t_1 <= 5d+165) then
        tmp = ((x / y) * (x / y)) + t_1
    else
        tmp = (-x * (-x / (y * y))) + ((z / t_m) * (z / t_m))
    end if
    code = tmp
end function
t_m = Math.abs(t);
public static double code(double x, double y, double z, double t_m) {
	double t_1 = (z * z) / (t_m * t_m);
	double tmp;
	if (t_1 <= 5e+165) {
		tmp = ((x / y) * (x / y)) + t_1;
	} else {
		tmp = (-x * (-x / (y * y))) + ((z / t_m) * (z / t_m));
	}
	return tmp;
}
t_m = math.fabs(t)
def code(x, y, z, t_m):
	t_1 = (z * z) / (t_m * t_m)
	tmp = 0
	if t_1 <= 5e+165:
		tmp = ((x / y) * (x / y)) + t_1
	else:
		tmp = (-x * (-x / (y * y))) + ((z / t_m) * (z / t_m))
	return tmp
t_m = abs(t)
function code(x, y, z, t_m)
	t_1 = Float64(Float64(z * z) / Float64(t_m * t_m))
	tmp = 0.0
	if (t_1 <= 5e+165)
		tmp = Float64(Float64(Float64(x / y) * Float64(x / y)) + t_1);
	else
		tmp = Float64(Float64(Float64(-x) * Float64(Float64(-x) / Float64(y * y))) + Float64(Float64(z / t_m) * Float64(z / t_m)));
	end
	return tmp
end
t_m = abs(t);
function tmp_2 = code(x, y, z, t_m)
	t_1 = (z * z) / (t_m * t_m);
	tmp = 0.0;
	if (t_1 <= 5e+165)
		tmp = ((x / y) * (x / y)) + t_1;
	else
		tmp = (-x * (-x / (y * y))) + ((z / t_m) * (z / t_m));
	end
	tmp_2 = tmp;
end
t_m = N[Abs[t], $MachinePrecision]
code[x_, y_, z_, t$95$m_] := Block[{t$95$1 = N[(N[(z * z), $MachinePrecision] / N[(t$95$m * t$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 5e+165], N[(N[(N[(x / y), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision], N[(N[((-x) * N[((-x) / N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(z / t$95$m), $MachinePrecision] * N[(z / t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_m = \left|t\right|

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

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


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

    1. Initial program 73.4%

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

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

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

    if 4.9999999999999997e165 < (/.f64 (*.f64 z z) (*.f64 t t))

    1. Initial program 59.2%

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

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

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

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

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

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

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

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

        \[\leadsto \left(-x\right) \cdot \frac{-x}{\color{blue}{y \cdot y}} + \frac{z \cdot z}{t \cdot t} \]
      12. lift-*.f6467.1

        \[\leadsto \left(-x\right) \cdot \frac{-x}{\color{blue}{y \cdot y}} + \frac{z \cdot z}{t \cdot t} \]
    3. Applied rewrites67.1%

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

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

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

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

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

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

        \[\leadsto \left(-x\right) \cdot \frac{-x}{y \cdot y} + \frac{z}{t} \cdot \color{blue}{\frac{z}{t}} \]
      7. lift-*.f6495.7

        \[\leadsto \left(-x\right) \cdot \frac{-x}{y \cdot y} + \color{blue}{\frac{z}{t} \cdot \frac{z}{t}} \]
    5. Applied rewrites95.7%

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

Alternative 6: 91.0% accurate, 0.6× speedup?

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

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

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


\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 75.2%

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

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

        \[\leadsto \frac{\color{blue}{\left(\mathsf{neg}\left(z\right)\right) \cdot \left(\mathsf{neg}\left(z\right)\right)}}{t \cdot t} + \frac{x \cdot x}{y \cdot y} \]
      10. pow2N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(-z, \frac{-z}{t \cdot t}, \color{blue}{\frac{\frac{x}{y} \cdot x}{y}}\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. 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. pow2N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 93.0% accurate, 0.6× speedup?

\[\begin{array}{l} t_m = \left|t\right| \\ \begin{array}{l} t_1 := \frac{z \cdot z}{t\_m \cdot t\_m}\\ \mathbf{if}\;t\_1 \leq 5 \cdot 10^{+165}:\\ \;\;\;\;\frac{x}{y} \cdot \frac{x}{y} + t\_1\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot y} \cdot x + \frac{\frac{z}{t\_m} \cdot z}{t\_m}\\ \end{array} \end{array} \]
t_m = (fabs.f64 t)
(FPCore (x y z t_m)
 :precision binary64
 (let* ((t_1 (/ (* z z) (* t_m t_m))))
   (if (<= t_1 5e+165)
     (+ (* (/ x y) (/ x y)) t_1)
     (+ (* (/ x (* y y)) x) (/ (* (/ z t_m) z) t_m)))))
t_m = fabs(t);
double code(double x, double y, double z, double t_m) {
	double t_1 = (z * z) / (t_m * t_m);
	double tmp;
	if (t_1 <= 5e+165) {
		tmp = ((x / y) * (x / y)) + t_1;
	} else {
		tmp = ((x / (y * y)) * x) + (((z / t_m) * z) / t_m);
	}
	return tmp;
}
t_m =     private
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_m)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t_m
    real(8) :: t_1
    real(8) :: tmp
    t_1 = (z * z) / (t_m * t_m)
    if (t_1 <= 5d+165) then
        tmp = ((x / y) * (x / y)) + t_1
    else
        tmp = ((x / (y * y)) * x) + (((z / t_m) * z) / t_m)
    end if
    code = tmp
end function
t_m = Math.abs(t);
public static double code(double x, double y, double z, double t_m) {
	double t_1 = (z * z) / (t_m * t_m);
	double tmp;
	if (t_1 <= 5e+165) {
		tmp = ((x / y) * (x / y)) + t_1;
	} else {
		tmp = ((x / (y * y)) * x) + (((z / t_m) * z) / t_m);
	}
	return tmp;
}
t_m = math.fabs(t)
def code(x, y, z, t_m):
	t_1 = (z * z) / (t_m * t_m)
	tmp = 0
	if t_1 <= 5e+165:
		tmp = ((x / y) * (x / y)) + t_1
	else:
		tmp = ((x / (y * y)) * x) + (((z / t_m) * z) / t_m)
	return tmp
t_m = abs(t)
function code(x, y, z, t_m)
	t_1 = Float64(Float64(z * z) / Float64(t_m * t_m))
	tmp = 0.0
	if (t_1 <= 5e+165)
		tmp = Float64(Float64(Float64(x / y) * Float64(x / y)) + t_1);
	else
		tmp = Float64(Float64(Float64(x / Float64(y * y)) * x) + Float64(Float64(Float64(z / t_m) * z) / t_m));
	end
	return tmp
end
t_m = abs(t);
function tmp_2 = code(x, y, z, t_m)
	t_1 = (z * z) / (t_m * t_m);
	tmp = 0.0;
	if (t_1 <= 5e+165)
		tmp = ((x / y) * (x / y)) + t_1;
	else
		tmp = ((x / (y * y)) * x) + (((z / t_m) * z) / t_m);
	end
	tmp_2 = tmp;
end
t_m = N[Abs[t], $MachinePrecision]
code[x_, y_, z_, t$95$m_] := Block[{t$95$1 = N[(N[(z * z), $MachinePrecision] / N[(t$95$m * t$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 5e+165], N[(N[(N[(x / y), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision], N[(N[(N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision] + N[(N[(N[(z / t$95$m), $MachinePrecision] * z), $MachinePrecision] / t$95$m), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_m = \left|t\right|

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

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


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

    1. Initial program 73.4%

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

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

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

    if 4.9999999999999997e165 < (/.f64 (*.f64 z z) (*.f64 t t))

    1. Initial program 59.2%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{x}{y}}}{y} \cdot x + \frac{z \cdot z}{t \cdot t} \]
    3. Applied rewrites67.5%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{x}{y}}{y} \cdot x + \frac{\color{blue}{\frac{z}{t} \cdot z}}{t} \]
      12. lower-/.f6493.4

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

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

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

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

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

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

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

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

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

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

Alternative 8: 88.6% accurate, 0.6× speedup?

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

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

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


\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 75.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(\frac{\frac{z}{t}}{t}, z, \color{blue}{\frac{x \cdot x}{y \cdot y}}\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. 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-/.f6480.9

        \[\leadsto \frac{x}{y} \cdot \color{blue}{\frac{x}{y}} + \frac{z \cdot z}{t \cdot t} \]
    3. Applied rewrites80.9%

      \[\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 9: 85.0% accurate, 0.6× speedup?

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

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

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


\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 75.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(\frac{\frac{z}{t}}{t}, z, \color{blue}{\frac{x \cdot x}{y \cdot y}}\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. 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. +-commutativeN/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. associate-/r*N/A

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{{z}^{2}}{t} \cdot y + t \cdot \frac{{x}^{2}}{y}}{t \cdot y}} \]
    3. Applied rewrites61.0%

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

      \[\leadsto \frac{\color{blue}{\frac{t \cdot {x}^{2}}{y}}}{t \cdot y} \]
    5. 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. lift-*.f6417.7

        \[\leadsto \frac{\frac{\left(x \cdot x\right) \cdot t}{y}}{t \cdot y} \]
    6. Applied rewrites17.7%

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

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

        \[\leadsto \color{blue}{\frac{\frac{\left(x \cdot x\right) \cdot t}{y}}{t \cdot y}} \]
      3. *-commutativeN/A

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{z}{t} \cdot z}{t} \]
      4. lift-*.f6450.2

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

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

Alternative 10: 79.7% accurate, 0.7× speedup?

\[\begin{array}{l} t_m = \left|t\right| \\ \begin{array}{l} \mathbf{if}\;y \cdot y \leq 5 \cdot 10^{-297}:\\ \;\;\;\;\frac{\left(\frac{x}{y} \cdot x\right) \cdot t\_m}{t\_m \cdot y}\\ \mathbf{elif}\;y \cdot y \leq 2 \cdot 10^{+232}:\\ \;\;\;\;\frac{x}{y \cdot y} \cdot x + \frac{z \cdot z}{t\_m \cdot t\_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{z}{t\_m} \cdot z}{t\_m}\\ \end{array} \end{array} \]
t_m = (fabs.f64 t)
(FPCore (x y z t_m)
 :precision binary64
 (if (<= (* y y) 5e-297)
   (/ (* (* (/ x y) x) t_m) (* t_m y))
   (if (<= (* y y) 2e+232)
     (+ (* (/ x (* y y)) x) (/ (* z z) (* t_m t_m)))
     (/ (* (/ z t_m) z) t_m))))
t_m = fabs(t);
double code(double x, double y, double z, double t_m) {
	double tmp;
	if ((y * y) <= 5e-297) {
		tmp = (((x / y) * x) * t_m) / (t_m * y);
	} else if ((y * y) <= 2e+232) {
		tmp = ((x / (y * y)) * x) + ((z * z) / (t_m * t_m));
	} else {
		tmp = ((z / t_m) * z) / t_m;
	}
	return tmp;
}
t_m =     private
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_m)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t_m
    real(8) :: tmp
    if ((y * y) <= 5d-297) then
        tmp = (((x / y) * x) * t_m) / (t_m * y)
    else if ((y * y) <= 2d+232) then
        tmp = ((x / (y * y)) * x) + ((z * z) / (t_m * t_m))
    else
        tmp = ((z / t_m) * z) / t_m
    end if
    code = tmp
end function
t_m = Math.abs(t);
public static double code(double x, double y, double z, double t_m) {
	double tmp;
	if ((y * y) <= 5e-297) {
		tmp = (((x / y) * x) * t_m) / (t_m * y);
	} else if ((y * y) <= 2e+232) {
		tmp = ((x / (y * y)) * x) + ((z * z) / (t_m * t_m));
	} else {
		tmp = ((z / t_m) * z) / t_m;
	}
	return tmp;
}
t_m = math.fabs(t)
def code(x, y, z, t_m):
	tmp = 0
	if (y * y) <= 5e-297:
		tmp = (((x / y) * x) * t_m) / (t_m * y)
	elif (y * y) <= 2e+232:
		tmp = ((x / (y * y)) * x) + ((z * z) / (t_m * t_m))
	else:
		tmp = ((z / t_m) * z) / t_m
	return tmp
t_m = abs(t)
function code(x, y, z, t_m)
	tmp = 0.0
	if (Float64(y * y) <= 5e-297)
		tmp = Float64(Float64(Float64(Float64(x / y) * x) * t_m) / Float64(t_m * y));
	elseif (Float64(y * y) <= 2e+232)
		tmp = Float64(Float64(Float64(x / Float64(y * y)) * x) + Float64(Float64(z * z) / Float64(t_m * t_m)));
	else
		tmp = Float64(Float64(Float64(z / t_m) * z) / t_m);
	end
	return tmp
end
t_m = abs(t);
function tmp_2 = code(x, y, z, t_m)
	tmp = 0.0;
	if ((y * y) <= 5e-297)
		tmp = (((x / y) * x) * t_m) / (t_m * y);
	elseif ((y * y) <= 2e+232)
		tmp = ((x / (y * y)) * x) + ((z * z) / (t_m * t_m));
	else
		tmp = ((z / t_m) * z) / t_m;
	end
	tmp_2 = tmp;
end
t_m = N[Abs[t], $MachinePrecision]
code[x_, y_, z_, t$95$m_] := If[LessEqual[N[(y * y), $MachinePrecision], 5e-297], N[(N[(N[(N[(x / y), $MachinePrecision] * x), $MachinePrecision] * t$95$m), $MachinePrecision] / N[(t$95$m * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(y * y), $MachinePrecision], 2e+232], N[(N[(N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision] + N[(N[(z * z), $MachinePrecision] / N[(t$95$m * t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(z / t$95$m), $MachinePrecision] * z), $MachinePrecision] / t$95$m), $MachinePrecision]]]
\begin{array}{l}
t_m = \left|t\right|

\\
\begin{array}{l}
\mathbf{if}\;y \cdot y \leq 5 \cdot 10^{-297}:\\
\;\;\;\;\frac{\left(\frac{x}{y} \cdot x\right) \cdot t\_m}{t\_m \cdot y}\\

\mathbf{elif}\;y \cdot y \leq 2 \cdot 10^{+232}:\\
\;\;\;\;\frac{x}{y \cdot y} \cdot x + \frac{z \cdot z}{t\_m \cdot t\_m}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 y y) < 5e-297

    1. Initial program 61.0%

      \[\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. 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. +-commutativeN/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. associate-/r*N/A

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{\frac{t \cdot {x}^{2}}{y}}}{t \cdot y} \]
    5. 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. lift-*.f6468.1

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

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

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

        \[\leadsto \frac{\frac{\left(x \cdot x\right) \cdot t}{y}}{t \cdot y} \]
      3. lift-*.f64N/A

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

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

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

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

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

        \[\leadsto \frac{\left(\frac{x}{y} \cdot x\right) \cdot t}{t \cdot y} \]
      9. lift-/.f64N/A

        \[\leadsto \frac{\left(\frac{x}{y} \cdot x\right) \cdot t}{t \cdot y} \]
      10. lift-*.f6481.4

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

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

    if 5e-297 < (*.f64 y y) < 2.00000000000000011e232

    1. Initial program 76.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.00000000000000011e232 < (*.f64 y y)

    1. Initial program 56.2%

      \[\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. 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. +-commutativeN/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. associate-/r*N/A

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{{z}^{2}}{t} \cdot y + t \cdot \frac{{x}^{2}}{y}}{t \cdot y}} \]
    3. Applied rewrites67.5%

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

      \[\leadsto \frac{\color{blue}{\frac{t \cdot {x}^{2}}{y}}}{t \cdot y} \]
    5. 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. lift-*.f6428.5

        \[\leadsto \frac{\frac{\left(x \cdot x\right) \cdot t}{y}}{t \cdot y} \]
    6. Applied rewrites28.5%

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

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

        \[\leadsto \color{blue}{\frac{\frac{\left(x \cdot x\right) \cdot t}{y}}{t \cdot y}} \]
      3. *-commutativeN/A

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

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

        \[\leadsto \color{blue}{\frac{\frac{\frac{\left(x \cdot x\right) \cdot t}{y}}{y}}{t}} \]
    8. Applied rewrites29.3%

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

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

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

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

        \[\leadsto \frac{\frac{z}{t} \cdot z}{t} \]
      4. lift-*.f6476.8

        \[\leadsto \frac{\frac{z}{t} \cdot \color{blue}{z}}{t} \]
    11. Applied rewrites76.8%

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

Alternative 11: 96.8% accurate, 0.7× speedup?

\[\begin{array}{l} t_m = \left|t\right| \\ \left(-x\right) \cdot \left(\frac{x}{y} \cdot \frac{-1}{y}\right) + \frac{z}{t\_m} \cdot \frac{z}{t\_m} \end{array} \]
t_m = (fabs.f64 t)
(FPCore (x y z t_m)
 :precision binary64
 (+ (* (- x) (* (/ x y) (/ -1.0 y))) (* (/ z t_m) (/ z t_m))))
t_m = fabs(t);
double code(double x, double y, double z, double t_m) {
	return (-x * ((x / y) * (-1.0 / y))) + ((z / t_m) * (z / t_m));
}
t_m =     private
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_m)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t_m
    code = (-x * ((x / y) * ((-1.0d0) / y))) + ((z / t_m) * (z / t_m))
end function
t_m = Math.abs(t);
public static double code(double x, double y, double z, double t_m) {
	return (-x * ((x / y) * (-1.0 / y))) + ((z / t_m) * (z / t_m));
}
t_m = math.fabs(t)
def code(x, y, z, t_m):
	return (-x * ((x / y) * (-1.0 / y))) + ((z / t_m) * (z / t_m))
t_m = abs(t)
function code(x, y, z, t_m)
	return Float64(Float64(Float64(-x) * Float64(Float64(x / y) * Float64(-1.0 / y))) + Float64(Float64(z / t_m) * Float64(z / t_m)))
end
t_m = abs(t);
function tmp = code(x, y, z, t_m)
	tmp = (-x * ((x / y) * (-1.0 / y))) + ((z / t_m) * (z / t_m));
end
t_m = N[Abs[t], $MachinePrecision]
code[x_, y_, z_, t$95$m_] := N[(N[((-x) * N[(N[(x / y), $MachinePrecision] * N[(-1.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(z / t$95$m), $MachinePrecision] * N[(z / t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
t_m = \left|t\right|

\\
\left(-x\right) \cdot \left(\frac{x}{y} \cdot \frac{-1}{y}\right) + \frac{z}{t\_m} \cdot \frac{z}{t\_m}
\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 \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. sqr-neg-revN/A

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

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

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

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

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

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

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

      \[\leadsto \left(-x\right) \cdot \frac{-x}{\color{blue}{y \cdot y}} + \frac{z \cdot z}{t \cdot t} \]
    12. lift-*.f6473.5

      \[\leadsto \left(-x\right) \cdot \frac{-x}{\color{blue}{y \cdot y}} + \frac{z \cdot z}{t \cdot t} \]
  3. Applied rewrites73.5%

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

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

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

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

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

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

      \[\leadsto \left(-x\right) \cdot \frac{-x}{y \cdot y} + \frac{z}{t} \cdot \color{blue}{\frac{z}{t}} \]
    7. lift-*.f6489.9

      \[\leadsto \left(-x\right) \cdot \frac{-x}{y \cdot y} + \color{blue}{\frac{z}{t} \cdot \frac{z}{t}} \]
  5. Applied rewrites89.9%

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

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

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

      \[\leadsto \left(-x\right) \cdot \color{blue}{\frac{\mathsf{neg}\left(x\right)}{y \cdot y}} + \frac{z}{t} \cdot \frac{z}{t} \]
    4. mul-1-negN/A

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

      \[\leadsto \left(-x\right) \cdot \frac{\color{blue}{x \cdot -1}}{y \cdot y} + \frac{z}{t} \cdot \frac{z}{t} \]
    6. times-fracN/A

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

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

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

      \[\leadsto \left(-x\right) \cdot \left(\frac{x}{y} \cdot \color{blue}{\frac{-1}{y}}\right) + \frac{z}{t} \cdot \frac{z}{t} \]
  7. Applied rewrites96.8%

    \[\leadsto \left(-x\right) \cdot \color{blue}{\left(\frac{x}{y} \cdot \frac{-1}{y}\right)} + \frac{z}{t} \cdot \frac{z}{t} \]
  8. Add Preprocessing

Alternative 12: 95.2% accurate, 0.7× speedup?

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

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

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


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

    1. Initial program 61.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.99999999999999978e-227 < t

    1. Initial program 67.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 13: 95.0% accurate, 0.7× speedup?

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

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

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


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

    1. Initial program 61.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{x}{y}}{y} \cdot x + \frac{\color{blue}{\frac{z}{t} \cdot z}}{t} \]
      12. lower-/.f6497.9

        \[\leadsto \frac{\frac{x}{y}}{y} \cdot x + \frac{\color{blue}{\frac{z}{t}} \cdot z}{t} \]
    5. Applied rewrites97.9%

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

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

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

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

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

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

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

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

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

    if 3.8000000000000003e-225 < t

    1. Initial program 67.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 14: 56.8% accurate, 1.6× speedup?

\[\begin{array}{l} t_m = \left|t\right| \\ \frac{\frac{z}{t\_m} \cdot z}{t\_m} \end{array} \]
t_m = (fabs.f64 t)
(FPCore (x y z t_m) :precision binary64 (/ (* (/ z t_m) z) t_m))
t_m = fabs(t);
double code(double x, double y, double z, double t_m) {
	return ((z / t_m) * z) / t_m;
}
t_m =     private
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_m)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t_m
    code = ((z / t_m) * z) / t_m
end function
t_m = Math.abs(t);
public static double code(double x, double y, double z, double t_m) {
	return ((z / t_m) * z) / t_m;
}
t_m = math.fabs(t)
def code(x, y, z, t_m):
	return ((z / t_m) * z) / t_m
t_m = abs(t)
function code(x, y, z, t_m)
	return Float64(Float64(Float64(z / t_m) * z) / t_m)
end
t_m = abs(t);
function tmp = code(x, y, z, t_m)
	tmp = ((z / t_m) * z) / t_m;
end
t_m = N[Abs[t], $MachinePrecision]
code[x_, y_, z_, t$95$m_] := N[(N[(N[(z / t$95$m), $MachinePrecision] * z), $MachinePrecision] / t$95$m), $MachinePrecision]
\begin{array}{l}
t_m = \left|t\right|

\\
\frac{\frac{z}{t\_m} \cdot z}{t\_m}
\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. 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. +-commutativeN/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. associate-/r*N/A

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

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

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

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

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

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

    \[\leadsto \frac{\color{blue}{\frac{t \cdot {x}^{2}}{y}}}{t \cdot y} \]
  5. 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. lift-*.f6447.8

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{\left(x \cdot x\right) \cdot t}{y}}{t \cdot y}} \]
    3. *-commutativeN/A

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

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

      \[\leadsto \color{blue}{\frac{\frac{\frac{\left(x \cdot x\right) \cdot t}{y}}{y}}{t}} \]
  8. Applied rewrites47.3%

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

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

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

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

      \[\leadsto \frac{\frac{z}{t} \cdot z}{t} \]
    4. lift-*.f6456.8

      \[\leadsto \frac{\frac{z}{t} \cdot \color{blue}{z}}{t} \]
  11. Applied rewrites56.8%

    \[\leadsto \frac{\color{blue}{\frac{z}{t} \cdot z}}{t} \]
  12. 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 2025093 
(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))))