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

Percentage Accurate: 67.8% → 99.6%
Time: 16.3s
Alternatives: 9
Speedup: 1.0×

Specification

?
\[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
(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]
\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t}

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 9 alternatives:

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

Initial Program: 67.8% accurate, 1.0× speedup?

\[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t} \]
(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]
\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t}

Alternative 1: 99.6% accurate, 0.8× speedup?

\[\frac{z}{t} \cdot \frac{z}{t} - \left(-\frac{x}{y}\right) \cdot \frac{x}{y} \]
(FPCore (x y z t)
  :precision binary64
  (- (* (/ z t) (/ z t)) (* (- (/ x y)) (/ x y))))
double code(double x, double y, double z, double t) {
	return ((z / t) * (z / t)) - (-(x / y) * (x / y));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y, z, t)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = ((z / t) * (z / t)) - (-(x / y) * (x / y))
end function
public static double code(double x, double y, double z, double t) {
	return ((z / t) * (z / t)) - (-(x / y) * (x / y));
}
def code(x, y, z, t):
	return ((z / t) * (z / t)) - (-(x / y) * (x / y))
function code(x, y, z, t)
	return Float64(Float64(Float64(z / t) * Float64(z / t)) - Float64(Float64(-Float64(x / y)) * Float64(x / y)))
end
function tmp = code(x, y, z, t)
	tmp = ((z / t) * (z / t)) - (-(x / y) * (x / y));
end
code[x_, y_, z_, t_] := N[(N[(N[(z / t), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision] - N[((-N[(x / y), $MachinePrecision]) * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{z}{t} \cdot \frac{z}{t} - \left(-\frac{x}{y}\right) \cdot \frac{x}{y}
Derivation
  1. Initial program 67.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 \color{blue}{\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t}} \]
    2. +-commutativeN/A

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

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

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

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

      \[\leadsto \frac{z \cdot z}{t \cdot t} + \color{blue}{\frac{x}{y} \cdot \frac{x}{y}} \]
    7. fp-cancel-sign-sub-invN/A

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{z}{t \cdot t} \cdot z - \left(-\color{blue}{\frac{x}{y}}\right) \cdot \frac{x}{y} \]
    18. lower-/.f6489.9%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{z}{t} \cdot \color{blue}{\frac{z}{t}} - \left(-\frac{x}{y}\right) \cdot \frac{x}{y} \]
    10. lower-*.f6499.6%

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

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

Alternative 2: 96.8% accurate, 0.5× speedup?

\[\begin{array}{l} \mathbf{if}\;\frac{z \cdot z}{t \cdot t} \leq 5000000000000000164943055170434837427135440057522539318423791570869012863893044939457394359293162206430058690814701199200294101105758807930912040583618895295566352963538529190225559103961304787468696490024321895827150961861074155612506360583410417131562672326958643646649953541871894528:\\ \;\;\;\;\frac{x}{y} \cdot \frac{x}{y} + \frac{\frac{z \cdot z}{t}}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{z}{t} \cdot \frac{z}{t} - \frac{x}{\left(-y\right) \cdot y} \cdot x\\ \end{array} \]
(FPCore (x y z t)
  :precision binary64
  (if (<=
     (/ (* z z) (* t t))
     5000000000000000164943055170434837427135440057522539318423791570869012863893044939457394359293162206430058690814701199200294101105758807930912040583618895295566352963538529190225559103961304787468696490024321895827150961861074155612506360583410417131562672326958643646649953541871894528)
  (+ (* (/ x y) (/ x y)) (/ (/ (* z z) t) t))
  (- (* (/ z t) (/ z t)) (* (/ x (* (- y) y)) x))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (((z * z) / (t * t)) <= 5e+285) {
		tmp = ((x / y) * (x / y)) + (((z * z) / t) / t);
	} else {
		tmp = ((z / t) * (z / t)) - ((x / (-y * y)) * x);
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y, z, t)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if (((z * z) / (t * t)) <= 5d+285) then
        tmp = ((x / y) * (x / y)) + (((z * z) / t) / t)
    else
        tmp = ((z / t) * (z / t)) - ((x / (-y * y)) * x)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (((z * z) / (t * t)) <= 5e+285) {
		tmp = ((x / y) * (x / y)) + (((z * z) / t) / t);
	} else {
		tmp = ((z / t) * (z / t)) - ((x / (-y * y)) * x);
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if ((z * z) / (t * t)) <= 5e+285:
		tmp = ((x / y) * (x / y)) + (((z * z) / t) / t)
	else:
		tmp = ((z / t) * (z / t)) - ((x / (-y * y)) * x)
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (Float64(Float64(z * z) / Float64(t * t)) <= 5e+285)
		tmp = Float64(Float64(Float64(x / y) * Float64(x / y)) + Float64(Float64(Float64(z * z) / t) / t));
	else
		tmp = Float64(Float64(Float64(z / t) * Float64(z / t)) - Float64(Float64(x / Float64(Float64(-y) * y)) * x));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (((z * z) / (t * t)) <= 5e+285)
		tmp = ((x / y) * (x / y)) + (((z * z) / t) / t);
	else
		tmp = ((z / t) * (z / t)) - ((x / (-y * y)) * x);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[N[(N[(z * z), $MachinePrecision] / N[(t * t), $MachinePrecision]), $MachinePrecision], 5000000000000000164943055170434837427135440057522539318423791570869012863893044939457394359293162206430058690814701199200294101105758807930912040583618895295566352963538529190225559103961304787468696490024321895827150961861074155612506360583410417131562672326958643646649953541871894528], N[(N[(N[(x / y), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(z * z), $MachinePrecision] / t), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(N[(N[(z / t), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision] - N[(N[(x / N[((-y) * y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\frac{z \cdot z}{t \cdot t} \leq 5000000000000000164943055170434837427135440057522539318423791570869012863893044939457394359293162206430058690814701199200294101105758807930912040583618895295566352963538529190225559103961304787468696490024321895827150961861074155612506360583410417131562672326958643646649953541871894528:\\
\;\;\;\;\frac{x}{y} \cdot \frac{x}{y} + \frac{\frac{z \cdot z}{t}}{t}\\

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


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

    1. Initial program 67.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{x \cdot x}{y \cdot y} + \color{blue}{\frac{z \cdot z}{t \cdot t}} \]
      2. lift-*.f64N/A

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

        \[\leadsto \frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{\color{blue}{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-/.f6479.3%

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

      \[\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} + \frac{\color{blue}{\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-*l/N/A

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

        \[\leadsto \frac{x \cdot x}{y \cdot y} + \frac{\color{blue}{\frac{z \cdot z}{t}}}{t} \]
      5. lower-*.f6474.0%

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

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

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

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

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

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

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

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

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

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

    if 5.0000000000000002e285 < (/.f64 (*.f64 z z) (*.f64 t t))

    1. Initial program 67.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 \color{blue}{\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t}} \]
      2. +-commutativeN/A

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

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

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

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

        \[\leadsto \frac{z \cdot z}{t \cdot t} + \color{blue}{\frac{x}{y} \cdot \frac{x}{y}} \]
      7. fp-cancel-sign-sub-invN/A

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{z}{t \cdot t} \cdot z - \left(-\color{blue}{\frac{x}{y}}\right) \cdot \frac{x}{y} \]
      18. lower-/.f6489.9%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{z}{t} \cdot \color{blue}{\frac{z}{t}} - \left(-\frac{x}{y}\right) \cdot \frac{x}{y} \]
      10. lower-*.f6499.6%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{z}{t} \cdot \frac{z}{t} - \left(\mathsf{neg}\left(\color{blue}{\frac{x}{y \cdot y}} \cdot x\right)\right) \]
      12. distribute-lft-neg-outN/A

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

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

        \[\leadsto \frac{z}{t} \cdot \frac{z}{t} - \left(\mathsf{neg}\left(\color{blue}{\frac{x}{y \cdot y}}\right)\right) \cdot x \]
      15. distribute-neg-frac2N/A

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

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

        \[\leadsto \frac{z}{t} \cdot \frac{z}{t} - \frac{x}{\mathsf{neg}\left(\color{blue}{y \cdot y}\right)} \cdot x \]
      18. distribute-lft-neg-inN/A

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

        \[\leadsto \frac{z}{t} \cdot \frac{z}{t} - \frac{x}{\color{blue}{\left(\mathsf{neg}\left(y\right)\right) \cdot y}} \cdot x \]
      20. lower-neg.f6489.6%

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

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

Alternative 3: 96.7% accurate, 0.6× speedup?

\[\begin{array}{l} \mathbf{if}\;\frac{z \cdot z}{t \cdot t} \leq 199999999999999990228658492784702641067783209223724333989331677811470234474999183665567757783446804561917508975342765134138965065011049861852714718525529079875407330767468500015544730764581724487680:\\ \;\;\;\;\frac{z}{t \cdot t} \cdot z - \left(-\frac{x}{y}\right) \cdot \frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{z}{t} \cdot \frac{z}{t} - \frac{x}{\left(-y\right) \cdot y} \cdot x\\ \end{array} \]
(FPCore (x y z t)
  :precision binary64
  (if (<=
     (/ (* z z) (* t t))
     199999999999999990228658492784702641067783209223724333989331677811470234474999183665567757783446804561917508975342765134138965065011049861852714718525529079875407330767468500015544730764581724487680)
  (- (* (/ z (* t t)) z) (* (- (/ x y)) (/ x y)))
  (- (* (/ z t) (/ z t)) (* (/ x (* (- y) y)) x))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (((z * z) / (t * t)) <= 2e+197) {
		tmp = ((z / (t * t)) * z) - (-(x / y) * (x / y));
	} else {
		tmp = ((z / t) * (z / t)) - ((x / (-y * y)) * x);
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y, z, t)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if (((z * z) / (t * t)) <= 2d+197) then
        tmp = ((z / (t * t)) * z) - (-(x / y) * (x / y))
    else
        tmp = ((z / t) * (z / t)) - ((x / (-y * y)) * x)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (((z * z) / (t * t)) <= 2e+197) {
		tmp = ((z / (t * t)) * z) - (-(x / y) * (x / y));
	} else {
		tmp = ((z / t) * (z / t)) - ((x / (-y * y)) * x);
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if ((z * z) / (t * t)) <= 2e+197:
		tmp = ((z / (t * t)) * z) - (-(x / y) * (x / y))
	else:
		tmp = ((z / t) * (z / t)) - ((x / (-y * y)) * x)
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (Float64(Float64(z * z) / Float64(t * t)) <= 2e+197)
		tmp = Float64(Float64(Float64(z / Float64(t * t)) * z) - Float64(Float64(-Float64(x / y)) * Float64(x / y)));
	else
		tmp = Float64(Float64(Float64(z / t) * Float64(z / t)) - Float64(Float64(x / Float64(Float64(-y) * y)) * x));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (((z * z) / (t * t)) <= 2e+197)
		tmp = ((z / (t * t)) * z) - (-(x / y) * (x / y));
	else
		tmp = ((z / t) * (z / t)) - ((x / (-y * y)) * x);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[N[(N[(z * z), $MachinePrecision] / N[(t * t), $MachinePrecision]), $MachinePrecision], 199999999999999990228658492784702641067783209223724333989331677811470234474999183665567757783446804561917508975342765134138965065011049861852714718525529079875407330767468500015544730764581724487680], N[(N[(N[(z / N[(t * t), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision] - N[((-N[(x / y), $MachinePrecision]) * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(z / t), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision] - N[(N[(x / N[((-y) * y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\frac{z \cdot z}{t \cdot t} \leq 199999999999999990228658492784702641067783209223724333989331677811470234474999183665567757783446804561917508975342765134138965065011049861852714718525529079875407330767468500015544730764581724487680:\\
\;\;\;\;\frac{z}{t \cdot t} \cdot z - \left(-\frac{x}{y}\right) \cdot \frac{x}{y}\\

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


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

    1. Initial program 67.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 \color{blue}{\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t}} \]
      2. +-commutativeN/A

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

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

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

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

        \[\leadsto \frac{z \cdot z}{t \cdot t} + \color{blue}{\frac{x}{y} \cdot \frac{x}{y}} \]
      7. fp-cancel-sign-sub-invN/A

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{z}{t \cdot t} \cdot z - \left(-\color{blue}{\frac{x}{y}}\right) \cdot \frac{x}{y} \]
      18. lower-/.f6489.9%

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

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

    if 1.9999999999999999e197 < (/.f64 (*.f64 z z) (*.f64 t t))

    1. Initial program 67.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 \color{blue}{\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t}} \]
      2. +-commutativeN/A

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

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

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

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

        \[\leadsto \frac{z \cdot z}{t \cdot t} + \color{blue}{\frac{x}{y} \cdot \frac{x}{y}} \]
      7. fp-cancel-sign-sub-invN/A

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{z}{t \cdot t} \cdot z - \left(-\color{blue}{\frac{x}{y}}\right) \cdot \frac{x}{y} \]
      18. lower-/.f6489.9%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{z}{t} \cdot \color{blue}{\frac{z}{t}} - \left(-\frac{x}{y}\right) \cdot \frac{x}{y} \]
      10. lower-*.f6499.6%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{z}{t} \cdot \frac{z}{t} - \left(\mathsf{neg}\left(\color{blue}{\frac{x}{y \cdot y}} \cdot x\right)\right) \]
      12. distribute-lft-neg-outN/A

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

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

        \[\leadsto \frac{z}{t} \cdot \frac{z}{t} - \left(\mathsf{neg}\left(\color{blue}{\frac{x}{y \cdot y}}\right)\right) \cdot x \]
      15. distribute-neg-frac2N/A

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

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

        \[\leadsto \frac{z}{t} \cdot \frac{z}{t} - \frac{x}{\mathsf{neg}\left(\color{blue}{y \cdot y}\right)} \cdot x \]
      18. distribute-lft-neg-inN/A

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

        \[\leadsto \frac{z}{t} \cdot \frac{z}{t} - \frac{x}{\color{blue}{\left(\mathsf{neg}\left(y\right)\right) \cdot y}} \cdot x \]
      20. lower-neg.f6489.6%

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

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

Alternative 4: 95.8% accurate, 0.6× speedup?

\[\begin{array}{l} t_1 := \frac{z \cdot z}{t \cdot t}\\ \mathbf{if}\;t\_1 \leq 199999999999999990228658492784702641067783209223724333989331677811470234474999183665567757783446804561917508975342765134138965065011049861852714718525529079875407330767468500015544730764581724487680:\\ \;\;\;\;\frac{x}{y} \cdot \frac{x}{y} + t\_1\\ \mathbf{else}:\\ \;\;\;\;\frac{z}{t} \cdot \frac{z}{t} - \frac{x}{\left(-y\right) \cdot y} \cdot x\\ \end{array} \]
(FPCore (x y z t)
  :precision binary64
  (let* ((t_1 (/ (* z z) (* t t))))
  (if (<=
       t_1
       199999999999999990228658492784702641067783209223724333989331677811470234474999183665567757783446804561917508975342765134138965065011049861852714718525529079875407330767468500015544730764581724487680)
    (+ (* (/ x y) (/ x y)) t_1)
    (- (* (/ z t) (/ z t)) (* (/ x (* (- y) y)) x)))))
double code(double x, double y, double z, double t) {
	double t_1 = (z * z) / (t * t);
	double tmp;
	if (t_1 <= 2e+197) {
		tmp = ((x / y) * (x / y)) + t_1;
	} else {
		tmp = ((z / t) * (z / t)) - ((x / (-y * y)) * x);
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y, z, t)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = (z * z) / (t * t)
    if (t_1 <= 2d+197) then
        tmp = ((x / y) * (x / y)) + t_1
    else
        tmp = ((z / t) * (z / t)) - ((x / (-y * y)) * x)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = (z * z) / (t * t);
	double tmp;
	if (t_1 <= 2e+197) {
		tmp = ((x / y) * (x / y)) + t_1;
	} else {
		tmp = ((z / t) * (z / t)) - ((x / (-y * y)) * x);
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = (z * z) / (t * t)
	tmp = 0
	if t_1 <= 2e+197:
		tmp = ((x / y) * (x / y)) + t_1
	else:
		tmp = ((z / t) * (z / t)) - ((x / (-y * y)) * x)
	return tmp
function code(x, y, z, t)
	t_1 = Float64(Float64(z * z) / Float64(t * t))
	tmp = 0.0
	if (t_1 <= 2e+197)
		tmp = Float64(Float64(Float64(x / y) * Float64(x / y)) + t_1);
	else
		tmp = Float64(Float64(Float64(z / t) * Float64(z / t)) - Float64(Float64(x / Float64(Float64(-y) * y)) * x));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = (z * z) / (t * t);
	tmp = 0.0;
	if (t_1 <= 2e+197)
		tmp = ((x / y) * (x / y)) + t_1;
	else
		tmp = ((z / t) * (z / t)) - ((x / (-y * y)) * x);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z * z), $MachinePrecision] / N[(t * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 199999999999999990228658492784702641067783209223724333989331677811470234474999183665567757783446804561917508975342765134138965065011049861852714718525529079875407330767468500015544730764581724487680], N[(N[(N[(x / y), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision], N[(N[(N[(z / t), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision] - N[(N[(x / N[((-y) * y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_1 := \frac{z \cdot z}{t \cdot t}\\
\mathbf{if}\;t\_1 \leq 199999999999999990228658492784702641067783209223724333989331677811470234474999183665567757783446804561917508975342765134138965065011049861852714718525529079875407330767468500015544730764581724487680:\\
\;\;\;\;\frac{x}{y} \cdot \frac{x}{y} + t\_1\\

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


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

    1. Initial program 67.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 \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. 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-/.f6482.3%

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

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

    if 1.9999999999999999e197 < (/.f64 (*.f64 z z) (*.f64 t t))

    1. Initial program 67.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 \color{blue}{\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t}} \]
      2. +-commutativeN/A

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

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

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

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

        \[\leadsto \frac{z \cdot z}{t \cdot t} + \color{blue}{\frac{x}{y} \cdot \frac{x}{y}} \]
      7. fp-cancel-sign-sub-invN/A

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{z}{t \cdot t} \cdot z - \left(-\color{blue}{\frac{x}{y}}\right) \cdot \frac{x}{y} \]
      18. lower-/.f6489.9%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{z}{t} \cdot \color{blue}{\frac{z}{t}} - \left(-\frac{x}{y}\right) \cdot \frac{x}{y} \]
      10. lower-*.f6499.6%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{z}{t} \cdot \frac{z}{t} - \left(\mathsf{neg}\left(\color{blue}{\frac{x}{y \cdot y}} \cdot x\right)\right) \]
      12. distribute-lft-neg-outN/A

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

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

        \[\leadsto \frac{z}{t} \cdot \frac{z}{t} - \left(\mathsf{neg}\left(\color{blue}{\frac{x}{y \cdot y}}\right)\right) \cdot x \]
      15. distribute-neg-frac2N/A

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

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

        \[\leadsto \frac{z}{t} \cdot \frac{z}{t} - \frac{x}{\mathsf{neg}\left(\color{blue}{y \cdot y}\right)} \cdot x \]
      18. distribute-lft-neg-inN/A

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

        \[\leadsto \frac{z}{t} \cdot \frac{z}{t} - \frac{x}{\color{blue}{\left(\mathsf{neg}\left(y\right)\right) \cdot y}} \cdot x \]
      20. lower-neg.f6489.6%

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

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

Alternative 5: 93.4% accurate, 0.6× speedup?

\[\begin{array}{l} t_1 := \frac{z \cdot z}{t \cdot t}\\ \mathbf{if}\;t\_1 \leq 199999999999999990228658492784702641067783209223724333989331677811470234474999183665567757783446804561917508975342765134138965065011049861852714718525529079875407330767468500015544730764581724487680:\\ \;\;\;\;\frac{x}{y} \cdot \frac{x}{y} + t\_1\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{z}{t}}{t} \cdot z + \frac{x}{y \cdot y} \cdot x\\ \end{array} \]
(FPCore (x y z t)
  :precision binary64
  (let* ((t_1 (/ (* z z) (* t t))))
  (if (<=
       t_1
       199999999999999990228658492784702641067783209223724333989331677811470234474999183665567757783446804561917508975342765134138965065011049861852714718525529079875407330767468500015544730764581724487680)
    (+ (* (/ x y) (/ x y)) t_1)
    (+ (* (/ (/ z t) t) z) (* (/ x (* y y)) x)))))
double code(double x, double y, double z, double t) {
	double t_1 = (z * z) / (t * t);
	double tmp;
	if (t_1 <= 2e+197) {
		tmp = ((x / y) * (x / y)) + t_1;
	} else {
		tmp = (((z / t) / t) * z) + ((x / (y * y)) * x);
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y, z, t)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = (z * z) / (t * t)
    if (t_1 <= 2d+197) then
        tmp = ((x / y) * (x / y)) + t_1
    else
        tmp = (((z / t) / t) * z) + ((x / (y * y)) * x)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = (z * z) / (t * t);
	double tmp;
	if (t_1 <= 2e+197) {
		tmp = ((x / y) * (x / y)) + t_1;
	} else {
		tmp = (((z / t) / t) * z) + ((x / (y * y)) * x);
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = (z * z) / (t * t)
	tmp = 0
	if t_1 <= 2e+197:
		tmp = ((x / y) * (x / y)) + t_1
	else:
		tmp = (((z / t) / t) * z) + ((x / (y * y)) * x)
	return tmp
function code(x, y, z, t)
	t_1 = Float64(Float64(z * z) / Float64(t * t))
	tmp = 0.0
	if (t_1 <= 2e+197)
		tmp = Float64(Float64(Float64(x / y) * Float64(x / y)) + t_1);
	else
		tmp = Float64(Float64(Float64(Float64(z / t) / t) * z) + Float64(Float64(x / Float64(y * y)) * x));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = (z * z) / (t * t);
	tmp = 0.0;
	if (t_1 <= 2e+197)
		tmp = ((x / y) * (x / y)) + t_1;
	else
		tmp = (((z / t) / t) * z) + ((x / (y * y)) * x);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z * z), $MachinePrecision] / N[(t * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 199999999999999990228658492784702641067783209223724333989331677811470234474999183665567757783446804561917508975342765134138965065011049861852714718525529079875407330767468500015544730764581724487680], N[(N[(N[(x / y), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision], N[(N[(N[(N[(z / t), $MachinePrecision] / t), $MachinePrecision] * z), $MachinePrecision] + N[(N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_1 := \frac{z \cdot z}{t \cdot t}\\
\mathbf{if}\;t\_1 \leq 199999999999999990228658492784702641067783209223724333989331677811470234474999183665567757783446804561917508975342765134138965065011049861852714718525529079875407330767468500015544730764581724487680:\\
\;\;\;\;\frac{x}{y} \cdot \frac{x}{y} + t\_1\\

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


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

    1. Initial program 67.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 \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. 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-/.f6482.3%

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

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

    if 1.9999999999999999e197 < (/.f64 (*.f64 z z) (*.f64 t t))

    1. Initial program 67.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 \color{blue}{\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t}} \]
      2. +-commutativeN/A

        \[\leadsto \color{blue}{\frac{z \cdot z}{t \cdot t} + \frac{x \cdot x}{y \cdot y}} \]
      3. lower-+.f6467.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 89.8% accurate, 0.7× speedup?

\[\begin{array}{l} \mathbf{if}\;t \cdot t \leq \frac{101201127}{202402253307310618352495346718917307049556649764142118356901358027430339567995346891960383701437124495187077864316811911389808737385793476867013399940738509921517424276566361364466907742093216341239767678472745068562007483424692698618103355649159556340810056512358769552333414615230502532186327508646006263307707741093494784}:\\ \;\;\;\;\frac{x}{y \cdot y} \cdot x + \frac{\frac{z \cdot z}{t}}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{z}{t \cdot t} \cdot z + \frac{\frac{x}{y}}{y} \cdot x\\ \end{array} \]
(FPCore (x y z t)
  :precision binary64
  (if (<=
     (* t t)
     101201127/202402253307310618352495346718917307049556649764142118356901358027430339567995346891960383701437124495187077864316811911389808737385793476867013399940738509921517424276566361364466907742093216341239767678472745068562007483424692698618103355649159556340810056512358769552333414615230502532186327508646006263307707741093494784)
  (+ (* (/ x (* y y)) x) (/ (/ (* z z) t) t))
  (+ (* (/ z (* t t)) z) (* (/ (/ x y) y) x))))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((t * t) <= 5e-316) {
		tmp = ((x / (y * y)) * x) + (((z * z) / t) / t);
	} else {
		tmp = ((z / (t * t)) * z) + (((x / y) / y) * x);
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y, z, t)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if ((t * t) <= 5d-316) then
        tmp = ((x / (y * y)) * x) + (((z * z) / t) / t)
    else
        tmp = ((z / (t * t)) * z) + (((x / y) / y) * x)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if ((t * t) <= 5e-316) {
		tmp = ((x / (y * y)) * x) + (((z * z) / t) / t);
	} else {
		tmp = ((z / (t * t)) * z) + (((x / y) / y) * x);
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (t * t) <= 5e-316:
		tmp = ((x / (y * y)) * x) + (((z * z) / t) / t)
	else:
		tmp = ((z / (t * t)) * z) + (((x / y) / y) * x)
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (Float64(t * t) <= 5e-316)
		tmp = Float64(Float64(Float64(x / Float64(y * y)) * x) + Float64(Float64(Float64(z * z) / t) / t));
	else
		tmp = Float64(Float64(Float64(z / Float64(t * t)) * z) + Float64(Float64(Float64(x / y) / y) * x));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if ((t * t) <= 5e-316)
		tmp = ((x / (y * y)) * x) + (((z * z) / t) / t);
	else
		tmp = ((z / (t * t)) * z) + (((x / y) / y) * x);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[N[(t * t), $MachinePrecision], 101201127/202402253307310618352495346718917307049556649764142118356901358027430339567995346891960383701437124495187077864316811911389808737385793476867013399940738509921517424276566361364466907742093216341239767678472745068562007483424692698618103355649159556340810056512358769552333414615230502532186327508646006263307707741093494784], N[(N[(N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision] + N[(N[(N[(z * z), $MachinePrecision] / t), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(N[(N[(z / N[(t * t), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision] + N[(N[(N[(x / y), $MachinePrecision] / y), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;t \cdot t \leq \frac{101201127}{202402253307310618352495346718917307049556649764142118356901358027430339567995346891960383701437124495187077864316811911389808737385793476867013399940738509921517424276566361364466907742093216341239767678472745068562007483424692698618103355649159556340810056512358769552333414615230502532186327508646006263307707741093494784}:\\
\;\;\;\;\frac{x}{y \cdot y} \cdot x + \frac{\frac{z \cdot z}{t}}{t}\\

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


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 t t) < 5.0000000171117013e-316

    1. Initial program 67.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{x \cdot x}{y \cdot y} + \color{blue}{\frac{z \cdot z}{t \cdot t}} \]
      2. lift-*.f64N/A

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

        \[\leadsto \frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{\color{blue}{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-/.f6479.3%

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

      \[\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} + \frac{\color{blue}{\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-*l/N/A

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

        \[\leadsto \frac{x \cdot x}{y \cdot y} + \frac{\color{blue}{\frac{z \cdot z}{t}}}{t} \]
      5. lower-*.f6474.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.0000000171117013e-316 < (*.f64 t t)

    1. Initial program 67.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 \color{blue}{\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t}} \]
      2. +-commutativeN/A

        \[\leadsto \color{blue}{\frac{z \cdot z}{t \cdot t} + \frac{x \cdot x}{y \cdot y}} \]
      3. lower-+.f6467.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 88.1% accurate, 0.6× speedup?

\[\begin{array}{l} t_1 := \frac{z \cdot z}{t \cdot t}\\ \mathbf{if}\;t\_1 \leq 20000000000000001019220591274005456279710505470622733232619203286613548419128326636838181727778134043521316213363512555228359822654904417182365028760483854715262087764856296628876189602931571523608705123012237845488278935519238250121771614208:\\ \;\;\;\;\frac{x}{y} \cdot \frac{x}{y} + t\_1\\ \mathbf{else}:\\ \;\;\;\;\frac{z}{t \cdot t} \cdot z + \frac{x}{y \cdot y} \cdot x\\ \end{array} \]
(FPCore (x y z t)
  :precision binary64
  (let* ((t_1 (/ (* z z) (* t t))))
  (if (<=
       t_1
       20000000000000001019220591274005456279710505470622733232619203286613548419128326636838181727778134043521316213363512555228359822654904417182365028760483854715262087764856296628876189602931571523608705123012237845488278935519238250121771614208)
    (+ (* (/ x y) (/ x y)) t_1)
    (+ (* (/ z (* t t)) z) (* (/ x (* y y)) x)))))
double code(double x, double y, double z, double t) {
	double t_1 = (z * z) / (t * t);
	double tmp;
	if (t_1 <= 2e+241) {
		tmp = ((x / y) * (x / y)) + t_1;
	} else {
		tmp = ((z / (t * t)) * z) + ((x / (y * y)) * x);
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y, z, t)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = (z * z) / (t * t)
    if (t_1 <= 2d+241) then
        tmp = ((x / y) * (x / y)) + t_1
    else
        tmp = ((z / (t * t)) * z) + ((x / (y * y)) * x)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = (z * z) / (t * t);
	double tmp;
	if (t_1 <= 2e+241) {
		tmp = ((x / y) * (x / y)) + t_1;
	} else {
		tmp = ((z / (t * t)) * z) + ((x / (y * y)) * x);
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = (z * z) / (t * t)
	tmp = 0
	if t_1 <= 2e+241:
		tmp = ((x / y) * (x / y)) + t_1
	else:
		tmp = ((z / (t * t)) * z) + ((x / (y * y)) * x)
	return tmp
function code(x, y, z, t)
	t_1 = Float64(Float64(z * z) / Float64(t * t))
	tmp = 0.0
	if (t_1 <= 2e+241)
		tmp = Float64(Float64(Float64(x / y) * Float64(x / y)) + t_1);
	else
		tmp = Float64(Float64(Float64(z / Float64(t * t)) * z) + Float64(Float64(x / Float64(y * y)) * x));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = (z * z) / (t * t);
	tmp = 0.0;
	if (t_1 <= 2e+241)
		tmp = ((x / y) * (x / y)) + t_1;
	else
		tmp = ((z / (t * t)) * z) + ((x / (y * y)) * x);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z * z), $MachinePrecision] / N[(t * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 20000000000000001019220591274005456279710505470622733232619203286613548419128326636838181727778134043521316213363512555228359822654904417182365028760483854715262087764856296628876189602931571523608705123012237845488278935519238250121771614208], N[(N[(N[(x / y), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision], N[(N[(N[(z / N[(t * t), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision] + N[(N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_1 := \frac{z \cdot z}{t \cdot t}\\
\mathbf{if}\;t\_1 \leq 20000000000000001019220591274005456279710505470622733232619203286613548419128326636838181727778134043521316213363512555228359822654904417182365028760483854715262087764856296628876189602931571523608705123012237845488278935519238250121771614208:\\
\;\;\;\;\frac{x}{y} \cdot \frac{x}{y} + t\_1\\

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


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

    1. Initial program 67.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 \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. 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-/.f6482.3%

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

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

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

    1. Initial program 67.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 \color{blue}{\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t}} \]
      2. +-commutativeN/A

        \[\leadsto \color{blue}{\frac{z \cdot z}{t \cdot t} + \frac{x \cdot x}{y \cdot y}} \]
      3. lower-+.f6467.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 81.0% accurate, 1.0× speedup?

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

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

real(8) function code(x, y, z, t)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = ((z / (t * t)) * z) + ((x / (y * y)) * x)
end function
public static double code(double x, double y, double z, double t) {
	return ((z / (t * t)) * z) + ((x / (y * y)) * x);
}
def code(x, y, z, t):
	return ((z / (t * t)) * z) + ((x / (y * y)) * x)
function code(x, y, z, t)
	return Float64(Float64(Float64(z / Float64(t * t)) * z) + Float64(Float64(x / Float64(y * y)) * x))
end
function tmp = code(x, y, z, t)
	tmp = ((z / (t * t)) * z) + ((x / (y * y)) * x);
end
code[x_, y_, z_, t_] := N[(N[(N[(z / N[(t * t), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision] + N[(N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]
\frac{z}{t \cdot t} \cdot z + \frac{x}{y \cdot y} \cdot x
Derivation
  1. Initial program 67.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 \color{blue}{\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t}} \]
    2. +-commutativeN/A

      \[\leadsto \color{blue}{\frac{z \cdot z}{t \cdot t} + \frac{x \cdot x}{y \cdot y}} \]
    3. lower-+.f6467.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 74.2% accurate, 1.0× speedup?

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

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

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

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

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

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

Reproduce

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