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

Percentage Accurate: 99.3% → 99.8%
Time: 7.9s
Alternatives: 10
Speedup: 1.1×

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}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 10 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.3% 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.1× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(a, 120, \frac{60}{z - t} \cdot \left(x - y\right)\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(Float64(60.0 / Float64(z - t)) * Float64(x - y)))
end
code[x_, y_, z_, t_, a_] := N[(a * 120.0 + N[(N[(60.0 / N[(z - t), $MachinePrecision]), $MachinePrecision] * N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

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

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

      \[\leadsto \frac{60 \cdot \left(x - y\right)}{z - t} + \color{blue}{a \cdot 120} \]
    3. fp-cancel-sign-sub-invN/A

      \[\leadsto \color{blue}{\frac{60 \cdot \left(x - y\right)}{z - t} - \left(\mathsf{neg}\left(a\right)\right) \cdot 120} \]
    4. fp-cancel-sub-sign-invN/A

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

      \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(a\right)\right)\right)\right) \cdot 120 + \frac{60 \cdot \left(x - y\right)}{z - t}} \]
    6. remove-double-negN/A

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

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

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

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

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

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

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

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

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

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

Alternative 2: 54.8% 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 -2 \cdot 10^{+172} \lor \neg \left(t\_1 \leq 5 \cdot 10^{+188}\right):\\ \;\;\;\;\frac{y}{t} \cdot 60\\ \mathbf{else}:\\ \;\;\;\;120 \cdot a\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (/ (* 60.0 (- x y)) (- z t))))
   (if (or (<= t_1 -2e+172) (not (<= t_1 5e+188)))
     (* (/ y t) 60.0)
     (* 120.0 a))))
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 <= -2e+172) || !(t_1 <= 5e+188)) {
		tmp = (y / t) * 60.0;
	} else {
		tmp = 120.0 * a;
	}
	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 <= (-2d+172)) .or. (.not. (t_1 <= 5d+188))) then
        tmp = (y / t) * 60.0d0
    else
        tmp = 120.0d0 * a
    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 <= -2e+172) || !(t_1 <= 5e+188)) {
		tmp = (y / t) * 60.0;
	} else {
		tmp = 120.0 * a;
	}
	return tmp;
}
def code(x, y, z, t, a):
	t_1 = (60.0 * (x - y)) / (z - t)
	tmp = 0
	if (t_1 <= -2e+172) or not (t_1 <= 5e+188):
		tmp = (y / t) * 60.0
	else:
		tmp = 120.0 * a
	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 <= -2e+172) || !(t_1 <= 5e+188))
		tmp = Float64(Float64(y / t) * 60.0);
	else
		tmp = Float64(120.0 * a);
	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 <= -2e+172) || ~((t_1 <= 5e+188)))
		tmp = (y / t) * 60.0;
	else
		tmp = 120.0 * a;
	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[Or[LessEqual[t$95$1, -2e+172], N[Not[LessEqual[t$95$1, 5e+188]], $MachinePrecision]], N[(N[(y / t), $MachinePrecision] * 60.0), $MachinePrecision], N[(120.0 * a), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{else}:\\
\;\;\;\;120 \cdot a\\


\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)) < -2.0000000000000002e172 or 5.0000000000000001e188 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t))

    1. Initial program 96.0%

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

      \[\leadsto \color{blue}{60 \cdot \frac{x - y}{z - t}} \]
    4. Step-by-step derivation
      1. associate-*r/N/A

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(x - y\right) \cdot \frac{60}{\color{blue}{z}} \]
    7. Step-by-step derivation
      1. Applied rewrites59.4%

        \[\leadsto \left(x - y\right) \cdot \frac{60}{\color{blue}{z}} \]
      2. Taylor expanded in x around 0

        \[\leadsto -60 \cdot \color{blue}{\frac{y}{z - t}} \]
      3. Step-by-step derivation
        1. Applied rewrites51.2%

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

          \[\leadsto 60 \cdot \frac{y}{\color{blue}{t}} \]
        3. Step-by-step derivation
          1. Applied rewrites29.9%

            \[\leadsto \frac{y}{t} \cdot 60 \]

          if -2.0000000000000002e172 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < 5.0000000000000001e188

          1. Initial program 99.8%

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

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

              \[\leadsto \color{blue}{120 \cdot a} \]
          5. Applied rewrites65.0%

            \[\leadsto \color{blue}{120 \cdot a} \]
        4. Recombined 2 regimes into one program.
        5. Final simplification58.2%

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

        Alternative 3: 67.6% accurate, 0.6× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_1 := 60 \cdot \left(x - y\right)\\ \mathbf{if}\;t\_1 \leq -2 \cdot 10^{+129} \lor \neg \left(t\_1 \leq 5 \cdot 10^{+105}\right):\\ \;\;\;\;\left(x - y\right) \cdot \frac{60}{z - t}\\ \mathbf{else}:\\ \;\;\;\;120 \cdot a\\ \end{array} \end{array} \]
        (FPCore (x y z t a)
         :precision binary64
         (let* ((t_1 (* 60.0 (- x y))))
           (if (or (<= t_1 -2e+129) (not (<= t_1 5e+105)))
             (* (- x y) (/ 60.0 (- z t)))
             (* 120.0 a))))
        double code(double x, double y, double z, double t, double a) {
        	double t_1 = 60.0 * (x - y);
        	double tmp;
        	if ((t_1 <= -2e+129) || !(t_1 <= 5e+105)) {
        		tmp = (x - y) * (60.0 / (z - t));
        	} else {
        		tmp = 120.0 * a;
        	}
        	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)
            if ((t_1 <= (-2d+129)) .or. (.not. (t_1 <= 5d+105))) then
                tmp = (x - y) * (60.0d0 / (z - t))
            else
                tmp = 120.0d0 * a
            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);
        	double tmp;
        	if ((t_1 <= -2e+129) || !(t_1 <= 5e+105)) {
        		tmp = (x - y) * (60.0 / (z - t));
        	} else {
        		tmp = 120.0 * a;
        	}
        	return tmp;
        }
        
        def code(x, y, z, t, a):
        	t_1 = 60.0 * (x - y)
        	tmp = 0
        	if (t_1 <= -2e+129) or not (t_1 <= 5e+105):
        		tmp = (x - y) * (60.0 / (z - t))
        	else:
        		tmp = 120.0 * a
        	return tmp
        
        function code(x, y, z, t, a)
        	t_1 = Float64(60.0 * Float64(x - y))
        	tmp = 0.0
        	if ((t_1 <= -2e+129) || !(t_1 <= 5e+105))
        		tmp = Float64(Float64(x - y) * Float64(60.0 / Float64(z - t)));
        	else
        		tmp = Float64(120.0 * a);
        	end
        	return tmp
        end
        
        function tmp_2 = code(x, y, z, t, a)
        	t_1 = 60.0 * (x - y);
        	tmp = 0.0;
        	if ((t_1 <= -2e+129) || ~((t_1 <= 5e+105)))
        		tmp = (x - y) * (60.0 / (z - t));
        	else
        		tmp = 120.0 * a;
        	end
        	tmp_2 = tmp;
        end
        
        code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(60.0 * N[(x - y), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -2e+129], N[Not[LessEqual[t$95$1, 5e+105]], $MachinePrecision]], N[(N[(x - y), $MachinePrecision] * N[(60.0 / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(120.0 * a), $MachinePrecision]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_1 := 60 \cdot \left(x - y\right)\\
        \mathbf{if}\;t\_1 \leq -2 \cdot 10^{+129} \lor \neg \left(t\_1 \leq 5 \cdot 10^{+105}\right):\\
        \;\;\;\;\left(x - y\right) \cdot \frac{60}{z - t}\\
        
        \mathbf{else}:\\
        \;\;\;\;120 \cdot a\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if (*.f64 #s(literal 60 binary64) (-.f64 x y)) < -2e129 or 5.00000000000000046e105 < (*.f64 #s(literal 60 binary64) (-.f64 x y))

          1. Initial program 98.3%

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

            \[\leadsto \color{blue}{60 \cdot \frac{x - y}{z - t}} \]
          4. Step-by-step derivation
            1. associate-*r/N/A

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

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

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

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

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

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

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

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

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

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

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

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

          if -2e129 < (*.f64 #s(literal 60 binary64) (-.f64 x y)) < 5.00000000000000046e105

          1. Initial program 99.8%

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

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

              \[\leadsto \color{blue}{120 \cdot a} \]
          5. Applied rewrites83.2%

            \[\leadsto \color{blue}{120 \cdot a} \]
        3. Recombined 2 regimes into one program.
        4. Final simplification79.8%

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

        Alternative 4: 67.3% accurate, 0.6× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_1 := 60 \cdot \left(x - y\right)\\ \mathbf{if}\;t\_1 \leq -2 \cdot 10^{+129} \lor \neg \left(t\_1 \leq 5 \cdot 10^{+105}\right):\\ \;\;\;\;\frac{-60 \cdot \left(y - x\right)}{z - t}\\ \mathbf{else}:\\ \;\;\;\;120 \cdot a\\ \end{array} \end{array} \]
        (FPCore (x y z t a)
         :precision binary64
         (let* ((t_1 (* 60.0 (- x y))))
           (if (or (<= t_1 -2e+129) (not (<= t_1 5e+105)))
             (/ (* -60.0 (- y x)) (- z t))
             (* 120.0 a))))
        double code(double x, double y, double z, double t, double a) {
        	double t_1 = 60.0 * (x - y);
        	double tmp;
        	if ((t_1 <= -2e+129) || !(t_1 <= 5e+105)) {
        		tmp = (-60.0 * (y - x)) / (z - t);
        	} else {
        		tmp = 120.0 * a;
        	}
        	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)
            if ((t_1 <= (-2d+129)) .or. (.not. (t_1 <= 5d+105))) then
                tmp = ((-60.0d0) * (y - x)) / (z - t)
            else
                tmp = 120.0d0 * a
            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);
        	double tmp;
        	if ((t_1 <= -2e+129) || !(t_1 <= 5e+105)) {
        		tmp = (-60.0 * (y - x)) / (z - t);
        	} else {
        		tmp = 120.0 * a;
        	}
        	return tmp;
        }
        
        def code(x, y, z, t, a):
        	t_1 = 60.0 * (x - y)
        	tmp = 0
        	if (t_1 <= -2e+129) or not (t_1 <= 5e+105):
        		tmp = (-60.0 * (y - x)) / (z - t)
        	else:
        		tmp = 120.0 * a
        	return tmp
        
        function code(x, y, z, t, a)
        	t_1 = Float64(60.0 * Float64(x - y))
        	tmp = 0.0
        	if ((t_1 <= -2e+129) || !(t_1 <= 5e+105))
        		tmp = Float64(Float64(-60.0 * Float64(y - x)) / Float64(z - t));
        	else
        		tmp = Float64(120.0 * a);
        	end
        	return tmp
        end
        
        function tmp_2 = code(x, y, z, t, a)
        	t_1 = 60.0 * (x - y);
        	tmp = 0.0;
        	if ((t_1 <= -2e+129) || ~((t_1 <= 5e+105)))
        		tmp = (-60.0 * (y - x)) / (z - t);
        	else
        		tmp = 120.0 * a;
        	end
        	tmp_2 = tmp;
        end
        
        code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(60.0 * N[(x - y), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -2e+129], N[Not[LessEqual[t$95$1, 5e+105]], $MachinePrecision]], N[(N[(-60.0 * N[(y - x), $MachinePrecision]), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision], N[(120.0 * a), $MachinePrecision]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_1 := 60 \cdot \left(x - y\right)\\
        \mathbf{if}\;t\_1 \leq -2 \cdot 10^{+129} \lor \neg \left(t\_1 \leq 5 \cdot 10^{+105}\right):\\
        \;\;\;\;\frac{-60 \cdot \left(y - x\right)}{z - t}\\
        
        \mathbf{else}:\\
        \;\;\;\;120 \cdot a\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if (*.f64 #s(literal 60 binary64) (-.f64 x y)) < -2e129 or 5.00000000000000046e105 < (*.f64 #s(literal 60 binary64) (-.f64 x y))

          1. Initial program 98.3%

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

            \[\leadsto \color{blue}{60 \cdot \frac{x - y}{z - t}} \]
          4. Step-by-step derivation
            1. associate-*r/N/A

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \left(x - y\right) \cdot \frac{60}{\color{blue}{z}} \]
          7. Step-by-step derivation
            1. Applied rewrites42.1%

              \[\leadsto \left(x - y\right) \cdot \frac{60}{\color{blue}{z}} \]
            2. Taylor expanded in x around 0

              \[\leadsto -60 \cdot \frac{y}{z - t} + \color{blue}{60 \cdot \frac{x}{z - t}} \]
            3. Step-by-step derivation
              1. Applied rewrites75.9%

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

              if -2e129 < (*.f64 #s(literal 60 binary64) (-.f64 x y)) < 5.00000000000000046e105

              1. Initial program 99.8%

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

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

                  \[\leadsto \color{blue}{120 \cdot a} \]
              5. Applied rewrites83.2%

                \[\leadsto \color{blue}{120 \cdot a} \]
            4. Recombined 2 regimes into one program.
            5. Final simplification79.4%

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

            Alternative 5: 88.7% accurate, 0.8× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -4.6 \cdot 10^{+57} \lor \neg \left(x \leq 6.5 \cdot 10^{+92}\right):\\ \;\;\;\;\mathsf{fma}\left(a, 120, \frac{x \cdot 60}{z - t}\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(120, a, \frac{y}{z - t} \cdot -60\right)\\ \end{array} \end{array} \]
            (FPCore (x y z t a)
             :precision binary64
             (if (or (<= x -4.6e+57) (not (<= x 6.5e+92)))
               (fma a 120.0 (/ (* x 60.0) (- z t)))
               (fma 120.0 a (* (/ y (- z t)) -60.0))))
            double code(double x, double y, double z, double t, double a) {
            	double tmp;
            	if ((x <= -4.6e+57) || !(x <= 6.5e+92)) {
            		tmp = fma(a, 120.0, ((x * 60.0) / (z - t)));
            	} else {
            		tmp = fma(120.0, a, ((y / (z - t)) * -60.0));
            	}
            	return tmp;
            }
            
            function code(x, y, z, t, a)
            	tmp = 0.0
            	if ((x <= -4.6e+57) || !(x <= 6.5e+92))
            		tmp = fma(a, 120.0, Float64(Float64(x * 60.0) / Float64(z - t)));
            	else
            		tmp = fma(120.0, a, Float64(Float64(y / Float64(z - t)) * -60.0));
            	end
            	return tmp
            end
            
            code[x_, y_, z_, t_, a_] := If[Or[LessEqual[x, -4.6e+57], N[Not[LessEqual[x, 6.5e+92]], $MachinePrecision]], N[(a * 120.0 + N[(N[(x * 60.0), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(120.0 * a + N[(N[(y / N[(z - t), $MachinePrecision]), $MachinePrecision] * -60.0), $MachinePrecision]), $MachinePrecision]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            \mathbf{if}\;x \leq -4.6 \cdot 10^{+57} \lor \neg \left(x \leq 6.5 \cdot 10^{+92}\right):\\
            \;\;\;\;\mathsf{fma}\left(a, 120, \frac{x \cdot 60}{z - t}\right)\\
            
            \mathbf{else}:\\
            \;\;\;\;\mathsf{fma}\left(120, a, \frac{y}{z - t} \cdot -60\right)\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if x < -4.5999999999999998e57 or 6.49999999999999999e92 < x

              1. Initial program 98.7%

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

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

                  \[\leadsto \frac{\color{blue}{60 \cdot x}}{z - t} + a \cdot 120 \]
              5. Applied rewrites93.2%

                \[\leadsto \frac{\color{blue}{60 \cdot x}}{z - t} + a \cdot 120 \]
              6. 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.f6493.3

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

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

              if -4.5999999999999998e57 < x < 6.49999999999999999e92

              1. Initial program 99.2%

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

                \[\leadsto \color{blue}{-60 \cdot \frac{y}{z - t} + 120 \cdot a} \]
              4. Step-by-step derivation
                1. +-commutativeN/A

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

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

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

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

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

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

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

              \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -4.6 \cdot 10^{+57} \lor \neg \left(x \leq 6.5 \cdot 10^{+92}\right):\\ \;\;\;\;\mathsf{fma}\left(a, 120, \frac{x \cdot 60}{z - t}\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(120, a, \frac{y}{z - t} \cdot -60\right)\\ \end{array} \]
            5. Add Preprocessing

            Alternative 6: 81.5% accurate, 0.8× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1.1 \cdot 10^{+159} \lor \neg \left(x \leq 2.65 \cdot 10^{+109}\right):\\ \;\;\;\;\frac{-60 \cdot \left(y - x\right)}{z - t}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(120, a, \frac{y}{z - t} \cdot -60\right)\\ \end{array} \end{array} \]
            (FPCore (x y z t a)
             :precision binary64
             (if (or (<= x -1.1e+159) (not (<= x 2.65e+109)))
               (/ (* -60.0 (- y x)) (- z t))
               (fma 120.0 a (* (/ y (- z t)) -60.0))))
            double code(double x, double y, double z, double t, double a) {
            	double tmp;
            	if ((x <= -1.1e+159) || !(x <= 2.65e+109)) {
            		tmp = (-60.0 * (y - x)) / (z - t);
            	} else {
            		tmp = fma(120.0, a, ((y / (z - t)) * -60.0));
            	}
            	return tmp;
            }
            
            function code(x, y, z, t, a)
            	tmp = 0.0
            	if ((x <= -1.1e+159) || !(x <= 2.65e+109))
            		tmp = Float64(Float64(-60.0 * Float64(y - x)) / Float64(z - t));
            	else
            		tmp = fma(120.0, a, Float64(Float64(y / Float64(z - t)) * -60.0));
            	end
            	return tmp
            end
            
            code[x_, y_, z_, t_, a_] := If[Or[LessEqual[x, -1.1e+159], N[Not[LessEqual[x, 2.65e+109]], $MachinePrecision]], N[(N[(-60.0 * N[(y - x), $MachinePrecision]), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision], N[(120.0 * a + N[(N[(y / N[(z - t), $MachinePrecision]), $MachinePrecision] * -60.0), $MachinePrecision]), $MachinePrecision]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            \mathbf{if}\;x \leq -1.1 \cdot 10^{+159} \lor \neg \left(x \leq 2.65 \cdot 10^{+109}\right):\\
            \;\;\;\;\frac{-60 \cdot \left(y - x\right)}{z - t}\\
            
            \mathbf{else}:\\
            \;\;\;\;\mathsf{fma}\left(120, a, \frac{y}{z - t} \cdot -60\right)\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if x < -1.1e159 or 2.65000000000000013e109 < x

              1. Initial program 98.4%

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

                \[\leadsto \color{blue}{60 \cdot \frac{x - y}{z - t}} \]
              4. Step-by-step derivation
                1. associate-*r/N/A

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \left(x - y\right) \cdot \frac{60}{\color{blue}{z}} \]
              7. Step-by-step derivation
                1. Applied rewrites41.5%

                  \[\leadsto \left(x - y\right) \cdot \frac{60}{\color{blue}{z}} \]
                2. Taylor expanded in x around 0

                  \[\leadsto -60 \cdot \frac{y}{z - t} + \color{blue}{60 \cdot \frac{x}{z - t}} \]
                3. Step-by-step derivation
                  1. Applied rewrites76.7%

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

                  if -1.1e159 < x < 2.65000000000000013e109

                  1. Initial program 99.3%

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

                    \[\leadsto \color{blue}{-60 \cdot \frac{y}{z - t} + 120 \cdot a} \]
                  4. Step-by-step derivation
                    1. +-commutativeN/A

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

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

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

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

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

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

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

                  \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.1 \cdot 10^{+159} \lor \neg \left(x \leq 2.65 \cdot 10^{+109}\right):\\ \;\;\;\;\frac{-60 \cdot \left(y - x\right)}{z - t}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(120, a, \frac{y}{z - t} \cdot -60\right)\\ \end{array} \]
                6. Add Preprocessing

                Alternative 7: 58.1% accurate, 0.9× speedup?

                \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -4.8 \cdot 10^{+212}:\\ \;\;\;\;\frac{y}{z - t} \cdot -60\\ \mathbf{elif}\;y \leq 2.8 \cdot 10^{+106}:\\ \;\;\;\;120 \cdot a\\ \mathbf{else}:\\ \;\;\;\;\left(-y\right) \cdot \frac{60}{z - t}\\ \end{array} \end{array} \]
                (FPCore (x y z t a)
                 :precision binary64
                 (if (<= y -4.8e+212)
                   (* (/ y (- z t)) -60.0)
                   (if (<= y 2.8e+106) (* 120.0 a) (* (- y) (/ 60.0 (- z t))))))
                double code(double x, double y, double z, double t, double a) {
                	double tmp;
                	if (y <= -4.8e+212) {
                		tmp = (y / (z - t)) * -60.0;
                	} else if (y <= 2.8e+106) {
                		tmp = 120.0 * a;
                	} else {
                		tmp = -y * (60.0 / (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) :: tmp
                    if (y <= (-4.8d+212)) then
                        tmp = (y / (z - t)) * (-60.0d0)
                    else if (y <= 2.8d+106) then
                        tmp = 120.0d0 * a
                    else
                        tmp = -y * (60.0d0 / (z - t))
                    end if
                    code = tmp
                end function
                
                public static double code(double x, double y, double z, double t, double a) {
                	double tmp;
                	if (y <= -4.8e+212) {
                		tmp = (y / (z - t)) * -60.0;
                	} else if (y <= 2.8e+106) {
                		tmp = 120.0 * a;
                	} else {
                		tmp = -y * (60.0 / (z - t));
                	}
                	return tmp;
                }
                
                def code(x, y, z, t, a):
                	tmp = 0
                	if y <= -4.8e+212:
                		tmp = (y / (z - t)) * -60.0
                	elif y <= 2.8e+106:
                		tmp = 120.0 * a
                	else:
                		tmp = -y * (60.0 / (z - t))
                	return tmp
                
                function code(x, y, z, t, a)
                	tmp = 0.0
                	if (y <= -4.8e+212)
                		tmp = Float64(Float64(y / Float64(z - t)) * -60.0);
                	elseif (y <= 2.8e+106)
                		tmp = Float64(120.0 * a);
                	else
                		tmp = Float64(Float64(-y) * Float64(60.0 / Float64(z - t)));
                	end
                	return tmp
                end
                
                function tmp_2 = code(x, y, z, t, a)
                	tmp = 0.0;
                	if (y <= -4.8e+212)
                		tmp = (y / (z - t)) * -60.0;
                	elseif (y <= 2.8e+106)
                		tmp = 120.0 * a;
                	else
                		tmp = -y * (60.0 / (z - t));
                	end
                	tmp_2 = tmp;
                end
                
                code[x_, y_, z_, t_, a_] := If[LessEqual[y, -4.8e+212], N[(N[(y / N[(z - t), $MachinePrecision]), $MachinePrecision] * -60.0), $MachinePrecision], If[LessEqual[y, 2.8e+106], N[(120.0 * a), $MachinePrecision], N[((-y) * N[(60.0 / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
                
                \begin{array}{l}
                
                \\
                \begin{array}{l}
                \mathbf{if}\;y \leq -4.8 \cdot 10^{+212}:\\
                \;\;\;\;\frac{y}{z - t} \cdot -60\\
                
                \mathbf{elif}\;y \leq 2.8 \cdot 10^{+106}:\\
                \;\;\;\;120 \cdot a\\
                
                \mathbf{else}:\\
                \;\;\;\;\left(-y\right) \cdot \frac{60}{z - t}\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 3 regimes
                2. if y < -4.8e212

                  1. Initial program 95.1%

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

                    \[\leadsto \color{blue}{60 \cdot \frac{x - y}{z - t}} \]
                  4. Step-by-step derivation
                    1. associate-*r/N/A

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

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto \left(x - y\right) \cdot \frac{60}{\color{blue}{z}} \]
                  7. Step-by-step derivation
                    1. Applied rewrites67.6%

                      \[\leadsto \left(x - y\right) \cdot \frac{60}{\color{blue}{z}} \]
                    2. Taylor expanded in x around 0

                      \[\leadsto -60 \cdot \color{blue}{\frac{y}{z - t}} \]
                    3. Step-by-step derivation
                      1. Applied rewrites86.2%

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

                      if -4.8e212 < y < 2.79999999999999993e106

                      1. Initial program 99.8%

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

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

                          \[\leadsto \color{blue}{120 \cdot a} \]
                      5. Applied rewrites63.7%

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

                      if 2.79999999999999993e106 < y

                      1. Initial program 97.1%

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

                        \[\leadsto \color{blue}{60 \cdot \frac{x - y}{z - t}} \]
                      4. Step-by-step derivation
                        1. associate-*r/N/A

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

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

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

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

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

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

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

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

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

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

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

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

                        \[\leadsto \left(-1 \cdot y\right) \cdot \frac{\color{blue}{60}}{z - t} \]
                      7. Step-by-step derivation
                        1. Applied rewrites73.5%

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

                      Alternative 8: 58.1% accurate, 1.0× speedup?

                      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -4.8 \cdot 10^{+212} \lor \neg \left(y \leq 2.8 \cdot 10^{+106}\right):\\ \;\;\;\;\frac{y}{z - t} \cdot -60\\ \mathbf{else}:\\ \;\;\;\;120 \cdot a\\ \end{array} \end{array} \]
                      (FPCore (x y z t a)
                       :precision binary64
                       (if (or (<= y -4.8e+212) (not (<= y 2.8e+106)))
                         (* (/ y (- z t)) -60.0)
                         (* 120.0 a)))
                      double code(double x, double y, double z, double t, double a) {
                      	double tmp;
                      	if ((y <= -4.8e+212) || !(y <= 2.8e+106)) {
                      		tmp = (y / (z - t)) * -60.0;
                      	} else {
                      		tmp = 120.0 * a;
                      	}
                      	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) :: tmp
                          if ((y <= (-4.8d+212)) .or. (.not. (y <= 2.8d+106))) then
                              tmp = (y / (z - t)) * (-60.0d0)
                          else
                              tmp = 120.0d0 * a
                          end if
                          code = tmp
                      end function
                      
                      public static double code(double x, double y, double z, double t, double a) {
                      	double tmp;
                      	if ((y <= -4.8e+212) || !(y <= 2.8e+106)) {
                      		tmp = (y / (z - t)) * -60.0;
                      	} else {
                      		tmp = 120.0 * a;
                      	}
                      	return tmp;
                      }
                      
                      def code(x, y, z, t, a):
                      	tmp = 0
                      	if (y <= -4.8e+212) or not (y <= 2.8e+106):
                      		tmp = (y / (z - t)) * -60.0
                      	else:
                      		tmp = 120.0 * a
                      	return tmp
                      
                      function code(x, y, z, t, a)
                      	tmp = 0.0
                      	if ((y <= -4.8e+212) || !(y <= 2.8e+106))
                      		tmp = Float64(Float64(y / Float64(z - t)) * -60.0);
                      	else
                      		tmp = Float64(120.0 * a);
                      	end
                      	return tmp
                      end
                      
                      function tmp_2 = code(x, y, z, t, a)
                      	tmp = 0.0;
                      	if ((y <= -4.8e+212) || ~((y <= 2.8e+106)))
                      		tmp = (y / (z - t)) * -60.0;
                      	else
                      		tmp = 120.0 * a;
                      	end
                      	tmp_2 = tmp;
                      end
                      
                      code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -4.8e+212], N[Not[LessEqual[y, 2.8e+106]], $MachinePrecision]], N[(N[(y / N[(z - t), $MachinePrecision]), $MachinePrecision] * -60.0), $MachinePrecision], N[(120.0 * a), $MachinePrecision]]
                      
                      \begin{array}{l}
                      
                      \\
                      \begin{array}{l}
                      \mathbf{if}\;y \leq -4.8 \cdot 10^{+212} \lor \neg \left(y \leq 2.8 \cdot 10^{+106}\right):\\
                      \;\;\;\;\frac{y}{z - t} \cdot -60\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;120 \cdot a\\
                      
                      
                      \end{array}
                      \end{array}
                      
                      Derivation
                      1. Split input into 2 regimes
                      2. if y < -4.8e212 or 2.79999999999999993e106 < y

                        1. Initial program 96.4%

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

                          \[\leadsto \color{blue}{60 \cdot \frac{x - y}{z - t}} \]
                        4. Step-by-step derivation
                          1. associate-*r/N/A

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

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

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

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

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

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

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

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

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

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

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

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

                          \[\leadsto \left(x - y\right) \cdot \frac{60}{\color{blue}{z}} \]
                        7. Step-by-step derivation
                          1. Applied rewrites54.7%

                            \[\leadsto \left(x - y\right) \cdot \frac{60}{\color{blue}{z}} \]
                          2. Taylor expanded in x around 0

                            \[\leadsto -60 \cdot \color{blue}{\frac{y}{z - t}} \]
                          3. Step-by-step derivation
                            1. Applied rewrites78.1%

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

                            if -4.8e212 < y < 2.79999999999999993e106

                            1. Initial program 99.8%

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

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

                                \[\leadsto \color{blue}{120 \cdot a} \]
                            5. Applied rewrites63.7%

                              \[\leadsto \color{blue}{120 \cdot a} \]
                          4. Recombined 2 regimes into one program.
                          5. Final simplification67.0%

                            \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -4.8 \cdot 10^{+212} \lor \neg \left(y \leq 2.8 \cdot 10^{+106}\right):\\ \;\;\;\;\frac{y}{z - t} \cdot -60\\ \mathbf{else}:\\ \;\;\;\;120 \cdot a\\ \end{array} \]
                          6. Add Preprocessing

                          Alternative 9: 52.3% accurate, 1.1× speedup?

                          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -4.5 \cdot 10^{+218} \lor \neg \left(y \leq 3.3 \cdot 10^{+157}\right):\\ \;\;\;\;y \cdot \frac{-60}{z}\\ \mathbf{else}:\\ \;\;\;\;120 \cdot a\\ \end{array} \end{array} \]
                          (FPCore (x y z t a)
                           :precision binary64
                           (if (or (<= y -4.5e+218) (not (<= y 3.3e+157)))
                             (* y (/ -60.0 z))
                             (* 120.0 a)))
                          double code(double x, double y, double z, double t, double a) {
                          	double tmp;
                          	if ((y <= -4.5e+218) || !(y <= 3.3e+157)) {
                          		tmp = y * (-60.0 / z);
                          	} else {
                          		tmp = 120.0 * a;
                          	}
                          	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) :: tmp
                              if ((y <= (-4.5d+218)) .or. (.not. (y <= 3.3d+157))) then
                                  tmp = y * ((-60.0d0) / z)
                              else
                                  tmp = 120.0d0 * a
                              end if
                              code = tmp
                          end function
                          
                          public static double code(double x, double y, double z, double t, double a) {
                          	double tmp;
                          	if ((y <= -4.5e+218) || !(y <= 3.3e+157)) {
                          		tmp = y * (-60.0 / z);
                          	} else {
                          		tmp = 120.0 * a;
                          	}
                          	return tmp;
                          }
                          
                          def code(x, y, z, t, a):
                          	tmp = 0
                          	if (y <= -4.5e+218) or not (y <= 3.3e+157):
                          		tmp = y * (-60.0 / z)
                          	else:
                          		tmp = 120.0 * a
                          	return tmp
                          
                          function code(x, y, z, t, a)
                          	tmp = 0.0
                          	if ((y <= -4.5e+218) || !(y <= 3.3e+157))
                          		tmp = Float64(y * Float64(-60.0 / z));
                          	else
                          		tmp = Float64(120.0 * a);
                          	end
                          	return tmp
                          end
                          
                          function tmp_2 = code(x, y, z, t, a)
                          	tmp = 0.0;
                          	if ((y <= -4.5e+218) || ~((y <= 3.3e+157)))
                          		tmp = y * (-60.0 / z);
                          	else
                          		tmp = 120.0 * a;
                          	end
                          	tmp_2 = tmp;
                          end
                          
                          code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -4.5e+218], N[Not[LessEqual[y, 3.3e+157]], $MachinePrecision]], N[(y * N[(-60.0 / z), $MachinePrecision]), $MachinePrecision], N[(120.0 * a), $MachinePrecision]]
                          
                          \begin{array}{l}
                          
                          \\
                          \begin{array}{l}
                          \mathbf{if}\;y \leq -4.5 \cdot 10^{+218} \lor \neg \left(y \leq 3.3 \cdot 10^{+157}\right):\\
                          \;\;\;\;y \cdot \frac{-60}{z}\\
                          
                          \mathbf{else}:\\
                          \;\;\;\;120 \cdot a\\
                          
                          
                          \end{array}
                          \end{array}
                          
                          Derivation
                          1. Split input into 2 regimes
                          2. if y < -4.50000000000000008e218 or 3.3000000000000002e157 < y

                            1. Initial program 95.4%

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

                              \[\leadsto \color{blue}{60 \cdot \frac{x - y}{z} + 120 \cdot a} \]
                            4. Step-by-step derivation
                              1. *-commutativeN/A

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

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

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

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

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

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

                              \[\leadsto -60 \cdot \color{blue}{\frac{y}{z}} \]
                            7. Step-by-step derivation
                              1. Applied rewrites58.4%

                                \[\leadsto \frac{y}{z} \cdot \color{blue}{-60} \]
                              2. Step-by-step derivation
                                1. Applied rewrites58.5%

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

                                if -4.50000000000000008e218 < y < 3.3000000000000002e157

                                1. Initial program 99.8%

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

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

                                    \[\leadsto \color{blue}{120 \cdot a} \]
                                5. Applied rewrites61.5%

                                  \[\leadsto \color{blue}{120 \cdot a} \]
                              3. Recombined 2 regimes into one program.
                              4. Final simplification61.0%

                                \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -4.5 \cdot 10^{+218} \lor \neg \left(y \leq 3.3 \cdot 10^{+157}\right):\\ \;\;\;\;y \cdot \frac{-60}{z}\\ \mathbf{else}:\\ \;\;\;\;120 \cdot a\\ \end{array} \]
                              5. Add Preprocessing

                              Alternative 10: 50.6% accurate, 5.2× 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.0%

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

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

                                  \[\leadsto \color{blue}{120 \cdot a} \]
                              5. Applied rewrites52.9%

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

                              Developer Target 1: 99.8% accurate, 0.8× speedup?

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

                              Reproduce

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