Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTicks from plot-0.2.3.4, B

Percentage Accurate: 85.8% → 98.1%
Time: 3.4s
Alternatives: 10
Speedup: 1.0×

Specification

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

\\
x + \frac{y \cdot \left(z - t\right)}{a - t}
\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 10 alternatives:

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

Initial Program: 85.8% accurate, 1.0× speedup?

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

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

Alternative 1: 98.1% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{y \cdot \frac{z - t}{a - t}} + x \]
    8. sub-divN/A

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{z}{a - t} - \frac{t}{a - t}, y, x\right)} \]
    11. sub-divN/A

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

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

      \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{z - t}}{a - t}, y, x\right) \]
    14. lift--.f6498.1

      \[\leadsto \mathsf{fma}\left(\frac{z - t}{\color{blue}{a - t}}, y, x\right) \]
  3. Applied rewrites98.1%

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

Alternative 2: 86.8% accurate, 0.7× speedup?

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

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

\mathbf{elif}\;t \leq 2.2 \cdot 10^{+63}:\\
\;\;\;\;x + y \cdot \frac{z}{a - t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.15000000000000008e96 or 2.1999999999999999e63 < t

    1. Initial program 70.9%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{y \cdot \frac{z - t}{a - t}} + x \]
      8. sub-divN/A

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{z}{a - t} - \frac{t}{a - t}, y, x\right)} \]
      11. sub-divN/A

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{neg}\left(t\right)}{a - t}, y, x\right) \]
      2. lower-neg.f6488.5

        \[\leadsto \mathsf{fma}\left(\frac{-t}{a - t}, y, x\right) \]
    6. Applied rewrites88.5%

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

    if -1.15000000000000008e96 < t < 2.1999999999999999e63

    1. Initial program 94.5%

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

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

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

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

        \[\leadsto x + y \cdot \frac{z}{\color{blue}{a - t}} \]
      4. lift--.f6485.8

        \[\leadsto x + y \cdot \frac{z}{a - \color{blue}{t}} \]
    4. Applied rewrites85.8%

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

Alternative 3: 84.3% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq -7.6 \cdot 10^{+99}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;t \leq 1.15 \cdot 10^{+158}:\\ \;\;\;\;x + y \cdot \frac{z}{a - t}\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (<= t -7.6e+99)
   (+ x y)
   (if (<= t 1.15e+158) (+ x (* y (/ z (- a t)))) (+ x y))))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (t <= -7.6e+99) {
		tmp = x + y;
	} else if (t <= 1.15e+158) {
		tmp = x + (y * (z / (a - t)));
	} else {
		tmp = x + y;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: tmp
    if (t <= (-7.6d+99)) then
        tmp = x + y
    else if (t <= 1.15d+158) then
        tmp = x + (y * (z / (a - t)))
    else
        tmp = x + y
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (t <= -7.6e+99) {
		tmp = x + y;
	} else if (t <= 1.15e+158) {
		tmp = x + (y * (z / (a - t)));
	} else {
		tmp = x + y;
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if t <= -7.6e+99:
		tmp = x + y
	elif t <= 1.15e+158:
		tmp = x + (y * (z / (a - t)))
	else:
		tmp = x + y
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if (t <= -7.6e+99)
		tmp = Float64(x + y);
	elseif (t <= 1.15e+158)
		tmp = Float64(x + Float64(y * Float64(z / Float64(a - t))));
	else
		tmp = Float64(x + y);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if (t <= -7.6e+99)
		tmp = x + y;
	elseif (t <= 1.15e+158)
		tmp = x + (y * (z / (a - t)));
	else
		tmp = x + y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -7.6e+99], N[(x + y), $MachinePrecision], If[LessEqual[t, 1.15e+158], N[(x + N[(y * N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;t \leq -7.6 \cdot 10^{+99}:\\
\;\;\;\;x + y\\

\mathbf{elif}\;t \leq 1.15 \cdot 10^{+158}:\\
\;\;\;\;x + y \cdot \frac{z}{a - t}\\

\mathbf{else}:\\
\;\;\;\;x + y\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -7.6e99 or 1.14999999999999993e158 < t

    1. Initial program 67.2%

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

      \[\leadsto x + \color{blue}{y} \]
    3. Step-by-step derivation
      1. Applied rewrites85.0%

        \[\leadsto x + \color{blue}{y} \]

      if -7.6e99 < t < 1.14999999999999993e158

      1. Initial program 93.3%

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

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

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

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

          \[\leadsto x + y \cdot \frac{z}{\color{blue}{a - t}} \]
        4. lift--.f6484.0

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

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

    Alternative 4: 81.5% accurate, 0.8× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_1 := \mathsf{fma}\left(y, \frac{z - t}{a}, x\right)\\ \mathbf{if}\;a \leq -3.35 \cdot 10^{+34}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;a \leq 140000:\\ \;\;\;\;x - \left(z - t\right) \cdot \frac{y}{t}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
    (FPCore (x y z t a)
     :precision binary64
     (let* ((t_1 (fma y (/ (- z t) a) x)))
       (if (<= a -3.35e+34)
         t_1
         (if (<= a 140000.0) (- x (* (- z t) (/ y t))) t_1))))
    double code(double x, double y, double z, double t, double a) {
    	double t_1 = fma(y, ((z - t) / a), x);
    	double tmp;
    	if (a <= -3.35e+34) {
    		tmp = t_1;
    	} else if (a <= 140000.0) {
    		tmp = x - ((z - t) * (y / t));
    	} else {
    		tmp = t_1;
    	}
    	return tmp;
    }
    
    function code(x, y, z, t, a)
    	t_1 = fma(y, Float64(Float64(z - t) / a), x)
    	tmp = 0.0
    	if (a <= -3.35e+34)
    		tmp = t_1;
    	elseif (a <= 140000.0)
    		tmp = Float64(x - Float64(Float64(z - t) * Float64(y / t)));
    	else
    		tmp = t_1;
    	end
    	return tmp
    end
    
    code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -3.35e+34], t$95$1, If[LessEqual[a, 140000.0], N[(x - N[(N[(z - t), $MachinePrecision] * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_1 := \mathsf{fma}\left(y, \frac{z - t}{a}, x\right)\\
    \mathbf{if}\;a \leq -3.35 \cdot 10^{+34}:\\
    \;\;\;\;t\_1\\
    
    \mathbf{elif}\;a \leq 140000:\\
    \;\;\;\;x - \left(z - t\right) \cdot \frac{y}{t}\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_1\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if a < -3.3500000000000001e34 or 1.4e5 < a

      1. Initial program 84.0%

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

        \[\leadsto \color{blue}{x + \frac{y \cdot \left(z - t\right)}{a}} \]
      3. Step-by-step derivation
        1. +-commutativeN/A

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

          \[\leadsto y \cdot \frac{z - t}{a} + x \]
        3. lower-fma.f64N/A

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

          \[\leadsto \mathsf{fma}\left(y, \frac{z - t}{\color{blue}{a}}, x\right) \]
        5. lift--.f6485.1

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

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

      if -3.3500000000000001e34 < a < 1.4e5

      1. Initial program 87.5%

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

        \[\leadsto \color{blue}{x + -1 \cdot \frac{y \cdot \left(z - t\right)}{t}} \]
      3. Step-by-step derivation
        1. fp-cancel-sign-sub-invN/A

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

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

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

          \[\leadsto x - \frac{-1 \cdot \left(y \cdot \left(z - t\right)\right)}{\color{blue}{-1 \cdot t}} \]
        5. mul-1-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto x - \left(z - t\right) \cdot \frac{\color{blue}{y}}{t} \]
        7. lower-/.f6478.3

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

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

    Alternative 5: 78.0% accurate, 0.8× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq -3.4 \cdot 10^{+53}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;t \leq 2.4 \cdot 10^{+113}:\\ \;\;\;\;\mathsf{fma}\left(y, \frac{z - t}{a}, x\right)\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \end{array} \]
    (FPCore (x y z t a)
     :precision binary64
     (if (<= t -3.4e+53)
       (+ x y)
       (if (<= t 2.4e+113) (fma y (/ (- z t) a) x) (+ x y))))
    double code(double x, double y, double z, double t, double a) {
    	double tmp;
    	if (t <= -3.4e+53) {
    		tmp = x + y;
    	} else if (t <= 2.4e+113) {
    		tmp = fma(y, ((z - t) / a), x);
    	} else {
    		tmp = x + y;
    	}
    	return tmp;
    }
    
    function code(x, y, z, t, a)
    	tmp = 0.0
    	if (t <= -3.4e+53)
    		tmp = Float64(x + y);
    	elseif (t <= 2.4e+113)
    		tmp = fma(y, Float64(Float64(z - t) / a), x);
    	else
    		tmp = Float64(x + y);
    	end
    	return tmp
    end
    
    code[x_, y_, z_, t_, a_] := If[LessEqual[t, -3.4e+53], N[(x + y), $MachinePrecision], If[LessEqual[t, 2.4e+113], N[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], N[(x + y), $MachinePrecision]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;t \leq -3.4 \cdot 10^{+53}:\\
    \;\;\;\;x + y\\
    
    \mathbf{elif}\;t \leq 2.4 \cdot 10^{+113}:\\
    \;\;\;\;\mathsf{fma}\left(y, \frac{z - t}{a}, x\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;x + y\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if t < -3.39999999999999998e53 or 2.39999999999999983e113 < t

      1. Initial program 71.3%

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

        \[\leadsto x + \color{blue}{y} \]
      3. Step-by-step derivation
        1. Applied rewrites81.0%

          \[\leadsto x + \color{blue}{y} \]

        if -3.39999999999999998e53 < t < 2.39999999999999983e113

        1. Initial program 94.2%

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

          \[\leadsto \color{blue}{x + \frac{y \cdot \left(z - t\right)}{a}} \]
        3. Step-by-step derivation
          1. +-commutativeN/A

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

            \[\leadsto y \cdot \frac{z - t}{a} + x \]
          3. lower-fma.f64N/A

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

            \[\leadsto \mathsf{fma}\left(y, \frac{z - t}{\color{blue}{a}}, x\right) \]
          5. lift--.f6476.2

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

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

      Alternative 6: 76.8% accurate, 0.7× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq -1 \cdot 10^{+72}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;t \leq 2.4 \cdot 10^{+63}:\\ \;\;\;\;\mathsf{fma}\left(y, \frac{z}{a}, x\right)\\ \mathbf{elif}\;t \leq 2.55 \cdot 10^{+120}:\\ \;\;\;\;\mathsf{fma}\left(\frac{-t}{a}, y, x\right)\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \end{array} \]
      (FPCore (x y z t a)
       :precision binary64
       (if (<= t -1e+72)
         (+ x y)
         (if (<= t 2.4e+63)
           (fma y (/ z a) x)
           (if (<= t 2.55e+120) (fma (/ (- t) a) y x) (+ x y)))))
      double code(double x, double y, double z, double t, double a) {
      	double tmp;
      	if (t <= -1e+72) {
      		tmp = x + y;
      	} else if (t <= 2.4e+63) {
      		tmp = fma(y, (z / a), x);
      	} else if (t <= 2.55e+120) {
      		tmp = fma((-t / a), y, x);
      	} else {
      		tmp = x + y;
      	}
      	return tmp;
      }
      
      function code(x, y, z, t, a)
      	tmp = 0.0
      	if (t <= -1e+72)
      		tmp = Float64(x + y);
      	elseif (t <= 2.4e+63)
      		tmp = fma(y, Float64(z / a), x);
      	elseif (t <= 2.55e+120)
      		tmp = fma(Float64(Float64(-t) / a), y, x);
      	else
      		tmp = Float64(x + y);
      	end
      	return tmp
      end
      
      code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1e+72], N[(x + y), $MachinePrecision], If[LessEqual[t, 2.4e+63], N[(y * N[(z / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t, 2.55e+120], N[(N[((-t) / a), $MachinePrecision] * y + x), $MachinePrecision], N[(x + y), $MachinePrecision]]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;t \leq -1 \cdot 10^{+72}:\\
      \;\;\;\;x + y\\
      
      \mathbf{elif}\;t \leq 2.4 \cdot 10^{+63}:\\
      \;\;\;\;\mathsf{fma}\left(y, \frac{z}{a}, x\right)\\
      
      \mathbf{elif}\;t \leq 2.55 \cdot 10^{+120}:\\
      \;\;\;\;\mathsf{fma}\left(\frac{-t}{a}, y, x\right)\\
      
      \mathbf{else}:\\
      \;\;\;\;x + y\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if t < -9.99999999999999944e71 or 2.55000000000000014e120 < t

        1. Initial program 70.1%

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

          \[\leadsto x + \color{blue}{y} \]
        3. Step-by-step derivation
          1. Applied rewrites82.0%

            \[\leadsto x + \color{blue}{y} \]

          if -9.99999999999999944e71 < t < 2.4e63

          1. Initial program 94.6%

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

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

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

              \[\leadsto y \cdot \frac{z}{a} + x \]
            3. lower-fma.f64N/A

              \[\leadsto \mathsf{fma}\left(y, \color{blue}{\frac{z}{a}}, x\right) \]
            4. lower-/.f6474.7

              \[\leadsto \mathsf{fma}\left(y, \frac{z}{\color{blue}{a}}, x\right) \]
          4. Applied rewrites74.7%

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

          if 2.4e63 < t < 2.55000000000000014e120

          1. Initial program 85.4%

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

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

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

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

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

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

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

              \[\leadsto \color{blue}{y \cdot \frac{z - t}{a - t}} + x \]
            8. sub-divN/A

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

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

              \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{z}{a - t} - \frac{t}{a - t}, y, x\right)} \]
            11. sub-divN/A

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

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

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

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

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

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

              \[\leadsto \mathsf{fma}\left(\frac{\mathsf{neg}\left(t\right)}{a - t}, y, x\right) \]
            2. lower-neg.f6478.4

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

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

            \[\leadsto \mathsf{fma}\left(\frac{-t}{\color{blue}{a}}, y, x\right) \]
          8. Step-by-step derivation
            1. Applied rewrites47.0%

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

          Alternative 7: 75.9% accurate, 0.9× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq -1 \cdot 10^{+72}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;t \leq 1.6 \cdot 10^{+59}:\\ \;\;\;\;\mathsf{fma}\left(y, \frac{z}{a}, x\right)\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \end{array} \]
          (FPCore (x y z t a)
           :precision binary64
           (if (<= t -1e+72) (+ x y) (if (<= t 1.6e+59) (fma y (/ z a) x) (+ x y))))
          double code(double x, double y, double z, double t, double a) {
          	double tmp;
          	if (t <= -1e+72) {
          		tmp = x + y;
          	} else if (t <= 1.6e+59) {
          		tmp = fma(y, (z / a), x);
          	} else {
          		tmp = x + y;
          	}
          	return tmp;
          }
          
          function code(x, y, z, t, a)
          	tmp = 0.0
          	if (t <= -1e+72)
          		tmp = Float64(x + y);
          	elseif (t <= 1.6e+59)
          		tmp = fma(y, Float64(z / a), x);
          	else
          		tmp = Float64(x + y);
          	end
          	return tmp
          end
          
          code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1e+72], N[(x + y), $MachinePrecision], If[LessEqual[t, 1.6e+59], N[(y * N[(z / a), $MachinePrecision] + x), $MachinePrecision], N[(x + y), $MachinePrecision]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          \mathbf{if}\;t \leq -1 \cdot 10^{+72}:\\
          \;\;\;\;x + y\\
          
          \mathbf{elif}\;t \leq 1.6 \cdot 10^{+59}:\\
          \;\;\;\;\mathsf{fma}\left(y, \frac{z}{a}, x\right)\\
          
          \mathbf{else}:\\
          \;\;\;\;x + y\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if t < -9.99999999999999944e71 or 1.59999999999999991e59 < t

            1. Initial program 72.0%

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

              \[\leadsto x + \color{blue}{y} \]
            3. Step-by-step derivation
              1. Applied rewrites80.0%

                \[\leadsto x + \color{blue}{y} \]

              if -9.99999999999999944e71 < t < 1.59999999999999991e59

              1. Initial program 94.7%

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

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

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

                  \[\leadsto y \cdot \frac{z}{a} + x \]
                3. lower-fma.f64N/A

                  \[\leadsto \mathsf{fma}\left(y, \color{blue}{\frac{z}{a}}, x\right) \]
                4. lower-/.f6474.7

                  \[\leadsto \mathsf{fma}\left(y, \frac{z}{\color{blue}{a}}, x\right) \]
              4. Applied rewrites74.7%

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

            Alternative 8: 63.2% accurate, 1.3× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -1.35 \cdot 10^{+161}:\\ \;\;\;\;x\\ \mathbf{elif}\;a \leq 4.8 \cdot 10^{+101}:\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
            (FPCore (x y z t a)
             :precision binary64
             (if (<= a -1.35e+161) x (if (<= a 4.8e+101) (+ x y) x)))
            double code(double x, double y, double z, double t, double a) {
            	double tmp;
            	if (a <= -1.35e+161) {
            		tmp = x;
            	} else if (a <= 4.8e+101) {
            		tmp = x + y;
            	} else {
            		tmp = x;
            	}
            	return tmp;
            }
            
            module fmin_fmax_functions
                implicit none
                private
                public fmax
                public fmin
            
                interface fmax
                    module procedure fmax88
                    module procedure fmax44
                    module procedure fmax84
                    module procedure fmax48
                end interface
                interface fmin
                    module procedure fmin88
                    module procedure fmin44
                    module procedure fmin84
                    module procedure fmin48
                end interface
            contains
                real(8) function fmax88(x, y) result (res)
                    real(8), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                end function
                real(4) function fmax44(x, y) result (res)
                    real(4), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                end function
                real(8) function fmax84(x, y) result(res)
                    real(8), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                end function
                real(8) function fmax48(x, y) result(res)
                    real(4), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                end function
                real(8) function fmin88(x, y) result (res)
                    real(8), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                end function
                real(4) function fmin44(x, y) result (res)
                    real(4), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                end function
                real(8) function fmin84(x, y) result(res)
                    real(8), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                end function
                real(8) function fmin48(x, y) result(res)
                    real(4), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                end function
            end module
            
            real(8) function code(x, y, z, t, 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.35d+161)) then
                    tmp = x
                else if (a <= 4.8d+101) then
                    tmp = x + y
                else
                    tmp = x
                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.35e+161) {
            		tmp = x;
            	} else if (a <= 4.8e+101) {
            		tmp = x + y;
            	} else {
            		tmp = x;
            	}
            	return tmp;
            }
            
            def code(x, y, z, t, a):
            	tmp = 0
            	if a <= -1.35e+161:
            		tmp = x
            	elif a <= 4.8e+101:
            		tmp = x + y
            	else:
            		tmp = x
            	return tmp
            
            function code(x, y, z, t, a)
            	tmp = 0.0
            	if (a <= -1.35e+161)
            		tmp = x;
            	elseif (a <= 4.8e+101)
            		tmp = Float64(x + y);
            	else
            		tmp = x;
            	end
            	return tmp
            end
            
            function tmp_2 = code(x, y, z, t, a)
            	tmp = 0.0;
            	if (a <= -1.35e+161)
            		tmp = x;
            	elseif (a <= 4.8e+101)
            		tmp = x + y;
            	else
            		tmp = x;
            	end
            	tmp_2 = tmp;
            end
            
            code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1.35e+161], x, If[LessEqual[a, 4.8e+101], N[(x + y), $MachinePrecision], x]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            \mathbf{if}\;a \leq -1.35 \cdot 10^{+161}:\\
            \;\;\;\;x\\
            
            \mathbf{elif}\;a \leq 4.8 \cdot 10^{+101}:\\
            \;\;\;\;x + y\\
            
            \mathbf{else}:\\
            \;\;\;\;x\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if a < -1.3499999999999999e161 or 4.79999999999999977e101 < a

              1. Initial program 82.6%

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

                \[\leadsto \color{blue}{x} \]
              3. Step-by-step derivation
                1. Applied rewrites67.2%

                  \[\leadsto \color{blue}{x} \]

                if -1.3499999999999999e161 < a < 4.79999999999999977e101

                1. Initial program 87.1%

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

                  \[\leadsto x + \color{blue}{y} \]
                3. Step-by-step derivation
                  1. Applied rewrites61.6%

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

                Alternative 9: 53.0% accurate, 0.9× speedup?

                \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{y \cdot \left(z - t\right)}{a - t} \leq -5 \cdot 10^{+137}:\\ \;\;\;\;y\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
                (FPCore (x y z t a)
                 :precision binary64
                 (if (<= (/ (* y (- z t)) (- a t)) -5e+137) y x))
                double code(double x, double y, double z, double t, double a) {
                	double tmp;
                	if (((y * (z - t)) / (a - t)) <= -5e+137) {
                		tmp = y;
                	} else {
                		tmp = x;
                	}
                	return tmp;
                }
                
                module fmin_fmax_functions
                    implicit none
                    private
                    public fmax
                    public fmin
                
                    interface fmax
                        module procedure fmax88
                        module procedure fmax44
                        module procedure fmax84
                        module procedure fmax48
                    end interface
                    interface fmin
                        module procedure fmin88
                        module procedure fmin44
                        module procedure fmin84
                        module procedure fmin48
                    end interface
                contains
                    real(8) function fmax88(x, y) result (res)
                        real(8), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                    end function
                    real(4) function fmax44(x, y) result (res)
                        real(4), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                    end function
                    real(8) function fmax84(x, y) result(res)
                        real(8), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                    end function
                    real(8) function fmax48(x, y) result(res)
                        real(4), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                    end function
                    real(8) function fmin88(x, y) result (res)
                        real(8), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                    end function
                    real(4) function fmin44(x, y) result (res)
                        real(4), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                    end function
                    real(8) function fmin84(x, y) result(res)
                        real(8), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                    end function
                    real(8) function fmin48(x, y) result(res)
                        real(4), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                    end function
                end module
                
                real(8) function code(x, y, z, t, a)
                use fmin_fmax_functions
                    real(8), intent (in) :: x
                    real(8), intent (in) :: y
                    real(8), intent (in) :: z
                    real(8), intent (in) :: t
                    real(8), intent (in) :: a
                    real(8) :: tmp
                    if (((y * (z - t)) / (a - t)) <= (-5d+137)) then
                        tmp = y
                    else
                        tmp = x
                    end if
                    code = tmp
                end function
                
                public static double code(double x, double y, double z, double t, double a) {
                	double tmp;
                	if (((y * (z - t)) / (a - t)) <= -5e+137) {
                		tmp = y;
                	} else {
                		tmp = x;
                	}
                	return tmp;
                }
                
                def code(x, y, z, t, a):
                	tmp = 0
                	if ((y * (z - t)) / (a - t)) <= -5e+137:
                		tmp = y
                	else:
                		tmp = x
                	return tmp
                
                function code(x, y, z, t, a)
                	tmp = 0.0
                	if (Float64(Float64(y * Float64(z - t)) / Float64(a - t)) <= -5e+137)
                		tmp = y;
                	else
                		tmp = x;
                	end
                	return tmp
                end
                
                function tmp_2 = code(x, y, z, t, a)
                	tmp = 0.0;
                	if (((y * (z - t)) / (a - t)) <= -5e+137)
                		tmp = y;
                	else
                		tmp = x;
                	end
                	tmp_2 = tmp;
                end
                
                code[x_, y_, z_, t_, a_] := If[LessEqual[N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision], -5e+137], y, x]
                
                \begin{array}{l}
                
                \\
                \begin{array}{l}
                \mathbf{if}\;\frac{y \cdot \left(z - t\right)}{a - t} \leq -5 \cdot 10^{+137}:\\
                \;\;\;\;y\\
                
                \mathbf{else}:\\
                \;\;\;\;x\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 2 regimes
                2. if (/.f64 (*.f64 y (-.f64 z t)) (-.f64 a t)) < -5.0000000000000002e137

                  1. Initial program 59.7%

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

                    \[\leadsto \color{blue}{x + -1 \cdot \frac{y \cdot \left(z - t\right)}{t}} \]
                  3. Step-by-step derivation
                    1. fp-cancel-sign-sub-invN/A

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

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

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

                      \[\leadsto x - \frac{-1 \cdot \left(y \cdot \left(z - t\right)\right)}{\color{blue}{-1 \cdot t}} \]
                    5. mul-1-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                      \[\leadsto -\frac{\left(z - t\right) \cdot y}{t} \]
                    6. lift-/.f6435.4

                      \[\leadsto -\frac{\left(z - t\right) \cdot y}{t} \]
                  7. Applied rewrites35.4%

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

                    \[\leadsto y \]
                  9. Step-by-step derivation
                    1. Applied rewrites28.4%

                      \[\leadsto y \]

                    if -5.0000000000000002e137 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 a t))

                    1. Initial program 91.1%

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

                      \[\leadsto \color{blue}{x} \]
                    3. Step-by-step derivation
                      1. Applied rewrites58.0%

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

                    Alternative 10: 50.6% accurate, 15.3× speedup?

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

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

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

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

                      Reproduce

                      ?
                      herbie shell --seed 2025119 
                      (FPCore (x y z t a)
                        :name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTicks from plot-0.2.3.4, B"
                        :precision binary64
                        (+ x (/ (* y (- z t)) (- a t))))