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

Percentage Accurate: 99.3% → 99.4%
Time: 4.0s
Alternatives: 13
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}

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 13 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.4% accurate, 1.1× speedup?

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(a, 120, \color{blue}{\frac{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. lower-*.f64N/A

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

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

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

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

Alternative 2: 54.3% 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^{+230}:\\ \;\;\;\;\frac{y}{t} \cdot 60\\ \mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+146}:\\ \;\;\;\;120 \cdot a\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z} \cdot 60\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (/ (* 60.0 (- x y)) (- z t))))
   (if (<= t_1 -2e+230)
     (* (/ y t) 60.0)
     (if (<= t_1 2e+146) (* 120.0 a) (* (/ x z) 60.0)))))
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+230) {
		tmp = (y / t) * 60.0;
	} else if (t_1 <= 2e+146) {
		tmp = 120.0 * a;
	} else {
		tmp = (x / z) * 60.0;
	}
	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+230)) then
        tmp = (y / t) * 60.0d0
    else if (t_1 <= 2d+146) then
        tmp = 120.0d0 * a
    else
        tmp = (x / z) * 60.0d0
    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+230) {
		tmp = (y / t) * 60.0;
	} else if (t_1 <= 2e+146) {
		tmp = 120.0 * a;
	} else {
		tmp = (x / z) * 60.0;
	}
	return tmp;
}
def code(x, y, z, t, a):
	t_1 = (60.0 * (x - y)) / (z - t)
	tmp = 0
	if t_1 <= -2e+230:
		tmp = (y / t) * 60.0
	elif t_1 <= 2e+146:
		tmp = 120.0 * a
	else:
		tmp = (x / z) * 60.0
	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+230)
		tmp = Float64(Float64(y / t) * 60.0);
	elseif (t_1 <= 2e+146)
		tmp = Float64(120.0 * a);
	else
		tmp = Float64(Float64(x / z) * 60.0);
	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+230)
		tmp = (y / t) * 60.0;
	elseif (t_1 <= 2e+146)
		tmp = 120.0 * a;
	else
		tmp = (x / z) * 60.0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(60.0 * N[(x - y), $MachinePrecision]), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+230], N[(N[(y / t), $MachinePrecision] * 60.0), $MachinePrecision], If[LessEqual[t$95$1, 2e+146], N[(120.0 * a), $MachinePrecision], N[(N[(x / z), $MachinePrecision] * 60.0), $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^{+230}:\\
\;\;\;\;\frac{y}{t} \cdot 60\\

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

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


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

    1. Initial program 96.4%

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

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

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

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

        \[\leadsto \frac{y}{z - t} \cdot -60 \]
      4. lift--.f6450.1

        \[\leadsto \frac{y}{z - t} \cdot -60 \]
    4. Applied rewrites50.1%

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

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

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

        \[\leadsto \frac{y}{t} \cdot 60 \]
      3. lower-/.f6432.4

        \[\leadsto \frac{y}{t} \cdot 60 \]
    7. Applied rewrites32.4%

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

    if -2.0000000000000002e230 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < 1.99999999999999987e146

    1. Initial program 99.8%

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

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

        \[\leadsto 120 \cdot \color{blue}{a} \]
    4. Applied rewrites59.9%

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

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

    1. Initial program 98.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 54.0% accurate, 0.4× speedup?

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

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < -2.0000000000000002e230 or 5.0000000000000001e142 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t))

    1. Initial program 97.5%

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

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

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

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

        \[\leadsto \frac{y}{z - t} \cdot -60 \]
      4. lift--.f6447.6

        \[\leadsto \frac{y}{z - t} \cdot -60 \]
    4. Applied rewrites47.6%

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

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

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

        \[\leadsto \frac{y}{t} \cdot 60 \]
      3. lower-/.f6430.0

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

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

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

    1. Initial program 99.8%

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

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

        \[\leadsto 120 \cdot \color{blue}{a} \]
    4. Applied rewrites60.0%

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

Alternative 4: 59.1% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -1.2 \cdot 10^{-52}:\\ \;\;\;\;120 \cdot a\\ \mathbf{elif}\;a \leq 4.8 \cdot 10^{-267}:\\ \;\;\;\;\frac{x - y}{t} \cdot -60\\ \mathbf{elif}\;a \leq 1.4 \cdot 10^{-82}:\\ \;\;\;\;\frac{y}{z - t} \cdot -60\\ \mathbf{else}:\\ \;\;\;\;120 \cdot a\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (<= a -1.2e-52)
   (* 120.0 a)
   (if (<= a 4.8e-267)
     (* (/ (- x y) t) -60.0)
     (if (<= a 1.4e-82) (* (/ y (- z t)) -60.0) (* 120.0 a)))))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (a <= -1.2e-52) {
		tmp = 120.0 * a;
	} else if (a <= 4.8e-267) {
		tmp = ((x - y) / t) * -60.0;
	} else if (a <= 1.4e-82) {
		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 (a <= (-1.2d-52)) then
        tmp = 120.0d0 * a
    else if (a <= 4.8d-267) then
        tmp = ((x - y) / t) * (-60.0d0)
    else if (a <= 1.4d-82) 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 (a <= -1.2e-52) {
		tmp = 120.0 * a;
	} else if (a <= 4.8e-267) {
		tmp = ((x - y) / t) * -60.0;
	} else if (a <= 1.4e-82) {
		tmp = (y / (z - t)) * -60.0;
	} else {
		tmp = 120.0 * a;
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if a <= -1.2e-52:
		tmp = 120.0 * a
	elif a <= 4.8e-267:
		tmp = ((x - y) / t) * -60.0
	elif a <= 1.4e-82:
		tmp = (y / (z - t)) * -60.0
	else:
		tmp = 120.0 * a
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if (a <= -1.2e-52)
		tmp = Float64(120.0 * a);
	elseif (a <= 4.8e-267)
		tmp = Float64(Float64(Float64(x - y) / t) * -60.0);
	elseif (a <= 1.4e-82)
		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 (a <= -1.2e-52)
		tmp = 120.0 * a;
	elseif (a <= 4.8e-267)
		tmp = ((x - y) / t) * -60.0;
	elseif (a <= 1.4e-82)
		tmp = (y / (z - t)) * -60.0;
	else
		tmp = 120.0 * a;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1.2e-52], N[(120.0 * a), $MachinePrecision], If[LessEqual[a, 4.8e-267], N[(N[(N[(x - y), $MachinePrecision] / t), $MachinePrecision] * -60.0), $MachinePrecision], If[LessEqual[a, 1.4e-82], N[(N[(y / N[(z - t), $MachinePrecision]), $MachinePrecision] * -60.0), $MachinePrecision], N[(120.0 * a), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.2 \cdot 10^{-52}:\\
\;\;\;\;120 \cdot a\\

\mathbf{elif}\;a \leq 4.8 \cdot 10^{-267}:\\
\;\;\;\;\frac{x - y}{t} \cdot -60\\

\mathbf{elif}\;a \leq 1.4 \cdot 10^{-82}:\\
\;\;\;\;\frac{y}{z - t} \cdot -60\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if a < -1.2000000000000001e-52 or 1.40000000000000012e-82 < a

    1. Initial program 99.3%

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

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

        \[\leadsto 120 \cdot \color{blue}{a} \]
    4. Applied rewrites69.1%

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

    if -1.2000000000000001e-52 < a < 4.7999999999999996e-267

    1. Initial program 99.3%

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

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

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

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

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

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

        \[\leadsto \frac{\left(x - y\right) \cdot 60}{z - t} \]
      6. lift--.f6481.5

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

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

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

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

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

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

        \[\leadsto \frac{x - y}{t} \cdot -60 \]
      5. lift--.f6444.6

        \[\leadsto \frac{x - y}{t} \cdot -60 \]
    7. Applied rewrites44.6%

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

    if 4.7999999999999996e-267 < a < 1.40000000000000012e-82

    1. Initial program 99.4%

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

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

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

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

        \[\leadsto \frac{y}{z - t} \cdot -60 \]
      4. lift--.f6442.6

        \[\leadsto \frac{y}{z - t} \cdot -60 \]
    4. Applied rewrites42.6%

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

Alternative 5: 58.9% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -1.2 \cdot 10^{-52}:\\ \;\;\;\;120 \cdot a\\ \mathbf{elif}\;a \leq 6.5 \cdot 10^{-140}:\\ \;\;\;\;\frac{x - y}{t} \cdot -60\\ \mathbf{elif}\;a \leq 6.6 \cdot 10^{-82}:\\ \;\;\;\;\frac{x - y}{z} \cdot 60\\ \mathbf{else}:\\ \;\;\;\;120 \cdot a\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (<= a -1.2e-52)
   (* 120.0 a)
   (if (<= a 6.5e-140)
     (* (/ (- x y) t) -60.0)
     (if (<= a 6.6e-82) (* (/ (- x y) z) 60.0) (* 120.0 a)))))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (a <= -1.2e-52) {
		tmp = 120.0 * a;
	} else if (a <= 6.5e-140) {
		tmp = ((x - y) / t) * -60.0;
	} else if (a <= 6.6e-82) {
		tmp = ((x - y) / z) * 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 (a <= (-1.2d-52)) then
        tmp = 120.0d0 * a
    else if (a <= 6.5d-140) then
        tmp = ((x - y) / t) * (-60.0d0)
    else if (a <= 6.6d-82) then
        tmp = ((x - y) / z) * 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 (a <= -1.2e-52) {
		tmp = 120.0 * a;
	} else if (a <= 6.5e-140) {
		tmp = ((x - y) / t) * -60.0;
	} else if (a <= 6.6e-82) {
		tmp = ((x - y) / z) * 60.0;
	} else {
		tmp = 120.0 * a;
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if a <= -1.2e-52:
		tmp = 120.0 * a
	elif a <= 6.5e-140:
		tmp = ((x - y) / t) * -60.0
	elif a <= 6.6e-82:
		tmp = ((x - y) / z) * 60.0
	else:
		tmp = 120.0 * a
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if (a <= -1.2e-52)
		tmp = Float64(120.0 * a);
	elseif (a <= 6.5e-140)
		tmp = Float64(Float64(Float64(x - y) / t) * -60.0);
	elseif (a <= 6.6e-82)
		tmp = Float64(Float64(Float64(x - y) / z) * 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 (a <= -1.2e-52)
		tmp = 120.0 * a;
	elseif (a <= 6.5e-140)
		tmp = ((x - y) / t) * -60.0;
	elseif (a <= 6.6e-82)
		tmp = ((x - y) / z) * 60.0;
	else
		tmp = 120.0 * a;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1.2e-52], N[(120.0 * a), $MachinePrecision], If[LessEqual[a, 6.5e-140], N[(N[(N[(x - y), $MachinePrecision] / t), $MachinePrecision] * -60.0), $MachinePrecision], If[LessEqual[a, 6.6e-82], N[(N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision] * 60.0), $MachinePrecision], N[(120.0 * a), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.2 \cdot 10^{-52}:\\
\;\;\;\;120 \cdot a\\

\mathbf{elif}\;a \leq 6.5 \cdot 10^{-140}:\\
\;\;\;\;\frac{x - y}{t} \cdot -60\\

\mathbf{elif}\;a \leq 6.6 \cdot 10^{-82}:\\
\;\;\;\;\frac{x - y}{z} \cdot 60\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if a < -1.2000000000000001e-52 or 6.60000000000000045e-82 < a

    1. Initial program 99.3%

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

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

        \[\leadsto 120 \cdot \color{blue}{a} \]
    4. Applied rewrites69.2%

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

    if -1.2000000000000001e-52 < a < 6.4999999999999995e-140

    1. Initial program 99.3%

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

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

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

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

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

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

        \[\leadsto \frac{\left(x - y\right) \cdot 60}{z - t} \]
      6. lift--.f6482.2

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

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

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

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

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

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

        \[\leadsto \frac{x - y}{t} \cdot -60 \]
      5. lift--.f6444.0

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

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

    if 6.4999999999999995e-140 < a < 6.60000000000000045e-82

    1. Initial program 99.8%

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

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

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

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

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

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

        \[\leadsto \frac{\left(x - y\right) \cdot 60}{z - t} \]
      6. lift--.f6470.1

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

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

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

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

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

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

        \[\leadsto \frac{x - y}{z} \cdot 60 \]
      5. lift--.f6439.0

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

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

Alternative 6: 83.7% accurate, 0.8× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, -60, 120 \cdot a\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -2.1000000000000001e23

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(a, 120, \color{blue}{\frac{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. lower-*.f64N/A

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(a, 120, \frac{x - y}{t} \cdot -60\right) \]
      5. lift--.f6487.6

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

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

    if -2.1000000000000001e23 < t < 8.5000000000000001e-34

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

    if 8.5000000000000001e-34 < t

    1. Initial program 99.0%

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

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

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

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

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

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

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

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

Alternative 7: 83.7% accurate, 0.8× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -2.1000000000000001e23 or 8.5000000000000001e-34 < t

    1. Initial program 99.2%

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

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

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

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

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

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

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

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

    if -2.1000000000000001e23 < t < 8.5000000000000001e-34

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

Alternative 8: 81.6% accurate, 0.8× speedup?

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

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

\mathbf{elif}\;a \leq 10^{-81}:\\
\;\;\;\;\frac{\left(x - y\right) \cdot 60}{z - t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -2.89999999999999988e-187 or 9.9999999999999996e-82 < a

    1. Initial program 99.3%

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y}{z - t}, -60, 120 \cdot a\right) \]
      5. lower-*.f6480.8

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

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

    if -2.89999999999999988e-187 < a < 9.9999999999999996e-82

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

Alternative 9: 74.5% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -3.4 \cdot 10^{+55}:\\ \;\;\;\;120 \cdot a\\ \mathbf{elif}\;a \leq 7.6 \cdot 10^{-43}:\\ \;\;\;\;\frac{\left(x - y\right) \cdot 60}{z - t}\\ \mathbf{else}:\\ \;\;\;\;120 \cdot a\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (<= a -3.4e+55)
   (* 120.0 a)
   (if (<= a 7.6e-43) (/ (* (- x y) 60.0) (- z t)) (* 120.0 a))))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (a <= -3.4e+55) {
		tmp = 120.0 * a;
	} else if (a <= 7.6e-43) {
		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) :: tmp
    if (a <= (-3.4d+55)) then
        tmp = 120.0d0 * a
    else if (a <= 7.6d-43) 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 tmp;
	if (a <= -3.4e+55) {
		tmp = 120.0 * a;
	} else if (a <= 7.6e-43) {
		tmp = ((x - y) * 60.0) / (z - t);
	} else {
		tmp = 120.0 * a;
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if a <= -3.4e+55:
		tmp = 120.0 * a
	elif a <= 7.6e-43:
		tmp = ((x - y) * 60.0) / (z - t)
	else:
		tmp = 120.0 * a
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if (a <= -3.4e+55)
		tmp = Float64(120.0 * a);
	elseif (a <= 7.6e-43)
		tmp = Float64(Float64(Float64(x - y) * 60.0) / Float64(z - t));
	else
		tmp = Float64(120.0 * a);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if (a <= -3.4e+55)
		tmp = 120.0 * a;
	elseif (a <= 7.6e-43)
		tmp = ((x - y) * 60.0) / (z - t);
	else
		tmp = 120.0 * a;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -3.4e+55], N[(120.0 * a), $MachinePrecision], If[LessEqual[a, 7.6e-43], N[(N[(N[(x - y), $MachinePrecision] * 60.0), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision], N[(120.0 * a), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.4 \cdot 10^{+55}:\\
\;\;\;\;120 \cdot a\\

\mathbf{elif}\;a \leq 7.6 \cdot 10^{-43}:\\
\;\;\;\;\frac{\left(x - y\right) \cdot 60}{z - t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -3.3999999999999998e55 or 7.59999999999999939e-43 < a

    1. Initial program 99.4%

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

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

        \[\leadsto 120 \cdot \color{blue}{a} \]
    4. Applied rewrites74.8%

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

    if -3.3999999999999998e55 < a < 7.59999999999999939e-43

    1. Initial program 99.3%

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

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

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

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

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

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

        \[\leadsto \frac{\left(x - y\right) \cdot 60}{z - t} \]
      6. lift--.f6474.1

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

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

Alternative 10: 74.7% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -3.4 \cdot 10^{+55}:\\ \;\;\;\;120 \cdot a\\ \mathbf{elif}\;a \leq 7.6 \cdot 10^{-43}:\\ \;\;\;\;\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
 (if (<= a -3.4e+55)
   (* 120.0 a)
   (if (<= a 7.6e-43) (* (- x y) (/ 60.0 (- z t))) (* 120.0 a))))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (a <= -3.4e+55) {
		tmp = 120.0 * a;
	} else if (a <= 7.6e-43) {
		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) :: tmp
    if (a <= (-3.4d+55)) then
        tmp = 120.0d0 * a
    else if (a <= 7.6d-43) 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 tmp;
	if (a <= -3.4e+55) {
		tmp = 120.0 * a;
	} else if (a <= 7.6e-43) {
		tmp = (x - y) * (60.0 / (z - t));
	} else {
		tmp = 120.0 * a;
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if a <= -3.4e+55:
		tmp = 120.0 * a
	elif a <= 7.6e-43:
		tmp = (x - y) * (60.0 / (z - t))
	else:
		tmp = 120.0 * a
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if (a <= -3.4e+55)
		tmp = Float64(120.0 * a);
	elseif (a <= 7.6e-43)
		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)
	tmp = 0.0;
	if (a <= -3.4e+55)
		tmp = 120.0 * a;
	elseif (a <= 7.6e-43)
		tmp = (x - y) * (60.0 / (z - t));
	else
		tmp = 120.0 * a;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -3.4e+55], N[(120.0 * a), $MachinePrecision], If[LessEqual[a, 7.6e-43], 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}
\mathbf{if}\;a \leq -3.4 \cdot 10^{+55}:\\
\;\;\;\;120 \cdot a\\

\mathbf{elif}\;a \leq 7.6 \cdot 10^{-43}:\\
\;\;\;\;\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 a < -3.3999999999999998e55 or 7.59999999999999939e-43 < a

    1. Initial program 99.4%

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

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

        \[\leadsto 120 \cdot \color{blue}{a} \]
    4. Applied rewrites74.8%

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

    if -3.3999999999999998e55 < a < 7.59999999999999939e-43

    1. Initial program 99.3%

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

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

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

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

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

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

        \[\leadsto \frac{\left(x - y\right) \cdot 60}{z - t} \]
      6. lift--.f6474.1

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 61.0% accurate, 0.9× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -3.59999999999999984e-6 or 4.29999999999999963e-93 < z

    1. Initial program 99.2%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y}{z}, -60, 120 \cdot a\right) \]
      4. lift-*.f6470.0

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

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

    if -3.59999999999999984e-6 < z < 4.29999999999999963e-93

    1. Initial program 99.5%

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

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

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

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

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

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

        \[\leadsto \frac{\left(x - y\right) \cdot 60}{z - t} \]
      6. lift--.f6462.9

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

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

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

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

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

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

        \[\leadsto \frac{x - y}{t} \cdot -60 \]
      5. lift--.f6448.9

        \[\leadsto \frac{x - y}{t} \cdot -60 \]
    7. Applied rewrites48.9%

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

Alternative 12: 58.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -1.2 \cdot 10^{-52}:\\ \;\;\;\;120 \cdot a\\ \mathbf{elif}\;a \leq 2.65 \cdot 10^{-92}:\\ \;\;\;\;\frac{x - y}{t} \cdot -60\\ \mathbf{else}:\\ \;\;\;\;120 \cdot a\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (<= a -1.2e-52)
   (* 120.0 a)
   (if (<= a 2.65e-92) (* (/ (- x y) t) -60.0) (* 120.0 a))))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (a <= -1.2e-52) {
		tmp = 120.0 * a;
	} else if (a <= 2.65e-92) {
		tmp = ((x - 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) :: tmp
    if (a <= (-1.2d-52)) then
        tmp = 120.0d0 * a
    else if (a <= 2.65d-92) then
        tmp = ((x - 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 tmp;
	if (a <= -1.2e-52) {
		tmp = 120.0 * a;
	} else if (a <= 2.65e-92) {
		tmp = ((x - y) / t) * -60.0;
	} else {
		tmp = 120.0 * a;
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if a <= -1.2e-52:
		tmp = 120.0 * a
	elif a <= 2.65e-92:
		tmp = ((x - y) / t) * -60.0
	else:
		tmp = 120.0 * a
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if (a <= -1.2e-52)
		tmp = Float64(120.0 * a);
	elseif (a <= 2.65e-92)
		tmp = Float64(Float64(Float64(x - y) / 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 (a <= -1.2e-52)
		tmp = 120.0 * a;
	elseif (a <= 2.65e-92)
		tmp = ((x - y) / t) * -60.0;
	else
		tmp = 120.0 * a;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1.2e-52], N[(120.0 * a), $MachinePrecision], If[LessEqual[a, 2.65e-92], N[(N[(N[(x - y), $MachinePrecision] / t), $MachinePrecision] * -60.0), $MachinePrecision], N[(120.0 * a), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.2 \cdot 10^{-52}:\\
\;\;\;\;120 \cdot a\\

\mathbf{elif}\;a \leq 2.65 \cdot 10^{-92}:\\
\;\;\;\;\frac{x - y}{t} \cdot -60\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -1.2000000000000001e-52 or 2.65000000000000015e-92 < a

    1. Initial program 99.3%

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

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

        \[\leadsto 120 \cdot \color{blue}{a} \]
    4. Applied rewrites68.8%

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

    if -1.2000000000000001e-52 < a < 2.65000000000000015e-92

    1. Initial program 99.3%

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

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

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

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

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

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

        \[\leadsto \frac{\left(x - y\right) \cdot 60}{z - t} \]
      6. lift--.f6481.1

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

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

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

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

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

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

        \[\leadsto \frac{x - y}{t} \cdot -60 \]
      5. lift--.f6443.3

        \[\leadsto \frac{x - y}{t} \cdot -60 \]
    7. Applied rewrites43.3%

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

Alternative 13: 50.0% 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.3%

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

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

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

    \[\leadsto \color{blue}{120 \cdot a} \]
  5. 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 2025106 
(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)))