Graphics.Rendering.Plot.Render.Plot.Legend:renderLegendOutside from plot-0.2.3.4, B

Percentage Accurate: 99.9% → 99.9%
Time: 10.2s
Alternatives: 10
Speedup: 1.0×

Specification

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

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

real(8) function code(x, y, z, t)
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) + z) + y) + t)) + (y * 5.0d0)
end function
public static double code(double x, double y, double z, double t) {
	return (x * ((((y + z) + z) + y) + t)) + (y * 5.0);
}
def code(x, y, z, t):
	return (x * ((((y + z) + z) + y) + t)) + (y * 5.0)
function code(x, y, z, t)
	return Float64(Float64(x * Float64(Float64(Float64(Float64(y + z) + z) + y) + t)) + Float64(y * 5.0))
end
function tmp = code(x, y, z, t)
	tmp = (x * ((((y + z) + z) + y) + t)) + (y * 5.0);
end
code[x_, y_, z_, t_] := N[(N[(x * N[(N[(N[(N[(y + z), $MachinePrecision] + z), $MachinePrecision] + y), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision] + N[(y * 5), $MachinePrecision]), $MachinePrecision]
x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 10 alternatives:

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

Initial Program: 99.9% accurate, 1.0× speedup?

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

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

real(8) function code(x, y, z, t)
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) + z) + y) + t)) + (y * 5.0d0)
end function
public static double code(double x, double y, double z, double t) {
	return (x * ((((y + z) + z) + y) + t)) + (y * 5.0);
}
def code(x, y, z, t):
	return (x * ((((y + z) + z) + y) + t)) + (y * 5.0)
function code(x, y, z, t)
	return Float64(Float64(x * Float64(Float64(Float64(Float64(y + z) + z) + y) + t)) + Float64(y * 5.0))
end
function tmp = code(x, y, z, t)
	tmp = (x * ((((y + z) + z) + y) + t)) + (y * 5.0);
end
code[x_, y_, z_, t_] := N[(N[(x * N[(N[(N[(N[(y + z), $MachinePrecision] + z), $MachinePrecision] + y), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision] + N[(y * 5), $MachinePrecision]), $MachinePrecision]
x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5

Alternative 1: 99.9% accurate, 1.0× speedup?

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

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

real(8) function code(x, y, z, t)
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 * ((((z + y) + y) + z) + t)) + (y * 5.0d0)
end function
public static double code(double x, double y, double z, double t) {
	return (x * ((((z + y) + y) + z) + t)) + (y * 5.0);
}
def code(x, y, z, t):
	return (x * ((((z + y) + y) + z) + t)) + (y * 5.0)
function code(x, y, z, t)
	return Float64(Float64(x * Float64(Float64(Float64(Float64(z + y) + y) + z) + t)) + Float64(y * 5.0))
end
function tmp = code(x, y, z, t)
	tmp = (x * ((((z + y) + y) + z) + t)) + (y * 5.0);
end
code[x_, y_, z_, t_] := N[(N[(x * N[(N[(N[(N[(z + y), $MachinePrecision] + y), $MachinePrecision] + z), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision] + N[(y * 5), $MachinePrecision]), $MachinePrecision]
x \cdot \left(\left(\left(\left(z + y\right) + y\right) + z\right) + t\right) + y \cdot 5
Derivation
  1. Initial program 99.9%

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

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

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

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

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

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

      \[\leadsto x \cdot \left(\color{blue}{\left(\left(\left(y + z\right) + y\right) + z\right)} + t\right) + y \cdot 5 \]
    7. lower-+.f6499.9%

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

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

      \[\leadsto x \cdot \left(\left(\left(\color{blue}{\left(z + y\right)} + y\right) + z\right) + t\right) + y \cdot 5 \]
    10. lower-+.f6499.9%

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

    \[\leadsto x \cdot \left(\color{blue}{\left(\left(\left(z + y\right) + y\right) + z\right)} + t\right) + y \cdot 5 \]
  4. Add Preprocessing

Alternative 2: 99.9% accurate, 1.0× speedup?

\[\left(t + 2 \cdot \left(z + y\right)\right) \cdot x - -5 \cdot y \]
(FPCore (x y z t)
  :precision binary64
  (- (* (+ t (* 2 (+ z y))) x) (* -5 y)))
double code(double x, double y, double z, double t) {
	return ((t + (2.0 * (z + y))) * x) - (-5.0 * y);
}
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 + (2.0d0 * (z + y))) * x) - ((-5.0d0) * y)
end function
public static double code(double x, double y, double z, double t) {
	return ((t + (2.0 * (z + y))) * x) - (-5.0 * y);
}
def code(x, y, z, t):
	return ((t + (2.0 * (z + y))) * x) - (-5.0 * y)
function code(x, y, z, t)
	return Float64(Float64(Float64(t + Float64(2.0 * Float64(z + y))) * x) - Float64(-5.0 * y))
end
function tmp = code(x, y, z, t)
	tmp = ((t + (2.0 * (z + y))) * x) - (-5.0 * y);
end
code[x_, y_, z_, t_] := N[(N[(N[(t + N[(2 * N[(z + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision] - N[(-5 * y), $MachinePrecision]), $MachinePrecision]
\left(t + 2 \cdot \left(z + y\right)\right) \cdot x - -5 \cdot y
Derivation
  1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(t + \left(\left(y + z\right) + \color{blue}{\left(y + z\right)}\right)\right) \cdot x - \left(\mathsf{neg}\left(y\right)\right) \cdot 5 \]
    16. count-2N/A

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

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

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

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

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

      \[\leadsto \left(t + 2 \cdot \left(z + y\right)\right) \cdot x - \color{blue}{5 \cdot \left(\mathsf{neg}\left(y\right)\right)} \]
    22. distribute-rgt-neg-inN/A

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

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

      \[\leadsto \left(t + 2 \cdot \left(z + y\right)\right) \cdot x - \color{blue}{\left(\mathsf{neg}\left(5\right)\right) \cdot y} \]
  3. Applied rewrites99.9%

    \[\leadsto \color{blue}{\left(t + 2 \cdot \left(z + y\right)\right) \cdot x - -5 \cdot y} \]
  4. Add Preprocessing

Alternative 3: 99.2% accurate, 0.7× speedup?

\[\begin{array}{l} t_1 := x \cdot \left(t + 2 \cdot \left(y + z\right)\right)\\ \mathbf{if}\;x \leq -5:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 360:\\ \;\;\;\;x \cdot \left(\left(\left(z + z\right) + y\right) + t\right) + y \cdot 5\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \]
(FPCore (x y z t)
  :precision binary64
  (let* ((t_1 (* x (+ t (* 2 (+ y z))))))
  (if (<= x -5)
    t_1
    (if (<= x 360) (+ (* x (+ (+ (+ z z) y) t)) (* y 5)) t_1))))
double code(double x, double y, double z, double t) {
	double t_1 = x * (t + (2.0 * (y + z)));
	double tmp;
	if (x <= -5.0) {
		tmp = t_1;
	} else if (x <= 360.0) {
		tmp = (x * (((z + z) + y) + t)) + (y * 5.0);
	} 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 * (t + (2.0d0 * (y + z)))
    if (x <= (-5.0d0)) then
        tmp = t_1
    else if (x <= 360.0d0) then
        tmp = (x * (((z + z) + y) + t)) + (y * 5.0d0)
    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 * (t + (2.0 * (y + z)));
	double tmp;
	if (x <= -5.0) {
		tmp = t_1;
	} else if (x <= 360.0) {
		tmp = (x * (((z + z) + y) + t)) + (y * 5.0);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x * (t + (2.0 * (y + z)))
	tmp = 0
	if x <= -5.0:
		tmp = t_1
	elif x <= 360.0:
		tmp = (x * (((z + z) + y) + t)) + (y * 5.0)
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x * Float64(t + Float64(2.0 * Float64(y + z))))
	tmp = 0.0
	if (x <= -5.0)
		tmp = t_1;
	elseif (x <= 360.0)
		tmp = Float64(Float64(x * Float64(Float64(Float64(z + z) + y) + t)) + Float64(y * 5.0));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x * (t + (2.0 * (y + z)));
	tmp = 0.0;
	if (x <= -5.0)
		tmp = t_1;
	elseif (x <= 360.0)
		tmp = (x * (((z + z) + y) + t)) + (y * 5.0);
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(t + N[(2 * N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -5], t$95$1, If[LessEqual[x, 360], N[(N[(x * N[(N[(N[(z + z), $MachinePrecision] + y), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision] + N[(y * 5), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := x \cdot \left(t + 2 \cdot \left(y + z\right)\right)\\
\mathbf{if}\;x \leq -5:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \leq 360:\\
\;\;\;\;x \cdot \left(\left(\left(z + z\right) + y\right) + t\right) + y \cdot 5\\

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


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -5 or 360 < x

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(t + \left(\left(y + z\right) + \color{blue}{\left(y + z\right)}\right)\right) \cdot x - \left(\mathsf{neg}\left(y\right)\right) \cdot 5 \]
      16. count-2N/A

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

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

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

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

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

        \[\leadsto \left(t + 2 \cdot \left(z + y\right)\right) \cdot x - \color{blue}{5 \cdot \left(\mathsf{neg}\left(y\right)\right)} \]
      22. distribute-rgt-neg-inN/A

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

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

        \[\leadsto \left(t + 2 \cdot \left(z + y\right)\right) \cdot x - \color{blue}{\left(\mathsf{neg}\left(5\right)\right) \cdot y} \]
    3. Applied rewrites99.9%

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

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

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

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

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

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

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

        \[\leadsto x \cdot \left(t + \left(2 \cdot \left(y + z\right) + 5 \cdot \color{blue}{\frac{y}{x}}\right)\right) \]
      7. lower-/.f6488.8%

        \[\leadsto x \cdot \left(t + \left(2 \cdot \left(y + z\right) + 5 \cdot \frac{y}{\color{blue}{x}}\right)\right) \]
    6. Applied rewrites88.8%

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

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

        \[\leadsto x \cdot \left(t + 2 \cdot \left(y + \color{blue}{z}\right)\right) \]
      2. lower-+.f6472.7%

        \[\leadsto x \cdot \left(t + 2 \cdot \left(y + z\right)\right) \]
    9. Applied rewrites72.7%

      \[\leadsto x \cdot \left(t + 2 \cdot \color{blue}{\left(y + z\right)}\right) \]

    if -5 < x < 360

    1. Initial program 99.9%

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

      \[\leadsto x \cdot \left(\left(\left(\color{blue}{z} + z\right) + y\right) + t\right) + y \cdot 5 \]
    3. Step-by-step derivation
      1. Applied rewrites93.0%

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

    Alternative 4: 99.1% accurate, 0.8× speedup?

    \[\begin{array}{l} t_1 := x \cdot \left(t + 2 \cdot \left(y + z\right)\right)\\ \mathbf{if}\;x \leq -1600000000:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 370:\\ \;\;\;\;x \cdot \left(t + 2 \cdot z\right) + y \cdot 5\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \]
    (FPCore (x y z t)
      :precision binary64
      (let* ((t_1 (* x (+ t (* 2 (+ y z))))))
      (if (<= x -1600000000)
        t_1
        (if (<= x 370) (+ (* x (+ t (* 2 z))) (* y 5)) t_1))))
    double code(double x, double y, double z, double t) {
    	double t_1 = x * (t + (2.0 * (y + z)));
    	double tmp;
    	if (x <= -1600000000.0) {
    		tmp = t_1;
    	} else if (x <= 370.0) {
    		tmp = (x * (t + (2.0 * z))) + (y * 5.0);
    	} 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 * (t + (2.0d0 * (y + z)))
        if (x <= (-1600000000.0d0)) then
            tmp = t_1
        else if (x <= 370.0d0) then
            tmp = (x * (t + (2.0d0 * z))) + (y * 5.0d0)
        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 * (t + (2.0 * (y + z)));
    	double tmp;
    	if (x <= -1600000000.0) {
    		tmp = t_1;
    	} else if (x <= 370.0) {
    		tmp = (x * (t + (2.0 * z))) + (y * 5.0);
    	} else {
    		tmp = t_1;
    	}
    	return tmp;
    }
    
    def code(x, y, z, t):
    	t_1 = x * (t + (2.0 * (y + z)))
    	tmp = 0
    	if x <= -1600000000.0:
    		tmp = t_1
    	elif x <= 370.0:
    		tmp = (x * (t + (2.0 * z))) + (y * 5.0)
    	else:
    		tmp = t_1
    	return tmp
    
    function code(x, y, z, t)
    	t_1 = Float64(x * Float64(t + Float64(2.0 * Float64(y + z))))
    	tmp = 0.0
    	if (x <= -1600000000.0)
    		tmp = t_1;
    	elseif (x <= 370.0)
    		tmp = Float64(Float64(x * Float64(t + Float64(2.0 * z))) + Float64(y * 5.0));
    	else
    		tmp = t_1;
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, y, z, t)
    	t_1 = x * (t + (2.0 * (y + z)));
    	tmp = 0.0;
    	if (x <= -1600000000.0)
    		tmp = t_1;
    	elseif (x <= 370.0)
    		tmp = (x * (t + (2.0 * z))) + (y * 5.0);
    	else
    		tmp = t_1;
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(t + N[(2 * N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1600000000], t$95$1, If[LessEqual[x, 370], N[(N[(x * N[(t + N[(2 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * 5), $MachinePrecision]), $MachinePrecision], t$95$1]]]
    
    \begin{array}{l}
    t_1 := x \cdot \left(t + 2 \cdot \left(y + z\right)\right)\\
    \mathbf{if}\;x \leq -1600000000:\\
    \;\;\;\;t\_1\\
    
    \mathbf{elif}\;x \leq 370:\\
    \;\;\;\;x \cdot \left(t + 2 \cdot z\right) + y \cdot 5\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_1\\
    
    
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if x < -1.6e9 or 370 < x

      1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \left(t + \left(\left(y + z\right) + \color{blue}{\left(y + z\right)}\right)\right) \cdot x - \left(\mathsf{neg}\left(y\right)\right) \cdot 5 \]
        16. count-2N/A

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

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

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

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

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

          \[\leadsto \left(t + 2 \cdot \left(z + y\right)\right) \cdot x - \color{blue}{5 \cdot \left(\mathsf{neg}\left(y\right)\right)} \]
        22. distribute-rgt-neg-inN/A

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

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

          \[\leadsto \left(t + 2 \cdot \left(z + y\right)\right) \cdot x - \color{blue}{\left(\mathsf{neg}\left(5\right)\right) \cdot y} \]
      3. Applied rewrites99.9%

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

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

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

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

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

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

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

          \[\leadsto x \cdot \left(t + \left(2 \cdot \left(y + z\right) + 5 \cdot \color{blue}{\frac{y}{x}}\right)\right) \]
        7. lower-/.f6488.8%

          \[\leadsto x \cdot \left(t + \left(2 \cdot \left(y + z\right) + 5 \cdot \frac{y}{\color{blue}{x}}\right)\right) \]
      6. Applied rewrites88.8%

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

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

          \[\leadsto x \cdot \left(t + 2 \cdot \left(y + \color{blue}{z}\right)\right) \]
        2. lower-+.f6472.7%

          \[\leadsto x \cdot \left(t + 2 \cdot \left(y + z\right)\right) \]
      9. Applied rewrites72.7%

        \[\leadsto x \cdot \left(t + 2 \cdot \color{blue}{\left(y + z\right)}\right) \]

      if -1.6e9 < x < 370

      1. Initial program 99.9%

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

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

          \[\leadsto x \cdot \left(t + \color{blue}{2 \cdot z}\right) + y \cdot 5 \]
        2. lower-*.f6484.6%

          \[\leadsto x \cdot \left(t + 2 \cdot \color{blue}{z}\right) + y \cdot 5 \]
      4. Applied rewrites84.6%

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

    Alternative 5: 88.3% accurate, 0.8× speedup?

    \[\begin{array}{l} t_1 := x \cdot \left(t + 2 \cdot \left(y + z\right)\right)\\ \mathbf{if}\;x \leq \frac{-7716728645107167}{5846006549323611672814739330865132078623730171904}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 6600000000:\\ \;\;\;\;\left(\left(y + y\right) + t\right) \cdot x - -5 \cdot y\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \]
    (FPCore (x y z t)
      :precision binary64
      (let* ((t_1 (* x (+ t (* 2 (+ y z))))))
      (if (<=
           x
           -7716728645107167/5846006549323611672814739330865132078623730171904)
        t_1
        (if (<= x 6600000000) (- (* (+ (+ y y) t) x) (* -5 y)) t_1))))
    double code(double x, double y, double z, double t) {
    	double t_1 = x * (t + (2.0 * (y + z)));
    	double tmp;
    	if (x <= -1.32e-33) {
    		tmp = t_1;
    	} else if (x <= 6600000000.0) {
    		tmp = (((y + y) + t) * x) - (-5.0 * 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 = x * (t + (2.0d0 * (y + z)))
        if (x <= (-1.32d-33)) then
            tmp = t_1
        else if (x <= 6600000000.0d0) then
            tmp = (((y + y) + t) * x) - ((-5.0d0) * 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 = x * (t + (2.0 * (y + z)));
    	double tmp;
    	if (x <= -1.32e-33) {
    		tmp = t_1;
    	} else if (x <= 6600000000.0) {
    		tmp = (((y + y) + t) * x) - (-5.0 * y);
    	} else {
    		tmp = t_1;
    	}
    	return tmp;
    }
    
    def code(x, y, z, t):
    	t_1 = x * (t + (2.0 * (y + z)))
    	tmp = 0
    	if x <= -1.32e-33:
    		tmp = t_1
    	elif x <= 6600000000.0:
    		tmp = (((y + y) + t) * x) - (-5.0 * y)
    	else:
    		tmp = t_1
    	return tmp
    
    function code(x, y, z, t)
    	t_1 = Float64(x * Float64(t + Float64(2.0 * Float64(y + z))))
    	tmp = 0.0
    	if (x <= -1.32e-33)
    		tmp = t_1;
    	elseif (x <= 6600000000.0)
    		tmp = Float64(Float64(Float64(Float64(y + y) + t) * x) - Float64(-5.0 * y));
    	else
    		tmp = t_1;
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, y, z, t)
    	t_1 = x * (t + (2.0 * (y + z)));
    	tmp = 0.0;
    	if (x <= -1.32e-33)
    		tmp = t_1;
    	elseif (x <= 6600000000.0)
    		tmp = (((y + y) + t) * x) - (-5.0 * y);
    	else
    		tmp = t_1;
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(t + N[(2 * N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -7716728645107167/5846006549323611672814739330865132078623730171904], t$95$1, If[LessEqual[x, 6600000000], N[(N[(N[(N[(y + y), $MachinePrecision] + t), $MachinePrecision] * x), $MachinePrecision] - N[(-5 * y), $MachinePrecision]), $MachinePrecision], t$95$1]]]
    
    \begin{array}{l}
    t_1 := x \cdot \left(t + 2 \cdot \left(y + z\right)\right)\\
    \mathbf{if}\;x \leq \frac{-7716728645107167}{5846006549323611672814739330865132078623730171904}:\\
    \;\;\;\;t\_1\\
    
    \mathbf{elif}\;x \leq 6600000000:\\
    \;\;\;\;\left(\left(y + y\right) + t\right) \cdot x - -5 \cdot y\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_1\\
    
    
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if x < -1.3199999999999999e-33 or 6.6e9 < x

      1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \left(t + \left(\left(y + z\right) + \color{blue}{\left(y + z\right)}\right)\right) \cdot x - \left(\mathsf{neg}\left(y\right)\right) \cdot 5 \]
        16. count-2N/A

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

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

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

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

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

          \[\leadsto \left(t + 2 \cdot \left(z + y\right)\right) \cdot x - \color{blue}{5 \cdot \left(\mathsf{neg}\left(y\right)\right)} \]
        22. distribute-rgt-neg-inN/A

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

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

          \[\leadsto \left(t + 2 \cdot \left(z + y\right)\right) \cdot x - \color{blue}{\left(\mathsf{neg}\left(5\right)\right) \cdot y} \]
      3. Applied rewrites99.9%

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

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

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

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

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

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

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

          \[\leadsto x \cdot \left(t + \left(2 \cdot \left(y + z\right) + 5 \cdot \color{blue}{\frac{y}{x}}\right)\right) \]
        7. lower-/.f6488.8%

          \[\leadsto x \cdot \left(t + \left(2 \cdot \left(y + z\right) + 5 \cdot \frac{y}{\color{blue}{x}}\right)\right) \]
      6. Applied rewrites88.8%

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

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

          \[\leadsto x \cdot \left(t + 2 \cdot \left(y + \color{blue}{z}\right)\right) \]
        2. lower-+.f6472.7%

          \[\leadsto x \cdot \left(t + 2 \cdot \left(y + z\right)\right) \]
      9. Applied rewrites72.7%

        \[\leadsto x \cdot \left(t + 2 \cdot \color{blue}{\left(y + z\right)}\right) \]

      if -1.3199999999999999e-33 < x < 6.6e9

      1. Initial program 99.9%

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

        \[\leadsto x \cdot \left(\color{blue}{2 \cdot y} + t\right) + y \cdot 5 \]
      3. Step-by-step derivation
        1. lower-*.f6473.3%

          \[\leadsto x \cdot \left(2 \cdot \color{blue}{y} + t\right) + y \cdot 5 \]
      4. Applied rewrites73.3%

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

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

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

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

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

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

          \[\leadsto x \cdot \left(2 \cdot y + t\right) - \color{blue}{-5 \cdot y} \]
        7. lower--.f6473.3%

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

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

          \[\leadsto \color{blue}{\left(2 \cdot y + t\right) \cdot x} - -5 \cdot y \]
        10. lower-*.f6473.3%

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

          \[\leadsto \left(2 \cdot \color{blue}{y} + t\right) \cdot x - -5 \cdot y \]
        12. count-2-revN/A

          \[\leadsto \left(\left(y + \color{blue}{y}\right) + t\right) \cdot x - -5 \cdot y \]
        13. lower-+.f6473.3%

          \[\leadsto \left(\left(y + \color{blue}{y}\right) + t\right) \cdot x - -5 \cdot y \]
      6. Applied rewrites73.3%

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

    Alternative 6: 88.1% accurate, 0.9× speedup?

    \[\begin{array}{l} t_1 := x \cdot \left(t + 2 \cdot \left(y + z\right)\right)\\ \mathbf{if}\;x \leq \frac{-7716728645107167}{5846006549323611672814739330865132078623730171904}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 3400:\\ \;\;\;\;t \cdot x + y \cdot 5\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \]
    (FPCore (x y z t)
      :precision binary64
      (let* ((t_1 (* x (+ t (* 2 (+ y z))))))
      (if (<=
           x
           -7716728645107167/5846006549323611672814739330865132078623730171904)
        t_1
        (if (<= x 3400) (+ (* t x) (* y 5)) t_1))))
    double code(double x, double y, double z, double t) {
    	double t_1 = x * (t + (2.0 * (y + z)));
    	double tmp;
    	if (x <= -1.32e-33) {
    		tmp = t_1;
    	} else if (x <= 3400.0) {
    		tmp = (t * x) + (y * 5.0);
    	} 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 * (t + (2.0d0 * (y + z)))
        if (x <= (-1.32d-33)) then
            tmp = t_1
        else if (x <= 3400.0d0) then
            tmp = (t * x) + (y * 5.0d0)
        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 * (t + (2.0 * (y + z)));
    	double tmp;
    	if (x <= -1.32e-33) {
    		tmp = t_1;
    	} else if (x <= 3400.0) {
    		tmp = (t * x) + (y * 5.0);
    	} else {
    		tmp = t_1;
    	}
    	return tmp;
    }
    
    def code(x, y, z, t):
    	t_1 = x * (t + (2.0 * (y + z)))
    	tmp = 0
    	if x <= -1.32e-33:
    		tmp = t_1
    	elif x <= 3400.0:
    		tmp = (t * x) + (y * 5.0)
    	else:
    		tmp = t_1
    	return tmp
    
    function code(x, y, z, t)
    	t_1 = Float64(x * Float64(t + Float64(2.0 * Float64(y + z))))
    	tmp = 0.0
    	if (x <= -1.32e-33)
    		tmp = t_1;
    	elseif (x <= 3400.0)
    		tmp = Float64(Float64(t * x) + Float64(y * 5.0));
    	else
    		tmp = t_1;
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, y, z, t)
    	t_1 = x * (t + (2.0 * (y + z)));
    	tmp = 0.0;
    	if (x <= -1.32e-33)
    		tmp = t_1;
    	elseif (x <= 3400.0)
    		tmp = (t * x) + (y * 5.0);
    	else
    		tmp = t_1;
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(t + N[(2 * N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -7716728645107167/5846006549323611672814739330865132078623730171904], t$95$1, If[LessEqual[x, 3400], N[(N[(t * x), $MachinePrecision] + N[(y * 5), $MachinePrecision]), $MachinePrecision], t$95$1]]]
    
    \begin{array}{l}
    t_1 := x \cdot \left(t + 2 \cdot \left(y + z\right)\right)\\
    \mathbf{if}\;x \leq \frac{-7716728645107167}{5846006549323611672814739330865132078623730171904}:\\
    \;\;\;\;t\_1\\
    
    \mathbf{elif}\;x \leq 3400:\\
    \;\;\;\;t \cdot x + y \cdot 5\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_1\\
    
    
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if x < -1.3199999999999999e-33 or 3400 < x

      1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \left(t + \left(\left(y + z\right) + \color{blue}{\left(y + z\right)}\right)\right) \cdot x - \left(\mathsf{neg}\left(y\right)\right) \cdot 5 \]
        16. count-2N/A

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

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

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

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

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

          \[\leadsto \left(t + 2 \cdot \left(z + y\right)\right) \cdot x - \color{blue}{5 \cdot \left(\mathsf{neg}\left(y\right)\right)} \]
        22. distribute-rgt-neg-inN/A

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

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

          \[\leadsto \left(t + 2 \cdot \left(z + y\right)\right) \cdot x - \color{blue}{\left(\mathsf{neg}\left(5\right)\right) \cdot y} \]
      3. Applied rewrites99.9%

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

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

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

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

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

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

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

          \[\leadsto x \cdot \left(t + \left(2 \cdot \left(y + z\right) + 5 \cdot \color{blue}{\frac{y}{x}}\right)\right) \]
        7. lower-/.f6488.8%

          \[\leadsto x \cdot \left(t + \left(2 \cdot \left(y + z\right) + 5 \cdot \frac{y}{\color{blue}{x}}\right)\right) \]
      6. Applied rewrites88.8%

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

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

          \[\leadsto x \cdot \left(t + 2 \cdot \left(y + \color{blue}{z}\right)\right) \]
        2. lower-+.f6472.7%

          \[\leadsto x \cdot \left(t + 2 \cdot \left(y + z\right)\right) \]
      9. Applied rewrites72.7%

        \[\leadsto x \cdot \left(t + 2 \cdot \color{blue}{\left(y + z\right)}\right) \]

      if -1.3199999999999999e-33 < x < 3400

      1. Initial program 99.9%

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

        \[\leadsto \color{blue}{t \cdot x} + y \cdot 5 \]
      3. Step-by-step derivation
        1. lower-*.f6457.2%

          \[\leadsto t \cdot \color{blue}{x} + y \cdot 5 \]
      4. Applied rewrites57.2%

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

    Alternative 7: 78.2% accurate, 1.0× speedup?

    \[\begin{array}{l} t_1 := \left(\left(x + x\right) - -5\right) \cdot y\\ \mathbf{if}\;y \leq \frac{-3984496719921263}{147573952589676412928}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq 135000000000000004850604486226195539359797635277641641055901100892353001764058090011880924581106113590851534848:\\ \;\;\;\;x \cdot \left(t + 2 \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \]
    (FPCore (x y z t)
      :precision binary64
      (let* ((t_1 (* (- (+ x x) -5) y)))
      (if (<= y -3984496719921263/147573952589676412928)
        t_1
        (if (<=
             y
             135000000000000004850604486226195539359797635277641641055901100892353001764058090011880924581106113590851534848)
          (* x (+ t (* 2 z)))
          t_1))))
    double code(double x, double y, double z, double t) {
    	double t_1 = ((x + x) - -5.0) * y;
    	double tmp;
    	if (y <= -2.7e-5) {
    		tmp = t_1;
    	} else if (y <= 1.35e+110) {
    		tmp = x * (t + (2.0 * z));
    	} 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 + x) - (-5.0d0)) * y
        if (y <= (-2.7d-5)) then
            tmp = t_1
        else if (y <= 1.35d+110) then
            tmp = x * (t + (2.0d0 * z))
        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 + x) - -5.0) * y;
    	double tmp;
    	if (y <= -2.7e-5) {
    		tmp = t_1;
    	} else if (y <= 1.35e+110) {
    		tmp = x * (t + (2.0 * z));
    	} else {
    		tmp = t_1;
    	}
    	return tmp;
    }
    
    def code(x, y, z, t):
    	t_1 = ((x + x) - -5.0) * y
    	tmp = 0
    	if y <= -2.7e-5:
    		tmp = t_1
    	elif y <= 1.35e+110:
    		tmp = x * (t + (2.0 * z))
    	else:
    		tmp = t_1
    	return tmp
    
    function code(x, y, z, t)
    	t_1 = Float64(Float64(Float64(x + x) - -5.0) * y)
    	tmp = 0.0
    	if (y <= -2.7e-5)
    		tmp = t_1;
    	elseif (y <= 1.35e+110)
    		tmp = Float64(x * Float64(t + Float64(2.0 * z)));
    	else
    		tmp = t_1;
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, y, z, t)
    	t_1 = ((x + x) - -5.0) * y;
    	tmp = 0.0;
    	if (y <= -2.7e-5)
    		tmp = t_1;
    	elseif (y <= 1.35e+110)
    		tmp = x * (t + (2.0 * z));
    	else
    		tmp = t_1;
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(x + x), $MachinePrecision] - -5), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[y, -3984496719921263/147573952589676412928], t$95$1, If[LessEqual[y, 135000000000000004850604486226195539359797635277641641055901100892353001764058090011880924581106113590851534848], N[(x * N[(t + N[(2 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
    
    \begin{array}{l}
    t_1 := \left(\left(x + x\right) - -5\right) \cdot y\\
    \mathbf{if}\;y \leq \frac{-3984496719921263}{147573952589676412928}:\\
    \;\;\;\;t\_1\\
    
    \mathbf{elif}\;y \leq 135000000000000004850604486226195539359797635277641641055901100892353001764058090011880924581106113590851534848:\\
    \;\;\;\;x \cdot \left(t + 2 \cdot z\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_1\\
    
    
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if y < -2.6999999999999999e-5 or 1.35e110 < y

      1. Initial program 99.9%

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

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

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

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

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

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

          \[\leadsto x \cdot \left(\color{blue}{\left(\left(\left(y + z\right) + y\right) + z\right)} + t\right) + y \cdot 5 \]
        7. lower-+.f6499.9%

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

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

          \[\leadsto x \cdot \left(\left(\left(\color{blue}{\left(z + y\right)} + y\right) + z\right) + t\right) + y \cdot 5 \]
        10. lower-+.f6499.9%

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

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

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

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

          \[\leadsto y \cdot \left(5 + \color{blue}{2 \cdot x}\right) \]
        3. lower-*.f6447.0%

          \[\leadsto y \cdot \left(5 + 2 \cdot \color{blue}{x}\right) \]
      6. Applied rewrites47.0%

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

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

          \[\leadsto \left(5 + 2 \cdot x\right) \cdot \color{blue}{y} \]
        3. lower-*.f6447.0%

          \[\leadsto \left(5 + 2 \cdot x\right) \cdot \color{blue}{y} \]
        4. lift-+.f64N/A

          \[\leadsto \left(5 + 2 \cdot x\right) \cdot y \]
        5. +-commutativeN/A

          \[\leadsto \left(2 \cdot x + 5\right) \cdot y \]
        6. add-flipN/A

          \[\leadsto \left(2 \cdot x - \left(\mathsf{neg}\left(5\right)\right)\right) \cdot y \]
        7. metadata-evalN/A

          \[\leadsto \left(2 \cdot x - -5\right) \cdot y \]
        8. lower--.f6447.0%

          \[\leadsto \left(2 \cdot x - -5\right) \cdot y \]
        9. lift-*.f64N/A

          \[\leadsto \left(2 \cdot x - -5\right) \cdot y \]
        10. count-2-revN/A

          \[\leadsto \left(\left(x + x\right) - -5\right) \cdot y \]
        11. lower-+.f6447.0%

          \[\leadsto \left(\left(x + x\right) - -5\right) \cdot y \]
      8. Applied rewrites47.0%

        \[\leadsto \left(\left(x + x\right) - -5\right) \cdot \color{blue}{y} \]

      if -2.6999999999999999e-5 < y < 1.35e110

      1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \left(t + \left(\left(y + z\right) + \color{blue}{\left(y + z\right)}\right)\right) \cdot x - \left(\mathsf{neg}\left(y\right)\right) \cdot 5 \]
        16. count-2N/A

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

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

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

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

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

          \[\leadsto \left(t + 2 \cdot \left(z + y\right)\right) \cdot x - \color{blue}{5 \cdot \left(\mathsf{neg}\left(y\right)\right)} \]
        22. distribute-rgt-neg-inN/A

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

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

          \[\leadsto \left(t + 2 \cdot \left(z + y\right)\right) \cdot x - \color{blue}{\left(\mathsf{neg}\left(5\right)\right) \cdot y} \]
      3. Applied rewrites99.9%

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

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

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

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

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

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

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

          \[\leadsto x \cdot \left(t + \left(2 \cdot \left(y + z\right) + 5 \cdot \color{blue}{\frac{y}{x}}\right)\right) \]
        7. lower-/.f6488.8%

          \[\leadsto x \cdot \left(t + \left(2 \cdot \left(y + z\right) + 5 \cdot \frac{y}{\color{blue}{x}}\right)\right) \]
      6. Applied rewrites88.8%

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

        \[\leadsto x \cdot \left(t + \color{blue}{2 \cdot z}\right) \]
      8. Step-by-step derivation
        1. lower-+.f64N/A

          \[\leadsto x \cdot \left(t + 2 \cdot \color{blue}{z}\right) \]
        2. lower-*.f6457.9%

          \[\leadsto x \cdot \left(t + 2 \cdot z\right) \]
      9. Applied rewrites57.9%

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

    Alternative 8: 47.0% accurate, 2.2× speedup?

    \[\left(\left(x + x\right) - -5\right) \cdot y \]
    (FPCore (x y z t)
      :precision binary64
      (* (- (+ x x) -5) y))
    double code(double x, double y, double z, double t) {
    	return ((x + x) - -5.0) * y;
    }
    
    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 + x) - (-5.0d0)) * y
    end function
    
    public static double code(double x, double y, double z, double t) {
    	return ((x + x) - -5.0) * y;
    }
    
    def code(x, y, z, t):
    	return ((x + x) - -5.0) * y
    
    function code(x, y, z, t)
    	return Float64(Float64(Float64(x + x) - -5.0) * y)
    end
    
    function tmp = code(x, y, z, t)
    	tmp = ((x + x) - -5.0) * y;
    end
    
    code[x_, y_, z_, t_] := N[(N[(N[(x + x), $MachinePrecision] - -5), $MachinePrecision] * y), $MachinePrecision]
    
    \left(\left(x + x\right) - -5\right) \cdot y
    
    Derivation
    1. Initial program 99.9%

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

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

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

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

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

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

        \[\leadsto x \cdot \left(\color{blue}{\left(\left(\left(y + z\right) + y\right) + z\right)} + t\right) + y \cdot 5 \]
      7. lower-+.f6499.9%

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

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

        \[\leadsto x \cdot \left(\left(\left(\color{blue}{\left(z + y\right)} + y\right) + z\right) + t\right) + y \cdot 5 \]
      10. lower-+.f6499.9%

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

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

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

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

        \[\leadsto y \cdot \left(5 + \color{blue}{2 \cdot x}\right) \]
      3. lower-*.f6447.0%

        \[\leadsto y \cdot \left(5 + 2 \cdot \color{blue}{x}\right) \]
    6. Applied rewrites47.0%

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

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

        \[\leadsto \left(5 + 2 \cdot x\right) \cdot \color{blue}{y} \]
      3. lower-*.f6447.0%

        \[\leadsto \left(5 + 2 \cdot x\right) \cdot \color{blue}{y} \]
      4. lift-+.f64N/A

        \[\leadsto \left(5 + 2 \cdot x\right) \cdot y \]
      5. +-commutativeN/A

        \[\leadsto \left(2 \cdot x + 5\right) \cdot y \]
      6. add-flipN/A

        \[\leadsto \left(2 \cdot x - \left(\mathsf{neg}\left(5\right)\right)\right) \cdot y \]
      7. metadata-evalN/A

        \[\leadsto \left(2 \cdot x - -5\right) \cdot y \]
      8. lower--.f6447.0%

        \[\leadsto \left(2 \cdot x - -5\right) \cdot y \]
      9. lift-*.f64N/A

        \[\leadsto \left(2 \cdot x - -5\right) \cdot y \]
      10. count-2-revN/A

        \[\leadsto \left(\left(x + x\right) - -5\right) \cdot y \]
      11. lower-+.f6447.0%

        \[\leadsto \left(\left(x + x\right) - -5\right) \cdot y \]
    8. Applied rewrites47.0%

      \[\leadsto \left(\left(x + x\right) - -5\right) \cdot \color{blue}{y} \]
    9. Add Preprocessing

    Alternative 9: 46.2% accurate, 1.2× speedup?

    \[\begin{array}{l} t_1 := \left(y + y\right) \cdot x\\ \mathbf{if}\;x \leq -1850000000:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 3400:\\ \;\;\;\;5 \cdot y\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \]
    (FPCore (x y z t)
      :precision binary64
      (let* ((t_1 (* (+ y y) x)))
      (if (<= x -1850000000) t_1 (if (<= x 3400) (* 5 y) t_1))))
    double code(double x, double y, double z, double t) {
    	double t_1 = (y + y) * x;
    	double tmp;
    	if (x <= -1850000000.0) {
    		tmp = t_1;
    	} else if (x <= 3400.0) {
    		tmp = 5.0 * 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 = (y + y) * x
        if (x <= (-1850000000.0d0)) then
            tmp = t_1
        else if (x <= 3400.0d0) then
            tmp = 5.0d0 * 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 = (y + y) * x;
    	double tmp;
    	if (x <= -1850000000.0) {
    		tmp = t_1;
    	} else if (x <= 3400.0) {
    		tmp = 5.0 * y;
    	} else {
    		tmp = t_1;
    	}
    	return tmp;
    }
    
    def code(x, y, z, t):
    	t_1 = (y + y) * x
    	tmp = 0
    	if x <= -1850000000.0:
    		tmp = t_1
    	elif x <= 3400.0:
    		tmp = 5.0 * y
    	else:
    		tmp = t_1
    	return tmp
    
    function code(x, y, z, t)
    	t_1 = Float64(Float64(y + y) * x)
    	tmp = 0.0
    	if (x <= -1850000000.0)
    		tmp = t_1;
    	elseif (x <= 3400.0)
    		tmp = Float64(5.0 * y);
    	else
    		tmp = t_1;
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, y, z, t)
    	t_1 = (y + y) * x;
    	tmp = 0.0;
    	if (x <= -1850000000.0)
    		tmp = t_1;
    	elseif (x <= 3400.0)
    		tmp = 5.0 * y;
    	else
    		tmp = t_1;
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y + y), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -1850000000], t$95$1, If[LessEqual[x, 3400], N[(5 * y), $MachinePrecision], t$95$1]]]
    
    \begin{array}{l}
    t_1 := \left(y + y\right) \cdot x\\
    \mathbf{if}\;x \leq -1850000000:\\
    \;\;\;\;t\_1\\
    
    \mathbf{elif}\;x \leq 3400:\\
    \;\;\;\;5 \cdot y\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_1\\
    
    
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if x < -1.85e9 or 3400 < x

      1. Initial program 99.9%

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

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

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

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

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

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

          \[\leadsto x \cdot \left(\color{blue}{\left(\left(\left(y + z\right) + y\right) + z\right)} + t\right) + y \cdot 5 \]
        7. lower-+.f6499.9%

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

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

          \[\leadsto x \cdot \left(\left(\left(\color{blue}{\left(z + y\right)} + y\right) + z\right) + t\right) + y \cdot 5 \]
        10. lower-+.f6499.9%

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

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

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

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

          \[\leadsto y \cdot \left(5 + \color{blue}{2 \cdot x}\right) \]
        3. lower-*.f6447.0%

          \[\leadsto y \cdot \left(5 + 2 \cdot \color{blue}{x}\right) \]
      6. Applied rewrites47.0%

        \[\leadsto \color{blue}{y \cdot \left(5 + 2 \cdot x\right)} \]
      7. Taylor expanded in x around inf

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

          \[\leadsto 2 \cdot \left(x \cdot \color{blue}{y}\right) \]
        2. lower-*.f6420.5%

          \[\leadsto 2 \cdot \left(x \cdot y\right) \]
      9. Applied rewrites20.5%

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

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

          \[\leadsto 2 \cdot \left(x \cdot y\right) \]
        3. *-commutativeN/A

          \[\leadsto 2 \cdot \left(y \cdot x\right) \]
        4. associate-*r*N/A

          \[\leadsto \left(2 \cdot y\right) \cdot x \]
        5. lower-*.f64N/A

          \[\leadsto \left(2 \cdot y\right) \cdot x \]
        6. count-2-revN/A

          \[\leadsto \left(y + y\right) \cdot x \]
        7. lower-+.f6420.5%

          \[\leadsto \left(y + y\right) \cdot x \]
      11. Applied rewrites20.5%

        \[\leadsto \left(y + y\right) \cdot x \]

      if -1.85e9 < x < 3400

      1. Initial program 99.9%

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

        \[\leadsto \color{blue}{5 \cdot y} \]
      3. Step-by-step derivation
        1. lower-*.f6428.8%

          \[\leadsto 5 \cdot \color{blue}{y} \]
      4. Applied rewrites28.8%

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

    Alternative 10: 28.8% accurate, 4.3× speedup?

    \[5 \cdot y \]
    (FPCore (x y z t)
      :precision binary64
      (* 5 y))
    double code(double x, double y, double z, double t) {
    	return 5.0 * y;
    }
    
    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 = 5.0d0 * y
    end function
    
    public static double code(double x, double y, double z, double t) {
    	return 5.0 * y;
    }
    
    def code(x, y, z, t):
    	return 5.0 * y
    
    function code(x, y, z, t)
    	return Float64(5.0 * y)
    end
    
    function tmp = code(x, y, z, t)
    	tmp = 5.0 * y;
    end
    
    code[x_, y_, z_, t_] := N[(5 * y), $MachinePrecision]
    
    5 \cdot y
    
    Derivation
    1. Initial program 99.9%

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

      \[\leadsto \color{blue}{5 \cdot y} \]
    3. Step-by-step derivation
      1. lower-*.f6428.8%

        \[\leadsto 5 \cdot \color{blue}{y} \]
    4. Applied rewrites28.8%

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

    Reproduce

    ?
    herbie shell --seed 2025271 -o generate:evaluate
    (FPCore (x y z t)
      :name "Graphics.Rendering.Plot.Render.Plot.Legend:renderLegendOutside from plot-0.2.3.4, B"
      :precision binary64
      (+ (* x (+ (+ (+ (+ y z) z) y) t)) (* y 5)))