Numeric.Signal.Multichannel:$cget from hsignal-0.2.7.1

Percentage Accurate: 97.9% → 97.9%
Time: 3.4s
Alternatives: 7
Speedup: 1.0×

Specification

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

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

real(8) function code(x, y, z, t)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = ((x / y) * (z - t)) + t
end function
public static double code(double x, double y, double z, double t) {
	return ((x / y) * (z - t)) + t;
}
def code(x, y, z, t):
	return ((x / y) * (z - t)) + t
function code(x, y, z, t)
	return Float64(Float64(Float64(x / y) * Float64(z - t)) + t)
end
function tmp = code(x, y, z, t)
	tmp = ((x / y) * (z - t)) + t;
end
code[x_, y_, z_, t_] := N[(N[(N[(x / y), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]
\frac{x}{y} \cdot \left(z - t\right) + t

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

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

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

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

real(8) function code(x, y, z, t)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = ((x / y) * (z - t)) + t
end function
public static double code(double x, double y, double z, double t) {
	return ((x / y) * (z - t)) + t;
}
def code(x, y, z, t):
	return ((x / y) * (z - t)) + t
function code(x, y, z, t)
	return Float64(Float64(Float64(x / y) * Float64(z - t)) + t)
end
function tmp = code(x, y, z, t)
	tmp = ((x / y) * (z - t)) + t;
end
code[x_, y_, z_, t_] := N[(N[(N[(x / y), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]
\frac{x}{y} \cdot \left(z - t\right) + t

Alternative 1: 85.7% accurate, 0.7× speedup?

\[\begin{array}{l} \mathbf{if}\;t \leq -3.95 \cdot 10^{+117}:\\ \;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\ \mathbf{elif}\;t \leq 3.35 \cdot 10^{+41}:\\ \;\;\;\;\frac{x}{y} \cdot z + t\\ \mathbf{else}:\\ \;\;\;\;t - \frac{x}{y} \cdot t\\ \end{array} \]
(FPCore (x y z t)
  :precision binary64
  (if (<= t -3.95e+117)
  (* t (- 1.0 (/ x y)))
  (if (<= t 3.35e+41) (+ (* (/ x y) z) t) (- t (* (/ x y) t)))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (t <= -3.95e+117) {
		tmp = t * (1.0 - (x / y));
	} else if (t <= 3.35e+41) {
		tmp = ((x / y) * z) + t;
	} else {
		tmp = t - ((x / y) * 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)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if (t <= (-3.95d+117)) then
        tmp = t * (1.0d0 - (x / y))
    else if (t <= 3.35d+41) then
        tmp = ((x / y) * z) + t
    else
        tmp = t - ((x / y) * t)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (t <= -3.95e+117) {
		tmp = t * (1.0 - (x / y));
	} else if (t <= 3.35e+41) {
		tmp = ((x / y) * z) + t;
	} else {
		tmp = t - ((x / y) * t);
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if t <= -3.95e+117:
		tmp = t * (1.0 - (x / y))
	elif t <= 3.35e+41:
		tmp = ((x / y) * z) + t
	else:
		tmp = t - ((x / y) * t)
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (t <= -3.95e+117)
		tmp = Float64(t * Float64(1.0 - Float64(x / y)));
	elseif (t <= 3.35e+41)
		tmp = Float64(Float64(Float64(x / y) * z) + t);
	else
		tmp = Float64(t - Float64(Float64(x / y) * t));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (t <= -3.95e+117)
		tmp = t * (1.0 - (x / y));
	elseif (t <= 3.35e+41)
		tmp = ((x / y) * z) + t;
	else
		tmp = t - ((x / y) * t);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[t, -3.95e+117], N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3.35e+41], N[(N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision] + t), $MachinePrecision], N[(t - N[(N[(x / y), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;t \leq -3.95 \cdot 10^{+117}:\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\

\mathbf{elif}\;t \leq 3.35 \cdot 10^{+41}:\\
\;\;\;\;\frac{x}{y} \cdot z + t\\

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


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

    1. Initial program 97.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto t - \frac{\color{blue}{\left(t - z\right) \cdot x}}{y} \]
      15. lower--.f6492.7%

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

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

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

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

        \[\leadsto t \cdot \left(1 - \color{blue}{\frac{x}{y}}\right) \]
      3. lower-/.f6465.4%

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

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

    if -3.9500000000000001e117 < t < 3.3499999999999998e41

    1. Initial program 97.9%

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

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

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

        \[\leadsto \frac{x \cdot z}{y} + t \]
    4. Applied rewrites73.8%

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

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

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

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

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

        \[\leadsto \frac{x}{y} \cdot z + t \]
    6. Applied rewrites76.9%

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

    if 3.3499999999999998e41 < t

    1. Initial program 97.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto t - \frac{\color{blue}{\left(t - z\right) \cdot x}}{y} \]
      15. lower--.f6492.7%

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

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

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

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

        \[\leadsto t \cdot \left(1 - \color{blue}{\frac{x}{y}}\right) \]
      3. lower-/.f6465.4%

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

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

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

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

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

        \[\leadsto 1 \cdot t + \color{blue}{\left(\mathsf{neg}\left(\frac{x}{y}\right)\right) \cdot t} \]
      5. fp-cancel-sign-sub-invN/A

        \[\leadsto 1 \cdot t - \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\frac{x}{y}\right)\right)\right)\right) \cdot t} \]
      6. *-lft-identityN/A

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

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

        \[\leadsto t - \frac{x}{y} \cdot t \]
      9. lower-*.f6465.4%

        \[\leadsto t - \frac{x}{y} \cdot \color{blue}{t} \]
    8. Applied rewrites65.4%

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

Alternative 2: 73.7% accurate, 0.7× speedup?

\[\begin{array}{l} \mathbf{if}\;t \leq -1.12 \cdot 10^{-191}:\\ \;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\ \mathbf{elif}\;t \leq 3.8 \cdot 10^{-83}:\\ \;\;\;\;\frac{x \cdot z}{y}\\ \mathbf{else}:\\ \;\;\;\;t - \frac{x}{y} \cdot t\\ \end{array} \]
(FPCore (x y z t)
  :precision binary64
  (if (<= t -1.12e-191)
  (* t (- 1.0 (/ x y)))
  (if (<= t 3.8e-83) (/ (* x z) y) (- t (* (/ x y) t)))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (t <= -1.12e-191) {
		tmp = t * (1.0 - (x / y));
	} else if (t <= 3.8e-83) {
		tmp = (x * z) / y;
	} else {
		tmp = t - ((x / y) * 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)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if (t <= (-1.12d-191)) then
        tmp = t * (1.0d0 - (x / y))
    else if (t <= 3.8d-83) then
        tmp = (x * z) / y
    else
        tmp = t - ((x / y) * t)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (t <= -1.12e-191) {
		tmp = t * (1.0 - (x / y));
	} else if (t <= 3.8e-83) {
		tmp = (x * z) / y;
	} else {
		tmp = t - ((x / y) * t);
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if t <= -1.12e-191:
		tmp = t * (1.0 - (x / y))
	elif t <= 3.8e-83:
		tmp = (x * z) / y
	else:
		tmp = t - ((x / y) * t)
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (t <= -1.12e-191)
		tmp = Float64(t * Float64(1.0 - Float64(x / y)));
	elseif (t <= 3.8e-83)
		tmp = Float64(Float64(x * z) / y);
	else
		tmp = Float64(t - Float64(Float64(x / y) * t));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (t <= -1.12e-191)
		tmp = t * (1.0 - (x / y));
	elseif (t <= 3.8e-83)
		tmp = (x * z) / y;
	else
		tmp = t - ((x / y) * t);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.12e-191], N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3.8e-83], N[(N[(x * z), $MachinePrecision] / y), $MachinePrecision], N[(t - N[(N[(x / y), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;t \leq -1.12 \cdot 10^{-191}:\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\

\mathbf{elif}\;t \leq 3.8 \cdot 10^{-83}:\\
\;\;\;\;\frac{x \cdot z}{y}\\

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


\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -1.12e-191

    1. Initial program 97.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto t - \frac{\color{blue}{\left(t - z\right) \cdot x}}{y} \]
      15. lower--.f6492.7%

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

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

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

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

        \[\leadsto t \cdot \left(1 - \color{blue}{\frac{x}{y}}\right) \]
      3. lower-/.f6465.4%

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

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

    if -1.12e-191 < t < 3.7999999999999998e-83

    1. Initial program 97.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto t - \frac{\color{blue}{\left(t - z\right) \cdot x}}{y} \]
      15. lower--.f6492.7%

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

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

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

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

        \[\leadsto t \cdot \left(1 - \color{blue}{\frac{x}{y}}\right) \]
      3. lower-/.f6465.4%

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

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

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

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

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

        \[\leadsto 1 \cdot t + \color{blue}{\left(\mathsf{neg}\left(\frac{x}{y}\right)\right) \cdot t} \]
      5. fp-cancel-sign-sub-invN/A

        \[\leadsto 1 \cdot t - \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\frac{x}{y}\right)\right)\right)\right) \cdot t} \]
      6. *-lft-identityN/A

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

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

        \[\leadsto t - \frac{x}{y} \cdot t \]
      9. lower-*.f6465.4%

        \[\leadsto t - \frac{x}{y} \cdot \color{blue}{t} \]
    8. Applied rewrites65.4%

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

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

        \[\leadsto \frac{x \cdot z}{\color{blue}{y}} \]
      2. lower-*.f6437.9%

        \[\leadsto \frac{x \cdot z}{y} \]
    11. Applied rewrites37.9%

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

    if 3.7999999999999998e-83 < t

    1. Initial program 97.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto t - \frac{\color{blue}{\left(t - z\right) \cdot x}}{y} \]
      15. lower--.f6492.7%

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

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

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

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

        \[\leadsto t \cdot \left(1 - \color{blue}{\frac{x}{y}}\right) \]
      3. lower-/.f6465.4%

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

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

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

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

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

        \[\leadsto 1 \cdot t + \color{blue}{\left(\mathsf{neg}\left(\frac{x}{y}\right)\right) \cdot t} \]
      5. fp-cancel-sign-sub-invN/A

        \[\leadsto 1 \cdot t - \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\frac{x}{y}\right)\right)\right)\right) \cdot t} \]
      6. *-lft-identityN/A

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

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

        \[\leadsto t - \frac{x}{y} \cdot t \]
      9. lower-*.f6465.4%

        \[\leadsto t - \frac{x}{y} \cdot \color{blue}{t} \]
    8. Applied rewrites65.4%

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

Alternative 3: 73.7% accurate, 0.7× speedup?

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

\mathbf{elif}\;t \leq 3.8 \cdot 10^{-83}:\\
\;\;\;\;\frac{x \cdot z}{y}\\

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


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.12e-191 or 3.7999999999999998e-83 < t

    1. Initial program 97.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto t - \frac{\color{blue}{\left(t - z\right) \cdot x}}{y} \]
      15. lower--.f6492.7%

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

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

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

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

        \[\leadsto t \cdot \left(1 - \color{blue}{\frac{x}{y}}\right) \]
      3. lower-/.f6465.4%

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

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

    if -1.12e-191 < t < 3.7999999999999998e-83

    1. Initial program 97.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto t - \frac{\color{blue}{\left(t - z\right) \cdot x}}{y} \]
      15. lower--.f6492.7%

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

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

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

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

        \[\leadsto t \cdot \left(1 - \color{blue}{\frac{x}{y}}\right) \]
      3. lower-/.f6465.4%

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

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

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

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

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

        \[\leadsto 1 \cdot t + \color{blue}{\left(\mathsf{neg}\left(\frac{x}{y}\right)\right) \cdot t} \]
      5. fp-cancel-sign-sub-invN/A

        \[\leadsto 1 \cdot t - \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\frac{x}{y}\right)\right)\right)\right) \cdot t} \]
      6. *-lft-identityN/A

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

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

        \[\leadsto t - \frac{x}{y} \cdot t \]
      9. lower-*.f6465.4%

        \[\leadsto t - \frac{x}{y} \cdot \color{blue}{t} \]
    8. Applied rewrites65.4%

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

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

        \[\leadsto \frac{x \cdot z}{\color{blue}{y}} \]
      2. lower-*.f6437.9%

        \[\leadsto \frac{x \cdot z}{y} \]
    11. Applied rewrites37.9%

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

Alternative 4: 60.7% accurate, 0.5× speedup?

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

\mathbf{elif}\;\frac{x}{y} \leq 4 \cdot 10^{-34}:\\
\;\;\;\;t\\

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


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 x y) < -2.0000000000000001e-141 or 3.9999999999999997e-34 < (/.f64 x y)

    1. Initial program 97.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto t - \frac{\color{blue}{\left(t - z\right) \cdot x}}{y} \]
      15. lower--.f6492.7%

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

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

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

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

        \[\leadsto t \cdot \left(1 - \color{blue}{\frac{x}{y}}\right) \]
      3. lower-/.f6465.4%

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

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

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

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

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

        \[\leadsto 1 \cdot t + \color{blue}{\left(\mathsf{neg}\left(\frac{x}{y}\right)\right) \cdot t} \]
      5. fp-cancel-sign-sub-invN/A

        \[\leadsto 1 \cdot t - \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\frac{x}{y}\right)\right)\right)\right) \cdot t} \]
      6. *-lft-identityN/A

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

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

        \[\leadsto t - \frac{x}{y} \cdot t \]
      9. lower-*.f6465.4%

        \[\leadsto t - \frac{x}{y} \cdot \color{blue}{t} \]
    8. Applied rewrites65.4%

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

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

        \[\leadsto \frac{x \cdot z}{\color{blue}{y}} \]
      2. lower-*.f6437.9%

        \[\leadsto \frac{x \cdot z}{y} \]
    11. Applied rewrites37.9%

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

    if -2.0000000000000001e-141 < (/.f64 x y) < 3.9999999999999997e-34

    1. Initial program 97.9%

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

      \[\leadsto \color{blue}{t} \]
    3. Step-by-step derivation
      1. Applied rewrites38.6%

        \[\leadsto \color{blue}{t} \]
    4. Recombined 2 regimes into one program.
    5. Add Preprocessing

    Alternative 5: 41.9% accurate, 0.7× speedup?

    \[\begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -5 \cdot 10^{+117}:\\ \;\;\;\;y \cdot \frac{t}{y}\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \]
    (FPCore (x y z t)
      :precision binary64
      (if (<= (/ x y) -5e+117) (* y (/ t y)) t))
    double code(double x, double y, double z, double t) {
    	double tmp;
    	if ((x / y) <= -5e+117) {
    		tmp = y * (t / y);
    	} else {
    		tmp = 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)
    use fmin_fmax_functions
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        real(8), intent (in) :: z
        real(8), intent (in) :: t
        real(8) :: tmp
        if ((x / y) <= (-5d+117)) then
            tmp = y * (t / y)
        else
            tmp = t
        end if
        code = tmp
    end function
    
    public static double code(double x, double y, double z, double t) {
    	double tmp;
    	if ((x / y) <= -5e+117) {
    		tmp = y * (t / y);
    	} else {
    		tmp = t;
    	}
    	return tmp;
    }
    
    def code(x, y, z, t):
    	tmp = 0
    	if (x / y) <= -5e+117:
    		tmp = y * (t / y)
    	else:
    		tmp = t
    	return tmp
    
    function code(x, y, z, t)
    	tmp = 0.0
    	if (Float64(x / y) <= -5e+117)
    		tmp = Float64(y * Float64(t / y));
    	else
    		tmp = t;
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, y, z, t)
    	tmp = 0.0;
    	if ((x / y) <= -5e+117)
    		tmp = y * (t / y);
    	else
    		tmp = t;
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -5e+117], N[(y * N[(t / y), $MachinePrecision]), $MachinePrecision], t]
    
    \begin{array}{l}
    \mathbf{if}\;\frac{x}{y} \leq -5 \cdot 10^{+117}:\\
    \;\;\;\;y \cdot \frac{t}{y}\\
    
    \mathbf{else}:\\
    \;\;\;\;t\\
    
    
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if (/.f64 x y) < -4.9999999999999998e117

      1. Initial program 97.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto t - \frac{\color{blue}{\left(t - z\right) \cdot x}}{y} \]
        15. lower--.f6492.7%

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

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

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

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

          \[\leadsto t \cdot \left(1 - \color{blue}{\frac{x}{y}}\right) \]
        3. lower-/.f6465.4%

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

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

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

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

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

          \[\leadsto \left(1 - \frac{x}{y}\right) \cdot t \]
        5. sub-to-fractionN/A

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

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

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

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

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

          \[\leadsto \left(y - x\right) \cdot \frac{\color{blue}{t}}{y} \]
        11. lower-/.f6456.3%

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

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

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

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

        if -4.9999999999999998e117 < (/.f64 x y)

        1. Initial program 97.9%

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

          \[\leadsto \color{blue}{t} \]
        3. Step-by-step derivation
          1. Applied rewrites38.6%

            \[\leadsto \color{blue}{t} \]
        4. Recombined 2 regimes into one program.
        5. Add Preprocessing

        Alternative 6: 38.6% accurate, 23.0× speedup?

        \[t \]
        (FPCore (x y z t)
          :precision binary64
          t)
        double code(double x, double y, double z, double t) {
        	return t;
        }
        
        module fmin_fmax_functions
            implicit none
            private
            public fmax
            public fmin
        
            interface fmax
                module procedure fmax88
                module procedure fmax44
                module procedure fmax84
                module procedure fmax48
            end interface
            interface fmin
                module procedure fmin88
                module procedure fmin44
                module procedure fmin84
                module procedure fmin48
            end interface
        contains
            real(8) function fmax88(x, y) result (res)
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
            end function
            real(4) function fmax44(x, y) result (res)
                real(4), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
            end function
            real(8) function fmax84(x, y) result(res)
                real(8), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
            end function
            real(8) function fmax48(x, y) result(res)
                real(4), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
            end function
            real(8) function fmin88(x, y) result (res)
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
            end function
            real(4) function fmin44(x, y) result (res)
                real(4), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
            end function
            real(8) function fmin84(x, y) result(res)
                real(8), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
            end function
            real(8) function fmin48(x, y) result(res)
                real(4), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
            end function
        end module
        
        real(8) function code(x, y, z, t)
        use fmin_fmax_functions
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            real(8), intent (in) :: z
            real(8), intent (in) :: t
            code = t
        end function
        
        public static double code(double x, double y, double z, double t) {
        	return t;
        }
        
        def code(x, y, z, t):
        	return t
        
        function code(x, y, z, t)
        	return t
        end
        
        function tmp = code(x, y, z, t)
        	tmp = t;
        end
        
        code[x_, y_, z_, t_] := t
        
        t
        
        Derivation
        1. Initial program 97.9%

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

          \[\leadsto \color{blue}{t} \]
        3. Step-by-step derivation
          1. Applied rewrites38.6%

            \[\leadsto \color{blue}{t} \]
          2. Add Preprocessing

          Reproduce

          ?
          herbie shell --seed 2025258 
          (FPCore (x y z t)
            :name "Numeric.Signal.Multichannel:$cget from hsignal-0.2.7.1"
            :precision binary64
            (+ (* (/ x y) (- z t)) t))