Data.Colour.RGB:hslsv from colour-2.3.3, B

Percentage Accurate: 99.5% → 99.8%
Time: 5.2s
Alternatives: 17
Speedup: 1.0×

Specification

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

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

real(8) function code(x, y, z, t, a)
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), intent (in) :: a
    code = ((60.0d0 * (x - y)) / (z - t)) + (a * 120.0d0)
end function
public static double code(double x, double y, double z, double t, double a) {
	return ((60.0 * (x - y)) / (z - t)) + (a * 120.0);
}
def code(x, y, z, t, a):
	return ((60.0 * (x - y)) / (z - t)) + (a * 120.0)
function code(x, y, z, t, a)
	return Float64(Float64(Float64(60.0 * Float64(x - y)) / Float64(z - t)) + Float64(a * 120.0))
end
function tmp = code(x, y, z, t, a)
	tmp = ((60.0 * (x - y)) / (z - t)) + (a * 120.0);
end
code[x_, y_, z_, t_, a_] := N[(N[(N[(60.0 * N[(x - y), $MachinePrecision]), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision] + N[(a * 120.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{60 \cdot \left(x - y\right)}{z - t} + a \cdot 120
\end{array}

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 17 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: 99.5% accurate, 1.0× speedup?

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

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

real(8) function code(x, y, z, t, a)
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), intent (in) :: a
    code = ((60.0d0 * (x - y)) / (z - t)) + (a * 120.0d0)
end function
public static double code(double x, double y, double z, double t, double a) {
	return ((60.0 * (x - y)) / (z - t)) + (a * 120.0);
}
def code(x, y, z, t, a):
	return ((60.0 * (x - y)) / (z - t)) + (a * 120.0)
function code(x, y, z, t, a)
	return Float64(Float64(Float64(60.0 * Float64(x - y)) / Float64(z - t)) + Float64(a * 120.0))
end
function tmp = code(x, y, z, t, a)
	tmp = ((60.0 * (x - y)) / (z - t)) + (a * 120.0);
end
code[x_, y_, z_, t_, a_] := N[(N[(N[(60.0 * N[(x - y), $MachinePrecision]), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision] + N[(a * 120.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{60 \cdot \left(x - y\right)}{z - t} + a \cdot 120
\end{array}

Alternative 1: 99.8% accurate, 1.0× speedup?

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

\\
\mathsf{fma}\left(a, 120, \frac{60}{\frac{z - t}{x - y}}\right)
\end{array}
Derivation
  1. Initial program 99.5%

    \[\frac{60 \cdot \left(x - y\right)}{z - t} + a \cdot 120 \]
  2. Step-by-step derivation
    1. lift-+.f64N/A

      \[\leadsto \color{blue}{\frac{60 \cdot \left(x - y\right)}{z - t} + a \cdot 120} \]
    2. +-commutativeN/A

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

      \[\leadsto \color{blue}{a \cdot 120} + \frac{60 \cdot \left(x - y\right)}{z - t} \]
    4. lower-fma.f6499.5

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(a, 120, \color{blue}{\left(x - y\right) \cdot \frac{60}{z - t}}\right) \]
    10. frac-2negN/A

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

      \[\leadsto \mathsf{fma}\left(a, 120, \left(x - y\right) \cdot \color{blue}{\frac{\mathsf{neg}\left(60\right)}{\mathsf{neg}\left(\left(z - t\right)\right)}}\right) \]
    12. metadata-evalN/A

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

      \[\leadsto \mathsf{fma}\left(a, 120, \left(x - y\right) \cdot \frac{-60}{\mathsf{neg}\left(\color{blue}{\left(z - t\right)}\right)}\right) \]
    14. sub-negate-revN/A

      \[\leadsto \mathsf{fma}\left(a, 120, \left(x - y\right) \cdot \frac{-60}{\color{blue}{t - z}}\right) \]
    15. lower--.f6499.8

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

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

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

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

      \[\leadsto \mathsf{fma}\left(a, 120, \left(x - y\right) \cdot \color{blue}{\frac{\mathsf{neg}\left(-60\right)}{\mathsf{neg}\left(\left(t - z\right)\right)}}\right) \]
    4. metadata-evalN/A

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

      \[\leadsto \mathsf{fma}\left(a, 120, \left(x - y\right) \cdot \frac{60}{\mathsf{neg}\left(\color{blue}{\left(t - z\right)}\right)}\right) \]
    6. sub-negate-revN/A

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

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

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

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

      \[\leadsto \mathsf{fma}\left(a, 120, \color{blue}{60 \cdot \frac{x - y}{z - t}}\right) \]
    11. div-flipN/A

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

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

      \[\leadsto \mathsf{fma}\left(a, 120, \color{blue}{\frac{60}{\frac{z - t}{x - y}}}\right) \]
    14. lower-/.f6499.8

      \[\leadsto \mathsf{fma}\left(a, 120, \frac{60}{\color{blue}{\frac{z - t}{x - y}}}\right) \]
  5. Applied rewrites99.8%

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

Alternative 2: 99.8% accurate, 1.0× speedup?

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

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

    \[\frac{60 \cdot \left(x - y\right)}{z - t} + a \cdot 120 \]
  2. Step-by-step derivation
    1. lift-+.f64N/A

      \[\leadsto \color{blue}{\frac{60 \cdot \left(x - y\right)}{z - t} + a \cdot 120} \]
    2. +-commutativeN/A

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

      \[\leadsto \color{blue}{a \cdot 120} + \frac{60 \cdot \left(x - y\right)}{z - t} \]
    4. lower-fma.f6499.5

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(a, 120, \color{blue}{\left(x - y\right) \cdot \frac{60}{z - t}}\right) \]
    10. frac-2negN/A

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

      \[\leadsto \mathsf{fma}\left(a, 120, \left(x - y\right) \cdot \color{blue}{\frac{\mathsf{neg}\left(60\right)}{\mathsf{neg}\left(\left(z - t\right)\right)}}\right) \]
    12. metadata-evalN/A

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

      \[\leadsto \mathsf{fma}\left(a, 120, \left(x - y\right) \cdot \frac{-60}{\mathsf{neg}\left(\color{blue}{\left(z - t\right)}\right)}\right) \]
    14. sub-negate-revN/A

      \[\leadsto \mathsf{fma}\left(a, 120, \left(x - y\right) \cdot \frac{-60}{\color{blue}{t - z}}\right) \]
    15. lower--.f6499.8

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

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

Alternative 3: 89.2% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.25 \cdot 10^{-10}:\\
\;\;\;\;\mathsf{fma}\left(a, 120, \frac{60 \cdot x}{z - t}\right)\\

\mathbf{elif}\;x \leq 3.85 \cdot 10^{+115}:\\
\;\;\;\;\mathsf{fma}\left(a, 120, \frac{-60 \cdot y}{z - t}\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, 120, \frac{60}{\frac{z - t}{x}}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -2.25e-10

    1. Initial program 99.5%

      \[\frac{60 \cdot \left(x - y\right)}{z - t} + a \cdot 120 \]
    2. Taylor expanded in x around inf

      \[\leadsto \frac{\color{blue}{60 \cdot x}}{z - t} + a \cdot 120 \]
    3. Step-by-step derivation
      1. lower-*.f6475.0

        \[\leadsto \frac{60 \cdot \color{blue}{x}}{z - t} + a \cdot 120 \]
    4. Applied rewrites75.0%

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

        \[\leadsto \color{blue}{\frac{60 \cdot x}{z - t} + a \cdot 120} \]
      2. +-commutativeN/A

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

        \[\leadsto \color{blue}{a \cdot 120} + \frac{60 \cdot x}{z - t} \]
      4. lower-fma.f6475.0

        \[\leadsto \color{blue}{\mathsf{fma}\left(a, 120, \frac{60 \cdot x}{z - t}\right)} \]
    6. Applied rewrites75.0%

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

    if -2.25e-10 < x < 3.84999999999999984e115

    1. Initial program 99.5%

      \[\frac{60 \cdot \left(x - y\right)}{z - t} + a \cdot 120 \]
    2. Taylor expanded in x around inf

      \[\leadsto \frac{\color{blue}{60 \cdot x}}{z - t} + a \cdot 120 \]
    3. Step-by-step derivation
      1. lower-*.f6475.0

        \[\leadsto \frac{60 \cdot \color{blue}{x}}{z - t} + a \cdot 120 \]
    4. Applied rewrites75.0%

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

        \[\leadsto \color{blue}{\frac{60 \cdot x}{z - t} + a \cdot 120} \]
      2. +-commutativeN/A

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

        \[\leadsto \color{blue}{a \cdot 120} + \frac{60 \cdot x}{z - t} \]
      4. lower-fma.f6475.0

        \[\leadsto \color{blue}{\mathsf{fma}\left(a, 120, \frac{60 \cdot x}{z - t}\right)} \]
    6. Applied rewrites75.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(a, 120, \frac{60 \cdot x}{z - t}\right)} \]
    7. Taylor expanded in x around 0

      \[\leadsto \mathsf{fma}\left(a, 120, \frac{\color{blue}{-60 \cdot y}}{z - t}\right) \]
    8. Step-by-step derivation
      1. lower-*.f6474.8

        \[\leadsto \mathsf{fma}\left(a, 120, \frac{-60 \cdot \color{blue}{y}}{z - t}\right) \]
    9. Applied rewrites74.8%

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

    if 3.84999999999999984e115 < x

    1. Initial program 99.5%

      \[\frac{60 \cdot \left(x - y\right)}{z - t} + a \cdot 120 \]
    2. Step-by-step derivation
      1. lift-+.f64N/A

        \[\leadsto \color{blue}{\frac{60 \cdot \left(x - y\right)}{z - t} + a \cdot 120} \]
      2. +-commutativeN/A

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

        \[\leadsto \color{blue}{a \cdot 120} + \frac{60 \cdot \left(x - y\right)}{z - t} \]
      4. lower-fma.f6499.5

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(a, 120, \color{blue}{\left(x - y\right) \cdot \frac{60}{z - t}}\right) \]
      10. frac-2negN/A

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

        \[\leadsto \mathsf{fma}\left(a, 120, \left(x - y\right) \cdot \color{blue}{\frac{\mathsf{neg}\left(60\right)}{\mathsf{neg}\left(\left(z - t\right)\right)}}\right) \]
      12. metadata-evalN/A

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

        \[\leadsto \mathsf{fma}\left(a, 120, \left(x - y\right) \cdot \frac{-60}{\mathsf{neg}\left(\color{blue}{\left(z - t\right)}\right)}\right) \]
      14. sub-negate-revN/A

        \[\leadsto \mathsf{fma}\left(a, 120, \left(x - y\right) \cdot \frac{-60}{\color{blue}{t - z}}\right) \]
      15. lower--.f6499.8

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

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

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

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

        \[\leadsto \mathsf{fma}\left(a, 120, \left(x - y\right) \cdot \color{blue}{\frac{\mathsf{neg}\left(-60\right)}{\mathsf{neg}\left(\left(t - z\right)\right)}}\right) \]
      4. metadata-evalN/A

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

        \[\leadsto \mathsf{fma}\left(a, 120, \left(x - y\right) \cdot \frac{60}{\mathsf{neg}\left(\color{blue}{\left(t - z\right)}\right)}\right) \]
      6. sub-negate-revN/A

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

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

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

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

        \[\leadsto \mathsf{fma}\left(a, 120, \color{blue}{60 \cdot \frac{x - y}{z - t}}\right) \]
      11. div-flipN/A

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

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

        \[\leadsto \mathsf{fma}\left(a, 120, \color{blue}{\frac{60}{\frac{z - t}{x - y}}}\right) \]
      14. lower-/.f6499.8

        \[\leadsto \mathsf{fma}\left(a, 120, \frac{60}{\color{blue}{\frac{z - t}{x - y}}}\right) \]
    5. Applied rewrites99.8%

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

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

        \[\leadsto \mathsf{fma}\left(a, 120, \frac{60}{\frac{z - t}{\color{blue}{x}}}\right) \]
      2. lower--.f6475.1

        \[\leadsto \mathsf{fma}\left(a, 120, \frac{60}{\frac{z - t}{x}}\right) \]
    8. Applied rewrites75.1%

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

Alternative 4: 89.1% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \mathsf{fma}\left(a, 120, \frac{60 \cdot x}{z - t}\right)\\ \mathbf{if}\;x \leq -2.25 \cdot 10^{-10}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 3.85 \cdot 10^{+115}:\\ \;\;\;\;\mathsf{fma}\left(a, 120, \frac{-60 \cdot y}{z - t}\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (fma a 120.0 (/ (* 60.0 x) (- z t)))))
   (if (<= x -2.25e-10)
     t_1
     (if (<= x 3.85e+115) (fma a 120.0 (/ (* -60.0 y) (- z t))) t_1))))
double code(double x, double y, double z, double t, double a) {
	double t_1 = fma(a, 120.0, ((60.0 * x) / (z - t)));
	double tmp;
	if (x <= -2.25e-10) {
		tmp = t_1;
	} else if (x <= 3.85e+115) {
		tmp = fma(a, 120.0, ((-60.0 * y) / (z - t)));
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(x, y, z, t, a)
	t_1 = fma(a, 120.0, Float64(Float64(60.0 * x) / Float64(z - t)))
	tmp = 0.0
	if (x <= -2.25e-10)
		tmp = t_1;
	elseif (x <= 3.85e+115)
		tmp = fma(a, 120.0, Float64(Float64(-60.0 * y) / Float64(z - t)));
	else
		tmp = t_1;
	end
	return tmp
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(a * 120.0 + N[(N[(60.0 * x), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.25e-10], t$95$1, If[LessEqual[x, 3.85e+115], N[(a * 120.0 + N[(N[(-60.0 * y), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(a, 120, \frac{60 \cdot x}{z - t}\right)\\
\mathbf{if}\;x \leq -2.25 \cdot 10^{-10}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \leq 3.85 \cdot 10^{+115}:\\
\;\;\;\;\mathsf{fma}\left(a, 120, \frac{-60 \cdot y}{z - t}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2.25e-10 or 3.84999999999999984e115 < x

    1. Initial program 99.5%

      \[\frac{60 \cdot \left(x - y\right)}{z - t} + a \cdot 120 \]
    2. Taylor expanded in x around inf

      \[\leadsto \frac{\color{blue}{60 \cdot x}}{z - t} + a \cdot 120 \]
    3. Step-by-step derivation
      1. lower-*.f6475.0

        \[\leadsto \frac{60 \cdot \color{blue}{x}}{z - t} + a \cdot 120 \]
    4. Applied rewrites75.0%

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

        \[\leadsto \color{blue}{\frac{60 \cdot x}{z - t} + a \cdot 120} \]
      2. +-commutativeN/A

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

        \[\leadsto \color{blue}{a \cdot 120} + \frac{60 \cdot x}{z - t} \]
      4. lower-fma.f6475.0

        \[\leadsto \color{blue}{\mathsf{fma}\left(a, 120, \frac{60 \cdot x}{z - t}\right)} \]
    6. Applied rewrites75.0%

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

    if -2.25e-10 < x < 3.84999999999999984e115

    1. Initial program 99.5%

      \[\frac{60 \cdot \left(x - y\right)}{z - t} + a \cdot 120 \]
    2. Taylor expanded in x around inf

      \[\leadsto \frac{\color{blue}{60 \cdot x}}{z - t} + a \cdot 120 \]
    3. Step-by-step derivation
      1. lower-*.f6475.0

        \[\leadsto \frac{60 \cdot \color{blue}{x}}{z - t} + a \cdot 120 \]
    4. Applied rewrites75.0%

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

        \[\leadsto \color{blue}{\frac{60 \cdot x}{z - t} + a \cdot 120} \]
      2. +-commutativeN/A

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

        \[\leadsto \color{blue}{a \cdot 120} + \frac{60 \cdot x}{z - t} \]
      4. lower-fma.f6475.0

        \[\leadsto \color{blue}{\mathsf{fma}\left(a, 120, \frac{60 \cdot x}{z - t}\right)} \]
    6. Applied rewrites75.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(a, 120, \frac{60 \cdot x}{z - t}\right)} \]
    7. Taylor expanded in x around 0

      \[\leadsto \mathsf{fma}\left(a, 120, \frac{\color{blue}{-60 \cdot y}}{z - t}\right) \]
    8. Step-by-step derivation
      1. lower-*.f6474.8

        \[\leadsto \mathsf{fma}\left(a, 120, \frac{-60 \cdot \color{blue}{y}}{z - t}\right) \]
    9. Applied rewrites74.8%

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

Alternative 5: 81.6% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \mathsf{fma}\left(60, \frac{x - y}{z}, 120 \cdot a\right)\\ \mathbf{if}\;z \leq -3.2 \cdot 10^{-56}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq -1.75 \cdot 10^{-202}:\\ \;\;\;\;60 \cdot \frac{x - y}{z - t}\\ \mathbf{elif}\;z \leq 1.9 \cdot 10^{-69}:\\ \;\;\;\;\mathsf{fma}\left(-60, \frac{x - y}{t}, 120 \cdot a\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (fma 60.0 (/ (- x y) z) (* 120.0 a))))
   (if (<= z -3.2e-56)
     t_1
     (if (<= z -1.75e-202)
       (* 60.0 (/ (- x y) (- z t)))
       (if (<= z 1.9e-69) (fma -60.0 (/ (- x y) t) (* 120.0 a)) t_1)))))
double code(double x, double y, double z, double t, double a) {
	double t_1 = fma(60.0, ((x - y) / z), (120.0 * a));
	double tmp;
	if (z <= -3.2e-56) {
		tmp = t_1;
	} else if (z <= -1.75e-202) {
		tmp = 60.0 * ((x - y) / (z - t));
	} else if (z <= 1.9e-69) {
		tmp = fma(-60.0, ((x - y) / t), (120.0 * a));
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(x, y, z, t, a)
	t_1 = fma(60.0, Float64(Float64(x - y) / z), Float64(120.0 * a))
	tmp = 0.0
	if (z <= -3.2e-56)
		tmp = t_1;
	elseif (z <= -1.75e-202)
		tmp = Float64(60.0 * Float64(Float64(x - y) / Float64(z - t)));
	elseif (z <= 1.9e-69)
		tmp = fma(-60.0, Float64(Float64(x - y) / t), Float64(120.0 * a));
	else
		tmp = t_1;
	end
	return tmp
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(60.0 * N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision] + N[(120.0 * a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.2e-56], t$95$1, If[LessEqual[z, -1.75e-202], N[(60.0 * N[(N[(x - y), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.9e-69], N[(-60.0 * N[(N[(x - y), $MachinePrecision] / t), $MachinePrecision] + N[(120.0 * a), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(60, \frac{x - y}{z}, 120 \cdot a\right)\\
\mathbf{if}\;z \leq -3.2 \cdot 10^{-56}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq -1.75 \cdot 10^{-202}:\\
\;\;\;\;60 \cdot \frac{x - y}{z - t}\\

\mathbf{elif}\;z \leq 1.9 \cdot 10^{-69}:\\
\;\;\;\;\mathsf{fma}\left(-60, \frac{x - y}{t}, 120 \cdot a\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -3.19999999999999986e-56 or 1.8999999999999999e-69 < z

    1. Initial program 99.5%

      \[\frac{60 \cdot \left(x - y\right)}{z - t} + a \cdot 120 \]
    2. Taylor expanded in z around inf

      \[\leadsto \color{blue}{60 \cdot \frac{x - y}{z} + 120 \cdot a} \]
    3. Step-by-step derivation
      1. lower-fma.f64N/A

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

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

        \[\leadsto \mathsf{fma}\left(60, \frac{x - y}{z}, 120 \cdot a\right) \]
      4. lower-*.f6462.6

        \[\leadsto \mathsf{fma}\left(60, \frac{x - y}{z}, 120 \cdot a\right) \]
    4. Applied rewrites62.6%

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

    if -3.19999999999999986e-56 < z < -1.75e-202

    1. Initial program 99.5%

      \[\frac{60 \cdot \left(x - y\right)}{z - t} + a \cdot 120 \]
    2. Taylor expanded in a around 0

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

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

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

        \[\leadsto 60 \cdot \frac{x - y}{\color{blue}{z} - t} \]
      4. lower--.f6451.1

        \[\leadsto 60 \cdot \frac{x - y}{z - \color{blue}{t}} \]
    4. Applied rewrites51.1%

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

    if -1.75e-202 < z < 1.8999999999999999e-69

    1. Initial program 99.5%

      \[\frac{60 \cdot \left(x - y\right)}{z - t} + a \cdot 120 \]
    2. Taylor expanded in z around 0

      \[\leadsto \color{blue}{-60 \cdot \frac{x - y}{t} + 120 \cdot a} \]
    3. Step-by-step derivation
      1. lower-fma.f64N/A

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

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

        \[\leadsto \mathsf{fma}\left(-60, \frac{x - y}{t}, 120 \cdot a\right) \]
      4. lower-*.f6465.1

        \[\leadsto \mathsf{fma}\left(-60, \frac{x - y}{t}, 120 \cdot a\right) \]
    4. Applied rewrites65.1%

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

Alternative 6: 74.9% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -6 \cdot 10^{-49}:\\ \;\;\;\;\mathsf{fma}\left(a, 120, \frac{60}{\frac{z}{x}}\right)\\ \mathbf{elif}\;z \leq -1.75 \cdot 10^{-202}:\\ \;\;\;\;60 \cdot \frac{x - y}{z - t}\\ \mathbf{elif}\;z \leq 9 \cdot 10^{-47}:\\ \;\;\;\;\mathsf{fma}\left(-60, \frac{x - y}{t}, 120 \cdot a\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(60, \frac{x}{z}, 120 \cdot a\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (<= z -6e-49)
   (fma a 120.0 (/ 60.0 (/ z x)))
   (if (<= z -1.75e-202)
     (* 60.0 (/ (- x y) (- z t)))
     (if (<= z 9e-47)
       (fma -60.0 (/ (- x y) t) (* 120.0 a))
       (fma 60.0 (/ x z) (* 120.0 a))))))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (z <= -6e-49) {
		tmp = fma(a, 120.0, (60.0 / (z / x)));
	} else if (z <= -1.75e-202) {
		tmp = 60.0 * ((x - y) / (z - t));
	} else if (z <= 9e-47) {
		tmp = fma(-60.0, ((x - y) / t), (120.0 * a));
	} else {
		tmp = fma(60.0, (x / z), (120.0 * a));
	}
	return tmp;
}
function code(x, y, z, t, a)
	tmp = 0.0
	if (z <= -6e-49)
		tmp = fma(a, 120.0, Float64(60.0 / Float64(z / x)));
	elseif (z <= -1.75e-202)
		tmp = Float64(60.0 * Float64(Float64(x - y) / Float64(z - t)));
	elseif (z <= 9e-47)
		tmp = fma(-60.0, Float64(Float64(x - y) / t), Float64(120.0 * a));
	else
		tmp = fma(60.0, Float64(x / z), Float64(120.0 * a));
	end
	return tmp
end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -6e-49], N[(a * 120.0 + N[(60.0 / N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -1.75e-202], N[(60.0 * N[(N[(x - y), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 9e-47], N[(-60.0 * N[(N[(x - y), $MachinePrecision] / t), $MachinePrecision] + N[(120.0 * a), $MachinePrecision]), $MachinePrecision], N[(60.0 * N[(x / z), $MachinePrecision] + N[(120.0 * a), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -6 \cdot 10^{-49}:\\
\;\;\;\;\mathsf{fma}\left(a, 120, \frac{60}{\frac{z}{x}}\right)\\

\mathbf{elif}\;z \leq -1.75 \cdot 10^{-202}:\\
\;\;\;\;60 \cdot \frac{x - y}{z - t}\\

\mathbf{elif}\;z \leq 9 \cdot 10^{-47}:\\
\;\;\;\;\mathsf{fma}\left(-60, \frac{x - y}{t}, 120 \cdot a\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(60, \frac{x}{z}, 120 \cdot a\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -6e-49

    1. Initial program 99.5%

      \[\frac{60 \cdot \left(x - y\right)}{z - t} + a \cdot 120 \]
    2. Step-by-step derivation
      1. lift-+.f64N/A

        \[\leadsto \color{blue}{\frac{60 \cdot \left(x - y\right)}{z - t} + a \cdot 120} \]
      2. +-commutativeN/A

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

        \[\leadsto \color{blue}{a \cdot 120} + \frac{60 \cdot \left(x - y\right)}{z - t} \]
      4. lower-fma.f6499.5

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(a, 120, \color{blue}{\left(x - y\right) \cdot \frac{60}{z - t}}\right) \]
      10. frac-2negN/A

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

        \[\leadsto \mathsf{fma}\left(a, 120, \left(x - y\right) \cdot \color{blue}{\frac{\mathsf{neg}\left(60\right)}{\mathsf{neg}\left(\left(z - t\right)\right)}}\right) \]
      12. metadata-evalN/A

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

        \[\leadsto \mathsf{fma}\left(a, 120, \left(x - y\right) \cdot \frac{-60}{\mathsf{neg}\left(\color{blue}{\left(z - t\right)}\right)}\right) \]
      14. sub-negate-revN/A

        \[\leadsto \mathsf{fma}\left(a, 120, \left(x - y\right) \cdot \frac{-60}{\color{blue}{t - z}}\right) \]
      15. lower--.f6499.8

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

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

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

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

        \[\leadsto \mathsf{fma}\left(a, 120, \left(x - y\right) \cdot \color{blue}{\frac{\mathsf{neg}\left(-60\right)}{\mathsf{neg}\left(\left(t - z\right)\right)}}\right) \]
      4. metadata-evalN/A

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

        \[\leadsto \mathsf{fma}\left(a, 120, \left(x - y\right) \cdot \frac{60}{\mathsf{neg}\left(\color{blue}{\left(t - z\right)}\right)}\right) \]
      6. sub-negate-revN/A

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

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

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

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

        \[\leadsto \mathsf{fma}\left(a, 120, \color{blue}{60 \cdot \frac{x - y}{z - t}}\right) \]
      11. div-flipN/A

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

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

        \[\leadsto \mathsf{fma}\left(a, 120, \color{blue}{\frac{60}{\frac{z - t}{x - y}}}\right) \]
      14. lower-/.f6499.8

        \[\leadsto \mathsf{fma}\left(a, 120, \frac{60}{\color{blue}{\frac{z - t}{x - y}}}\right) \]
    5. Applied rewrites99.8%

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

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

        \[\leadsto \mathsf{fma}\left(a, 120, \frac{60}{\frac{z - t}{\color{blue}{x}}}\right) \]
      2. lower--.f6475.1

        \[\leadsto \mathsf{fma}\left(a, 120, \frac{60}{\frac{z - t}{x}}\right) \]
    8. Applied rewrites75.1%

      \[\leadsto \mathsf{fma}\left(a, 120, \frac{60}{\color{blue}{\frac{z - t}{x}}}\right) \]
    9. Taylor expanded in z around inf

      \[\leadsto \mathsf{fma}\left(a, 120, \frac{60}{\frac{z}{\color{blue}{x}}}\right) \]
    10. Step-by-step derivation
      1. lower-/.f6453.5

        \[\leadsto \mathsf{fma}\left(a, 120, \frac{60}{\frac{z}{x}}\right) \]
    11. Applied rewrites53.5%

      \[\leadsto \mathsf{fma}\left(a, 120, \frac{60}{\frac{z}{\color{blue}{x}}}\right) \]

    if -6e-49 < z < -1.75e-202

    1. Initial program 99.5%

      \[\frac{60 \cdot \left(x - y\right)}{z - t} + a \cdot 120 \]
    2. Taylor expanded in a around 0

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

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

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

        \[\leadsto 60 \cdot \frac{x - y}{\color{blue}{z} - t} \]
      4. lower--.f6451.1

        \[\leadsto 60 \cdot \frac{x - y}{z - \color{blue}{t}} \]
    4. Applied rewrites51.1%

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

    if -1.75e-202 < z < 9e-47

    1. Initial program 99.5%

      \[\frac{60 \cdot \left(x - y\right)}{z - t} + a \cdot 120 \]
    2. Taylor expanded in z around 0

      \[\leadsto \color{blue}{-60 \cdot \frac{x - y}{t} + 120 \cdot a} \]
    3. Step-by-step derivation
      1. lower-fma.f64N/A

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

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

        \[\leadsto \mathsf{fma}\left(-60, \frac{x - y}{t}, 120 \cdot a\right) \]
      4. lower-*.f6465.1

        \[\leadsto \mathsf{fma}\left(-60, \frac{x - y}{t}, 120 \cdot a\right) \]
    4. Applied rewrites65.1%

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

    if 9e-47 < z

    1. Initial program 99.5%

      \[\frac{60 \cdot \left(x - y\right)}{z - t} + a \cdot 120 \]
    2. Taylor expanded in z around inf

      \[\leadsto \color{blue}{60 \cdot \frac{x - y}{z} + 120 \cdot a} \]
    3. Step-by-step derivation
      1. lower-fma.f64N/A

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

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

        \[\leadsto \mathsf{fma}\left(60, \frac{x - y}{z}, 120 \cdot a\right) \]
      4. lower-*.f6462.6

        \[\leadsto \mathsf{fma}\left(60, \frac{x - y}{z}, 120 \cdot a\right) \]
    4. Applied rewrites62.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(60, \frac{x - y}{z}, 120 \cdot a\right)} \]
    5. Taylor expanded in x around inf

      \[\leadsto \mathsf{fma}\left(60, \frac{x}{\color{blue}{z}}, 120 \cdot a\right) \]
    6. Step-by-step derivation
      1. lower-/.f6453.5

        \[\leadsto \mathsf{fma}\left(60, \frac{x}{z}, 120 \cdot a\right) \]
    7. Applied rewrites53.5%

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

Alternative 7: 74.9% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{60 \cdot \left(x - y\right)}{z - t}\\ \mathbf{if}\;t\_1 \leq -5 \cdot 10^{-13}:\\ \;\;\;\;60 \cdot \frac{x - y}{z - t}\\ \mathbf{elif}\;t\_1 \leq 10^{+56}:\\ \;\;\;\;120 \cdot a\\ \mathbf{else}:\\ \;\;\;\;\frac{-60}{t - z} \cdot \left(x - y\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (/ (* 60.0 (- x y)) (- z t))))
   (if (<= t_1 -5e-13)
     (* 60.0 (/ (- x y) (- z t)))
     (if (<= t_1 1e+56) (* 120.0 a) (* (/ -60.0 (- t z)) (- x y))))))
double code(double x, double y, double z, double t, double a) {
	double t_1 = (60.0 * (x - y)) / (z - t);
	double tmp;
	if (t_1 <= -5e-13) {
		tmp = 60.0 * ((x - y) / (z - t));
	} else if (t_1 <= 1e+56) {
		tmp = 120.0 * a;
	} else {
		tmp = (-60.0 / (t - z)) * (x - y);
	}
	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, a)
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), intent (in) :: a
    real(8) :: t_1
    real(8) :: tmp
    t_1 = (60.0d0 * (x - y)) / (z - t)
    if (t_1 <= (-5d-13)) then
        tmp = 60.0d0 * ((x - y) / (z - t))
    else if (t_1 <= 1d+56) then
        tmp = 120.0d0 * a
    else
        tmp = ((-60.0d0) / (t - z)) * (x - y)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double t_1 = (60.0 * (x - y)) / (z - t);
	double tmp;
	if (t_1 <= -5e-13) {
		tmp = 60.0 * ((x - y) / (z - t));
	} else if (t_1 <= 1e+56) {
		tmp = 120.0 * a;
	} else {
		tmp = (-60.0 / (t - z)) * (x - y);
	}
	return tmp;
}
def code(x, y, z, t, a):
	t_1 = (60.0 * (x - y)) / (z - t)
	tmp = 0
	if t_1 <= -5e-13:
		tmp = 60.0 * ((x - y) / (z - t))
	elif t_1 <= 1e+56:
		tmp = 120.0 * a
	else:
		tmp = (-60.0 / (t - z)) * (x - y)
	return tmp
function code(x, y, z, t, a)
	t_1 = Float64(Float64(60.0 * Float64(x - y)) / Float64(z - t))
	tmp = 0.0
	if (t_1 <= -5e-13)
		tmp = Float64(60.0 * Float64(Float64(x - y) / Float64(z - t)));
	elseif (t_1 <= 1e+56)
		tmp = Float64(120.0 * a);
	else
		tmp = Float64(Float64(-60.0 / Float64(t - z)) * Float64(x - y));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	t_1 = (60.0 * (x - y)) / (z - t);
	tmp = 0.0;
	if (t_1 <= -5e-13)
		tmp = 60.0 * ((x - y) / (z - t));
	elseif (t_1 <= 1e+56)
		tmp = 120.0 * a;
	else
		tmp = (-60.0 / (t - z)) * (x - y);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(60.0 * N[(x - y), $MachinePrecision]), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e-13], N[(60.0 * N[(N[(x - y), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+56], N[(120.0 * a), $MachinePrecision], N[(N[(-60.0 / N[(t - z), $MachinePrecision]), $MachinePrecision] * N[(x - y), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \frac{60 \cdot \left(x - y\right)}{z - t}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{-13}:\\
\;\;\;\;60 \cdot \frac{x - y}{z - t}\\

\mathbf{elif}\;t\_1 \leq 10^{+56}:\\
\;\;\;\;120 \cdot a\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < -4.9999999999999999e-13

    1. Initial program 99.5%

      \[\frac{60 \cdot \left(x - y\right)}{z - t} + a \cdot 120 \]
    2. Taylor expanded in a around 0

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

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

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

        \[\leadsto 60 \cdot \frac{x - y}{\color{blue}{z} - t} \]
      4. lower--.f6451.1

        \[\leadsto 60 \cdot \frac{x - y}{z - \color{blue}{t}} \]
    4. Applied rewrites51.1%

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

    if -4.9999999999999999e-13 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < 1.00000000000000009e56

    1. Initial program 99.5%

      \[\frac{60 \cdot \left(x - y\right)}{z - t} + a \cdot 120 \]
    2. Taylor expanded in z around inf

      \[\leadsto \color{blue}{120 \cdot a} \]
    3. Step-by-step derivation
      1. lower-*.f6450.3

        \[\leadsto 120 \cdot \color{blue}{a} \]
    4. Applied rewrites50.3%

      \[\leadsto \color{blue}{120 \cdot a} \]

    if 1.00000000000000009e56 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t))

    1. Initial program 99.5%

      \[\frac{60 \cdot \left(x - y\right)}{z - t} + a \cdot 120 \]
    2. Taylor expanded in a around 0

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

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

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

        \[\leadsto 60 \cdot \frac{x - y}{\color{blue}{z} - t} \]
      4. lower--.f6451.1

        \[\leadsto 60 \cdot \frac{x - y}{z - \color{blue}{t}} \]
    4. Applied rewrites51.1%

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

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

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

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

        \[\leadsto \frac{60}{z - t} \cdot \color{blue}{\left(x - y\right)} \]
      5. metadata-evalN/A

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

        \[\leadsto \frac{\mathsf{neg}\left(-60\right)}{z - t} \cdot \left(x - y\right) \]
      7. sub-negate-revN/A

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

        \[\leadsto \frac{\mathsf{neg}\left(-60\right)}{\mathsf{neg}\left(\left(t - z\right)\right)} \cdot \left(x - y\right) \]
      9. frac-2negN/A

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

        \[\leadsto \frac{-60}{t - z} \cdot \left(\color{blue}{x} - y\right) \]
      11. lower-*.f6451.1

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

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

Alternative 8: 74.9% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := 60 \cdot \frac{x - y}{z - t}\\ t_2 := \frac{60 \cdot \left(x - y\right)}{z - t}\\ \mathbf{if}\;t\_2 \leq -5 \cdot 10^{-13}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 \leq 10^{+56}:\\ \;\;\;\;120 \cdot a\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (* 60.0 (/ (- x y) (- z t)))) (t_2 (/ (* 60.0 (- x y)) (- z t))))
   (if (<= t_2 -5e-13) t_1 (if (<= t_2 1e+56) (* 120.0 a) t_1))))
double code(double x, double y, double z, double t, double a) {
	double t_1 = 60.0 * ((x - y) / (z - t));
	double t_2 = (60.0 * (x - y)) / (z - t);
	double tmp;
	if (t_2 <= -5e-13) {
		tmp = t_1;
	} else if (t_2 <= 1e+56) {
		tmp = 120.0 * a;
	} else {
		tmp = t_1;
	}
	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, a)
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), intent (in) :: a
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = 60.0d0 * ((x - y) / (z - t))
    t_2 = (60.0d0 * (x - y)) / (z - t)
    if (t_2 <= (-5d-13)) then
        tmp = t_1
    else if (t_2 <= 1d+56) then
        tmp = 120.0d0 * a
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double t_1 = 60.0 * ((x - y) / (z - t));
	double t_2 = (60.0 * (x - y)) / (z - t);
	double tmp;
	if (t_2 <= -5e-13) {
		tmp = t_1;
	} else if (t_2 <= 1e+56) {
		tmp = 120.0 * a;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a):
	t_1 = 60.0 * ((x - y) / (z - t))
	t_2 = (60.0 * (x - y)) / (z - t)
	tmp = 0
	if t_2 <= -5e-13:
		tmp = t_1
	elif t_2 <= 1e+56:
		tmp = 120.0 * a
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a)
	t_1 = Float64(60.0 * Float64(Float64(x - y) / Float64(z - t)))
	t_2 = Float64(Float64(60.0 * Float64(x - y)) / Float64(z - t))
	tmp = 0.0
	if (t_2 <= -5e-13)
		tmp = t_1;
	elseif (t_2 <= 1e+56)
		tmp = Float64(120.0 * a);
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	t_1 = 60.0 * ((x - y) / (z - t));
	t_2 = (60.0 * (x - y)) / (z - t);
	tmp = 0.0;
	if (t_2 <= -5e-13)
		tmp = t_1;
	elseif (t_2 <= 1e+56)
		tmp = 120.0 * a;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(60.0 * N[(N[(x - y), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(60.0 * N[(x - y), $MachinePrecision]), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e-13], t$95$1, If[LessEqual[t$95$2, 1e+56], N[(120.0 * a), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := 60 \cdot \frac{x - y}{z - t}\\
t_2 := \frac{60 \cdot \left(x - y\right)}{z - t}\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{-13}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_2 \leq 10^{+56}:\\
\;\;\;\;120 \cdot a\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < -4.9999999999999999e-13 or 1.00000000000000009e56 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t))

    1. Initial program 99.5%

      \[\frac{60 \cdot \left(x - y\right)}{z - t} + a \cdot 120 \]
    2. Taylor expanded in a around 0

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

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

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

        \[\leadsto 60 \cdot \frac{x - y}{\color{blue}{z} - t} \]
      4. lower--.f6451.1

        \[\leadsto 60 \cdot \frac{x - y}{z - \color{blue}{t}} \]
    4. Applied rewrites51.1%

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

    if -4.9999999999999999e-13 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < 1.00000000000000009e56

    1. Initial program 99.5%

      \[\frac{60 \cdot \left(x - y\right)}{z - t} + a \cdot 120 \]
    2. Taylor expanded in z around inf

      \[\leadsto \color{blue}{120 \cdot a} \]
    3. Step-by-step derivation
      1. lower-*.f6450.3

        \[\leadsto 120 \cdot \color{blue}{a} \]
    4. Applied rewrites50.3%

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

Alternative 9: 61.2% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.1 \cdot 10^{+124}:\\
\;\;\;\;60 \cdot \frac{x}{z - t}\\

\mathbf{elif}\;x \leq 1.85 \cdot 10^{+177}:\\
\;\;\;\;\mathsf{fma}\left(-60, \frac{y}{z}, 120 \cdot a\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{60}{\frac{z - t}{x}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -3.1000000000000002e124

    1. Initial program 99.5%

      \[\frac{60 \cdot \left(x - y\right)}{z - t} + a \cdot 120 \]
    2. Taylor expanded in x around inf

      \[\leadsto \color{blue}{60 \cdot \frac{x}{z - t}} \]
    3. Step-by-step derivation
      1. lower-*.f64N/A

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

        \[\leadsto 60 \cdot \frac{x}{\color{blue}{z - t}} \]
      3. lower--.f6427.0

        \[\leadsto 60 \cdot \frac{x}{z - \color{blue}{t}} \]
    4. Applied rewrites27.0%

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

    if -3.1000000000000002e124 < x < 1.85000000000000007e177

    1. Initial program 99.5%

      \[\frac{60 \cdot \left(x - y\right)}{z - t} + a \cdot 120 \]
    2. Taylor expanded in z around inf

      \[\leadsto \color{blue}{60 \cdot \frac{x - y}{z} + 120 \cdot a} \]
    3. Step-by-step derivation
      1. lower-fma.f64N/A

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

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

        \[\leadsto \mathsf{fma}\left(60, \frac{x - y}{z}, 120 \cdot a\right) \]
      4. lower-*.f6462.6

        \[\leadsto \mathsf{fma}\left(60, \frac{x - y}{z}, 120 \cdot a\right) \]
    4. Applied rewrites62.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(60, \frac{x - y}{z}, 120 \cdot a\right)} \]
    5. Taylor expanded in x around 0

      \[\leadsto -60 \cdot \frac{y}{z} + \color{blue}{120 \cdot a} \]
    6. Step-by-step derivation
      1. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(-60, \frac{y}{\color{blue}{z}}, 120 \cdot a\right) \]
      2. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(-60, \frac{y}{z}, 120 \cdot a\right) \]
      3. lower-*.f6454.1

        \[\leadsto \mathsf{fma}\left(-60, \frac{y}{z}, 120 \cdot a\right) \]
    7. Applied rewrites54.1%

      \[\leadsto \mathsf{fma}\left(-60, \color{blue}{\frac{y}{z}}, 120 \cdot a\right) \]

    if 1.85000000000000007e177 < x

    1. Initial program 99.5%

      \[\frac{60 \cdot \left(x - y\right)}{z - t} + a \cdot 120 \]
    2. Taylor expanded in x around inf

      \[\leadsto \color{blue}{60 \cdot \frac{x}{z - t}} \]
    3. Step-by-step derivation
      1. lower-*.f64N/A

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

        \[\leadsto 60 \cdot \frac{x}{\color{blue}{z - t}} \]
      3. lower--.f6427.0

        \[\leadsto 60 \cdot \frac{x}{z - \color{blue}{t}} \]
    4. Applied rewrites27.0%

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

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

        \[\leadsto 60 \cdot \frac{x}{\color{blue}{z - t}} \]
      3. div-flipN/A

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

        \[\leadsto 60 \cdot \frac{1}{\frac{z - t}{\color{blue}{x}}} \]
      5. mult-flip-revN/A

        \[\leadsto \frac{60}{\color{blue}{\frac{z - t}{x}}} \]
      6. lower-/.f6427.0

        \[\leadsto \frac{60}{\color{blue}{\frac{z - t}{x}}} \]
    6. Applied rewrites27.0%

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

Alternative 10: 60.6% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{60 \cdot \left(x - y\right)}{z - t}\\ \mathbf{if}\;t\_1 \leq -1 \cdot 10^{+88}:\\ \;\;\;\;\frac{x \cdot 60}{z - t}\\ \mathbf{elif}\;t\_1 \leq 10^{+48}:\\ \;\;\;\;120 \cdot a\\ \mathbf{else}:\\ \;\;\;\;60 \cdot \frac{x}{z - t}\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (/ (* 60.0 (- x y)) (- z t))))
   (if (<= t_1 -1e+88)
     (/ (* x 60.0) (- z t))
     (if (<= t_1 1e+48) (* 120.0 a) (* 60.0 (/ x (- z t)))))))
double code(double x, double y, double z, double t, double a) {
	double t_1 = (60.0 * (x - y)) / (z - t);
	double tmp;
	if (t_1 <= -1e+88) {
		tmp = (x * 60.0) / (z - t);
	} else if (t_1 <= 1e+48) {
		tmp = 120.0 * a;
	} else {
		tmp = 60.0 * (x / (z - t));
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y, z, t, a)
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), intent (in) :: a
    real(8) :: t_1
    real(8) :: tmp
    t_1 = (60.0d0 * (x - y)) / (z - t)
    if (t_1 <= (-1d+88)) then
        tmp = (x * 60.0d0) / (z - t)
    else if (t_1 <= 1d+48) then
        tmp = 120.0d0 * a
    else
        tmp = 60.0d0 * (x / (z - t))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double t_1 = (60.0 * (x - y)) / (z - t);
	double tmp;
	if (t_1 <= -1e+88) {
		tmp = (x * 60.0) / (z - t);
	} else if (t_1 <= 1e+48) {
		tmp = 120.0 * a;
	} else {
		tmp = 60.0 * (x / (z - t));
	}
	return tmp;
}
def code(x, y, z, t, a):
	t_1 = (60.0 * (x - y)) / (z - t)
	tmp = 0
	if t_1 <= -1e+88:
		tmp = (x * 60.0) / (z - t)
	elif t_1 <= 1e+48:
		tmp = 120.0 * a
	else:
		tmp = 60.0 * (x / (z - t))
	return tmp
function code(x, y, z, t, a)
	t_1 = Float64(Float64(60.0 * Float64(x - y)) / Float64(z - t))
	tmp = 0.0
	if (t_1 <= -1e+88)
		tmp = Float64(Float64(x * 60.0) / Float64(z - t));
	elseif (t_1 <= 1e+48)
		tmp = Float64(120.0 * a);
	else
		tmp = Float64(60.0 * Float64(x / Float64(z - t)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	t_1 = (60.0 * (x - y)) / (z - t);
	tmp = 0.0;
	if (t_1 <= -1e+88)
		tmp = (x * 60.0) / (z - t);
	elseif (t_1 <= 1e+48)
		tmp = 120.0 * a;
	else
		tmp = 60.0 * (x / (z - t));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(60.0 * N[(x - y), $MachinePrecision]), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+88], N[(N[(x * 60.0), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+48], N[(120.0 * a), $MachinePrecision], N[(60.0 * N[(x / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \frac{60 \cdot \left(x - y\right)}{z - t}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+88}:\\
\;\;\;\;\frac{x \cdot 60}{z - t}\\

\mathbf{elif}\;t\_1 \leq 10^{+48}:\\
\;\;\;\;120 \cdot a\\

\mathbf{else}:\\
\;\;\;\;60 \cdot \frac{x}{z - t}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < -9.99999999999999959e87

    1. Initial program 99.5%

      \[\frac{60 \cdot \left(x - y\right)}{z - t} + a \cdot 120 \]
    2. Taylor expanded in x around inf

      \[\leadsto \color{blue}{60 \cdot \frac{x}{z - t}} \]
    3. Step-by-step derivation
      1. lower-*.f64N/A

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

        \[\leadsto 60 \cdot \frac{x}{\color{blue}{z - t}} \]
      3. lower--.f6427.0

        \[\leadsto 60 \cdot \frac{x}{z - \color{blue}{t}} \]
    4. Applied rewrites27.0%

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

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

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

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

        \[\leadsto \frac{60 \cdot x}{\color{blue}{z - t}} \]
      5. *-commutativeN/A

        \[\leadsto \frac{x \cdot 60}{\color{blue}{z} - t} \]
      6. lower-*.f6427.0

        \[\leadsto \frac{x \cdot 60}{\color{blue}{z} - t} \]
    6. Applied rewrites27.0%

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

    if -9.99999999999999959e87 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < 1.00000000000000004e48

    1. Initial program 99.5%

      \[\frac{60 \cdot \left(x - y\right)}{z - t} + a \cdot 120 \]
    2. Taylor expanded in z around inf

      \[\leadsto \color{blue}{120 \cdot a} \]
    3. Step-by-step derivation
      1. lower-*.f6450.3

        \[\leadsto 120 \cdot \color{blue}{a} \]
    4. Applied rewrites50.3%

      \[\leadsto \color{blue}{120 \cdot a} \]

    if 1.00000000000000004e48 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t))

    1. Initial program 99.5%

      \[\frac{60 \cdot \left(x - y\right)}{z - t} + a \cdot 120 \]
    2. Taylor expanded in x around inf

      \[\leadsto \color{blue}{60 \cdot \frac{x}{z - t}} \]
    3. Step-by-step derivation
      1. lower-*.f64N/A

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

        \[\leadsto 60 \cdot \frac{x}{\color{blue}{z - t}} \]
      3. lower--.f6427.0

        \[\leadsto 60 \cdot \frac{x}{z - \color{blue}{t}} \]
    4. Applied rewrites27.0%

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

Alternative 11: 60.6% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := 60 \cdot \frac{x}{z - t}\\ t_2 := \frac{60 \cdot \left(x - y\right)}{z - t}\\ \mathbf{if}\;t\_2 \leq -1 \cdot 10^{+88}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 \leq 10^{+48}:\\ \;\;\;\;120 \cdot a\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (* 60.0 (/ x (- z t)))) (t_2 (/ (* 60.0 (- x y)) (- z t))))
   (if (<= t_2 -1e+88) t_1 (if (<= t_2 1e+48) (* 120.0 a) t_1))))
double code(double x, double y, double z, double t, double a) {
	double t_1 = 60.0 * (x / (z - t));
	double t_2 = (60.0 * (x - y)) / (z - t);
	double tmp;
	if (t_2 <= -1e+88) {
		tmp = t_1;
	} else if (t_2 <= 1e+48) {
		tmp = 120.0 * a;
	} else {
		tmp = t_1;
	}
	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, a)
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), intent (in) :: a
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = 60.0d0 * (x / (z - t))
    t_2 = (60.0d0 * (x - y)) / (z - t)
    if (t_2 <= (-1d+88)) then
        tmp = t_1
    else if (t_2 <= 1d+48) then
        tmp = 120.0d0 * a
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double t_1 = 60.0 * (x / (z - t));
	double t_2 = (60.0 * (x - y)) / (z - t);
	double tmp;
	if (t_2 <= -1e+88) {
		tmp = t_1;
	} else if (t_2 <= 1e+48) {
		tmp = 120.0 * a;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a):
	t_1 = 60.0 * (x / (z - t))
	t_2 = (60.0 * (x - y)) / (z - t)
	tmp = 0
	if t_2 <= -1e+88:
		tmp = t_1
	elif t_2 <= 1e+48:
		tmp = 120.0 * a
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a)
	t_1 = Float64(60.0 * Float64(x / Float64(z - t)))
	t_2 = Float64(Float64(60.0 * Float64(x - y)) / Float64(z - t))
	tmp = 0.0
	if (t_2 <= -1e+88)
		tmp = t_1;
	elseif (t_2 <= 1e+48)
		tmp = Float64(120.0 * a);
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	t_1 = 60.0 * (x / (z - t));
	t_2 = (60.0 * (x - y)) / (z - t);
	tmp = 0.0;
	if (t_2 <= -1e+88)
		tmp = t_1;
	elseif (t_2 <= 1e+48)
		tmp = 120.0 * a;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(60.0 * N[(x / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(60.0 * N[(x - y), $MachinePrecision]), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1e+88], t$95$1, If[LessEqual[t$95$2, 1e+48], N[(120.0 * a), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := 60 \cdot \frac{x}{z - t}\\
t_2 := \frac{60 \cdot \left(x - y\right)}{z - t}\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{+88}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_2 \leq 10^{+48}:\\
\;\;\;\;120 \cdot a\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < -9.99999999999999959e87 or 1.00000000000000004e48 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t))

    1. Initial program 99.5%

      \[\frac{60 \cdot \left(x - y\right)}{z - t} + a \cdot 120 \]
    2. Taylor expanded in x around inf

      \[\leadsto \color{blue}{60 \cdot \frac{x}{z - t}} \]
    3. Step-by-step derivation
      1. lower-*.f64N/A

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

        \[\leadsto 60 \cdot \frac{x}{\color{blue}{z - t}} \]
      3. lower--.f6427.0

        \[\leadsto 60 \cdot \frac{x}{z - \color{blue}{t}} \]
    4. Applied rewrites27.0%

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

    if -9.99999999999999959e87 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < 1.00000000000000004e48

    1. Initial program 99.5%

      \[\frac{60 \cdot \left(x - y\right)}{z - t} + a \cdot 120 \]
    2. Taylor expanded in z around inf

      \[\leadsto \color{blue}{120 \cdot a} \]
    3. Step-by-step derivation
      1. lower-*.f6450.3

        \[\leadsto 120 \cdot \color{blue}{a} \]
    4. Applied rewrites50.3%

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

Alternative 12: 59.2% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{\left(x - y\right) \cdot 60}{z}\\ t_2 := \frac{60 \cdot \left(x - y\right)}{z - t}\\ \mathbf{if}\;t\_2 \leq -1 \cdot 10^{+88}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 \leq 10^{+56}:\\ \;\;\;\;120 \cdot a\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (/ (* (- x y) 60.0) z)) (t_2 (/ (* 60.0 (- x y)) (- z t))))
   (if (<= t_2 -1e+88) t_1 (if (<= t_2 1e+56) (* 120.0 a) t_1))))
double code(double x, double y, double z, double t, double a) {
	double t_1 = ((x - y) * 60.0) / z;
	double t_2 = (60.0 * (x - y)) / (z - t);
	double tmp;
	if (t_2 <= -1e+88) {
		tmp = t_1;
	} else if (t_2 <= 1e+56) {
		tmp = 120.0 * a;
	} else {
		tmp = t_1;
	}
	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, a)
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), intent (in) :: a
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = ((x - y) * 60.0d0) / z
    t_2 = (60.0d0 * (x - y)) / (z - t)
    if (t_2 <= (-1d+88)) then
        tmp = t_1
    else if (t_2 <= 1d+56) then
        tmp = 120.0d0 * a
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double t_1 = ((x - y) * 60.0) / z;
	double t_2 = (60.0 * (x - y)) / (z - t);
	double tmp;
	if (t_2 <= -1e+88) {
		tmp = t_1;
	} else if (t_2 <= 1e+56) {
		tmp = 120.0 * a;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a):
	t_1 = ((x - y) * 60.0) / z
	t_2 = (60.0 * (x - y)) / (z - t)
	tmp = 0
	if t_2 <= -1e+88:
		tmp = t_1
	elif t_2 <= 1e+56:
		tmp = 120.0 * a
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a)
	t_1 = Float64(Float64(Float64(x - y) * 60.0) / z)
	t_2 = Float64(Float64(60.0 * Float64(x - y)) / Float64(z - t))
	tmp = 0.0
	if (t_2 <= -1e+88)
		tmp = t_1;
	elseif (t_2 <= 1e+56)
		tmp = Float64(120.0 * a);
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	t_1 = ((x - y) * 60.0) / z;
	t_2 = (60.0 * (x - y)) / (z - t);
	tmp = 0.0;
	if (t_2 <= -1e+88)
		tmp = t_1;
	elseif (t_2 <= 1e+56)
		tmp = 120.0 * a;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(x - y), $MachinePrecision] * 60.0), $MachinePrecision] / z), $MachinePrecision]}, Block[{t$95$2 = N[(N[(60.0 * N[(x - y), $MachinePrecision]), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1e+88], t$95$1, If[LessEqual[t$95$2, 1e+56], N[(120.0 * a), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \frac{\left(x - y\right) \cdot 60}{z}\\
t_2 := \frac{60 \cdot \left(x - y\right)}{z - t}\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{+88}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_2 \leq 10^{+56}:\\
\;\;\;\;120 \cdot a\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < -9.99999999999999959e87 or 1.00000000000000009e56 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t))

    1. Initial program 99.5%

      \[\frac{60 \cdot \left(x - y\right)}{z - t} + a \cdot 120 \]
    2. Taylor expanded in z around inf

      \[\leadsto \color{blue}{60 \cdot \frac{x - y}{z} + 120 \cdot a} \]
    3. Step-by-step derivation
      1. lower-fma.f64N/A

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

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

        \[\leadsto \mathsf{fma}\left(60, \frac{x - y}{z}, 120 \cdot a\right) \]
      4. lower-*.f6462.6

        \[\leadsto \mathsf{fma}\left(60, \frac{x - y}{z}, 120 \cdot a\right) \]
    4. Applied rewrites62.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(60, \frac{x - y}{z}, 120 \cdot a\right)} \]
    5. Taylor expanded in z around 0

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

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

        \[\leadsto 60 \cdot \frac{x - y}{z} \]
      3. lower--.f6428.0

        \[\leadsto 60 \cdot \frac{x - y}{z} \]
    7. Applied rewrites28.0%

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

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

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

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

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

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

        \[\leadsto \frac{60 \cdot \left(x - y\right)}{z} \]
      7. *-commutativeN/A

        \[\leadsto \frac{\left(x - y\right) \cdot 60}{z} \]
      8. lower-*.f6428.0

        \[\leadsto \frac{\left(x - y\right) \cdot 60}{z} \]
    9. Applied rewrites28.0%

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

    if -9.99999999999999959e87 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < 1.00000000000000009e56

    1. Initial program 99.5%

      \[\frac{60 \cdot \left(x - y\right)}{z - t} + a \cdot 120 \]
    2. Taylor expanded in z around inf

      \[\leadsto \color{blue}{120 \cdot a} \]
    3. Step-by-step derivation
      1. lower-*.f6450.3

        \[\leadsto 120 \cdot \color{blue}{a} \]
    4. Applied rewrites50.3%

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

Alternative 13: 59.1% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := 60 \cdot \frac{x - y}{z}\\ t_2 := \frac{60 \cdot \left(x - y\right)}{z - t}\\ \mathbf{if}\;t\_2 \leq -1 \cdot 10^{+88}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 \leq 10^{+56}:\\ \;\;\;\;120 \cdot a\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (* 60.0 (/ (- x y) z))) (t_2 (/ (* 60.0 (- x y)) (- z t))))
   (if (<= t_2 -1e+88) t_1 (if (<= t_2 1e+56) (* 120.0 a) t_1))))
double code(double x, double y, double z, double t, double a) {
	double t_1 = 60.0 * ((x - y) / z);
	double t_2 = (60.0 * (x - y)) / (z - t);
	double tmp;
	if (t_2 <= -1e+88) {
		tmp = t_1;
	} else if (t_2 <= 1e+56) {
		tmp = 120.0 * a;
	} else {
		tmp = t_1;
	}
	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, a)
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), intent (in) :: a
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = 60.0d0 * ((x - y) / z)
    t_2 = (60.0d0 * (x - y)) / (z - t)
    if (t_2 <= (-1d+88)) then
        tmp = t_1
    else if (t_2 <= 1d+56) then
        tmp = 120.0d0 * a
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double t_1 = 60.0 * ((x - y) / z);
	double t_2 = (60.0 * (x - y)) / (z - t);
	double tmp;
	if (t_2 <= -1e+88) {
		tmp = t_1;
	} else if (t_2 <= 1e+56) {
		tmp = 120.0 * a;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a):
	t_1 = 60.0 * ((x - y) / z)
	t_2 = (60.0 * (x - y)) / (z - t)
	tmp = 0
	if t_2 <= -1e+88:
		tmp = t_1
	elif t_2 <= 1e+56:
		tmp = 120.0 * a
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a)
	t_1 = Float64(60.0 * Float64(Float64(x - y) / z))
	t_2 = Float64(Float64(60.0 * Float64(x - y)) / Float64(z - t))
	tmp = 0.0
	if (t_2 <= -1e+88)
		tmp = t_1;
	elseif (t_2 <= 1e+56)
		tmp = Float64(120.0 * a);
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	t_1 = 60.0 * ((x - y) / z);
	t_2 = (60.0 * (x - y)) / (z - t);
	tmp = 0.0;
	if (t_2 <= -1e+88)
		tmp = t_1;
	elseif (t_2 <= 1e+56)
		tmp = 120.0 * a;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(60.0 * N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(60.0 * N[(x - y), $MachinePrecision]), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1e+88], t$95$1, If[LessEqual[t$95$2, 1e+56], N[(120.0 * a), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := 60 \cdot \frac{x - y}{z}\\
t_2 := \frac{60 \cdot \left(x - y\right)}{z - t}\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{+88}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_2 \leq 10^{+56}:\\
\;\;\;\;120 \cdot a\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < -9.99999999999999959e87 or 1.00000000000000009e56 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t))

    1. Initial program 99.5%

      \[\frac{60 \cdot \left(x - y\right)}{z - t} + a \cdot 120 \]
    2. Taylor expanded in z around inf

      \[\leadsto \color{blue}{60 \cdot \frac{x - y}{z} + 120 \cdot a} \]
    3. Step-by-step derivation
      1. lower-fma.f64N/A

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

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

        \[\leadsto \mathsf{fma}\left(60, \frac{x - y}{z}, 120 \cdot a\right) \]
      4. lower-*.f6462.6

        \[\leadsto \mathsf{fma}\left(60, \frac{x - y}{z}, 120 \cdot a\right) \]
    4. Applied rewrites62.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(60, \frac{x - y}{z}, 120 \cdot a\right)} \]
    5. Taylor expanded in z around 0

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

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

        \[\leadsto 60 \cdot \frac{x - y}{z} \]
      3. lower--.f6428.0

        \[\leadsto 60 \cdot \frac{x - y}{z} \]
    7. Applied rewrites28.0%

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

    if -9.99999999999999959e87 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < 1.00000000000000009e56

    1. Initial program 99.5%

      \[\frac{60 \cdot \left(x - y\right)}{z - t} + a \cdot 120 \]
    2. Taylor expanded in z around inf

      \[\leadsto \color{blue}{120 \cdot a} \]
    3. Step-by-step derivation
      1. lower-*.f6450.3

        \[\leadsto 120 \cdot \color{blue}{a} \]
    4. Applied rewrites50.3%

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

Alternative 14: 57.0% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{60 \cdot \left(x - y\right)}{z - t}\\ \mathbf{if}\;t\_1 \leq -5 \cdot 10^{+250}:\\ \;\;\;\;-60 \cdot \frac{x}{t}\\ \mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+56}:\\ \;\;\;\;120 \cdot a\\ \mathbf{else}:\\ \;\;\;\;\frac{60 \cdot y}{t - z}\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (/ (* 60.0 (- x y)) (- z t))))
   (if (<= t_1 -5e+250)
     (* -60.0 (/ x t))
     (if (<= t_1 2e+56) (* 120.0 a) (/ (* 60.0 y) (- t z))))))
double code(double x, double y, double z, double t, double a) {
	double t_1 = (60.0 * (x - y)) / (z - t);
	double tmp;
	if (t_1 <= -5e+250) {
		tmp = -60.0 * (x / t);
	} else if (t_1 <= 2e+56) {
		tmp = 120.0 * a;
	} else {
		tmp = (60.0 * y) / (t - z);
	}
	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, a)
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), intent (in) :: a
    real(8) :: t_1
    real(8) :: tmp
    t_1 = (60.0d0 * (x - y)) / (z - t)
    if (t_1 <= (-5d+250)) then
        tmp = (-60.0d0) * (x / t)
    else if (t_1 <= 2d+56) then
        tmp = 120.0d0 * a
    else
        tmp = (60.0d0 * y) / (t - z)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double t_1 = (60.0 * (x - y)) / (z - t);
	double tmp;
	if (t_1 <= -5e+250) {
		tmp = -60.0 * (x / t);
	} else if (t_1 <= 2e+56) {
		tmp = 120.0 * a;
	} else {
		tmp = (60.0 * y) / (t - z);
	}
	return tmp;
}
def code(x, y, z, t, a):
	t_1 = (60.0 * (x - y)) / (z - t)
	tmp = 0
	if t_1 <= -5e+250:
		tmp = -60.0 * (x / t)
	elif t_1 <= 2e+56:
		tmp = 120.0 * a
	else:
		tmp = (60.0 * y) / (t - z)
	return tmp
function code(x, y, z, t, a)
	t_1 = Float64(Float64(60.0 * Float64(x - y)) / Float64(z - t))
	tmp = 0.0
	if (t_1 <= -5e+250)
		tmp = Float64(-60.0 * Float64(x / t));
	elseif (t_1 <= 2e+56)
		tmp = Float64(120.0 * a);
	else
		tmp = Float64(Float64(60.0 * y) / Float64(t - z));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	t_1 = (60.0 * (x - y)) / (z - t);
	tmp = 0.0;
	if (t_1 <= -5e+250)
		tmp = -60.0 * (x / t);
	elseif (t_1 <= 2e+56)
		tmp = 120.0 * a;
	else
		tmp = (60.0 * y) / (t - z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(60.0 * N[(x - y), $MachinePrecision]), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+250], N[(-60.0 * N[(x / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+56], N[(120.0 * a), $MachinePrecision], N[(N[(60.0 * y), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \frac{60 \cdot \left(x - y\right)}{z - t}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+250}:\\
\;\;\;\;-60 \cdot \frac{x}{t}\\

\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+56}:\\
\;\;\;\;120 \cdot a\\

\mathbf{else}:\\
\;\;\;\;\frac{60 \cdot y}{t - z}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < -5.0000000000000002e250

    1. Initial program 99.5%

      \[\frac{60 \cdot \left(x - y\right)}{z - t} + a \cdot 120 \]
    2. Taylor expanded in x around inf

      \[\leadsto \color{blue}{60 \cdot \frac{x}{z - t}} \]
    3. Step-by-step derivation
      1. lower-*.f64N/A

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

        \[\leadsto 60 \cdot \frac{x}{\color{blue}{z - t}} \]
      3. lower--.f6427.0

        \[\leadsto 60 \cdot \frac{x}{z - \color{blue}{t}} \]
    4. Applied rewrites27.0%

      \[\leadsto \color{blue}{60 \cdot \frac{x}{z - t}} \]
    5. Taylor expanded in z around 0

      \[\leadsto -60 \cdot \color{blue}{\frac{x}{t}} \]
    6. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto -60 \cdot \frac{x}{\color{blue}{t}} \]
      2. lower-/.f6416.8

        \[\leadsto -60 \cdot \frac{x}{t} \]
    7. Applied rewrites16.8%

      \[\leadsto -60 \cdot \color{blue}{\frac{x}{t}} \]

    if -5.0000000000000002e250 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < 2.00000000000000018e56

    1. Initial program 99.5%

      \[\frac{60 \cdot \left(x - y\right)}{z - t} + a \cdot 120 \]
    2. Taylor expanded in z around inf

      \[\leadsto \color{blue}{120 \cdot a} \]
    3. Step-by-step derivation
      1. lower-*.f6450.3

        \[\leadsto 120 \cdot \color{blue}{a} \]
    4. Applied rewrites50.3%

      \[\leadsto \color{blue}{120 \cdot a} \]

    if 2.00000000000000018e56 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t))

    1. Initial program 99.5%

      \[\frac{60 \cdot \left(x - y\right)}{z - t} + a \cdot 120 \]
    2. Taylor expanded in a around 0

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

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

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

        \[\leadsto 60 \cdot \frac{x - y}{\color{blue}{z} - t} \]
      4. lower--.f6451.1

        \[\leadsto 60 \cdot \frac{x - y}{z - \color{blue}{t}} \]
    4. Applied rewrites51.1%

      \[\leadsto \color{blue}{60 \cdot \frac{x - y}{z - t}} \]
    5. Taylor expanded in x around 0

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

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

        \[\leadsto -60 \cdot \frac{y}{z - \color{blue}{t}} \]
      3. lower--.f6427.0

        \[\leadsto -60 \cdot \frac{y}{z - t} \]
    7. Applied rewrites27.0%

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

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

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

        \[\leadsto \frac{-60 \cdot y}{z - \color{blue}{t}} \]
      4. metadata-evalN/A

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

        \[\leadsto \frac{\mathsf{neg}\left(60 \cdot y\right)}{z - t} \]
      6. lift--.f64N/A

        \[\leadsto \frac{\mathsf{neg}\left(60 \cdot y\right)}{z - t} \]
      7. sub-negate-revN/A

        \[\leadsto \frac{\mathsf{neg}\left(60 \cdot y\right)}{\mathsf{neg}\left(\left(t - z\right)\right)} \]
      8. sub-negate-revN/A

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

        \[\leadsto \frac{\mathsf{neg}\left(60 \cdot y\right)}{\mathsf{neg}\left(\left(\mathsf{neg}\left(\left(z - t\right)\right)\right)\right)} \]
      10. frac-2neg-revN/A

        \[\leadsto \frac{60 \cdot y}{\mathsf{neg}\left(\left(z - t\right)\right)} \]
      11. lower-/.f64N/A

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

        \[\leadsto \frac{60 \cdot y}{\mathsf{neg}\left(\left(z - t\right)\right)} \]
      13. lift--.f64N/A

        \[\leadsto \frac{60 \cdot y}{\mathsf{neg}\left(\left(z - t\right)\right)} \]
      14. sub-negate-revN/A

        \[\leadsto \frac{60 \cdot y}{t - z} \]
      15. lower--.f6426.9

        \[\leadsto \frac{60 \cdot y}{t - z} \]
    9. Applied rewrites26.9%

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

Alternative 15: 56.9% accurate, 0.4× speedup?

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

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

real(8) function code(x, y, z, t, a)
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), intent (in) :: a
    real(8) :: t_1
    real(8) :: tmp
    t_1 = (60.0d0 * (x - y)) / (z - t)
    if (t_1 <= (-5d+250)) then
        tmp = (-60.0d0) * (x / t)
    else if (t_1 <= 2d+56) then
        tmp = 120.0d0 * a
    else
        tmp = (-60.0d0) * (y / (z - t))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double t_1 = (60.0 * (x - y)) / (z - t);
	double tmp;
	if (t_1 <= -5e+250) {
		tmp = -60.0 * (x / t);
	} else if (t_1 <= 2e+56) {
		tmp = 120.0 * a;
	} else {
		tmp = -60.0 * (y / (z - t));
	}
	return tmp;
}
def code(x, y, z, t, a):
	t_1 = (60.0 * (x - y)) / (z - t)
	tmp = 0
	if t_1 <= -5e+250:
		tmp = -60.0 * (x / t)
	elif t_1 <= 2e+56:
		tmp = 120.0 * a
	else:
		tmp = -60.0 * (y / (z - t))
	return tmp
function code(x, y, z, t, a)
	t_1 = Float64(Float64(60.0 * Float64(x - y)) / Float64(z - t))
	tmp = 0.0
	if (t_1 <= -5e+250)
		tmp = Float64(-60.0 * Float64(x / t));
	elseif (t_1 <= 2e+56)
		tmp = Float64(120.0 * a);
	else
		tmp = Float64(-60.0 * Float64(y / Float64(z - t)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	t_1 = (60.0 * (x - y)) / (z - t);
	tmp = 0.0;
	if (t_1 <= -5e+250)
		tmp = -60.0 * (x / t);
	elseif (t_1 <= 2e+56)
		tmp = 120.0 * a;
	else
		tmp = -60.0 * (y / (z - t));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(60.0 * N[(x - y), $MachinePrecision]), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+250], N[(-60.0 * N[(x / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+56], N[(120.0 * a), $MachinePrecision], N[(-60.0 * N[(y / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \frac{60 \cdot \left(x - y\right)}{z - t}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+250}:\\
\;\;\;\;-60 \cdot \frac{x}{t}\\

\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+56}:\\
\;\;\;\;120 \cdot a\\

\mathbf{else}:\\
\;\;\;\;-60 \cdot \frac{y}{z - t}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < -5.0000000000000002e250

    1. Initial program 99.5%

      \[\frac{60 \cdot \left(x - y\right)}{z - t} + a \cdot 120 \]
    2. Taylor expanded in x around inf

      \[\leadsto \color{blue}{60 \cdot \frac{x}{z - t}} \]
    3. Step-by-step derivation
      1. lower-*.f64N/A

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

        \[\leadsto 60 \cdot \frac{x}{\color{blue}{z - t}} \]
      3. lower--.f6427.0

        \[\leadsto 60 \cdot \frac{x}{z - \color{blue}{t}} \]
    4. Applied rewrites27.0%

      \[\leadsto \color{blue}{60 \cdot \frac{x}{z - t}} \]
    5. Taylor expanded in z around 0

      \[\leadsto -60 \cdot \color{blue}{\frac{x}{t}} \]
    6. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto -60 \cdot \frac{x}{\color{blue}{t}} \]
      2. lower-/.f6416.8

        \[\leadsto -60 \cdot \frac{x}{t} \]
    7. Applied rewrites16.8%

      \[\leadsto -60 \cdot \color{blue}{\frac{x}{t}} \]

    if -5.0000000000000002e250 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < 2.00000000000000018e56

    1. Initial program 99.5%

      \[\frac{60 \cdot \left(x - y\right)}{z - t} + a \cdot 120 \]
    2. Taylor expanded in z around inf

      \[\leadsto \color{blue}{120 \cdot a} \]
    3. Step-by-step derivation
      1. lower-*.f6450.3

        \[\leadsto 120 \cdot \color{blue}{a} \]
    4. Applied rewrites50.3%

      \[\leadsto \color{blue}{120 \cdot a} \]

    if 2.00000000000000018e56 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t))

    1. Initial program 99.5%

      \[\frac{60 \cdot \left(x - y\right)}{z - t} + a \cdot 120 \]
    2. Taylor expanded in a around 0

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

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

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

        \[\leadsto 60 \cdot \frac{x - y}{\color{blue}{z} - t} \]
      4. lower--.f6451.1

        \[\leadsto 60 \cdot \frac{x - y}{z - \color{blue}{t}} \]
    4. Applied rewrites51.1%

      \[\leadsto \color{blue}{60 \cdot \frac{x - y}{z - t}} \]
    5. Taylor expanded in x around 0

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

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

        \[\leadsto -60 \cdot \frac{y}{z - \color{blue}{t}} \]
      3. lower--.f6427.0

        \[\leadsto -60 \cdot \frac{y}{z - t} \]
    7. Applied rewrites27.0%

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

Alternative 16: 53.8% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := -60 \cdot \frac{x}{t}\\ t_2 := \frac{60 \cdot \left(x - y\right)}{z - t}\\ \mathbf{if}\;t\_2 \leq -5 \cdot 10^{+250}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 \leq 10^{+56}:\\ \;\;\;\;120 \cdot a\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (* -60.0 (/ x t))) (t_2 (/ (* 60.0 (- x y)) (- z t))))
   (if (<= t_2 -5e+250) t_1 (if (<= t_2 1e+56) (* 120.0 a) t_1))))
double code(double x, double y, double z, double t, double a) {
	double t_1 = -60.0 * (x / t);
	double t_2 = (60.0 * (x - y)) / (z - t);
	double tmp;
	if (t_2 <= -5e+250) {
		tmp = t_1;
	} else if (t_2 <= 1e+56) {
		tmp = 120.0 * a;
	} else {
		tmp = t_1;
	}
	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, a)
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), intent (in) :: a
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = (-60.0d0) * (x / t)
    t_2 = (60.0d0 * (x - y)) / (z - t)
    if (t_2 <= (-5d+250)) then
        tmp = t_1
    else if (t_2 <= 1d+56) then
        tmp = 120.0d0 * a
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double t_1 = -60.0 * (x / t);
	double t_2 = (60.0 * (x - y)) / (z - t);
	double tmp;
	if (t_2 <= -5e+250) {
		tmp = t_1;
	} else if (t_2 <= 1e+56) {
		tmp = 120.0 * a;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a):
	t_1 = -60.0 * (x / t)
	t_2 = (60.0 * (x - y)) / (z - t)
	tmp = 0
	if t_2 <= -5e+250:
		tmp = t_1
	elif t_2 <= 1e+56:
		tmp = 120.0 * a
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a)
	t_1 = Float64(-60.0 * Float64(x / t))
	t_2 = Float64(Float64(60.0 * Float64(x - y)) / Float64(z - t))
	tmp = 0.0
	if (t_2 <= -5e+250)
		tmp = t_1;
	elseif (t_2 <= 1e+56)
		tmp = Float64(120.0 * a);
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	t_1 = -60.0 * (x / t);
	t_2 = (60.0 * (x - y)) / (z - t);
	tmp = 0.0;
	if (t_2 <= -5e+250)
		tmp = t_1;
	elseif (t_2 <= 1e+56)
		tmp = 120.0 * a;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(-60.0 * N[(x / t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(60.0 * N[(x - y), $MachinePrecision]), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+250], t$95$1, If[LessEqual[t$95$2, 1e+56], N[(120.0 * a), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := -60 \cdot \frac{x}{t}\\
t_2 := \frac{60 \cdot \left(x - y\right)}{z - t}\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+250}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_2 \leq 10^{+56}:\\
\;\;\;\;120 \cdot a\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < -5.0000000000000002e250 or 1.00000000000000009e56 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t))

    1. Initial program 99.5%

      \[\frac{60 \cdot \left(x - y\right)}{z - t} + a \cdot 120 \]
    2. Taylor expanded in x around inf

      \[\leadsto \color{blue}{60 \cdot \frac{x}{z - t}} \]
    3. Step-by-step derivation
      1. lower-*.f64N/A

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

        \[\leadsto 60 \cdot \frac{x}{\color{blue}{z - t}} \]
      3. lower--.f6427.0

        \[\leadsto 60 \cdot \frac{x}{z - \color{blue}{t}} \]
    4. Applied rewrites27.0%

      \[\leadsto \color{blue}{60 \cdot \frac{x}{z - t}} \]
    5. Taylor expanded in z around 0

      \[\leadsto -60 \cdot \color{blue}{\frac{x}{t}} \]
    6. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto -60 \cdot \frac{x}{\color{blue}{t}} \]
      2. lower-/.f6416.8

        \[\leadsto -60 \cdot \frac{x}{t} \]
    7. Applied rewrites16.8%

      \[\leadsto -60 \cdot \color{blue}{\frac{x}{t}} \]

    if -5.0000000000000002e250 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < 1.00000000000000009e56

    1. Initial program 99.5%

      \[\frac{60 \cdot \left(x - y\right)}{z - t} + a \cdot 120 \]
    2. Taylor expanded in z around inf

      \[\leadsto \color{blue}{120 \cdot a} \]
    3. Step-by-step derivation
      1. lower-*.f6450.3

        \[\leadsto 120 \cdot \color{blue}{a} \]
    4. Applied rewrites50.3%

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

Alternative 17: 50.3% accurate, 4.6× speedup?

\[\begin{array}{l} \\ 120 \cdot a \end{array} \]
(FPCore (x y z t a) :precision binary64 (* 120.0 a))
double code(double x, double y, double z, double t, double a) {
	return 120.0 * a;
}
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, a)
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), intent (in) :: a
    code = 120.0d0 * a
end function
public static double code(double x, double y, double z, double t, double a) {
	return 120.0 * a;
}
def code(x, y, z, t, a):
	return 120.0 * a
function code(x, y, z, t, a)
	return Float64(120.0 * a)
end
function tmp = code(x, y, z, t, a)
	tmp = 120.0 * a;
end
code[x_, y_, z_, t_, a_] := N[(120.0 * a), $MachinePrecision]
\begin{array}{l}

\\
120 \cdot a
\end{array}
Derivation
  1. Initial program 99.5%

    \[\frac{60 \cdot \left(x - y\right)}{z - t} + a \cdot 120 \]
  2. Taylor expanded in z around inf

    \[\leadsto \color{blue}{120 \cdot a} \]
  3. Step-by-step derivation
    1. lower-*.f6450.3

      \[\leadsto 120 \cdot \color{blue}{a} \]
  4. Applied rewrites50.3%

    \[\leadsto \color{blue}{120 \cdot a} \]
  5. Add Preprocessing

Reproduce

?
herbie shell --seed 2025151 
(FPCore (x y z t a)
  :name "Data.Colour.RGB:hslsv from colour-2.3.3, B"
  :precision binary64
  (+ (/ (* 60.0 (- x y)) (- z t)) (* a 120.0)))