The letters hi in the upper-right quadrant

Percentage Accurate: 100.0% → 100.0%
Time: 8.2s
Alternatives: 13
Speedup: 1.4×

Specification

?
\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{{\left(y - 0.275\right)}^{2} + {\left(x - 0.275\right)}^{2}}\\ \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, -y\right), x - 0.825\right), 0.725 - x\right), \sqrt{{\left(y - 0.7\right)}^{2} + {\left(x - 0.775\right)}^{2}} - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 1\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - t\_0\right), t\_0 - 0.275\right)\right) \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (sqrt (+ (pow (- y 0.275) 2.0) (pow (- x 0.275) 2.0)))))
   (fmin
    (fmin
     (fmin
      (fmin
       (fmax (fmax (fmax (- y 0.55) (- y)) (- x 0.825)) (- 0.725 x))
       (- (sqrt (+ (pow (- y 0.7) 2.0) (pow (- x 0.775) 2.0))) 0.075))
      (fmax (fmax (fmax (- y) (- y 0.275)) (- x 0.55)) (- 0.45 x)))
     (fmax (fmax (fmax (- y) (- y 1.0)) (- x 0.1)) (- x)))
    (fmax
     (fmax
      (fmax (fmax (fmax (- y 0.55) (- x 0.55)) (- x)) (- 0.275 y))
      (- 0.175 t_0))
     (- t_0 0.275)))))
double code(double x, double y) {
	double t_0 = sqrt((pow((y - 0.275), 2.0) + pow((x - 0.275), 2.0)));
	return fmin(fmin(fmin(fmin(fmax(fmax(fmax((y - 0.55), -y), (x - 0.825)), (0.725 - x)), (sqrt((pow((y - 0.7), 2.0) + pow((x - 0.775), 2.0))) - 0.075)), fmax(fmax(fmax(-y, (y - 0.275)), (x - 0.55)), (0.45 - x))), fmax(fmax(fmax(-y, (y - 1.0)), (x - 0.1)), -x)), fmax(fmax(fmax(fmax(fmax((y - 0.55), (x - 0.55)), -x), (0.275 - y)), (0.175 - t_0)), (t_0 - 0.275)));
}
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)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    t_0 = sqrt((((y - 0.275d0) ** 2.0d0) + ((x - 0.275d0) ** 2.0d0)))
    code = fmin(fmin(fmin(fmin(fmax(fmax(fmax((y - 0.55d0), -y), (x - 0.825d0)), (0.725d0 - x)), (sqrt((((y - 0.7d0) ** 2.0d0) + ((x - 0.775d0) ** 2.0d0))) - 0.075d0)), fmax(fmax(fmax(-y, (y - 0.275d0)), (x - 0.55d0)), (0.45d0 - x))), fmax(fmax(fmax(-y, (y - 1.0d0)), (x - 0.1d0)), -x)), fmax(fmax(fmax(fmax(fmax((y - 0.55d0), (x - 0.55d0)), -x), (0.275d0 - y)), (0.175d0 - t_0)), (t_0 - 0.275d0)))
end function
public static double code(double x, double y) {
	double t_0 = Math.sqrt((Math.pow((y - 0.275), 2.0) + Math.pow((x - 0.275), 2.0)));
	return fmin(fmin(fmin(fmin(fmax(fmax(fmax((y - 0.55), -y), (x - 0.825)), (0.725 - x)), (Math.sqrt((Math.pow((y - 0.7), 2.0) + Math.pow((x - 0.775), 2.0))) - 0.075)), fmax(fmax(fmax(-y, (y - 0.275)), (x - 0.55)), (0.45 - x))), fmax(fmax(fmax(-y, (y - 1.0)), (x - 0.1)), -x)), fmax(fmax(fmax(fmax(fmax((y - 0.55), (x - 0.55)), -x), (0.275 - y)), (0.175 - t_0)), (t_0 - 0.275)));
}
def code(x, y):
	t_0 = math.sqrt((math.pow((y - 0.275), 2.0) + math.pow((x - 0.275), 2.0)))
	return fmin(fmin(fmin(fmin(fmax(fmax(fmax((y - 0.55), -y), (x - 0.825)), (0.725 - x)), (math.sqrt((math.pow((y - 0.7), 2.0) + math.pow((x - 0.775), 2.0))) - 0.075)), fmax(fmax(fmax(-y, (y - 0.275)), (x - 0.55)), (0.45 - x))), fmax(fmax(fmax(-y, (y - 1.0)), (x - 0.1)), -x)), fmax(fmax(fmax(fmax(fmax((y - 0.55), (x - 0.55)), -x), (0.275 - y)), (0.175 - t_0)), (t_0 - 0.275)))
function code(x, y)
	t_0 = sqrt(Float64((Float64(y - 0.275) ^ 2.0) + (Float64(x - 0.275) ^ 2.0)))
	return fmin(fmin(fmin(fmin(fmax(fmax(fmax(Float64(y - 0.55), Float64(-y)), Float64(x - 0.825)), Float64(0.725 - x)), Float64(sqrt(Float64((Float64(y - 0.7) ^ 2.0) + (Float64(x - 0.775) ^ 2.0))) - 0.075)), fmax(fmax(fmax(Float64(-y), Float64(y - 0.275)), Float64(x - 0.55)), Float64(0.45 - x))), fmax(fmax(fmax(Float64(-y), Float64(y - 1.0)), Float64(x - 0.1)), Float64(-x))), fmax(fmax(fmax(fmax(fmax(Float64(y - 0.55), Float64(x - 0.55)), Float64(-x)), Float64(0.275 - y)), Float64(0.175 - t_0)), Float64(t_0 - 0.275)))
end
function tmp = code(x, y)
	t_0 = sqrt((((y - 0.275) ^ 2.0) + ((x - 0.275) ^ 2.0)));
	tmp = min(min(min(min(max(max(max((y - 0.55), -y), (x - 0.825)), (0.725 - x)), (sqrt((((y - 0.7) ^ 2.0) + ((x - 0.775) ^ 2.0))) - 0.075)), max(max(max(-y, (y - 0.275)), (x - 0.55)), (0.45 - x))), max(max(max(-y, (y - 1.0)), (x - 0.1)), -x)), max(max(max(max(max((y - 0.55), (x - 0.55)), -x), (0.275 - y)), (0.175 - t_0)), (t_0 - 0.275)));
end
code[x_, y_] := Block[{t$95$0 = N[Sqrt[N[(N[Power[N[(y - 0.275), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(x - 0.275), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[Min[N[Min[N[Min[N[Min[N[Max[N[Max[N[Max[N[(y - 0.55), $MachinePrecision], (-y)], $MachinePrecision], N[(x - 0.825), $MachinePrecision]], $MachinePrecision], N[(0.725 - x), $MachinePrecision]], $MachinePrecision], N[(N[Sqrt[N[(N[Power[N[(y - 0.7), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(x - 0.775), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.075), $MachinePrecision]], $MachinePrecision], N[Max[N[Max[N[Max[(-y), N[(y - 0.275), $MachinePrecision]], $MachinePrecision], N[(x - 0.55), $MachinePrecision]], $MachinePrecision], N[(0.45 - x), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], N[Max[N[Max[N[Max[(-y), N[(y - 1.0), $MachinePrecision]], $MachinePrecision], N[(x - 0.1), $MachinePrecision]], $MachinePrecision], (-x)], $MachinePrecision]], $MachinePrecision], N[Max[N[Max[N[Max[N[Max[N[Max[N[(y - 0.55), $MachinePrecision], N[(x - 0.55), $MachinePrecision]], $MachinePrecision], (-x)], $MachinePrecision], N[(0.275 - y), $MachinePrecision]], $MachinePrecision], N[(0.175 - t$95$0), $MachinePrecision]], $MachinePrecision], N[(t$95$0 - 0.275), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sqrt{{\left(y - 0.275\right)}^{2} + {\left(x - 0.275\right)}^{2}}\\
\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, -y\right), x - 0.825\right), 0.725 - x\right), \sqrt{{\left(y - 0.7\right)}^{2} + {\left(x - 0.775\right)}^{2}} - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 1\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - t\_0\right), t\_0 - 0.275\right)\right)
\end{array}
\end{array}

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 13 alternatives:

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

Initial Program: 100.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{{\left(y - 0.275\right)}^{2} + {\left(x - 0.275\right)}^{2}}\\ \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, -y\right), x - 0.825\right), 0.725 - x\right), \sqrt{{\left(y - 0.7\right)}^{2} + {\left(x - 0.775\right)}^{2}} - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 1\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - t\_0\right), t\_0 - 0.275\right)\right) \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (sqrt (+ (pow (- y 0.275) 2.0) (pow (- x 0.275) 2.0)))))
   (fmin
    (fmin
     (fmin
      (fmin
       (fmax (fmax (fmax (- y 0.55) (- y)) (- x 0.825)) (- 0.725 x))
       (- (sqrt (+ (pow (- y 0.7) 2.0) (pow (- x 0.775) 2.0))) 0.075))
      (fmax (fmax (fmax (- y) (- y 0.275)) (- x 0.55)) (- 0.45 x)))
     (fmax (fmax (fmax (- y) (- y 1.0)) (- x 0.1)) (- x)))
    (fmax
     (fmax
      (fmax (fmax (fmax (- y 0.55) (- x 0.55)) (- x)) (- 0.275 y))
      (- 0.175 t_0))
     (- t_0 0.275)))))
double code(double x, double y) {
	double t_0 = sqrt((pow((y - 0.275), 2.0) + pow((x - 0.275), 2.0)));
	return fmin(fmin(fmin(fmin(fmax(fmax(fmax((y - 0.55), -y), (x - 0.825)), (0.725 - x)), (sqrt((pow((y - 0.7), 2.0) + pow((x - 0.775), 2.0))) - 0.075)), fmax(fmax(fmax(-y, (y - 0.275)), (x - 0.55)), (0.45 - x))), fmax(fmax(fmax(-y, (y - 1.0)), (x - 0.1)), -x)), fmax(fmax(fmax(fmax(fmax((y - 0.55), (x - 0.55)), -x), (0.275 - y)), (0.175 - t_0)), (t_0 - 0.275)));
}
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)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    t_0 = sqrt((((y - 0.275d0) ** 2.0d0) + ((x - 0.275d0) ** 2.0d0)))
    code = fmin(fmin(fmin(fmin(fmax(fmax(fmax((y - 0.55d0), -y), (x - 0.825d0)), (0.725d0 - x)), (sqrt((((y - 0.7d0) ** 2.0d0) + ((x - 0.775d0) ** 2.0d0))) - 0.075d0)), fmax(fmax(fmax(-y, (y - 0.275d0)), (x - 0.55d0)), (0.45d0 - x))), fmax(fmax(fmax(-y, (y - 1.0d0)), (x - 0.1d0)), -x)), fmax(fmax(fmax(fmax(fmax((y - 0.55d0), (x - 0.55d0)), -x), (0.275d0 - y)), (0.175d0 - t_0)), (t_0 - 0.275d0)))
end function
public static double code(double x, double y) {
	double t_0 = Math.sqrt((Math.pow((y - 0.275), 2.0) + Math.pow((x - 0.275), 2.0)));
	return fmin(fmin(fmin(fmin(fmax(fmax(fmax((y - 0.55), -y), (x - 0.825)), (0.725 - x)), (Math.sqrt((Math.pow((y - 0.7), 2.0) + Math.pow((x - 0.775), 2.0))) - 0.075)), fmax(fmax(fmax(-y, (y - 0.275)), (x - 0.55)), (0.45 - x))), fmax(fmax(fmax(-y, (y - 1.0)), (x - 0.1)), -x)), fmax(fmax(fmax(fmax(fmax((y - 0.55), (x - 0.55)), -x), (0.275 - y)), (0.175 - t_0)), (t_0 - 0.275)));
}
def code(x, y):
	t_0 = math.sqrt((math.pow((y - 0.275), 2.0) + math.pow((x - 0.275), 2.0)))
	return fmin(fmin(fmin(fmin(fmax(fmax(fmax((y - 0.55), -y), (x - 0.825)), (0.725 - x)), (math.sqrt((math.pow((y - 0.7), 2.0) + math.pow((x - 0.775), 2.0))) - 0.075)), fmax(fmax(fmax(-y, (y - 0.275)), (x - 0.55)), (0.45 - x))), fmax(fmax(fmax(-y, (y - 1.0)), (x - 0.1)), -x)), fmax(fmax(fmax(fmax(fmax((y - 0.55), (x - 0.55)), -x), (0.275 - y)), (0.175 - t_0)), (t_0 - 0.275)))
function code(x, y)
	t_0 = sqrt(Float64((Float64(y - 0.275) ^ 2.0) + (Float64(x - 0.275) ^ 2.0)))
	return fmin(fmin(fmin(fmin(fmax(fmax(fmax(Float64(y - 0.55), Float64(-y)), Float64(x - 0.825)), Float64(0.725 - x)), Float64(sqrt(Float64((Float64(y - 0.7) ^ 2.0) + (Float64(x - 0.775) ^ 2.0))) - 0.075)), fmax(fmax(fmax(Float64(-y), Float64(y - 0.275)), Float64(x - 0.55)), Float64(0.45 - x))), fmax(fmax(fmax(Float64(-y), Float64(y - 1.0)), Float64(x - 0.1)), Float64(-x))), fmax(fmax(fmax(fmax(fmax(Float64(y - 0.55), Float64(x - 0.55)), Float64(-x)), Float64(0.275 - y)), Float64(0.175 - t_0)), Float64(t_0 - 0.275)))
end
function tmp = code(x, y)
	t_0 = sqrt((((y - 0.275) ^ 2.0) + ((x - 0.275) ^ 2.0)));
	tmp = min(min(min(min(max(max(max((y - 0.55), -y), (x - 0.825)), (0.725 - x)), (sqrt((((y - 0.7) ^ 2.0) + ((x - 0.775) ^ 2.0))) - 0.075)), max(max(max(-y, (y - 0.275)), (x - 0.55)), (0.45 - x))), max(max(max(-y, (y - 1.0)), (x - 0.1)), -x)), max(max(max(max(max((y - 0.55), (x - 0.55)), -x), (0.275 - y)), (0.175 - t_0)), (t_0 - 0.275)));
end
code[x_, y_] := Block[{t$95$0 = N[Sqrt[N[(N[Power[N[(y - 0.275), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(x - 0.275), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[Min[N[Min[N[Min[N[Min[N[Max[N[Max[N[Max[N[(y - 0.55), $MachinePrecision], (-y)], $MachinePrecision], N[(x - 0.825), $MachinePrecision]], $MachinePrecision], N[(0.725 - x), $MachinePrecision]], $MachinePrecision], N[(N[Sqrt[N[(N[Power[N[(y - 0.7), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(x - 0.775), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.075), $MachinePrecision]], $MachinePrecision], N[Max[N[Max[N[Max[(-y), N[(y - 0.275), $MachinePrecision]], $MachinePrecision], N[(x - 0.55), $MachinePrecision]], $MachinePrecision], N[(0.45 - x), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], N[Max[N[Max[N[Max[(-y), N[(y - 1.0), $MachinePrecision]], $MachinePrecision], N[(x - 0.1), $MachinePrecision]], $MachinePrecision], (-x)], $MachinePrecision]], $MachinePrecision], N[Max[N[Max[N[Max[N[Max[N[Max[N[(y - 0.55), $MachinePrecision], N[(x - 0.55), $MachinePrecision]], $MachinePrecision], (-x)], $MachinePrecision], N[(0.275 - y), $MachinePrecision]], $MachinePrecision], N[(0.175 - t$95$0), $MachinePrecision]], $MachinePrecision], N[(t$95$0 - 0.275), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sqrt{{\left(y - 0.275\right)}^{2} + {\left(x - 0.275\right)}^{2}}\\
\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, -y\right), x - 0.825\right), 0.725 - x\right), \sqrt{{\left(y - 0.7\right)}^{2} + {\left(x - 0.775\right)}^{2}} - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 1\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - t\_0\right), t\_0 - 0.275\right)\right)
\end{array}
\end{array}

Alternative 1: 100.0% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(x - 0.275\right) - \left(0.275 - y\right)\\ \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, -y\right), x - 0.825\right), 0.725 - x\right), \sqrt{{\left(y - 0.7\right)}^{2} + {\left(x - 0.775\right)}^{2}} - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 1\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - t\_0\right), t\_0 - 0.275\right)\right) \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (- (- x 0.275) (- 0.275 y))))
   (fmin
    (fmin
     (fmin
      (fmin
       (fmax (fmax (fmax (- y 0.55) (- y)) (- x 0.825)) (- 0.725 x))
       (- (sqrt (+ (pow (- y 0.7) 2.0) (pow (- x 0.775) 2.0))) 0.075))
      (fmax (fmax (fmax (- y) (- y 0.275)) (- x 0.55)) (- 0.45 x)))
     (fmax (fmax (fmax (- y) (- y 1.0)) (- x 0.1)) (- x)))
    (fmax
     (fmax
      (fmax (fmax (fmax (- y 0.55) (- x 0.55)) (- x)) (- 0.275 y))
      (- 0.175 t_0))
     (- t_0 0.275)))))
double code(double x, double y) {
	double t_0 = (x - 0.275) - (0.275 - y);
	return fmin(fmin(fmin(fmin(fmax(fmax(fmax((y - 0.55), -y), (x - 0.825)), (0.725 - x)), (sqrt((pow((y - 0.7), 2.0) + pow((x - 0.775), 2.0))) - 0.075)), fmax(fmax(fmax(-y, (y - 0.275)), (x - 0.55)), (0.45 - x))), fmax(fmax(fmax(-y, (y - 1.0)), (x - 0.1)), -x)), fmax(fmax(fmax(fmax(fmax((y - 0.55), (x - 0.55)), -x), (0.275 - y)), (0.175 - t_0)), (t_0 - 0.275)));
}
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)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    t_0 = (x - 0.275d0) - (0.275d0 - y)
    code = fmin(fmin(fmin(fmin(fmax(fmax(fmax((y - 0.55d0), -y), (x - 0.825d0)), (0.725d0 - x)), (sqrt((((y - 0.7d0) ** 2.0d0) + ((x - 0.775d0) ** 2.0d0))) - 0.075d0)), fmax(fmax(fmax(-y, (y - 0.275d0)), (x - 0.55d0)), (0.45d0 - x))), fmax(fmax(fmax(-y, (y - 1.0d0)), (x - 0.1d0)), -x)), fmax(fmax(fmax(fmax(fmax((y - 0.55d0), (x - 0.55d0)), -x), (0.275d0 - y)), (0.175d0 - t_0)), (t_0 - 0.275d0)))
end function
public static double code(double x, double y) {
	double t_0 = (x - 0.275) - (0.275 - y);
	return fmin(fmin(fmin(fmin(fmax(fmax(fmax((y - 0.55), -y), (x - 0.825)), (0.725 - x)), (Math.sqrt((Math.pow((y - 0.7), 2.0) + Math.pow((x - 0.775), 2.0))) - 0.075)), fmax(fmax(fmax(-y, (y - 0.275)), (x - 0.55)), (0.45 - x))), fmax(fmax(fmax(-y, (y - 1.0)), (x - 0.1)), -x)), fmax(fmax(fmax(fmax(fmax((y - 0.55), (x - 0.55)), -x), (0.275 - y)), (0.175 - t_0)), (t_0 - 0.275)));
}
def code(x, y):
	t_0 = (x - 0.275) - (0.275 - y)
	return fmin(fmin(fmin(fmin(fmax(fmax(fmax((y - 0.55), -y), (x - 0.825)), (0.725 - x)), (math.sqrt((math.pow((y - 0.7), 2.0) + math.pow((x - 0.775), 2.0))) - 0.075)), fmax(fmax(fmax(-y, (y - 0.275)), (x - 0.55)), (0.45 - x))), fmax(fmax(fmax(-y, (y - 1.0)), (x - 0.1)), -x)), fmax(fmax(fmax(fmax(fmax((y - 0.55), (x - 0.55)), -x), (0.275 - y)), (0.175 - t_0)), (t_0 - 0.275)))
function code(x, y)
	t_0 = Float64(Float64(x - 0.275) - Float64(0.275 - y))
	return fmin(fmin(fmin(fmin(fmax(fmax(fmax(Float64(y - 0.55), Float64(-y)), Float64(x - 0.825)), Float64(0.725 - x)), Float64(sqrt(Float64((Float64(y - 0.7) ^ 2.0) + (Float64(x - 0.775) ^ 2.0))) - 0.075)), fmax(fmax(fmax(Float64(-y), Float64(y - 0.275)), Float64(x - 0.55)), Float64(0.45 - x))), fmax(fmax(fmax(Float64(-y), Float64(y - 1.0)), Float64(x - 0.1)), Float64(-x))), fmax(fmax(fmax(fmax(fmax(Float64(y - 0.55), Float64(x - 0.55)), Float64(-x)), Float64(0.275 - y)), Float64(0.175 - t_0)), Float64(t_0 - 0.275)))
end
function tmp = code(x, y)
	t_0 = (x - 0.275) - (0.275 - y);
	tmp = min(min(min(min(max(max(max((y - 0.55), -y), (x - 0.825)), (0.725 - x)), (sqrt((((y - 0.7) ^ 2.0) + ((x - 0.775) ^ 2.0))) - 0.075)), max(max(max(-y, (y - 0.275)), (x - 0.55)), (0.45 - x))), max(max(max(-y, (y - 1.0)), (x - 0.1)), -x)), max(max(max(max(max((y - 0.55), (x - 0.55)), -x), (0.275 - y)), (0.175 - t_0)), (t_0 - 0.275)));
end
code[x_, y_] := Block[{t$95$0 = N[(N[(x - 0.275), $MachinePrecision] - N[(0.275 - y), $MachinePrecision]), $MachinePrecision]}, N[Min[N[Min[N[Min[N[Min[N[Max[N[Max[N[Max[N[(y - 0.55), $MachinePrecision], (-y)], $MachinePrecision], N[(x - 0.825), $MachinePrecision]], $MachinePrecision], N[(0.725 - x), $MachinePrecision]], $MachinePrecision], N[(N[Sqrt[N[(N[Power[N[(y - 0.7), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(x - 0.775), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.075), $MachinePrecision]], $MachinePrecision], N[Max[N[Max[N[Max[(-y), N[(y - 0.275), $MachinePrecision]], $MachinePrecision], N[(x - 0.55), $MachinePrecision]], $MachinePrecision], N[(0.45 - x), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], N[Max[N[Max[N[Max[(-y), N[(y - 1.0), $MachinePrecision]], $MachinePrecision], N[(x - 0.1), $MachinePrecision]], $MachinePrecision], (-x)], $MachinePrecision]], $MachinePrecision], N[Max[N[Max[N[Max[N[Max[N[Max[N[(y - 0.55), $MachinePrecision], N[(x - 0.55), $MachinePrecision]], $MachinePrecision], (-x)], $MachinePrecision], N[(0.275 - y), $MachinePrecision]], $MachinePrecision], N[(0.175 - t$95$0), $MachinePrecision]], $MachinePrecision], N[(t$95$0 - 0.275), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(x - 0.275\right) - \left(0.275 - y\right)\\
\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, -y\right), x - 0.825\right), 0.725 - x\right), \sqrt{{\left(y - 0.7\right)}^{2} + {\left(x - 0.775\right)}^{2}} - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 1\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - t\_0\right), t\_0 - 0.275\right)\right)
\end{array}
\end{array}
Derivation
  1. Initial program 100.0%

    \[\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, -y\right), x - 0.825\right), 0.725 - x\right), \sqrt{{\left(y - 0.7\right)}^{2} + {\left(x - 0.775\right)}^{2}} - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 1\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \sqrt{{\left(y - 0.275\right)}^{2} + {\left(x - 0.275\right)}^{2}}\right), \sqrt{{\left(y - 0.275\right)}^{2} + {\left(x - 0.275\right)}^{2}} - 0.275\right)\right) \]
  2. Applied rewrites100.0%

    \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, -y\right), x - 0.825\right), 0.725 - x\right), \sqrt{{\left(y - 0.7\right)}^{2} + {\left(x - 0.775\right)}^{2}} - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 1\right), x - 0.1\right), -x\right)\right), \color{blue}{\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right)\right), \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right) - 0.275\right)}\right) \]
  3. Add Preprocessing

Alternative 2: 81.2% accurate, 1.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(x - 0.275\right) - \left(0.275 - y\right)\\ t_1 := \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right)\\ t_2 := \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), \left(\left(x - 0.775\right) \cdot \left(x - 0.775\right) - \left(0.7 - y\right)\right) - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(t\_1, 0.175 - t\_0\right), t\_0 - 0.275\right)\right)\\ \mathbf{if}\;x \leq -155:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;x \leq 1.05 \cdot 10^{-9}:\\ \;\;\;\;\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, -y\right), x - 0.825\right), 0.725 - x\right), -1 \cdot \left(y \cdot \left(1 - 0.625 \cdot \frac{1}{y}\right)\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 1\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(t\_1, 0.175 - \left(y - 0.55\right)\right), \left(y - 0.55\right) - 0.275\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (- (- x 0.275) (- 0.275 y)))
        (t_1 (fmax (fmax (fmax (- y 0.55) (- x 0.55)) (- x)) (- 0.275 y)))
        (t_2
         (fmin
          (fmin
           (fmin
            (fmin
             (fmax (fmax (fmax (- y 0.55) y) (- x 0.825)) (- 0.725 x))
             (- (- (* (- x 0.775) (- x 0.775)) (- 0.7 y)) 0.075))
            (fmax (fmax (fmax y (- y 0.275)) (- x 0.55)) (- 0.45 x)))
           (fmax (fmax (fmax y (- y 2.0)) (- x 0.1)) (- x)))
          (fmax (fmax t_1 (- 0.175 t_0)) (- t_0 0.275)))))
   (if (<= x -155.0)
     t_2
     (if (<= x 1.05e-9)
       (fmin
        (fmin
         (fmin
          (fmin
           (fmax (fmax (fmax (- y 0.55) (- y)) (- x 0.825)) (- 0.725 x))
           (* -1.0 (* y (- 1.0 (* 0.625 (/ 1.0 y))))))
          (fmax (fmax (fmax (- y) (- y 0.275)) (- x 0.55)) (- 0.45 x)))
         (fmax (fmax (fmax (- y) (- y 1.0)) (- x 0.1)) (- x)))
        (fmax (fmax t_1 (- 0.175 (- y 0.55))) (- (- y 0.55) 0.275)))
       t_2))))
double code(double x, double y) {
	double t_0 = (x - 0.275) - (0.275 - y);
	double t_1 = fmax(fmax(fmax((y - 0.55), (x - 0.55)), -x), (0.275 - y));
	double t_2 = fmin(fmin(fmin(fmin(fmax(fmax(fmax((y - 0.55), y), (x - 0.825)), (0.725 - x)), ((((x - 0.775) * (x - 0.775)) - (0.7 - y)) - 0.075)), fmax(fmax(fmax(y, (y - 0.275)), (x - 0.55)), (0.45 - x))), fmax(fmax(fmax(y, (y - 2.0)), (x - 0.1)), -x)), fmax(fmax(t_1, (0.175 - t_0)), (t_0 - 0.275)));
	double tmp;
	if (x <= -155.0) {
		tmp = t_2;
	} else if (x <= 1.05e-9) {
		tmp = fmin(fmin(fmin(fmin(fmax(fmax(fmax((y - 0.55), -y), (x - 0.825)), (0.725 - x)), (-1.0 * (y * (1.0 - (0.625 * (1.0 / y)))))), fmax(fmax(fmax(-y, (y - 0.275)), (x - 0.55)), (0.45 - x))), fmax(fmax(fmax(-y, (y - 1.0)), (x - 0.1)), -x)), fmax(fmax(t_1, (0.175 - (y - 0.55))), ((y - 0.55) - 0.275)));
	} else {
		tmp = t_2;
	}
	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)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_0 = (x - 0.275d0) - (0.275d0 - y)
    t_1 = fmax(fmax(fmax((y - 0.55d0), (x - 0.55d0)), -x), (0.275d0 - y))
    t_2 = fmin(fmin(fmin(fmin(fmax(fmax(fmax((y - 0.55d0), y), (x - 0.825d0)), (0.725d0 - x)), ((((x - 0.775d0) * (x - 0.775d0)) - (0.7d0 - y)) - 0.075d0)), fmax(fmax(fmax(y, (y - 0.275d0)), (x - 0.55d0)), (0.45d0 - x))), fmax(fmax(fmax(y, (y - 2.0d0)), (x - 0.1d0)), -x)), fmax(fmax(t_1, (0.175d0 - t_0)), (t_0 - 0.275d0)))
    if (x <= (-155.0d0)) then
        tmp = t_2
    else if (x <= 1.05d-9) then
        tmp = fmin(fmin(fmin(fmin(fmax(fmax(fmax((y - 0.55d0), -y), (x - 0.825d0)), (0.725d0 - x)), ((-1.0d0) * (y * (1.0d0 - (0.625d0 * (1.0d0 / y)))))), fmax(fmax(fmax(-y, (y - 0.275d0)), (x - 0.55d0)), (0.45d0 - x))), fmax(fmax(fmax(-y, (y - 1.0d0)), (x - 0.1d0)), -x)), fmax(fmax(t_1, (0.175d0 - (y - 0.55d0))), ((y - 0.55d0) - 0.275d0)))
    else
        tmp = t_2
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = (x - 0.275) - (0.275 - y);
	double t_1 = fmax(fmax(fmax((y - 0.55), (x - 0.55)), -x), (0.275 - y));
	double t_2 = fmin(fmin(fmin(fmin(fmax(fmax(fmax((y - 0.55), y), (x - 0.825)), (0.725 - x)), ((((x - 0.775) * (x - 0.775)) - (0.7 - y)) - 0.075)), fmax(fmax(fmax(y, (y - 0.275)), (x - 0.55)), (0.45 - x))), fmax(fmax(fmax(y, (y - 2.0)), (x - 0.1)), -x)), fmax(fmax(t_1, (0.175 - t_0)), (t_0 - 0.275)));
	double tmp;
	if (x <= -155.0) {
		tmp = t_2;
	} else if (x <= 1.05e-9) {
		tmp = fmin(fmin(fmin(fmin(fmax(fmax(fmax((y - 0.55), -y), (x - 0.825)), (0.725 - x)), (-1.0 * (y * (1.0 - (0.625 * (1.0 / y)))))), fmax(fmax(fmax(-y, (y - 0.275)), (x - 0.55)), (0.45 - x))), fmax(fmax(fmax(-y, (y - 1.0)), (x - 0.1)), -x)), fmax(fmax(t_1, (0.175 - (y - 0.55))), ((y - 0.55) - 0.275)));
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y):
	t_0 = (x - 0.275) - (0.275 - y)
	t_1 = fmax(fmax(fmax((y - 0.55), (x - 0.55)), -x), (0.275 - y))
	t_2 = fmin(fmin(fmin(fmin(fmax(fmax(fmax((y - 0.55), y), (x - 0.825)), (0.725 - x)), ((((x - 0.775) * (x - 0.775)) - (0.7 - y)) - 0.075)), fmax(fmax(fmax(y, (y - 0.275)), (x - 0.55)), (0.45 - x))), fmax(fmax(fmax(y, (y - 2.0)), (x - 0.1)), -x)), fmax(fmax(t_1, (0.175 - t_0)), (t_0 - 0.275)))
	tmp = 0
	if x <= -155.0:
		tmp = t_2
	elif x <= 1.05e-9:
		tmp = fmin(fmin(fmin(fmin(fmax(fmax(fmax((y - 0.55), -y), (x - 0.825)), (0.725 - x)), (-1.0 * (y * (1.0 - (0.625 * (1.0 / y)))))), fmax(fmax(fmax(-y, (y - 0.275)), (x - 0.55)), (0.45 - x))), fmax(fmax(fmax(-y, (y - 1.0)), (x - 0.1)), -x)), fmax(fmax(t_1, (0.175 - (y - 0.55))), ((y - 0.55) - 0.275)))
	else:
		tmp = t_2
	return tmp
function code(x, y)
	t_0 = Float64(Float64(x - 0.275) - Float64(0.275 - y))
	t_1 = fmax(fmax(fmax(Float64(y - 0.55), Float64(x - 0.55)), Float64(-x)), Float64(0.275 - y))
	t_2 = fmin(fmin(fmin(fmin(fmax(fmax(fmax(Float64(y - 0.55), y), Float64(x - 0.825)), Float64(0.725 - x)), Float64(Float64(Float64(Float64(x - 0.775) * Float64(x - 0.775)) - Float64(0.7 - y)) - 0.075)), fmax(fmax(fmax(y, Float64(y - 0.275)), Float64(x - 0.55)), Float64(0.45 - x))), fmax(fmax(fmax(y, Float64(y - 2.0)), Float64(x - 0.1)), Float64(-x))), fmax(fmax(t_1, Float64(0.175 - t_0)), Float64(t_0 - 0.275)))
	tmp = 0.0
	if (x <= -155.0)
		tmp = t_2;
	elseif (x <= 1.05e-9)
		tmp = fmin(fmin(fmin(fmin(fmax(fmax(fmax(Float64(y - 0.55), Float64(-y)), Float64(x - 0.825)), Float64(0.725 - x)), Float64(-1.0 * Float64(y * Float64(1.0 - Float64(0.625 * Float64(1.0 / y)))))), fmax(fmax(fmax(Float64(-y), Float64(y - 0.275)), Float64(x - 0.55)), Float64(0.45 - x))), fmax(fmax(fmax(Float64(-y), Float64(y - 1.0)), Float64(x - 0.1)), Float64(-x))), fmax(fmax(t_1, Float64(0.175 - Float64(y - 0.55))), Float64(Float64(y - 0.55) - 0.275)));
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = (x - 0.275) - (0.275 - y);
	t_1 = max(max(max((y - 0.55), (x - 0.55)), -x), (0.275 - y));
	t_2 = min(min(min(min(max(max(max((y - 0.55), y), (x - 0.825)), (0.725 - x)), ((((x - 0.775) * (x - 0.775)) - (0.7 - y)) - 0.075)), max(max(max(y, (y - 0.275)), (x - 0.55)), (0.45 - x))), max(max(max(y, (y - 2.0)), (x - 0.1)), -x)), max(max(t_1, (0.175 - t_0)), (t_0 - 0.275)));
	tmp = 0.0;
	if (x <= -155.0)
		tmp = t_2;
	elseif (x <= 1.05e-9)
		tmp = min(min(min(min(max(max(max((y - 0.55), -y), (x - 0.825)), (0.725 - x)), (-1.0 * (y * (1.0 - (0.625 * (1.0 / y)))))), max(max(max(-y, (y - 0.275)), (x - 0.55)), (0.45 - x))), max(max(max(-y, (y - 1.0)), (x - 0.1)), -x)), max(max(t_1, (0.175 - (y - 0.55))), ((y - 0.55) - 0.275)));
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(N[(x - 0.275), $MachinePrecision] - N[(0.275 - y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Max[N[Max[N[Max[N[(y - 0.55), $MachinePrecision], N[(x - 0.55), $MachinePrecision]], $MachinePrecision], (-x)], $MachinePrecision], N[(0.275 - y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Min[N[Min[N[Min[N[Min[N[Max[N[Max[N[Max[N[(y - 0.55), $MachinePrecision], y], $MachinePrecision], N[(x - 0.825), $MachinePrecision]], $MachinePrecision], N[(0.725 - x), $MachinePrecision]], $MachinePrecision], N[(N[(N[(N[(x - 0.775), $MachinePrecision] * N[(x - 0.775), $MachinePrecision]), $MachinePrecision] - N[(0.7 - y), $MachinePrecision]), $MachinePrecision] - 0.075), $MachinePrecision]], $MachinePrecision], N[Max[N[Max[N[Max[y, N[(y - 0.275), $MachinePrecision]], $MachinePrecision], N[(x - 0.55), $MachinePrecision]], $MachinePrecision], N[(0.45 - x), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], N[Max[N[Max[N[Max[y, N[(y - 2.0), $MachinePrecision]], $MachinePrecision], N[(x - 0.1), $MachinePrecision]], $MachinePrecision], (-x)], $MachinePrecision]], $MachinePrecision], N[Max[N[Max[t$95$1, N[(0.175 - t$95$0), $MachinePrecision]], $MachinePrecision], N[(t$95$0 - 0.275), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -155.0], t$95$2, If[LessEqual[x, 1.05e-9], N[Min[N[Min[N[Min[N[Min[N[Max[N[Max[N[Max[N[(y - 0.55), $MachinePrecision], (-y)], $MachinePrecision], N[(x - 0.825), $MachinePrecision]], $MachinePrecision], N[(0.725 - x), $MachinePrecision]], $MachinePrecision], N[(-1.0 * N[(y * N[(1.0 - N[(0.625 * N[(1.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Max[N[Max[N[Max[(-y), N[(y - 0.275), $MachinePrecision]], $MachinePrecision], N[(x - 0.55), $MachinePrecision]], $MachinePrecision], N[(0.45 - x), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], N[Max[N[Max[N[Max[(-y), N[(y - 1.0), $MachinePrecision]], $MachinePrecision], N[(x - 0.1), $MachinePrecision]], $MachinePrecision], (-x)], $MachinePrecision]], $MachinePrecision], N[Max[N[Max[t$95$1, N[(0.175 - N[(y - 0.55), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[(y - 0.55), $MachinePrecision] - 0.275), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], t$95$2]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(x - 0.275\right) - \left(0.275 - y\right)\\
t_1 := \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right)\\
t_2 := \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), \left(\left(x - 0.775\right) \cdot \left(x - 0.775\right) - \left(0.7 - y\right)\right) - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(t\_1, 0.175 - t\_0\right), t\_0 - 0.275\right)\right)\\
\mathbf{if}\;x \leq -155:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;x \leq 1.05 \cdot 10^{-9}:\\
\;\;\;\;\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, -y\right), x - 0.825\right), 0.725 - x\right), -1 \cdot \left(y \cdot \left(1 - 0.625 \cdot \frac{1}{y}\right)\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 1\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(t\_1, 0.175 - \left(y - 0.55\right)\right), \left(y - 0.55\right) - 0.275\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -155 or 1.0500000000000001e-9 < x

    1. Initial program 100.0%

      \[\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, -y\right), x - 0.825\right), 0.725 - x\right), \sqrt{{\left(y - 0.7\right)}^{2} + {\left(x - 0.775\right)}^{2}} - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 1\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \sqrt{{\left(y - 0.275\right)}^{2} + {\left(x - 0.275\right)}^{2}}\right), \sqrt{{\left(y - 0.275\right)}^{2} + {\left(x - 0.275\right)}^{2}} - 0.275\right)\right) \]
    2. Applied rewrites38.1%

      \[\leadsto \color{blue}{\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), \left(\left(x - 0.775\right) - \left(0.7 - y\right)\right) - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right)\right), \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right) - 0.275\right)\right)} \]
    3. Applied rewrites57.4%

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), \left(\color{blue}{\left(x - 0.775\right) \cdot \left(x - 0.775\right)} - \left(0.7 - y\right)\right) - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right)\right), \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right) - 0.275\right)\right) \]

    if -155 < x < 1.0500000000000001e-9

    1. Initial program 100.0%

      \[\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, -y\right), x - 0.825\right), 0.725 - x\right), \sqrt{{\left(y - 0.7\right)}^{2} + {\left(x - 0.775\right)}^{2}} - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 1\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \sqrt{{\left(y - 0.275\right)}^{2} + {\left(x - 0.275\right)}^{2}}\right), \sqrt{{\left(y - 0.275\right)}^{2} + {\left(x - 0.275\right)}^{2}} - 0.275\right)\right) \]
    2. Applied rewrites100.0%

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, -y\right), x - 0.825\right), 0.725 - x\right), \sqrt{{\left(y - 0.7\right)}^{2} + {\left(x - 0.775\right)}^{2}} - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 1\right), x - 0.1\right), -x\right)\right), \color{blue}{\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right)\right), \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right) - 0.275\right)}\right) \]
    3. Taylor expanded in y around -inf

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, -y\right), x - \frac{33}{40}\right), \frac{29}{40} - x\right), \color{blue}{-1 \cdot \left(y \cdot \left(1 - \frac{5}{8} \cdot \frac{1}{y}\right)\right)}\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - \frac{11}{40}\right), x - \frac{11}{20}\right), \frac{9}{20} - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 1\right), x - \frac{1}{10}\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, x - \frac{11}{20}\right), -x\right), \frac{11}{40} - y\right), \frac{7}{40} - \left(\left(x - \frac{11}{40}\right) - \left(\frac{11}{40} - y\right)\right)\right), \left(\left(x - \frac{11}{40}\right) - \left(\frac{11}{40} - y\right)\right) - \frac{11}{40}\right)\right) \]
    4. Applied rewrites45.0%

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, -y\right), x - 0.825\right), 0.725 - x\right), \color{blue}{-1 \cdot \left(y \cdot \left(1 - 0.625 \cdot \frac{1}{y}\right)\right)}\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 1\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right)\right), \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right) - 0.275\right)\right) \]
    5. Taylor expanded in x around 0

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, -y\right), x - \frac{33}{40}\right), \frac{29}{40} - x\right), -1 \cdot \left(y \cdot \left(1 - \frac{5}{8} \cdot \frac{1}{y}\right)\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - \frac{11}{40}\right), x - \frac{11}{20}\right), \frac{9}{20} - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 1\right), x - \frac{1}{10}\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, x - \frac{11}{20}\right), -x\right), \frac{11}{40} - y\right), \frac{7}{40} - \color{blue}{\left(y - \frac{11}{20}\right)}\right), \left(\left(x - \frac{11}{40}\right) - \left(\frac{11}{40} - y\right)\right) - \frac{11}{40}\right)\right) \]
    6. Applied rewrites45.0%

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, -y\right), x - 0.825\right), 0.725 - x\right), -1 \cdot \left(y \cdot \left(1 - 0.625 \cdot \frac{1}{y}\right)\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 1\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \color{blue}{\left(y - 0.55\right)}\right), \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right) - 0.275\right)\right) \]
    7. Taylor expanded in x around 0

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, -y\right), x - \frac{33}{40}\right), \frac{29}{40} - x\right), -1 \cdot \left(y \cdot \left(1 - \frac{5}{8} \cdot \frac{1}{y}\right)\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - \frac{11}{40}\right), x - \frac{11}{20}\right), \frac{9}{20} - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 1\right), x - \frac{1}{10}\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, x - \frac{11}{20}\right), -x\right), \frac{11}{40} - y\right), \frac{7}{40} - \left(y - \frac{11}{20}\right)\right), \color{blue}{\left(y - \frac{11}{20}\right)} - \frac{11}{40}\right)\right) \]
    8. Applied rewrites45.0%

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, -y\right), x - 0.825\right), 0.725 - x\right), -1 \cdot \left(y \cdot \left(1 - 0.625 \cdot \frac{1}{y}\right)\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 1\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \left(y - 0.55\right)\right), \color{blue}{\left(y - 0.55\right)} - 0.275\right)\right) \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 3: 79.4% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\\ t_1 := \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right)\\ t_2 := \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right)\\ t_3 := \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\\ t_4 := \mathsf{max}\left(\mathsf{max}\left(t\_2, 0.725 - \left(x + y\right)\right), \left(x + y\right) - 0.825\right)\\ \mathbf{if}\;x \leq -1750:\\ \;\;\;\;\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(t\_1, \left(x - 0.775\right) \cdot \left(x - 1.475\right) - 0.075\right), t\_3\right), t\_0\right), t\_4\right)\\ \mathbf{elif}\;x \leq 1.3 \cdot 10^{+24}:\\ \;\;\;\;\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, -y\right), x - 0.825\right), 0.725 - x\right), -1 \cdot \left(y \cdot \left(1 - 0.625 \cdot \frac{1}{y}\right)\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 1\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(t\_2, 0.175 - \left(y - 0.55\right)\right), \left(y - 0.55\right) - 0.275\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(t\_1, \left(x - 0.775\right) \cdot \left(\left(x + y\right) - 1.475\right) - 0.075\right), t\_3\right), t\_0\right), t\_4\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (fmax (fmax (fmax y (- y 2.0)) (- x 0.1)) (- x)))
        (t_1 (fmax (fmax (fmax (- y 0.55) y) (- x 0.825)) (- 0.725 x)))
        (t_2 (fmax (fmax (fmax (- y 0.55) (- x 0.55)) (- x)) (- 0.275 y)))
        (t_3 (fmax (fmax (fmax y (- y 0.275)) (- x 0.55)) (- 0.45 x)))
        (t_4 (fmax (fmax t_2 (- 0.725 (+ x y))) (- (+ x y) 0.825))))
   (if (<= x -1750.0)
     (fmin
      (fmin (fmin (fmin t_1 (- (* (- x 0.775) (- x 1.475)) 0.075)) t_3) t_0)
      t_4)
     (if (<= x 1.3e+24)
       (fmin
        (fmin
         (fmin
          (fmin
           (fmax (fmax (fmax (- y 0.55) (- y)) (- x 0.825)) (- 0.725 x))
           (* -1.0 (* y (- 1.0 (* 0.625 (/ 1.0 y))))))
          (fmax (fmax (fmax (- y) (- y 0.275)) (- x 0.55)) (- 0.45 x)))
         (fmax (fmax (fmax (- y) (- y 1.0)) (- x 0.1)) (- x)))
        (fmax (fmax t_2 (- 0.175 (- y 0.55))) (- (- y 0.55) 0.275)))
       (fmin
        (fmin
         (fmin (fmin t_1 (- (* (- x 0.775) (- (+ x y) 1.475)) 0.075)) t_3)
         t_0)
        t_4)))))
double code(double x, double y) {
	double t_0 = fmax(fmax(fmax(y, (y - 2.0)), (x - 0.1)), -x);
	double t_1 = fmax(fmax(fmax((y - 0.55), y), (x - 0.825)), (0.725 - x));
	double t_2 = fmax(fmax(fmax((y - 0.55), (x - 0.55)), -x), (0.275 - y));
	double t_3 = fmax(fmax(fmax(y, (y - 0.275)), (x - 0.55)), (0.45 - x));
	double t_4 = fmax(fmax(t_2, (0.725 - (x + y))), ((x + y) - 0.825));
	double tmp;
	if (x <= -1750.0) {
		tmp = fmin(fmin(fmin(fmin(t_1, (((x - 0.775) * (x - 1.475)) - 0.075)), t_3), t_0), t_4);
	} else if (x <= 1.3e+24) {
		tmp = fmin(fmin(fmin(fmin(fmax(fmax(fmax((y - 0.55), -y), (x - 0.825)), (0.725 - x)), (-1.0 * (y * (1.0 - (0.625 * (1.0 / y)))))), fmax(fmax(fmax(-y, (y - 0.275)), (x - 0.55)), (0.45 - x))), fmax(fmax(fmax(-y, (y - 1.0)), (x - 0.1)), -x)), fmax(fmax(t_2, (0.175 - (y - 0.55))), ((y - 0.55) - 0.275)));
	} else {
		tmp = fmin(fmin(fmin(fmin(t_1, (((x - 0.775) * ((x + y) - 1.475)) - 0.075)), t_3), t_0), t_4);
	}
	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)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: t_4
    real(8) :: tmp
    t_0 = fmax(fmax(fmax(y, (y - 2.0d0)), (x - 0.1d0)), -x)
    t_1 = fmax(fmax(fmax((y - 0.55d0), y), (x - 0.825d0)), (0.725d0 - x))
    t_2 = fmax(fmax(fmax((y - 0.55d0), (x - 0.55d0)), -x), (0.275d0 - y))
    t_3 = fmax(fmax(fmax(y, (y - 0.275d0)), (x - 0.55d0)), (0.45d0 - x))
    t_4 = fmax(fmax(t_2, (0.725d0 - (x + y))), ((x + y) - 0.825d0))
    if (x <= (-1750.0d0)) then
        tmp = fmin(fmin(fmin(fmin(t_1, (((x - 0.775d0) * (x - 1.475d0)) - 0.075d0)), t_3), t_0), t_4)
    else if (x <= 1.3d+24) then
        tmp = fmin(fmin(fmin(fmin(fmax(fmax(fmax((y - 0.55d0), -y), (x - 0.825d0)), (0.725d0 - x)), ((-1.0d0) * (y * (1.0d0 - (0.625d0 * (1.0d0 / y)))))), fmax(fmax(fmax(-y, (y - 0.275d0)), (x - 0.55d0)), (0.45d0 - x))), fmax(fmax(fmax(-y, (y - 1.0d0)), (x - 0.1d0)), -x)), fmax(fmax(t_2, (0.175d0 - (y - 0.55d0))), ((y - 0.55d0) - 0.275d0)))
    else
        tmp = fmin(fmin(fmin(fmin(t_1, (((x - 0.775d0) * ((x + y) - 1.475d0)) - 0.075d0)), t_3), t_0), t_4)
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = fmax(fmax(fmax(y, (y - 2.0)), (x - 0.1)), -x);
	double t_1 = fmax(fmax(fmax((y - 0.55), y), (x - 0.825)), (0.725 - x));
	double t_2 = fmax(fmax(fmax((y - 0.55), (x - 0.55)), -x), (0.275 - y));
	double t_3 = fmax(fmax(fmax(y, (y - 0.275)), (x - 0.55)), (0.45 - x));
	double t_4 = fmax(fmax(t_2, (0.725 - (x + y))), ((x + y) - 0.825));
	double tmp;
	if (x <= -1750.0) {
		tmp = fmin(fmin(fmin(fmin(t_1, (((x - 0.775) * (x - 1.475)) - 0.075)), t_3), t_0), t_4);
	} else if (x <= 1.3e+24) {
		tmp = fmin(fmin(fmin(fmin(fmax(fmax(fmax((y - 0.55), -y), (x - 0.825)), (0.725 - x)), (-1.0 * (y * (1.0 - (0.625 * (1.0 / y)))))), fmax(fmax(fmax(-y, (y - 0.275)), (x - 0.55)), (0.45 - x))), fmax(fmax(fmax(-y, (y - 1.0)), (x - 0.1)), -x)), fmax(fmax(t_2, (0.175 - (y - 0.55))), ((y - 0.55) - 0.275)));
	} else {
		tmp = fmin(fmin(fmin(fmin(t_1, (((x - 0.775) * ((x + y) - 1.475)) - 0.075)), t_3), t_0), t_4);
	}
	return tmp;
}
def code(x, y):
	t_0 = fmax(fmax(fmax(y, (y - 2.0)), (x - 0.1)), -x)
	t_1 = fmax(fmax(fmax((y - 0.55), y), (x - 0.825)), (0.725 - x))
	t_2 = fmax(fmax(fmax((y - 0.55), (x - 0.55)), -x), (0.275 - y))
	t_3 = fmax(fmax(fmax(y, (y - 0.275)), (x - 0.55)), (0.45 - x))
	t_4 = fmax(fmax(t_2, (0.725 - (x + y))), ((x + y) - 0.825))
	tmp = 0
	if x <= -1750.0:
		tmp = fmin(fmin(fmin(fmin(t_1, (((x - 0.775) * (x - 1.475)) - 0.075)), t_3), t_0), t_4)
	elif x <= 1.3e+24:
		tmp = fmin(fmin(fmin(fmin(fmax(fmax(fmax((y - 0.55), -y), (x - 0.825)), (0.725 - x)), (-1.0 * (y * (1.0 - (0.625 * (1.0 / y)))))), fmax(fmax(fmax(-y, (y - 0.275)), (x - 0.55)), (0.45 - x))), fmax(fmax(fmax(-y, (y - 1.0)), (x - 0.1)), -x)), fmax(fmax(t_2, (0.175 - (y - 0.55))), ((y - 0.55) - 0.275)))
	else:
		tmp = fmin(fmin(fmin(fmin(t_1, (((x - 0.775) * ((x + y) - 1.475)) - 0.075)), t_3), t_0), t_4)
	return tmp
function code(x, y)
	t_0 = fmax(fmax(fmax(y, Float64(y - 2.0)), Float64(x - 0.1)), Float64(-x))
	t_1 = fmax(fmax(fmax(Float64(y - 0.55), y), Float64(x - 0.825)), Float64(0.725 - x))
	t_2 = fmax(fmax(fmax(Float64(y - 0.55), Float64(x - 0.55)), Float64(-x)), Float64(0.275 - y))
	t_3 = fmax(fmax(fmax(y, Float64(y - 0.275)), Float64(x - 0.55)), Float64(0.45 - x))
	t_4 = fmax(fmax(t_2, Float64(0.725 - Float64(x + y))), Float64(Float64(x + y) - 0.825))
	tmp = 0.0
	if (x <= -1750.0)
		tmp = fmin(fmin(fmin(fmin(t_1, Float64(Float64(Float64(x - 0.775) * Float64(x - 1.475)) - 0.075)), t_3), t_0), t_4);
	elseif (x <= 1.3e+24)
		tmp = fmin(fmin(fmin(fmin(fmax(fmax(fmax(Float64(y - 0.55), Float64(-y)), Float64(x - 0.825)), Float64(0.725 - x)), Float64(-1.0 * Float64(y * Float64(1.0 - Float64(0.625 * Float64(1.0 / y)))))), fmax(fmax(fmax(Float64(-y), Float64(y - 0.275)), Float64(x - 0.55)), Float64(0.45 - x))), fmax(fmax(fmax(Float64(-y), Float64(y - 1.0)), Float64(x - 0.1)), Float64(-x))), fmax(fmax(t_2, Float64(0.175 - Float64(y - 0.55))), Float64(Float64(y - 0.55) - 0.275)));
	else
		tmp = fmin(fmin(fmin(fmin(t_1, Float64(Float64(Float64(x - 0.775) * Float64(Float64(x + y) - 1.475)) - 0.075)), t_3), t_0), t_4);
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = max(max(max(y, (y - 2.0)), (x - 0.1)), -x);
	t_1 = max(max(max((y - 0.55), y), (x - 0.825)), (0.725 - x));
	t_2 = max(max(max((y - 0.55), (x - 0.55)), -x), (0.275 - y));
	t_3 = max(max(max(y, (y - 0.275)), (x - 0.55)), (0.45 - x));
	t_4 = max(max(t_2, (0.725 - (x + y))), ((x + y) - 0.825));
	tmp = 0.0;
	if (x <= -1750.0)
		tmp = min(min(min(min(t_1, (((x - 0.775) * (x - 1.475)) - 0.075)), t_3), t_0), t_4);
	elseif (x <= 1.3e+24)
		tmp = min(min(min(min(max(max(max((y - 0.55), -y), (x - 0.825)), (0.725 - x)), (-1.0 * (y * (1.0 - (0.625 * (1.0 / y)))))), max(max(max(-y, (y - 0.275)), (x - 0.55)), (0.45 - x))), max(max(max(-y, (y - 1.0)), (x - 0.1)), -x)), max(max(t_2, (0.175 - (y - 0.55))), ((y - 0.55) - 0.275)));
	else
		tmp = min(min(min(min(t_1, (((x - 0.775) * ((x + y) - 1.475)) - 0.075)), t_3), t_0), t_4);
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[Max[N[Max[N[Max[y, N[(y - 2.0), $MachinePrecision]], $MachinePrecision], N[(x - 0.1), $MachinePrecision]], $MachinePrecision], (-x)], $MachinePrecision]}, Block[{t$95$1 = N[Max[N[Max[N[Max[N[(y - 0.55), $MachinePrecision], y], $MachinePrecision], N[(x - 0.825), $MachinePrecision]], $MachinePrecision], N[(0.725 - x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Max[N[Max[N[Max[N[(y - 0.55), $MachinePrecision], N[(x - 0.55), $MachinePrecision]], $MachinePrecision], (-x)], $MachinePrecision], N[(0.275 - y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Max[N[Max[N[Max[y, N[(y - 0.275), $MachinePrecision]], $MachinePrecision], N[(x - 0.55), $MachinePrecision]], $MachinePrecision], N[(0.45 - x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[Max[N[Max[t$95$2, N[(0.725 - N[(x + y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[(x + y), $MachinePrecision] - 0.825), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -1750.0], N[Min[N[Min[N[Min[N[Min[t$95$1, N[(N[(N[(x - 0.775), $MachinePrecision] * N[(x - 1.475), $MachinePrecision]), $MachinePrecision] - 0.075), $MachinePrecision]], $MachinePrecision], t$95$3], $MachinePrecision], t$95$0], $MachinePrecision], t$95$4], $MachinePrecision], If[LessEqual[x, 1.3e+24], N[Min[N[Min[N[Min[N[Min[N[Max[N[Max[N[Max[N[(y - 0.55), $MachinePrecision], (-y)], $MachinePrecision], N[(x - 0.825), $MachinePrecision]], $MachinePrecision], N[(0.725 - x), $MachinePrecision]], $MachinePrecision], N[(-1.0 * N[(y * N[(1.0 - N[(0.625 * N[(1.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Max[N[Max[N[Max[(-y), N[(y - 0.275), $MachinePrecision]], $MachinePrecision], N[(x - 0.55), $MachinePrecision]], $MachinePrecision], N[(0.45 - x), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], N[Max[N[Max[N[Max[(-y), N[(y - 1.0), $MachinePrecision]], $MachinePrecision], N[(x - 0.1), $MachinePrecision]], $MachinePrecision], (-x)], $MachinePrecision]], $MachinePrecision], N[Max[N[Max[t$95$2, N[(0.175 - N[(y - 0.55), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[(y - 0.55), $MachinePrecision] - 0.275), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], N[Min[N[Min[N[Min[N[Min[t$95$1, N[(N[(N[(x - 0.775), $MachinePrecision] * N[(N[(x + y), $MachinePrecision] - 1.475), $MachinePrecision]), $MachinePrecision] - 0.075), $MachinePrecision]], $MachinePrecision], t$95$3], $MachinePrecision], t$95$0], $MachinePrecision], t$95$4], $MachinePrecision]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\\
t_1 := \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right)\\
t_2 := \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right)\\
t_3 := \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\\
t_4 := \mathsf{max}\left(\mathsf{max}\left(t\_2, 0.725 - \left(x + y\right)\right), \left(x + y\right) - 0.825\right)\\
\mathbf{if}\;x \leq -1750:\\
\;\;\;\;\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(t\_1, \left(x - 0.775\right) \cdot \left(x - 1.475\right) - 0.075\right), t\_3\right), t\_0\right), t\_4\right)\\

\mathbf{elif}\;x \leq 1.3 \cdot 10^{+24}:\\
\;\;\;\;\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, -y\right), x - 0.825\right), 0.725 - x\right), -1 \cdot \left(y \cdot \left(1 - 0.625 \cdot \frac{1}{y}\right)\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 1\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(t\_2, 0.175 - \left(y - 0.55\right)\right), \left(y - 0.55\right) - 0.275\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(t\_1, \left(x - 0.775\right) \cdot \left(\left(x + y\right) - 1.475\right) - 0.075\right), t\_3\right), t\_0\right), t\_4\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1750

    1. Initial program 100.0%

      \[\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, -y\right), x - 0.825\right), 0.725 - x\right), \sqrt{{\left(y - 0.7\right)}^{2} + {\left(x - 0.775\right)}^{2}} - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 1\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \sqrt{{\left(y - 0.275\right)}^{2} + {\left(x - 0.275\right)}^{2}}\right), \sqrt{{\left(y - 0.275\right)}^{2} + {\left(x - 0.275\right)}^{2}} - 0.275\right)\right) \]
    2. Applied rewrites38.1%

      \[\leadsto \color{blue}{\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), \left(\left(x - 0.775\right) - \left(0.7 - y\right)\right) - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right)\right), \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right) - 0.275\right)\right)} \]
    3. Applied rewrites48.3%

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), \color{blue}{\left(\left(x - 0.775\right) - \left(0.7 - y\right)\right) \cdot \left(x - 0.775\right)} - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right)\right), \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right) - 0.275\right)\right) \]
    4. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, y\right), x - \frac{33}{40}\right), \frac{29}{40} - x\right), \left(x - \frac{31}{40}\right) \cdot \left(\left(x + y\right) - \frac{59}{40}\right) - \frac{3}{40}\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - \frac{11}{40}\right), x - \frac{11}{20}\right), \frac{9}{20} - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - \frac{1}{10}\right), \mathsf{neg}\left(x\right)\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, x - \frac{11}{20}\right), \mathsf{neg}\left(x\right)\right), \frac{11}{40} - y\right), \frac{29}{40} - \left(x + y\right)\right), \left(x + y\right) - \frac{33}{40}\right)\right)} \]
    5. Applied rewrites48.3%

      \[\leadsto \color{blue}{\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), \left(x - 0.775\right) \cdot \left(\left(x + y\right) - 1.475\right) - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.725 - \left(x + y\right)\right), \left(x + y\right) - 0.825\right)\right)} \]
    6. Taylor expanded in y around 0

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, y\right), x - \frac{33}{40}\right), \frac{29}{40} - x\right), \left(x - \frac{31}{40}\right) \cdot \left(x - \frac{59}{40}\right) - \frac{3}{40}\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - \frac{11}{40}\right), x - \frac{11}{20}\right), \frac{9}{20} - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - \frac{1}{10}\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, x - \frac{11}{20}\right), -\color{blue}{x}\right), \frac{11}{40} - y\right), \frac{29}{40} - \left(x + y\right)\right), \left(x + y\right) - \frac{33}{40}\right)\right) \]
    7. Applied rewrites49.5%

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), \left(x - 0.775\right) \cdot \left(x - 1.475\right) - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -\color{blue}{x}\right), 0.275 - y\right), 0.725 - \left(x + y\right)\right), \left(x + y\right) - 0.825\right)\right) \]

    if -1750 < x < 1.2999999999999999e24

    1. Initial program 100.0%

      \[\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, -y\right), x - 0.825\right), 0.725 - x\right), \sqrt{{\left(y - 0.7\right)}^{2} + {\left(x - 0.775\right)}^{2}} - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 1\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \sqrt{{\left(y - 0.275\right)}^{2} + {\left(x - 0.275\right)}^{2}}\right), \sqrt{{\left(y - 0.275\right)}^{2} + {\left(x - 0.275\right)}^{2}} - 0.275\right)\right) \]
    2. Applied rewrites100.0%

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, -y\right), x - 0.825\right), 0.725 - x\right), \sqrt{{\left(y - 0.7\right)}^{2} + {\left(x - 0.775\right)}^{2}} - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 1\right), x - 0.1\right), -x\right)\right), \color{blue}{\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right)\right), \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right) - 0.275\right)}\right) \]
    3. Taylor expanded in y around -inf

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, -y\right), x - \frac{33}{40}\right), \frac{29}{40} - x\right), \color{blue}{-1 \cdot \left(y \cdot \left(1 - \frac{5}{8} \cdot \frac{1}{y}\right)\right)}\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - \frac{11}{40}\right), x - \frac{11}{20}\right), \frac{9}{20} - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 1\right), x - \frac{1}{10}\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, x - \frac{11}{20}\right), -x\right), \frac{11}{40} - y\right), \frac{7}{40} - \left(\left(x - \frac{11}{40}\right) - \left(\frac{11}{40} - y\right)\right)\right), \left(\left(x - \frac{11}{40}\right) - \left(\frac{11}{40} - y\right)\right) - \frac{11}{40}\right)\right) \]
    4. Applied rewrites45.0%

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, -y\right), x - 0.825\right), 0.725 - x\right), \color{blue}{-1 \cdot \left(y \cdot \left(1 - 0.625 \cdot \frac{1}{y}\right)\right)}\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 1\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right)\right), \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right) - 0.275\right)\right) \]
    5. Taylor expanded in x around 0

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, -y\right), x - \frac{33}{40}\right), \frac{29}{40} - x\right), -1 \cdot \left(y \cdot \left(1 - \frac{5}{8} \cdot \frac{1}{y}\right)\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - \frac{11}{40}\right), x - \frac{11}{20}\right), \frac{9}{20} - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 1\right), x - \frac{1}{10}\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, x - \frac{11}{20}\right), -x\right), \frac{11}{40} - y\right), \frac{7}{40} - \color{blue}{\left(y - \frac{11}{20}\right)}\right), \left(\left(x - \frac{11}{40}\right) - \left(\frac{11}{40} - y\right)\right) - \frac{11}{40}\right)\right) \]
    6. Applied rewrites45.0%

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, -y\right), x - 0.825\right), 0.725 - x\right), -1 \cdot \left(y \cdot \left(1 - 0.625 \cdot \frac{1}{y}\right)\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 1\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \color{blue}{\left(y - 0.55\right)}\right), \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right) - 0.275\right)\right) \]
    7. Taylor expanded in x around 0

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, -y\right), x - \frac{33}{40}\right), \frac{29}{40} - x\right), -1 \cdot \left(y \cdot \left(1 - \frac{5}{8} \cdot \frac{1}{y}\right)\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - \frac{11}{40}\right), x - \frac{11}{20}\right), \frac{9}{20} - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 1\right), x - \frac{1}{10}\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, x - \frac{11}{20}\right), -x\right), \frac{11}{40} - y\right), \frac{7}{40} - \left(y - \frac{11}{20}\right)\right), \color{blue}{\left(y - \frac{11}{20}\right)} - \frac{11}{40}\right)\right) \]
    8. Applied rewrites45.0%

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, -y\right), x - 0.825\right), 0.725 - x\right), -1 \cdot \left(y \cdot \left(1 - 0.625 \cdot \frac{1}{y}\right)\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 1\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \left(y - 0.55\right)\right), \color{blue}{\left(y - 0.55\right)} - 0.275\right)\right) \]

    if 1.2999999999999999e24 < x

    1. Initial program 100.0%

      \[\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, -y\right), x - 0.825\right), 0.725 - x\right), \sqrt{{\left(y - 0.7\right)}^{2} + {\left(x - 0.775\right)}^{2}} - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 1\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \sqrt{{\left(y - 0.275\right)}^{2} + {\left(x - 0.275\right)}^{2}}\right), \sqrt{{\left(y - 0.275\right)}^{2} + {\left(x - 0.275\right)}^{2}} - 0.275\right)\right) \]
    2. Applied rewrites38.1%

      \[\leadsto \color{blue}{\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), \left(\left(x - 0.775\right) - \left(0.7 - y\right)\right) - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right)\right), \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right) - 0.275\right)\right)} \]
    3. Applied rewrites48.3%

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), \color{blue}{\left(\left(x - 0.775\right) - \left(0.7 - y\right)\right) \cdot \left(x - 0.775\right)} - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right)\right), \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right) - 0.275\right)\right) \]
    4. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, y\right), x - \frac{33}{40}\right), \frac{29}{40} - x\right), \left(x - \frac{31}{40}\right) \cdot \left(\left(x + y\right) - \frac{59}{40}\right) - \frac{3}{40}\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - \frac{11}{40}\right), x - \frac{11}{20}\right), \frac{9}{20} - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - \frac{1}{10}\right), \mathsf{neg}\left(x\right)\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, x - \frac{11}{20}\right), \mathsf{neg}\left(x\right)\right), \frac{11}{40} - y\right), \frac{29}{40} - \left(x + y\right)\right), \left(x + y\right) - \frac{33}{40}\right)\right)} \]
    5. Applied rewrites48.3%

      \[\leadsto \color{blue}{\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), \left(x - 0.775\right) \cdot \left(\left(x + y\right) - 1.475\right) - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.725 - \left(x + y\right)\right), \left(x + y\right) - 0.825\right)\right)} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 4: 66.6% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right)\\ t_1 := \left(x - 0.275\right) - \left(0.275 - y\right)\\ t_2 := \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, -y\right), x - 0.825\right), 0.725 - x\right)\\ t_3 := \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\\ t_4 := \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 1\right), x - 0.1\right), -x\right)\\ t_5 := \sqrt{{\left(y - 0.275\right)}^{2} + {\left(x - 0.275\right)}^{2}}\\ \mathbf{if}\;\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(t\_2, \sqrt{{\left(y - 0.7\right)}^{2} + {\left(x - 0.775\right)}^{2}} - 0.075\right), t\_3\right), t\_4\right), \mathsf{max}\left(\mathsf{max}\left(t\_0, 0.175 - t\_5\right), t\_5 - 0.275\right)\right) \leq 400000:\\ \;\;\;\;\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(t\_2, 0.625\right), t\_3\right), t\_4\right), \mathsf{max}\left(\mathsf{max}\left(t\_0, 0.175 - t\_1\right), t\_1 - 0.275\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), \left(x - 0.775\right) \cdot \left(x - 1.475\right) - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(t\_0, 0.725 - \left(x + y\right)\right), \left(x + y\right) - 0.825\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (fmax (fmax (fmax (- y 0.55) (- x 0.55)) (- x)) (- 0.275 y)))
        (t_1 (- (- x 0.275) (- 0.275 y)))
        (t_2 (fmax (fmax (fmax (- y 0.55) (- y)) (- x 0.825)) (- 0.725 x)))
        (t_3 (fmax (fmax (fmax (- y) (- y 0.275)) (- x 0.55)) (- 0.45 x)))
        (t_4 (fmax (fmax (fmax (- y) (- y 1.0)) (- x 0.1)) (- x)))
        (t_5 (sqrt (+ (pow (- y 0.275) 2.0) (pow (- x 0.275) 2.0)))))
   (if (<=
        (fmin
         (fmin
          (fmin
           (fmin
            t_2
            (- (sqrt (+ (pow (- y 0.7) 2.0) (pow (- x 0.775) 2.0))) 0.075))
           t_3)
          t_4)
         (fmax (fmax t_0 (- 0.175 t_5)) (- t_5 0.275)))
        400000.0)
     (fmin
      (fmin (fmin (fmin t_2 0.625) t_3) t_4)
      (fmax (fmax t_0 (- 0.175 t_1)) (- t_1 0.275)))
     (fmin
      (fmin
       (fmin
        (fmin
         (fmax (fmax (fmax (- y 0.55) y) (- x 0.825)) (- 0.725 x))
         (- (* (- x 0.775) (- x 1.475)) 0.075))
        (fmax (fmax (fmax y (- y 0.275)) (- x 0.55)) (- 0.45 x)))
       (fmax (fmax (fmax y (- y 2.0)) (- x 0.1)) (- x)))
      (fmax (fmax t_0 (- 0.725 (+ x y))) (- (+ x y) 0.825))))))
double code(double x, double y) {
	double t_0 = fmax(fmax(fmax((y - 0.55), (x - 0.55)), -x), (0.275 - y));
	double t_1 = (x - 0.275) - (0.275 - y);
	double t_2 = fmax(fmax(fmax((y - 0.55), -y), (x - 0.825)), (0.725 - x));
	double t_3 = fmax(fmax(fmax(-y, (y - 0.275)), (x - 0.55)), (0.45 - x));
	double t_4 = fmax(fmax(fmax(-y, (y - 1.0)), (x - 0.1)), -x);
	double t_5 = sqrt((pow((y - 0.275), 2.0) + pow((x - 0.275), 2.0)));
	double tmp;
	if (fmin(fmin(fmin(fmin(t_2, (sqrt((pow((y - 0.7), 2.0) + pow((x - 0.775), 2.0))) - 0.075)), t_3), t_4), fmax(fmax(t_0, (0.175 - t_5)), (t_5 - 0.275))) <= 400000.0) {
		tmp = fmin(fmin(fmin(fmin(t_2, 0.625), t_3), t_4), fmax(fmax(t_0, (0.175 - t_1)), (t_1 - 0.275)));
	} else {
		tmp = fmin(fmin(fmin(fmin(fmax(fmax(fmax((y - 0.55), y), (x - 0.825)), (0.725 - x)), (((x - 0.775) * (x - 1.475)) - 0.075)), fmax(fmax(fmax(y, (y - 0.275)), (x - 0.55)), (0.45 - x))), fmax(fmax(fmax(y, (y - 2.0)), (x - 0.1)), -x)), fmax(fmax(t_0, (0.725 - (x + y))), ((x + y) - 0.825)));
	}
	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)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: t_4
    real(8) :: t_5
    real(8) :: tmp
    t_0 = fmax(fmax(fmax((y - 0.55d0), (x - 0.55d0)), -x), (0.275d0 - y))
    t_1 = (x - 0.275d0) - (0.275d0 - y)
    t_2 = fmax(fmax(fmax((y - 0.55d0), -y), (x - 0.825d0)), (0.725d0 - x))
    t_3 = fmax(fmax(fmax(-y, (y - 0.275d0)), (x - 0.55d0)), (0.45d0 - x))
    t_4 = fmax(fmax(fmax(-y, (y - 1.0d0)), (x - 0.1d0)), -x)
    t_5 = sqrt((((y - 0.275d0) ** 2.0d0) + ((x - 0.275d0) ** 2.0d0)))
    if (fmin(fmin(fmin(fmin(t_2, (sqrt((((y - 0.7d0) ** 2.0d0) + ((x - 0.775d0) ** 2.0d0))) - 0.075d0)), t_3), t_4), fmax(fmax(t_0, (0.175d0 - t_5)), (t_5 - 0.275d0))) <= 400000.0d0) then
        tmp = fmin(fmin(fmin(fmin(t_2, 0.625d0), t_3), t_4), fmax(fmax(t_0, (0.175d0 - t_1)), (t_1 - 0.275d0)))
    else
        tmp = fmin(fmin(fmin(fmin(fmax(fmax(fmax((y - 0.55d0), y), (x - 0.825d0)), (0.725d0 - x)), (((x - 0.775d0) * (x - 1.475d0)) - 0.075d0)), fmax(fmax(fmax(y, (y - 0.275d0)), (x - 0.55d0)), (0.45d0 - x))), fmax(fmax(fmax(y, (y - 2.0d0)), (x - 0.1d0)), -x)), fmax(fmax(t_0, (0.725d0 - (x + y))), ((x + y) - 0.825d0)))
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = fmax(fmax(fmax((y - 0.55), (x - 0.55)), -x), (0.275 - y));
	double t_1 = (x - 0.275) - (0.275 - y);
	double t_2 = fmax(fmax(fmax((y - 0.55), -y), (x - 0.825)), (0.725 - x));
	double t_3 = fmax(fmax(fmax(-y, (y - 0.275)), (x - 0.55)), (0.45 - x));
	double t_4 = fmax(fmax(fmax(-y, (y - 1.0)), (x - 0.1)), -x);
	double t_5 = Math.sqrt((Math.pow((y - 0.275), 2.0) + Math.pow((x - 0.275), 2.0)));
	double tmp;
	if (fmin(fmin(fmin(fmin(t_2, (Math.sqrt((Math.pow((y - 0.7), 2.0) + Math.pow((x - 0.775), 2.0))) - 0.075)), t_3), t_4), fmax(fmax(t_0, (0.175 - t_5)), (t_5 - 0.275))) <= 400000.0) {
		tmp = fmin(fmin(fmin(fmin(t_2, 0.625), t_3), t_4), fmax(fmax(t_0, (0.175 - t_1)), (t_1 - 0.275)));
	} else {
		tmp = fmin(fmin(fmin(fmin(fmax(fmax(fmax((y - 0.55), y), (x - 0.825)), (0.725 - x)), (((x - 0.775) * (x - 1.475)) - 0.075)), fmax(fmax(fmax(y, (y - 0.275)), (x - 0.55)), (0.45 - x))), fmax(fmax(fmax(y, (y - 2.0)), (x - 0.1)), -x)), fmax(fmax(t_0, (0.725 - (x + y))), ((x + y) - 0.825)));
	}
	return tmp;
}
def code(x, y):
	t_0 = fmax(fmax(fmax((y - 0.55), (x - 0.55)), -x), (0.275 - y))
	t_1 = (x - 0.275) - (0.275 - y)
	t_2 = fmax(fmax(fmax((y - 0.55), -y), (x - 0.825)), (0.725 - x))
	t_3 = fmax(fmax(fmax(-y, (y - 0.275)), (x - 0.55)), (0.45 - x))
	t_4 = fmax(fmax(fmax(-y, (y - 1.0)), (x - 0.1)), -x)
	t_5 = math.sqrt((math.pow((y - 0.275), 2.0) + math.pow((x - 0.275), 2.0)))
	tmp = 0
	if fmin(fmin(fmin(fmin(t_2, (math.sqrt((math.pow((y - 0.7), 2.0) + math.pow((x - 0.775), 2.0))) - 0.075)), t_3), t_4), fmax(fmax(t_0, (0.175 - t_5)), (t_5 - 0.275))) <= 400000.0:
		tmp = fmin(fmin(fmin(fmin(t_2, 0.625), t_3), t_4), fmax(fmax(t_0, (0.175 - t_1)), (t_1 - 0.275)))
	else:
		tmp = fmin(fmin(fmin(fmin(fmax(fmax(fmax((y - 0.55), y), (x - 0.825)), (0.725 - x)), (((x - 0.775) * (x - 1.475)) - 0.075)), fmax(fmax(fmax(y, (y - 0.275)), (x - 0.55)), (0.45 - x))), fmax(fmax(fmax(y, (y - 2.0)), (x - 0.1)), -x)), fmax(fmax(t_0, (0.725 - (x + y))), ((x + y) - 0.825)))
	return tmp
function code(x, y)
	t_0 = fmax(fmax(fmax(Float64(y - 0.55), Float64(x - 0.55)), Float64(-x)), Float64(0.275 - y))
	t_1 = Float64(Float64(x - 0.275) - Float64(0.275 - y))
	t_2 = fmax(fmax(fmax(Float64(y - 0.55), Float64(-y)), Float64(x - 0.825)), Float64(0.725 - x))
	t_3 = fmax(fmax(fmax(Float64(-y), Float64(y - 0.275)), Float64(x - 0.55)), Float64(0.45 - x))
	t_4 = fmax(fmax(fmax(Float64(-y), Float64(y - 1.0)), Float64(x - 0.1)), Float64(-x))
	t_5 = sqrt(Float64((Float64(y - 0.275) ^ 2.0) + (Float64(x - 0.275) ^ 2.0)))
	tmp = 0.0
	if (fmin(fmin(fmin(fmin(t_2, Float64(sqrt(Float64((Float64(y - 0.7) ^ 2.0) + (Float64(x - 0.775) ^ 2.0))) - 0.075)), t_3), t_4), fmax(fmax(t_0, Float64(0.175 - t_5)), Float64(t_5 - 0.275))) <= 400000.0)
		tmp = fmin(fmin(fmin(fmin(t_2, 0.625), t_3), t_4), fmax(fmax(t_0, Float64(0.175 - t_1)), Float64(t_1 - 0.275)));
	else
		tmp = fmin(fmin(fmin(fmin(fmax(fmax(fmax(Float64(y - 0.55), y), Float64(x - 0.825)), Float64(0.725 - x)), Float64(Float64(Float64(x - 0.775) * Float64(x - 1.475)) - 0.075)), fmax(fmax(fmax(y, Float64(y - 0.275)), Float64(x - 0.55)), Float64(0.45 - x))), fmax(fmax(fmax(y, Float64(y - 2.0)), Float64(x - 0.1)), Float64(-x))), fmax(fmax(t_0, Float64(0.725 - Float64(x + y))), Float64(Float64(x + y) - 0.825)));
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = max(max(max((y - 0.55), (x - 0.55)), -x), (0.275 - y));
	t_1 = (x - 0.275) - (0.275 - y);
	t_2 = max(max(max((y - 0.55), -y), (x - 0.825)), (0.725 - x));
	t_3 = max(max(max(-y, (y - 0.275)), (x - 0.55)), (0.45 - x));
	t_4 = max(max(max(-y, (y - 1.0)), (x - 0.1)), -x);
	t_5 = sqrt((((y - 0.275) ^ 2.0) + ((x - 0.275) ^ 2.0)));
	tmp = 0.0;
	if (min(min(min(min(t_2, (sqrt((((y - 0.7) ^ 2.0) + ((x - 0.775) ^ 2.0))) - 0.075)), t_3), t_4), max(max(t_0, (0.175 - t_5)), (t_5 - 0.275))) <= 400000.0)
		tmp = min(min(min(min(t_2, 0.625), t_3), t_4), max(max(t_0, (0.175 - t_1)), (t_1 - 0.275)));
	else
		tmp = min(min(min(min(max(max(max((y - 0.55), y), (x - 0.825)), (0.725 - x)), (((x - 0.775) * (x - 1.475)) - 0.075)), max(max(max(y, (y - 0.275)), (x - 0.55)), (0.45 - x))), max(max(max(y, (y - 2.0)), (x - 0.1)), -x)), max(max(t_0, (0.725 - (x + y))), ((x + y) - 0.825)));
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[Max[N[Max[N[Max[N[(y - 0.55), $MachinePrecision], N[(x - 0.55), $MachinePrecision]], $MachinePrecision], (-x)], $MachinePrecision], N[(0.275 - y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(x - 0.275), $MachinePrecision] - N[(0.275 - y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Max[N[Max[N[Max[N[(y - 0.55), $MachinePrecision], (-y)], $MachinePrecision], N[(x - 0.825), $MachinePrecision]], $MachinePrecision], N[(0.725 - x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Max[N[Max[N[Max[(-y), N[(y - 0.275), $MachinePrecision]], $MachinePrecision], N[(x - 0.55), $MachinePrecision]], $MachinePrecision], N[(0.45 - x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[Max[N[Max[N[Max[(-y), N[(y - 1.0), $MachinePrecision]], $MachinePrecision], N[(x - 0.1), $MachinePrecision]], $MachinePrecision], (-x)], $MachinePrecision]}, Block[{t$95$5 = N[Sqrt[N[(N[Power[N[(y - 0.275), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(x - 0.275), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[Min[N[Min[N[Min[N[Min[t$95$2, N[(N[Sqrt[N[(N[Power[N[(y - 0.7), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(x - 0.775), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.075), $MachinePrecision]], $MachinePrecision], t$95$3], $MachinePrecision], t$95$4], $MachinePrecision], N[Max[N[Max[t$95$0, N[(0.175 - t$95$5), $MachinePrecision]], $MachinePrecision], N[(t$95$5 - 0.275), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], 400000.0], N[Min[N[Min[N[Min[N[Min[t$95$2, 0.625], $MachinePrecision], t$95$3], $MachinePrecision], t$95$4], $MachinePrecision], N[Max[N[Max[t$95$0, N[(0.175 - t$95$1), $MachinePrecision]], $MachinePrecision], N[(t$95$1 - 0.275), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], N[Min[N[Min[N[Min[N[Min[N[Max[N[Max[N[Max[N[(y - 0.55), $MachinePrecision], y], $MachinePrecision], N[(x - 0.825), $MachinePrecision]], $MachinePrecision], N[(0.725 - x), $MachinePrecision]], $MachinePrecision], N[(N[(N[(x - 0.775), $MachinePrecision] * N[(x - 1.475), $MachinePrecision]), $MachinePrecision] - 0.075), $MachinePrecision]], $MachinePrecision], N[Max[N[Max[N[Max[y, N[(y - 0.275), $MachinePrecision]], $MachinePrecision], N[(x - 0.55), $MachinePrecision]], $MachinePrecision], N[(0.45 - x), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], N[Max[N[Max[N[Max[y, N[(y - 2.0), $MachinePrecision]], $MachinePrecision], N[(x - 0.1), $MachinePrecision]], $MachinePrecision], (-x)], $MachinePrecision]], $MachinePrecision], N[Max[N[Max[t$95$0, N[(0.725 - N[(x + y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[(x + y), $MachinePrecision] - 0.825), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right)\\
t_1 := \left(x - 0.275\right) - \left(0.275 - y\right)\\
t_2 := \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, -y\right), x - 0.825\right), 0.725 - x\right)\\
t_3 := \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\\
t_4 := \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 1\right), x - 0.1\right), -x\right)\\
t_5 := \sqrt{{\left(y - 0.275\right)}^{2} + {\left(x - 0.275\right)}^{2}}\\
\mathbf{if}\;\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(t\_2, \sqrt{{\left(y - 0.7\right)}^{2} + {\left(x - 0.775\right)}^{2}} - 0.075\right), t\_3\right), t\_4\right), \mathsf{max}\left(\mathsf{max}\left(t\_0, 0.175 - t\_5\right), t\_5 - 0.275\right)\right) \leq 400000:\\
\;\;\;\;\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(t\_2, 0.625\right), t\_3\right), t\_4\right), \mathsf{max}\left(\mathsf{max}\left(t\_0, 0.175 - t\_1\right), t\_1 - 0.275\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), \left(x - 0.775\right) \cdot \left(x - 1.475\right) - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(t\_0, 0.725 - \left(x + y\right)\right), \left(x + y\right) - 0.825\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (fmin.f64 (fmin.f64 (fmin.f64 (fmin.f64 (fmax.f64 (fmax.f64 (fmax.f64 (-.f64 y #s(literal 11/20 binary64)) (neg.f64 y)) (-.f64 x #s(literal 33/40 binary64))) (-.f64 #s(literal 29/40 binary64) x)) (-.f64 (sqrt.f64 (+.f64 (pow.f64 (-.f64 y #s(literal 7/10 binary64)) #s(literal 2 binary64)) (pow.f64 (-.f64 x #s(literal 31/40 binary64)) #s(literal 2 binary64)))) #s(literal 3/40 binary64))) (fmax.f64 (fmax.f64 (fmax.f64 (neg.f64 y) (-.f64 y #s(literal 11/40 binary64))) (-.f64 x #s(literal 11/20 binary64))) (-.f64 #s(literal 9/20 binary64) x))) (fmax.f64 (fmax.f64 (fmax.f64 (neg.f64 y) (-.f64 y #s(literal 1 binary64))) (-.f64 x #s(literal 1/10 binary64))) (neg.f64 x))) (fmax.f64 (fmax.f64 (fmax.f64 (fmax.f64 (fmax.f64 (-.f64 y #s(literal 11/20 binary64)) (-.f64 x #s(literal 11/20 binary64))) (neg.f64 x)) (-.f64 #s(literal 11/40 binary64) y)) (-.f64 #s(literal 7/40 binary64) (sqrt.f64 (+.f64 (pow.f64 (-.f64 y #s(literal 11/40 binary64)) #s(literal 2 binary64)) (pow.f64 (-.f64 x #s(literal 11/40 binary64)) #s(literal 2 binary64)))))) (-.f64 (sqrt.f64 (+.f64 (pow.f64 (-.f64 y #s(literal 11/40 binary64)) #s(literal 2 binary64)) (pow.f64 (-.f64 x #s(literal 11/40 binary64)) #s(literal 2 binary64)))) #s(literal 11/40 binary64)))) < 4e5

    1. Initial program 100.0%

      \[\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, -y\right), x - 0.825\right), 0.725 - x\right), \sqrt{{\left(y - 0.7\right)}^{2} + {\left(x - 0.775\right)}^{2}} - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 1\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \sqrt{{\left(y - 0.275\right)}^{2} + {\left(x - 0.275\right)}^{2}}\right), \sqrt{{\left(y - 0.275\right)}^{2} + {\left(x - 0.275\right)}^{2}} - 0.275\right)\right) \]
    2. Applied rewrites100.0%

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, -y\right), x - 0.825\right), 0.725 - x\right), \sqrt{{\left(y - 0.7\right)}^{2} + {\left(x - 0.775\right)}^{2}} - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 1\right), x - 0.1\right), -x\right)\right), \color{blue}{\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right)\right), \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right) - 0.275\right)}\right) \]
    3. Taylor expanded in y around -inf

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, -y\right), x - \frac{33}{40}\right), \frac{29}{40} - x\right), \color{blue}{-1 \cdot \left(y \cdot \left(1 - \frac{5}{8} \cdot \frac{1}{y}\right)\right)}\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - \frac{11}{40}\right), x - \frac{11}{20}\right), \frac{9}{20} - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 1\right), x - \frac{1}{10}\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, x - \frac{11}{20}\right), -x\right), \frac{11}{40} - y\right), \frac{7}{40} - \left(\left(x - \frac{11}{40}\right) - \left(\frac{11}{40} - y\right)\right)\right), \left(\left(x - \frac{11}{40}\right) - \left(\frac{11}{40} - y\right)\right) - \frac{11}{40}\right)\right) \]
    4. Applied rewrites45.0%

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, -y\right), x - 0.825\right), 0.725 - x\right), \color{blue}{-1 \cdot \left(y \cdot \left(1 - 0.625 \cdot \frac{1}{y}\right)\right)}\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 1\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right)\right), \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right) - 0.275\right)\right) \]
    5. Taylor expanded in y around 0

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, -y\right), x - \frac{33}{40}\right), \frac{29}{40} - x\right), \frac{5}{8}\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - \frac{11}{40}\right), x - \frac{11}{20}\right), \frac{9}{20} - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 1\right), x - \frac{1}{10}\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, x - \frac{11}{20}\right), -x\right), \frac{11}{40} - y\right), \frac{7}{40} - \left(\left(x - \frac{11}{40}\right) - \left(\frac{11}{40} - y\right)\right)\right), \left(\left(x - \frac{11}{40}\right) - \left(\frac{11}{40} - y\right)\right) - \frac{11}{40}\right)\right) \]
    6. Applied rewrites28.0%

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, -y\right), x - 0.825\right), 0.725 - x\right), 0.625\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 1\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right)\right), \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right) - 0.275\right)\right) \]

    if 4e5 < (fmin.f64 (fmin.f64 (fmin.f64 (fmin.f64 (fmax.f64 (fmax.f64 (fmax.f64 (-.f64 y #s(literal 11/20 binary64)) (neg.f64 y)) (-.f64 x #s(literal 33/40 binary64))) (-.f64 #s(literal 29/40 binary64) x)) (-.f64 (sqrt.f64 (+.f64 (pow.f64 (-.f64 y #s(literal 7/10 binary64)) #s(literal 2 binary64)) (pow.f64 (-.f64 x #s(literal 31/40 binary64)) #s(literal 2 binary64)))) #s(literal 3/40 binary64))) (fmax.f64 (fmax.f64 (fmax.f64 (neg.f64 y) (-.f64 y #s(literal 11/40 binary64))) (-.f64 x #s(literal 11/20 binary64))) (-.f64 #s(literal 9/20 binary64) x))) (fmax.f64 (fmax.f64 (fmax.f64 (neg.f64 y) (-.f64 y #s(literal 1 binary64))) (-.f64 x #s(literal 1/10 binary64))) (neg.f64 x))) (fmax.f64 (fmax.f64 (fmax.f64 (fmax.f64 (fmax.f64 (-.f64 y #s(literal 11/20 binary64)) (-.f64 x #s(literal 11/20 binary64))) (neg.f64 x)) (-.f64 #s(literal 11/40 binary64) y)) (-.f64 #s(literal 7/40 binary64) (sqrt.f64 (+.f64 (pow.f64 (-.f64 y #s(literal 11/40 binary64)) #s(literal 2 binary64)) (pow.f64 (-.f64 x #s(literal 11/40 binary64)) #s(literal 2 binary64)))))) (-.f64 (sqrt.f64 (+.f64 (pow.f64 (-.f64 y #s(literal 11/40 binary64)) #s(literal 2 binary64)) (pow.f64 (-.f64 x #s(literal 11/40 binary64)) #s(literal 2 binary64)))) #s(literal 11/40 binary64))))

    1. Initial program 100.0%

      \[\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, -y\right), x - 0.825\right), 0.725 - x\right), \sqrt{{\left(y - 0.7\right)}^{2} + {\left(x - 0.775\right)}^{2}} - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 1\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \sqrt{{\left(y - 0.275\right)}^{2} + {\left(x - 0.275\right)}^{2}}\right), \sqrt{{\left(y - 0.275\right)}^{2} + {\left(x - 0.275\right)}^{2}} - 0.275\right)\right) \]
    2. Applied rewrites38.1%

      \[\leadsto \color{blue}{\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), \left(\left(x - 0.775\right) - \left(0.7 - y\right)\right) - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right)\right), \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right) - 0.275\right)\right)} \]
    3. Applied rewrites48.3%

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), \color{blue}{\left(\left(x - 0.775\right) - \left(0.7 - y\right)\right) \cdot \left(x - 0.775\right)} - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right)\right), \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right) - 0.275\right)\right) \]
    4. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, y\right), x - \frac{33}{40}\right), \frac{29}{40} - x\right), \left(x - \frac{31}{40}\right) \cdot \left(\left(x + y\right) - \frac{59}{40}\right) - \frac{3}{40}\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - \frac{11}{40}\right), x - \frac{11}{20}\right), \frac{9}{20} - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - \frac{1}{10}\right), \mathsf{neg}\left(x\right)\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, x - \frac{11}{20}\right), \mathsf{neg}\left(x\right)\right), \frac{11}{40} - y\right), \frac{29}{40} - \left(x + y\right)\right), \left(x + y\right) - \frac{33}{40}\right)\right)} \]
    5. Applied rewrites48.3%

      \[\leadsto \color{blue}{\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), \left(x - 0.775\right) \cdot \left(\left(x + y\right) - 1.475\right) - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.725 - \left(x + y\right)\right), \left(x + y\right) - 0.825\right)\right)} \]
    6. Taylor expanded in y around 0

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, y\right), x - \frac{33}{40}\right), \frac{29}{40} - x\right), \left(x - \frac{31}{40}\right) \cdot \left(x - \frac{59}{40}\right) - \frac{3}{40}\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - \frac{11}{40}\right), x - \frac{11}{20}\right), \frac{9}{20} - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - \frac{1}{10}\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, x - \frac{11}{20}\right), -\color{blue}{x}\right), \frac{11}{40} - y\right), \frac{29}{40} - \left(x + y\right)\right), \left(x + y\right) - \frac{33}{40}\right)\right) \]
    7. Applied rewrites49.5%

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), \left(x - 0.775\right) \cdot \left(x - 1.475\right) - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -\color{blue}{x}\right), 0.275 - y\right), 0.725 - \left(x + y\right)\right), \left(x + y\right) - 0.825\right)\right) \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 5: 60.2% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\\ t_1 := \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right)\\ t_2 := \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\\ t_3 := \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.725 - \left(x + y\right)\right), \left(x + y\right) - 0.825\right)\\ \mathbf{if}\;y \leq 1.75 \cdot 10^{+32}:\\ \;\;\;\;\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(t\_1, \left(x - 0.775\right) \cdot \left(x - 1.475\right) - 0.075\right), t\_2\right), t\_0\right), t\_3\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(t\_1, \left(x + y\right) - 1.55\right), t\_2\right), t\_0\right), t\_3\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (fmax (fmax (fmax y (- y 2.0)) (- x 0.1)) (- x)))
        (t_1 (fmax (fmax (fmax (- y 0.55) y) (- x 0.825)) (- 0.725 x)))
        (t_2 (fmax (fmax (fmax y (- y 0.275)) (- x 0.55)) (- 0.45 x)))
        (t_3
         (fmax
          (fmax
           (fmax (fmax (fmax (- y 0.55) (- x 0.55)) (- x)) (- 0.275 y))
           (- 0.725 (+ x y)))
          (- (+ x y) 0.825))))
   (if (<= y 1.75e+32)
     (fmin
      (fmin (fmin (fmin t_1 (- (* (- x 0.775) (- x 1.475)) 0.075)) t_2) t_0)
      t_3)
     (fmin (fmin (fmin (fmin t_1 (- (+ x y) 1.55)) t_2) t_0) t_3))))
double code(double x, double y) {
	double t_0 = fmax(fmax(fmax(y, (y - 2.0)), (x - 0.1)), -x);
	double t_1 = fmax(fmax(fmax((y - 0.55), y), (x - 0.825)), (0.725 - x));
	double t_2 = fmax(fmax(fmax(y, (y - 0.275)), (x - 0.55)), (0.45 - x));
	double t_3 = fmax(fmax(fmax(fmax(fmax((y - 0.55), (x - 0.55)), -x), (0.275 - y)), (0.725 - (x + y))), ((x + y) - 0.825));
	double tmp;
	if (y <= 1.75e+32) {
		tmp = fmin(fmin(fmin(fmin(t_1, (((x - 0.775) * (x - 1.475)) - 0.075)), t_2), t_0), t_3);
	} else {
		tmp = fmin(fmin(fmin(fmin(t_1, ((x + y) - 1.55)), t_2), t_0), t_3);
	}
	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)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: tmp
    t_0 = fmax(fmax(fmax(y, (y - 2.0d0)), (x - 0.1d0)), -x)
    t_1 = fmax(fmax(fmax((y - 0.55d0), y), (x - 0.825d0)), (0.725d0 - x))
    t_2 = fmax(fmax(fmax(y, (y - 0.275d0)), (x - 0.55d0)), (0.45d0 - x))
    t_3 = fmax(fmax(fmax(fmax(fmax((y - 0.55d0), (x - 0.55d0)), -x), (0.275d0 - y)), (0.725d0 - (x + y))), ((x + y) - 0.825d0))
    if (y <= 1.75d+32) then
        tmp = fmin(fmin(fmin(fmin(t_1, (((x - 0.775d0) * (x - 1.475d0)) - 0.075d0)), t_2), t_0), t_3)
    else
        tmp = fmin(fmin(fmin(fmin(t_1, ((x + y) - 1.55d0)), t_2), t_0), t_3)
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = fmax(fmax(fmax(y, (y - 2.0)), (x - 0.1)), -x);
	double t_1 = fmax(fmax(fmax((y - 0.55), y), (x - 0.825)), (0.725 - x));
	double t_2 = fmax(fmax(fmax(y, (y - 0.275)), (x - 0.55)), (0.45 - x));
	double t_3 = fmax(fmax(fmax(fmax(fmax((y - 0.55), (x - 0.55)), -x), (0.275 - y)), (0.725 - (x + y))), ((x + y) - 0.825));
	double tmp;
	if (y <= 1.75e+32) {
		tmp = fmin(fmin(fmin(fmin(t_1, (((x - 0.775) * (x - 1.475)) - 0.075)), t_2), t_0), t_3);
	} else {
		tmp = fmin(fmin(fmin(fmin(t_1, ((x + y) - 1.55)), t_2), t_0), t_3);
	}
	return tmp;
}
def code(x, y):
	t_0 = fmax(fmax(fmax(y, (y - 2.0)), (x - 0.1)), -x)
	t_1 = fmax(fmax(fmax((y - 0.55), y), (x - 0.825)), (0.725 - x))
	t_2 = fmax(fmax(fmax(y, (y - 0.275)), (x - 0.55)), (0.45 - x))
	t_3 = fmax(fmax(fmax(fmax(fmax((y - 0.55), (x - 0.55)), -x), (0.275 - y)), (0.725 - (x + y))), ((x + y) - 0.825))
	tmp = 0
	if y <= 1.75e+32:
		tmp = fmin(fmin(fmin(fmin(t_1, (((x - 0.775) * (x - 1.475)) - 0.075)), t_2), t_0), t_3)
	else:
		tmp = fmin(fmin(fmin(fmin(t_1, ((x + y) - 1.55)), t_2), t_0), t_3)
	return tmp
function code(x, y)
	t_0 = fmax(fmax(fmax(y, Float64(y - 2.0)), Float64(x - 0.1)), Float64(-x))
	t_1 = fmax(fmax(fmax(Float64(y - 0.55), y), Float64(x - 0.825)), Float64(0.725 - x))
	t_2 = fmax(fmax(fmax(y, Float64(y - 0.275)), Float64(x - 0.55)), Float64(0.45 - x))
	t_3 = fmax(fmax(fmax(fmax(fmax(Float64(y - 0.55), Float64(x - 0.55)), Float64(-x)), Float64(0.275 - y)), Float64(0.725 - Float64(x + y))), Float64(Float64(x + y) - 0.825))
	tmp = 0.0
	if (y <= 1.75e+32)
		tmp = fmin(fmin(fmin(fmin(t_1, Float64(Float64(Float64(x - 0.775) * Float64(x - 1.475)) - 0.075)), t_2), t_0), t_3);
	else
		tmp = fmin(fmin(fmin(fmin(t_1, Float64(Float64(x + y) - 1.55)), t_2), t_0), t_3);
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = max(max(max(y, (y - 2.0)), (x - 0.1)), -x);
	t_1 = max(max(max((y - 0.55), y), (x - 0.825)), (0.725 - x));
	t_2 = max(max(max(y, (y - 0.275)), (x - 0.55)), (0.45 - x));
	t_3 = max(max(max(max(max((y - 0.55), (x - 0.55)), -x), (0.275 - y)), (0.725 - (x + y))), ((x + y) - 0.825));
	tmp = 0.0;
	if (y <= 1.75e+32)
		tmp = min(min(min(min(t_1, (((x - 0.775) * (x - 1.475)) - 0.075)), t_2), t_0), t_3);
	else
		tmp = min(min(min(min(t_1, ((x + y) - 1.55)), t_2), t_0), t_3);
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[Max[N[Max[N[Max[y, N[(y - 2.0), $MachinePrecision]], $MachinePrecision], N[(x - 0.1), $MachinePrecision]], $MachinePrecision], (-x)], $MachinePrecision]}, Block[{t$95$1 = N[Max[N[Max[N[Max[N[(y - 0.55), $MachinePrecision], y], $MachinePrecision], N[(x - 0.825), $MachinePrecision]], $MachinePrecision], N[(0.725 - x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Max[N[Max[N[Max[y, N[(y - 0.275), $MachinePrecision]], $MachinePrecision], N[(x - 0.55), $MachinePrecision]], $MachinePrecision], N[(0.45 - x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Max[N[Max[N[Max[N[Max[N[Max[N[(y - 0.55), $MachinePrecision], N[(x - 0.55), $MachinePrecision]], $MachinePrecision], (-x)], $MachinePrecision], N[(0.275 - y), $MachinePrecision]], $MachinePrecision], N[(0.725 - N[(x + y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[(x + y), $MachinePrecision] - 0.825), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 1.75e+32], N[Min[N[Min[N[Min[N[Min[t$95$1, N[(N[(N[(x - 0.775), $MachinePrecision] * N[(x - 1.475), $MachinePrecision]), $MachinePrecision] - 0.075), $MachinePrecision]], $MachinePrecision], t$95$2], $MachinePrecision], t$95$0], $MachinePrecision], t$95$3], $MachinePrecision], N[Min[N[Min[N[Min[N[Min[t$95$1, N[(N[(x + y), $MachinePrecision] - 1.55), $MachinePrecision]], $MachinePrecision], t$95$2], $MachinePrecision], t$95$0], $MachinePrecision], t$95$3], $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\\
t_1 := \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right)\\
t_2 := \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\\
t_3 := \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.725 - \left(x + y\right)\right), \left(x + y\right) - 0.825\right)\\
\mathbf{if}\;y \leq 1.75 \cdot 10^{+32}:\\
\;\;\;\;\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(t\_1, \left(x - 0.775\right) \cdot \left(x - 1.475\right) - 0.075\right), t\_2\right), t\_0\right), t\_3\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(t\_1, \left(x + y\right) - 1.55\right), t\_2\right), t\_0\right), t\_3\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 1.75e32

    1. Initial program 100.0%

      \[\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, -y\right), x - 0.825\right), 0.725 - x\right), \sqrt{{\left(y - 0.7\right)}^{2} + {\left(x - 0.775\right)}^{2}} - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 1\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \sqrt{{\left(y - 0.275\right)}^{2} + {\left(x - 0.275\right)}^{2}}\right), \sqrt{{\left(y - 0.275\right)}^{2} + {\left(x - 0.275\right)}^{2}} - 0.275\right)\right) \]
    2. Applied rewrites38.1%

      \[\leadsto \color{blue}{\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), \left(\left(x - 0.775\right) - \left(0.7 - y\right)\right) - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right)\right), \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right) - 0.275\right)\right)} \]
    3. Applied rewrites48.3%

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), \color{blue}{\left(\left(x - 0.775\right) - \left(0.7 - y\right)\right) \cdot \left(x - 0.775\right)} - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right)\right), \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right) - 0.275\right)\right) \]
    4. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, y\right), x - \frac{33}{40}\right), \frac{29}{40} - x\right), \left(x - \frac{31}{40}\right) \cdot \left(\left(x + y\right) - \frac{59}{40}\right) - \frac{3}{40}\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - \frac{11}{40}\right), x - \frac{11}{20}\right), \frac{9}{20} - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - \frac{1}{10}\right), \mathsf{neg}\left(x\right)\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, x - \frac{11}{20}\right), \mathsf{neg}\left(x\right)\right), \frac{11}{40} - y\right), \frac{29}{40} - \left(x + y\right)\right), \left(x + y\right) - \frac{33}{40}\right)\right)} \]
    5. Applied rewrites48.3%

      \[\leadsto \color{blue}{\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), \left(x - 0.775\right) \cdot \left(\left(x + y\right) - 1.475\right) - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.725 - \left(x + y\right)\right), \left(x + y\right) - 0.825\right)\right)} \]
    6. Taylor expanded in y around 0

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, y\right), x - \frac{33}{40}\right), \frac{29}{40} - x\right), \left(x - \frac{31}{40}\right) \cdot \left(x - \frac{59}{40}\right) - \frac{3}{40}\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - \frac{11}{40}\right), x - \frac{11}{20}\right), \frac{9}{20} - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - \frac{1}{10}\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, x - \frac{11}{20}\right), -\color{blue}{x}\right), \frac{11}{40} - y\right), \frac{29}{40} - \left(x + y\right)\right), \left(x + y\right) - \frac{33}{40}\right)\right) \]
    7. Applied rewrites49.5%

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), \left(x - 0.775\right) \cdot \left(x - 1.475\right) - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -\color{blue}{x}\right), 0.275 - y\right), 0.725 - \left(x + y\right)\right), \left(x + y\right) - 0.825\right)\right) \]

    if 1.75e32 < y

    1. Initial program 100.0%

      \[\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, -y\right), x - 0.825\right), 0.725 - x\right), \sqrt{{\left(y - 0.7\right)}^{2} + {\left(x - 0.775\right)}^{2}} - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 1\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \sqrt{{\left(y - 0.275\right)}^{2} + {\left(x - 0.275\right)}^{2}}\right), \sqrt{{\left(y - 0.275\right)}^{2} + {\left(x - 0.275\right)}^{2}} - 0.275\right)\right) \]
    2. Applied rewrites38.1%

      \[\leadsto \color{blue}{\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), \left(\left(x - 0.775\right) - \left(0.7 - y\right)\right) - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right)\right), \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right) - 0.275\right)\right)} \]
    3. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, y\right), x - \frac{33}{40}\right), \frac{29}{40} - x\right), \left(x + y\right) - \frac{31}{20}\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - \frac{11}{40}\right), x - \frac{11}{20}\right), \frac{9}{20} - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - \frac{1}{10}\right), \mathsf{neg}\left(x\right)\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, x - \frac{11}{20}\right), \mathsf{neg}\left(x\right)\right), \frac{11}{40} - y\right), \frac{29}{40} - \left(x + y\right)\right), \left(x + y\right) - \frac{33}{40}\right)\right)} \]
    4. Applied rewrites38.1%

      \[\leadsto \color{blue}{\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), \left(x + y\right) - 1.55\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.725 - \left(x + y\right)\right), \left(x + y\right) - 0.825\right)\right)} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 6: 54.3% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\\ t_1 := \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right)\\ t_2 := \mathsf{max}\left(y, y - 0.275\right)\\ \mathbf{if}\;x \leq -2.45 \cdot 10^{-50}:\\ \;\;\;\;\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(t\_1, \left(x - 0.775\right) \cdot \left(\left(x + y\right) - 1.475\right) - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(t\_2, -0.55\right), 0.45 - x\right)\right), t\_0\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, -0.55\right), -x\right), 0.275 - y\right), 0.725 - \left(x + y\right)\right), \left(x + y\right) - 0.825\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(t\_1, \left(\left(x - 0.775\right) - \left(0.7 - y\right)\right) - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(t\_2, x - 0.55\right), 0.45 - x\right)\right), t\_0\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \left(y - 0.55\right)\right), \left(y - 0.55\right) - 0.275\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (fmax (fmax (fmax y (- y 2.0)) (- x 0.1)) (- x)))
        (t_1 (fmax (fmax (fmax (- y 0.55) y) (- x 0.825)) (- 0.725 x)))
        (t_2 (fmax y (- y 0.275))))
   (if (<= x -2.45e-50)
     (fmin
      (fmin
       (fmin
        (fmin t_1 (- (* (- x 0.775) (- (+ x y) 1.475)) 0.075))
        (fmax (fmax t_2 -0.55) (- 0.45 x)))
       t_0)
      (fmax
       (fmax
        (fmax (fmax (fmax (- y 0.55) -0.55) (- x)) (- 0.275 y))
        (- 0.725 (+ x y)))
       (- (+ x y) 0.825)))
     (fmin
      (fmin
       (fmin
        (fmin t_1 (- (- (- x 0.775) (- 0.7 y)) 0.075))
        (fmax (fmax t_2 (- x 0.55)) (- 0.45 x)))
       t_0)
      (fmax
       (fmax
        (fmax (fmax (fmax (- y 0.55) (- x 0.55)) (- x)) (- 0.275 y))
        (- 0.175 (- y 0.55)))
       (- (- y 0.55) 0.275))))))
double code(double x, double y) {
	double t_0 = fmax(fmax(fmax(y, (y - 2.0)), (x - 0.1)), -x);
	double t_1 = fmax(fmax(fmax((y - 0.55), y), (x - 0.825)), (0.725 - x));
	double t_2 = fmax(y, (y - 0.275));
	double tmp;
	if (x <= -2.45e-50) {
		tmp = fmin(fmin(fmin(fmin(t_1, (((x - 0.775) * ((x + y) - 1.475)) - 0.075)), fmax(fmax(t_2, -0.55), (0.45 - x))), t_0), fmax(fmax(fmax(fmax(fmax((y - 0.55), -0.55), -x), (0.275 - y)), (0.725 - (x + y))), ((x + y) - 0.825)));
	} else {
		tmp = fmin(fmin(fmin(fmin(t_1, (((x - 0.775) - (0.7 - y)) - 0.075)), fmax(fmax(t_2, (x - 0.55)), (0.45 - x))), t_0), fmax(fmax(fmax(fmax(fmax((y - 0.55), (x - 0.55)), -x), (0.275 - y)), (0.175 - (y - 0.55))), ((y - 0.55) - 0.275)));
	}
	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)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_0 = fmax(fmax(fmax(y, (y - 2.0d0)), (x - 0.1d0)), -x)
    t_1 = fmax(fmax(fmax((y - 0.55d0), y), (x - 0.825d0)), (0.725d0 - x))
    t_2 = fmax(y, (y - 0.275d0))
    if (x <= (-2.45d-50)) then
        tmp = fmin(fmin(fmin(fmin(t_1, (((x - 0.775d0) * ((x + y) - 1.475d0)) - 0.075d0)), fmax(fmax(t_2, (-0.55d0)), (0.45d0 - x))), t_0), fmax(fmax(fmax(fmax(fmax((y - 0.55d0), (-0.55d0)), -x), (0.275d0 - y)), (0.725d0 - (x + y))), ((x + y) - 0.825d0)))
    else
        tmp = fmin(fmin(fmin(fmin(t_1, (((x - 0.775d0) - (0.7d0 - y)) - 0.075d0)), fmax(fmax(t_2, (x - 0.55d0)), (0.45d0 - x))), t_0), fmax(fmax(fmax(fmax(fmax((y - 0.55d0), (x - 0.55d0)), -x), (0.275d0 - y)), (0.175d0 - (y - 0.55d0))), ((y - 0.55d0) - 0.275d0)))
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = fmax(fmax(fmax(y, (y - 2.0)), (x - 0.1)), -x);
	double t_1 = fmax(fmax(fmax((y - 0.55), y), (x - 0.825)), (0.725 - x));
	double t_2 = fmax(y, (y - 0.275));
	double tmp;
	if (x <= -2.45e-50) {
		tmp = fmin(fmin(fmin(fmin(t_1, (((x - 0.775) * ((x + y) - 1.475)) - 0.075)), fmax(fmax(t_2, -0.55), (0.45 - x))), t_0), fmax(fmax(fmax(fmax(fmax((y - 0.55), -0.55), -x), (0.275 - y)), (0.725 - (x + y))), ((x + y) - 0.825)));
	} else {
		tmp = fmin(fmin(fmin(fmin(t_1, (((x - 0.775) - (0.7 - y)) - 0.075)), fmax(fmax(t_2, (x - 0.55)), (0.45 - x))), t_0), fmax(fmax(fmax(fmax(fmax((y - 0.55), (x - 0.55)), -x), (0.275 - y)), (0.175 - (y - 0.55))), ((y - 0.55) - 0.275)));
	}
	return tmp;
}
def code(x, y):
	t_0 = fmax(fmax(fmax(y, (y - 2.0)), (x - 0.1)), -x)
	t_1 = fmax(fmax(fmax((y - 0.55), y), (x - 0.825)), (0.725 - x))
	t_2 = fmax(y, (y - 0.275))
	tmp = 0
	if x <= -2.45e-50:
		tmp = fmin(fmin(fmin(fmin(t_1, (((x - 0.775) * ((x + y) - 1.475)) - 0.075)), fmax(fmax(t_2, -0.55), (0.45 - x))), t_0), fmax(fmax(fmax(fmax(fmax((y - 0.55), -0.55), -x), (0.275 - y)), (0.725 - (x + y))), ((x + y) - 0.825)))
	else:
		tmp = fmin(fmin(fmin(fmin(t_1, (((x - 0.775) - (0.7 - y)) - 0.075)), fmax(fmax(t_2, (x - 0.55)), (0.45 - x))), t_0), fmax(fmax(fmax(fmax(fmax((y - 0.55), (x - 0.55)), -x), (0.275 - y)), (0.175 - (y - 0.55))), ((y - 0.55) - 0.275)))
	return tmp
function code(x, y)
	t_0 = fmax(fmax(fmax(y, Float64(y - 2.0)), Float64(x - 0.1)), Float64(-x))
	t_1 = fmax(fmax(fmax(Float64(y - 0.55), y), Float64(x - 0.825)), Float64(0.725 - x))
	t_2 = fmax(y, Float64(y - 0.275))
	tmp = 0.0
	if (x <= -2.45e-50)
		tmp = fmin(fmin(fmin(fmin(t_1, Float64(Float64(Float64(x - 0.775) * Float64(Float64(x + y) - 1.475)) - 0.075)), fmax(fmax(t_2, -0.55), Float64(0.45 - x))), t_0), fmax(fmax(fmax(fmax(fmax(Float64(y - 0.55), -0.55), Float64(-x)), Float64(0.275 - y)), Float64(0.725 - Float64(x + y))), Float64(Float64(x + y) - 0.825)));
	else
		tmp = fmin(fmin(fmin(fmin(t_1, Float64(Float64(Float64(x - 0.775) - Float64(0.7 - y)) - 0.075)), fmax(fmax(t_2, Float64(x - 0.55)), Float64(0.45 - x))), t_0), fmax(fmax(fmax(fmax(fmax(Float64(y - 0.55), Float64(x - 0.55)), Float64(-x)), Float64(0.275 - y)), Float64(0.175 - Float64(y - 0.55))), Float64(Float64(y - 0.55) - 0.275)));
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = max(max(max(y, (y - 2.0)), (x - 0.1)), -x);
	t_1 = max(max(max((y - 0.55), y), (x - 0.825)), (0.725 - x));
	t_2 = max(y, (y - 0.275));
	tmp = 0.0;
	if (x <= -2.45e-50)
		tmp = min(min(min(min(t_1, (((x - 0.775) * ((x + y) - 1.475)) - 0.075)), max(max(t_2, -0.55), (0.45 - x))), t_0), max(max(max(max(max((y - 0.55), -0.55), -x), (0.275 - y)), (0.725 - (x + y))), ((x + y) - 0.825)));
	else
		tmp = min(min(min(min(t_1, (((x - 0.775) - (0.7 - y)) - 0.075)), max(max(t_2, (x - 0.55)), (0.45 - x))), t_0), max(max(max(max(max((y - 0.55), (x - 0.55)), -x), (0.275 - y)), (0.175 - (y - 0.55))), ((y - 0.55) - 0.275)));
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[Max[N[Max[N[Max[y, N[(y - 2.0), $MachinePrecision]], $MachinePrecision], N[(x - 0.1), $MachinePrecision]], $MachinePrecision], (-x)], $MachinePrecision]}, Block[{t$95$1 = N[Max[N[Max[N[Max[N[(y - 0.55), $MachinePrecision], y], $MachinePrecision], N[(x - 0.825), $MachinePrecision]], $MachinePrecision], N[(0.725 - x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Max[y, N[(y - 0.275), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -2.45e-50], N[Min[N[Min[N[Min[N[Min[t$95$1, N[(N[(N[(x - 0.775), $MachinePrecision] * N[(N[(x + y), $MachinePrecision] - 1.475), $MachinePrecision]), $MachinePrecision] - 0.075), $MachinePrecision]], $MachinePrecision], N[Max[N[Max[t$95$2, -0.55], $MachinePrecision], N[(0.45 - x), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], t$95$0], $MachinePrecision], N[Max[N[Max[N[Max[N[Max[N[Max[N[(y - 0.55), $MachinePrecision], -0.55], $MachinePrecision], (-x)], $MachinePrecision], N[(0.275 - y), $MachinePrecision]], $MachinePrecision], N[(0.725 - N[(x + y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[(x + y), $MachinePrecision] - 0.825), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], N[Min[N[Min[N[Min[N[Min[t$95$1, N[(N[(N[(x - 0.775), $MachinePrecision] - N[(0.7 - y), $MachinePrecision]), $MachinePrecision] - 0.075), $MachinePrecision]], $MachinePrecision], N[Max[N[Max[t$95$2, N[(x - 0.55), $MachinePrecision]], $MachinePrecision], N[(0.45 - x), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], t$95$0], $MachinePrecision], N[Max[N[Max[N[Max[N[Max[N[Max[N[(y - 0.55), $MachinePrecision], N[(x - 0.55), $MachinePrecision]], $MachinePrecision], (-x)], $MachinePrecision], N[(0.275 - y), $MachinePrecision]], $MachinePrecision], N[(0.175 - N[(y - 0.55), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[(y - 0.55), $MachinePrecision] - 0.275), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\\
t_1 := \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right)\\
t_2 := \mathsf{max}\left(y, y - 0.275\right)\\
\mathbf{if}\;x \leq -2.45 \cdot 10^{-50}:\\
\;\;\;\;\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(t\_1, \left(x - 0.775\right) \cdot \left(\left(x + y\right) - 1.475\right) - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(t\_2, -0.55\right), 0.45 - x\right)\right), t\_0\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, -0.55\right), -x\right), 0.275 - y\right), 0.725 - \left(x + y\right)\right), \left(x + y\right) - 0.825\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(t\_1, \left(\left(x - 0.775\right) - \left(0.7 - y\right)\right) - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(t\_2, x - 0.55\right), 0.45 - x\right)\right), t\_0\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \left(y - 0.55\right)\right), \left(y - 0.55\right) - 0.275\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2.4499999999999999e-50

    1. Initial program 100.0%

      \[\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, -y\right), x - 0.825\right), 0.725 - x\right), \sqrt{{\left(y - 0.7\right)}^{2} + {\left(x - 0.775\right)}^{2}} - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 1\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \sqrt{{\left(y - 0.275\right)}^{2} + {\left(x - 0.275\right)}^{2}}\right), \sqrt{{\left(y - 0.275\right)}^{2} + {\left(x - 0.275\right)}^{2}} - 0.275\right)\right) \]
    2. Applied rewrites38.1%

      \[\leadsto \color{blue}{\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), \left(\left(x - 0.775\right) - \left(0.7 - y\right)\right) - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right)\right), \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right) - 0.275\right)\right)} \]
    3. Applied rewrites48.3%

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), \color{blue}{\left(\left(x - 0.775\right) - \left(0.7 - y\right)\right) \cdot \left(x - 0.775\right)} - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right)\right), \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right) - 0.275\right)\right) \]
    4. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, y\right), x - \frac{33}{40}\right), \frac{29}{40} - x\right), \left(x - \frac{31}{40}\right) \cdot \left(\left(x + y\right) - \frac{59}{40}\right) - \frac{3}{40}\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - \frac{11}{40}\right), x - \frac{11}{20}\right), \frac{9}{20} - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - \frac{1}{10}\right), \mathsf{neg}\left(x\right)\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, x - \frac{11}{20}\right), \mathsf{neg}\left(x\right)\right), \frac{11}{40} - y\right), \frac{29}{40} - \left(x + y\right)\right), \left(x + y\right) - \frac{33}{40}\right)\right)} \]
    5. Applied rewrites48.3%

      \[\leadsto \color{blue}{\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), \left(x - 0.775\right) \cdot \left(\left(x + y\right) - 1.475\right) - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.725 - \left(x + y\right)\right), \left(x + y\right) - 0.825\right)\right)} \]
    6. Taylor expanded in x around 0

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, y\right), x - \frac{33}{40}\right), \frac{29}{40} - x\right), \left(x - \frac{31}{40}\right) \cdot \left(\left(x + y\right) - \frac{59}{40}\right) - \frac{3}{40}\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - \frac{11}{40}\right), \frac{-11}{20}\right), \frac{9}{20} - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - \frac{1}{10}\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, x - \frac{11}{20}\right), -x\right), \frac{11}{40} - y\right), \frac{29}{40} - \left(x + y\right)\right), \left(x + y\right) - \frac{33}{40}\right)\right) \]
    7. Applied rewrites30.2%

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), \left(x - 0.775\right) \cdot \left(\left(x + y\right) - 1.475\right) - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), -0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.725 - \left(x + y\right)\right), \left(x + y\right) - 0.825\right)\right) \]
    8. Taylor expanded in x around 0

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, y\right), x - \frac{33}{40}\right), \frac{29}{40} - x\right), \left(x - \frac{31}{40}\right) \cdot \left(\left(x + y\right) - \frac{59}{40}\right) - \frac{3}{40}\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - \frac{11}{40}\right), \frac{-11}{20}\right), \frac{9}{20} - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - \frac{1}{10}\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, \frac{-11}{20}\right), -x\right), \frac{11}{40} - y\right), \frac{29}{40} - \left(x + y\right)\right), \left(x + y\right) - \frac{33}{40}\right)\right) \]
    9. Applied rewrites30.2%

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), \left(x - 0.775\right) \cdot \left(\left(x + y\right) - 1.475\right) - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), -0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, -0.55\right), -x\right), 0.275 - y\right), 0.725 - \left(x + y\right)\right), \left(x + y\right) - 0.825\right)\right) \]

    if -2.4499999999999999e-50 < x

    1. Initial program 100.0%

      \[\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, -y\right), x - 0.825\right), 0.725 - x\right), \sqrt{{\left(y - 0.7\right)}^{2} + {\left(x - 0.775\right)}^{2}} - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 1\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \sqrt{{\left(y - 0.275\right)}^{2} + {\left(x - 0.275\right)}^{2}}\right), \sqrt{{\left(y - 0.275\right)}^{2} + {\left(x - 0.275\right)}^{2}} - 0.275\right)\right) \]
    2. Applied rewrites38.1%

      \[\leadsto \color{blue}{\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), \left(\left(x - 0.775\right) - \left(0.7 - y\right)\right) - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right)\right), \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right) - 0.275\right)\right)} \]
    3. Taylor expanded in x around 0

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, y\right), x - \frac{33}{40}\right), \frac{29}{40} - x\right), \left(\left(x - \frac{31}{40}\right) - \left(\frac{7}{10} - y\right)\right) - \frac{3}{40}\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - \frac{11}{40}\right), x - \frac{11}{20}\right), \frac{9}{20} - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - \frac{1}{10}\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, x - \frac{11}{20}\right), -x\right), \frac{11}{40} - y\right), \frac{7}{40} - \color{blue}{\left(y - \frac{11}{20}\right)}\right), \left(\left(x - \frac{11}{40}\right) - \left(\frac{11}{40} - y\right)\right) - \frac{11}{40}\right)\right) \]
    4. Applied rewrites38.1%

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), \left(\left(x - 0.775\right) - \left(0.7 - y\right)\right) - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \color{blue}{\left(y - 0.55\right)}\right), \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right) - 0.275\right)\right) \]
    5. Taylor expanded in x around 0

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, y\right), x - \frac{33}{40}\right), \frac{29}{40} - x\right), \left(\left(x - \frac{31}{40}\right) - \left(\frac{7}{10} - y\right)\right) - \frac{3}{40}\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - \frac{11}{40}\right), x - \frac{11}{20}\right), \frac{9}{20} - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - \frac{1}{10}\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, x - \frac{11}{20}\right), -x\right), \frac{11}{40} - y\right), \frac{7}{40} - \left(y - \frac{11}{20}\right)\right), \color{blue}{\left(y - \frac{11}{20}\right)} - \frac{11}{40}\right)\right) \]
    6. Applied rewrites38.1%

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), \left(\left(x - 0.775\right) - \left(0.7 - y\right)\right) - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \left(y - 0.55\right)\right), \color{blue}{\left(y - 0.55\right)} - 0.275\right)\right) \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 7: 54.3% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.725 - \left(x + y\right)\\ t_1 := \left(x + y\right) - 0.825\\ t_2 := \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\\ t_3 := \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right)\\ t_4 := \mathsf{max}\left(y, y - 0.275\right)\\ \mathbf{if}\;x \leq -2.45 \cdot 10^{-50}:\\ \;\;\;\;\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(t\_3, \left(x - 0.775\right) \cdot \left(\left(x + y\right) - 1.475\right) - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(t\_4, -0.55\right), 0.45 - x\right)\right), t\_2\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, -0.55\right), -x\right), 0.275 - y\right), t\_0\right), t\_1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(t\_3, \left(x + y\right) - 1.55\right), \mathsf{max}\left(\mathsf{max}\left(t\_4, x - 0.55\right), 0.45 - x\right)\right), t\_2\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), t\_0\right), t\_1\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (- 0.725 (+ x y)))
        (t_1 (- (+ x y) 0.825))
        (t_2 (fmax (fmax (fmax y (- y 2.0)) (- x 0.1)) (- x)))
        (t_3 (fmax (fmax (fmax (- y 0.55) y) (- x 0.825)) (- 0.725 x)))
        (t_4 (fmax y (- y 0.275))))
   (if (<= x -2.45e-50)
     (fmin
      (fmin
       (fmin
        (fmin t_3 (- (* (- x 0.775) (- (+ x y) 1.475)) 0.075))
        (fmax (fmax t_4 -0.55) (- 0.45 x)))
       t_2)
      (fmax
       (fmax (fmax (fmax (fmax (- y 0.55) -0.55) (- x)) (- 0.275 y)) t_0)
       t_1))
     (fmin
      (fmin
       (fmin
        (fmin t_3 (- (+ x y) 1.55))
        (fmax (fmax t_4 (- x 0.55)) (- 0.45 x)))
       t_2)
      (fmax
       (fmax (fmax (fmax (fmax (- y 0.55) (- x 0.55)) (- x)) (- 0.275 y)) t_0)
       t_1)))))
double code(double x, double y) {
	double t_0 = 0.725 - (x + y);
	double t_1 = (x + y) - 0.825;
	double t_2 = fmax(fmax(fmax(y, (y - 2.0)), (x - 0.1)), -x);
	double t_3 = fmax(fmax(fmax((y - 0.55), y), (x - 0.825)), (0.725 - x));
	double t_4 = fmax(y, (y - 0.275));
	double tmp;
	if (x <= -2.45e-50) {
		tmp = fmin(fmin(fmin(fmin(t_3, (((x - 0.775) * ((x + y) - 1.475)) - 0.075)), fmax(fmax(t_4, -0.55), (0.45 - x))), t_2), fmax(fmax(fmax(fmax(fmax((y - 0.55), -0.55), -x), (0.275 - y)), t_0), t_1));
	} else {
		tmp = fmin(fmin(fmin(fmin(t_3, ((x + y) - 1.55)), fmax(fmax(t_4, (x - 0.55)), (0.45 - x))), t_2), fmax(fmax(fmax(fmax(fmax((y - 0.55), (x - 0.55)), -x), (0.275 - y)), t_0), 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)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: t_4
    real(8) :: tmp
    t_0 = 0.725d0 - (x + y)
    t_1 = (x + y) - 0.825d0
    t_2 = fmax(fmax(fmax(y, (y - 2.0d0)), (x - 0.1d0)), -x)
    t_3 = fmax(fmax(fmax((y - 0.55d0), y), (x - 0.825d0)), (0.725d0 - x))
    t_4 = fmax(y, (y - 0.275d0))
    if (x <= (-2.45d-50)) then
        tmp = fmin(fmin(fmin(fmin(t_3, (((x - 0.775d0) * ((x + y) - 1.475d0)) - 0.075d0)), fmax(fmax(t_4, (-0.55d0)), (0.45d0 - x))), t_2), fmax(fmax(fmax(fmax(fmax((y - 0.55d0), (-0.55d0)), -x), (0.275d0 - y)), t_0), t_1))
    else
        tmp = fmin(fmin(fmin(fmin(t_3, ((x + y) - 1.55d0)), fmax(fmax(t_4, (x - 0.55d0)), (0.45d0 - x))), t_2), fmax(fmax(fmax(fmax(fmax((y - 0.55d0), (x - 0.55d0)), -x), (0.275d0 - y)), t_0), t_1))
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = 0.725 - (x + y);
	double t_1 = (x + y) - 0.825;
	double t_2 = fmax(fmax(fmax(y, (y - 2.0)), (x - 0.1)), -x);
	double t_3 = fmax(fmax(fmax((y - 0.55), y), (x - 0.825)), (0.725 - x));
	double t_4 = fmax(y, (y - 0.275));
	double tmp;
	if (x <= -2.45e-50) {
		tmp = fmin(fmin(fmin(fmin(t_3, (((x - 0.775) * ((x + y) - 1.475)) - 0.075)), fmax(fmax(t_4, -0.55), (0.45 - x))), t_2), fmax(fmax(fmax(fmax(fmax((y - 0.55), -0.55), -x), (0.275 - y)), t_0), t_1));
	} else {
		tmp = fmin(fmin(fmin(fmin(t_3, ((x + y) - 1.55)), fmax(fmax(t_4, (x - 0.55)), (0.45 - x))), t_2), fmax(fmax(fmax(fmax(fmax((y - 0.55), (x - 0.55)), -x), (0.275 - y)), t_0), t_1));
	}
	return tmp;
}
def code(x, y):
	t_0 = 0.725 - (x + y)
	t_1 = (x + y) - 0.825
	t_2 = fmax(fmax(fmax(y, (y - 2.0)), (x - 0.1)), -x)
	t_3 = fmax(fmax(fmax((y - 0.55), y), (x - 0.825)), (0.725 - x))
	t_4 = fmax(y, (y - 0.275))
	tmp = 0
	if x <= -2.45e-50:
		tmp = fmin(fmin(fmin(fmin(t_3, (((x - 0.775) * ((x + y) - 1.475)) - 0.075)), fmax(fmax(t_4, -0.55), (0.45 - x))), t_2), fmax(fmax(fmax(fmax(fmax((y - 0.55), -0.55), -x), (0.275 - y)), t_0), t_1))
	else:
		tmp = fmin(fmin(fmin(fmin(t_3, ((x + y) - 1.55)), fmax(fmax(t_4, (x - 0.55)), (0.45 - x))), t_2), fmax(fmax(fmax(fmax(fmax((y - 0.55), (x - 0.55)), -x), (0.275 - y)), t_0), t_1))
	return tmp
function code(x, y)
	t_0 = Float64(0.725 - Float64(x + y))
	t_1 = Float64(Float64(x + y) - 0.825)
	t_2 = fmax(fmax(fmax(y, Float64(y - 2.0)), Float64(x - 0.1)), Float64(-x))
	t_3 = fmax(fmax(fmax(Float64(y - 0.55), y), Float64(x - 0.825)), Float64(0.725 - x))
	t_4 = fmax(y, Float64(y - 0.275))
	tmp = 0.0
	if (x <= -2.45e-50)
		tmp = fmin(fmin(fmin(fmin(t_3, Float64(Float64(Float64(x - 0.775) * Float64(Float64(x + y) - 1.475)) - 0.075)), fmax(fmax(t_4, -0.55), Float64(0.45 - x))), t_2), fmax(fmax(fmax(fmax(fmax(Float64(y - 0.55), -0.55), Float64(-x)), Float64(0.275 - y)), t_0), t_1));
	else
		tmp = fmin(fmin(fmin(fmin(t_3, Float64(Float64(x + y) - 1.55)), fmax(fmax(t_4, Float64(x - 0.55)), Float64(0.45 - x))), t_2), fmax(fmax(fmax(fmax(fmax(Float64(y - 0.55), Float64(x - 0.55)), Float64(-x)), Float64(0.275 - y)), t_0), t_1));
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = 0.725 - (x + y);
	t_1 = (x + y) - 0.825;
	t_2 = max(max(max(y, (y - 2.0)), (x - 0.1)), -x);
	t_3 = max(max(max((y - 0.55), y), (x - 0.825)), (0.725 - x));
	t_4 = max(y, (y - 0.275));
	tmp = 0.0;
	if (x <= -2.45e-50)
		tmp = min(min(min(min(t_3, (((x - 0.775) * ((x + y) - 1.475)) - 0.075)), max(max(t_4, -0.55), (0.45 - x))), t_2), max(max(max(max(max((y - 0.55), -0.55), -x), (0.275 - y)), t_0), t_1));
	else
		tmp = min(min(min(min(t_3, ((x + y) - 1.55)), max(max(t_4, (x - 0.55)), (0.45 - x))), t_2), max(max(max(max(max((y - 0.55), (x - 0.55)), -x), (0.275 - y)), t_0), t_1));
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(0.725 - N[(x + y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x + y), $MachinePrecision] - 0.825), $MachinePrecision]}, Block[{t$95$2 = N[Max[N[Max[N[Max[y, N[(y - 2.0), $MachinePrecision]], $MachinePrecision], N[(x - 0.1), $MachinePrecision]], $MachinePrecision], (-x)], $MachinePrecision]}, Block[{t$95$3 = N[Max[N[Max[N[Max[N[(y - 0.55), $MachinePrecision], y], $MachinePrecision], N[(x - 0.825), $MachinePrecision]], $MachinePrecision], N[(0.725 - x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[Max[y, N[(y - 0.275), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -2.45e-50], N[Min[N[Min[N[Min[N[Min[t$95$3, N[(N[(N[(x - 0.775), $MachinePrecision] * N[(N[(x + y), $MachinePrecision] - 1.475), $MachinePrecision]), $MachinePrecision] - 0.075), $MachinePrecision]], $MachinePrecision], N[Max[N[Max[t$95$4, -0.55], $MachinePrecision], N[(0.45 - x), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], t$95$2], $MachinePrecision], N[Max[N[Max[N[Max[N[Max[N[Max[N[(y - 0.55), $MachinePrecision], -0.55], $MachinePrecision], (-x)], $MachinePrecision], N[(0.275 - y), $MachinePrecision]], $MachinePrecision], t$95$0], $MachinePrecision], t$95$1], $MachinePrecision]], $MachinePrecision], N[Min[N[Min[N[Min[N[Min[t$95$3, N[(N[(x + y), $MachinePrecision] - 1.55), $MachinePrecision]], $MachinePrecision], N[Max[N[Max[t$95$4, N[(x - 0.55), $MachinePrecision]], $MachinePrecision], N[(0.45 - x), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], t$95$2], $MachinePrecision], N[Max[N[Max[N[Max[N[Max[N[Max[N[(y - 0.55), $MachinePrecision], N[(x - 0.55), $MachinePrecision]], $MachinePrecision], (-x)], $MachinePrecision], N[(0.275 - y), $MachinePrecision]], $MachinePrecision], t$95$0], $MachinePrecision], t$95$1], $MachinePrecision]], $MachinePrecision]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 0.725 - \left(x + y\right)\\
t_1 := \left(x + y\right) - 0.825\\
t_2 := \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\\
t_3 := \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right)\\
t_4 := \mathsf{max}\left(y, y - 0.275\right)\\
\mathbf{if}\;x \leq -2.45 \cdot 10^{-50}:\\
\;\;\;\;\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(t\_3, \left(x - 0.775\right) \cdot \left(\left(x + y\right) - 1.475\right) - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(t\_4, -0.55\right), 0.45 - x\right)\right), t\_2\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, -0.55\right), -x\right), 0.275 - y\right), t\_0\right), t\_1\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(t\_3, \left(x + y\right) - 1.55\right), \mathsf{max}\left(\mathsf{max}\left(t\_4, x - 0.55\right), 0.45 - x\right)\right), t\_2\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), t\_0\right), t\_1\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2.4499999999999999e-50

    1. Initial program 100.0%

      \[\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, -y\right), x - 0.825\right), 0.725 - x\right), \sqrt{{\left(y - 0.7\right)}^{2} + {\left(x - 0.775\right)}^{2}} - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 1\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \sqrt{{\left(y - 0.275\right)}^{2} + {\left(x - 0.275\right)}^{2}}\right), \sqrt{{\left(y - 0.275\right)}^{2} + {\left(x - 0.275\right)}^{2}} - 0.275\right)\right) \]
    2. Applied rewrites38.1%

      \[\leadsto \color{blue}{\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), \left(\left(x - 0.775\right) - \left(0.7 - y\right)\right) - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right)\right), \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right) - 0.275\right)\right)} \]
    3. Applied rewrites48.3%

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), \color{blue}{\left(\left(x - 0.775\right) - \left(0.7 - y\right)\right) \cdot \left(x - 0.775\right)} - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right)\right), \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right) - 0.275\right)\right) \]
    4. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, y\right), x - \frac{33}{40}\right), \frac{29}{40} - x\right), \left(x - \frac{31}{40}\right) \cdot \left(\left(x + y\right) - \frac{59}{40}\right) - \frac{3}{40}\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - \frac{11}{40}\right), x - \frac{11}{20}\right), \frac{9}{20} - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - \frac{1}{10}\right), \mathsf{neg}\left(x\right)\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, x - \frac{11}{20}\right), \mathsf{neg}\left(x\right)\right), \frac{11}{40} - y\right), \frac{29}{40} - \left(x + y\right)\right), \left(x + y\right) - \frac{33}{40}\right)\right)} \]
    5. Applied rewrites48.3%

      \[\leadsto \color{blue}{\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), \left(x - 0.775\right) \cdot \left(\left(x + y\right) - 1.475\right) - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.725 - \left(x + y\right)\right), \left(x + y\right) - 0.825\right)\right)} \]
    6. Taylor expanded in x around 0

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, y\right), x - \frac{33}{40}\right), \frac{29}{40} - x\right), \left(x - \frac{31}{40}\right) \cdot \left(\left(x + y\right) - \frac{59}{40}\right) - \frac{3}{40}\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - \frac{11}{40}\right), \frac{-11}{20}\right), \frac{9}{20} - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - \frac{1}{10}\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, x - \frac{11}{20}\right), -x\right), \frac{11}{40} - y\right), \frac{29}{40} - \left(x + y\right)\right), \left(x + y\right) - \frac{33}{40}\right)\right) \]
    7. Applied rewrites30.2%

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), \left(x - 0.775\right) \cdot \left(\left(x + y\right) - 1.475\right) - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), -0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.725 - \left(x + y\right)\right), \left(x + y\right) - 0.825\right)\right) \]
    8. Taylor expanded in x around 0

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, y\right), x - \frac{33}{40}\right), \frac{29}{40} - x\right), \left(x - \frac{31}{40}\right) \cdot \left(\left(x + y\right) - \frac{59}{40}\right) - \frac{3}{40}\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - \frac{11}{40}\right), \frac{-11}{20}\right), \frac{9}{20} - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - \frac{1}{10}\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, \frac{-11}{20}\right), -x\right), \frac{11}{40} - y\right), \frac{29}{40} - \left(x + y\right)\right), \left(x + y\right) - \frac{33}{40}\right)\right) \]
    9. Applied rewrites30.2%

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), \left(x - 0.775\right) \cdot \left(\left(x + y\right) - 1.475\right) - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), -0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, -0.55\right), -x\right), 0.275 - y\right), 0.725 - \left(x + y\right)\right), \left(x + y\right) - 0.825\right)\right) \]

    if -2.4499999999999999e-50 < x

    1. Initial program 100.0%

      \[\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, -y\right), x - 0.825\right), 0.725 - x\right), \sqrt{{\left(y - 0.7\right)}^{2} + {\left(x - 0.775\right)}^{2}} - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 1\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \sqrt{{\left(y - 0.275\right)}^{2} + {\left(x - 0.275\right)}^{2}}\right), \sqrt{{\left(y - 0.275\right)}^{2} + {\left(x - 0.275\right)}^{2}} - 0.275\right)\right) \]
    2. Applied rewrites38.1%

      \[\leadsto \color{blue}{\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), \left(\left(x - 0.775\right) - \left(0.7 - y\right)\right) - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right)\right), \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right) - 0.275\right)\right)} \]
    3. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, y\right), x - \frac{33}{40}\right), \frac{29}{40} - x\right), \left(x + y\right) - \frac{31}{20}\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - \frac{11}{40}\right), x - \frac{11}{20}\right), \frac{9}{20} - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - \frac{1}{10}\right), \mathsf{neg}\left(x\right)\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, x - \frac{11}{20}\right), \mathsf{neg}\left(x\right)\right), \frac{11}{40} - y\right), \frac{29}{40} - \left(x + y\right)\right), \left(x + y\right) - \frac{33}{40}\right)\right)} \]
    4. Applied rewrites38.1%

      \[\leadsto \color{blue}{\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), \left(x + y\right) - 1.55\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.725 - \left(x + y\right)\right), \left(x + y\right) - 0.825\right)\right)} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 8: 44.3% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{{\left(y - 0.275\right)}^{2} + {\left(x - 0.275\right)}^{2}}\\ t_1 := \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\\ t_2 := \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\\ t_3 := \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right)\\ t_4 := \mathsf{max}\left(\mathsf{max}\left(t\_3, 0.725 - \left(x + y\right)\right), \left(x + y\right) - 0.825\right)\\ t_5 := \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right)\\ \mathbf{if}\;\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, -y\right), x - 0.825\right), 0.725 - x\right), \sqrt{{\left(y - 0.7\right)}^{2} + {\left(x - 0.775\right)}^{2}} - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 1\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(t\_3, 0.175 - t\_0\right), t\_0 - 0.275\right)\right) \leq 1:\\ \;\;\;\;\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(t\_5, -0.775 \cdot \left(y - 1.475\right) - 0.075\right), t\_1\right), t\_2\right), t\_4\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(t\_5, \left(x + y\right) - 1.55\right), t\_1\right), t\_2\right), t\_4\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (sqrt (+ (pow (- y 0.275) 2.0) (pow (- x 0.275) 2.0))))
        (t_1 (fmax (fmax (fmax y (- y 0.275)) (- x 0.55)) (- 0.45 x)))
        (t_2 (fmax (fmax (fmax y (- y 2.0)) (- x 0.1)) (- x)))
        (t_3 (fmax (fmax (fmax (- y 0.55) (- x 0.55)) (- x)) (- 0.275 y)))
        (t_4 (fmax (fmax t_3 (- 0.725 (+ x y))) (- (+ x y) 0.825)))
        (t_5 (fmax (fmax (fmax (- y 0.55) y) (- x 0.825)) (- 0.725 x))))
   (if (<=
        (fmin
         (fmin
          (fmin
           (fmin
            (fmax (fmax (fmax (- y 0.55) (- y)) (- x 0.825)) (- 0.725 x))
            (- (sqrt (+ (pow (- y 0.7) 2.0) (pow (- x 0.775) 2.0))) 0.075))
           (fmax (fmax (fmax (- y) (- y 0.275)) (- x 0.55)) (- 0.45 x)))
          (fmax (fmax (fmax (- y) (- y 1.0)) (- x 0.1)) (- x)))
         (fmax (fmax t_3 (- 0.175 t_0)) (- t_0 0.275)))
        1.0)
     (fmin
      (fmin (fmin (fmin t_5 (- (* -0.775 (- y 1.475)) 0.075)) t_1) t_2)
      t_4)
     (fmin (fmin (fmin (fmin t_5 (- (+ x y) 1.55)) t_1) t_2) t_4))))
double code(double x, double y) {
	double t_0 = sqrt((pow((y - 0.275), 2.0) + pow((x - 0.275), 2.0)));
	double t_1 = fmax(fmax(fmax(y, (y - 0.275)), (x - 0.55)), (0.45 - x));
	double t_2 = fmax(fmax(fmax(y, (y - 2.0)), (x - 0.1)), -x);
	double t_3 = fmax(fmax(fmax((y - 0.55), (x - 0.55)), -x), (0.275 - y));
	double t_4 = fmax(fmax(t_3, (0.725 - (x + y))), ((x + y) - 0.825));
	double t_5 = fmax(fmax(fmax((y - 0.55), y), (x - 0.825)), (0.725 - x));
	double tmp;
	if (fmin(fmin(fmin(fmin(fmax(fmax(fmax((y - 0.55), -y), (x - 0.825)), (0.725 - x)), (sqrt((pow((y - 0.7), 2.0) + pow((x - 0.775), 2.0))) - 0.075)), fmax(fmax(fmax(-y, (y - 0.275)), (x - 0.55)), (0.45 - x))), fmax(fmax(fmax(-y, (y - 1.0)), (x - 0.1)), -x)), fmax(fmax(t_3, (0.175 - t_0)), (t_0 - 0.275))) <= 1.0) {
		tmp = fmin(fmin(fmin(fmin(t_5, ((-0.775 * (y - 1.475)) - 0.075)), t_1), t_2), t_4);
	} else {
		tmp = fmin(fmin(fmin(fmin(t_5, ((x + y) - 1.55)), t_1), t_2), t_4);
	}
	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)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: t_4
    real(8) :: t_5
    real(8) :: tmp
    t_0 = sqrt((((y - 0.275d0) ** 2.0d0) + ((x - 0.275d0) ** 2.0d0)))
    t_1 = fmax(fmax(fmax(y, (y - 0.275d0)), (x - 0.55d0)), (0.45d0 - x))
    t_2 = fmax(fmax(fmax(y, (y - 2.0d0)), (x - 0.1d0)), -x)
    t_3 = fmax(fmax(fmax((y - 0.55d0), (x - 0.55d0)), -x), (0.275d0 - y))
    t_4 = fmax(fmax(t_3, (0.725d0 - (x + y))), ((x + y) - 0.825d0))
    t_5 = fmax(fmax(fmax((y - 0.55d0), y), (x - 0.825d0)), (0.725d0 - x))
    if (fmin(fmin(fmin(fmin(fmax(fmax(fmax((y - 0.55d0), -y), (x - 0.825d0)), (0.725d0 - x)), (sqrt((((y - 0.7d0) ** 2.0d0) + ((x - 0.775d0) ** 2.0d0))) - 0.075d0)), fmax(fmax(fmax(-y, (y - 0.275d0)), (x - 0.55d0)), (0.45d0 - x))), fmax(fmax(fmax(-y, (y - 1.0d0)), (x - 0.1d0)), -x)), fmax(fmax(t_3, (0.175d0 - t_0)), (t_0 - 0.275d0))) <= 1.0d0) then
        tmp = fmin(fmin(fmin(fmin(t_5, (((-0.775d0) * (y - 1.475d0)) - 0.075d0)), t_1), t_2), t_4)
    else
        tmp = fmin(fmin(fmin(fmin(t_5, ((x + y) - 1.55d0)), t_1), t_2), t_4)
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = Math.sqrt((Math.pow((y - 0.275), 2.0) + Math.pow((x - 0.275), 2.0)));
	double t_1 = fmax(fmax(fmax(y, (y - 0.275)), (x - 0.55)), (0.45 - x));
	double t_2 = fmax(fmax(fmax(y, (y - 2.0)), (x - 0.1)), -x);
	double t_3 = fmax(fmax(fmax((y - 0.55), (x - 0.55)), -x), (0.275 - y));
	double t_4 = fmax(fmax(t_3, (0.725 - (x + y))), ((x + y) - 0.825));
	double t_5 = fmax(fmax(fmax((y - 0.55), y), (x - 0.825)), (0.725 - x));
	double tmp;
	if (fmin(fmin(fmin(fmin(fmax(fmax(fmax((y - 0.55), -y), (x - 0.825)), (0.725 - x)), (Math.sqrt((Math.pow((y - 0.7), 2.0) + Math.pow((x - 0.775), 2.0))) - 0.075)), fmax(fmax(fmax(-y, (y - 0.275)), (x - 0.55)), (0.45 - x))), fmax(fmax(fmax(-y, (y - 1.0)), (x - 0.1)), -x)), fmax(fmax(t_3, (0.175 - t_0)), (t_0 - 0.275))) <= 1.0) {
		tmp = fmin(fmin(fmin(fmin(t_5, ((-0.775 * (y - 1.475)) - 0.075)), t_1), t_2), t_4);
	} else {
		tmp = fmin(fmin(fmin(fmin(t_5, ((x + y) - 1.55)), t_1), t_2), t_4);
	}
	return tmp;
}
def code(x, y):
	t_0 = math.sqrt((math.pow((y - 0.275), 2.0) + math.pow((x - 0.275), 2.0)))
	t_1 = fmax(fmax(fmax(y, (y - 0.275)), (x - 0.55)), (0.45 - x))
	t_2 = fmax(fmax(fmax(y, (y - 2.0)), (x - 0.1)), -x)
	t_3 = fmax(fmax(fmax((y - 0.55), (x - 0.55)), -x), (0.275 - y))
	t_4 = fmax(fmax(t_3, (0.725 - (x + y))), ((x + y) - 0.825))
	t_5 = fmax(fmax(fmax((y - 0.55), y), (x - 0.825)), (0.725 - x))
	tmp = 0
	if fmin(fmin(fmin(fmin(fmax(fmax(fmax((y - 0.55), -y), (x - 0.825)), (0.725 - x)), (math.sqrt((math.pow((y - 0.7), 2.0) + math.pow((x - 0.775), 2.0))) - 0.075)), fmax(fmax(fmax(-y, (y - 0.275)), (x - 0.55)), (0.45 - x))), fmax(fmax(fmax(-y, (y - 1.0)), (x - 0.1)), -x)), fmax(fmax(t_3, (0.175 - t_0)), (t_0 - 0.275))) <= 1.0:
		tmp = fmin(fmin(fmin(fmin(t_5, ((-0.775 * (y - 1.475)) - 0.075)), t_1), t_2), t_4)
	else:
		tmp = fmin(fmin(fmin(fmin(t_5, ((x + y) - 1.55)), t_1), t_2), t_4)
	return tmp
function code(x, y)
	t_0 = sqrt(Float64((Float64(y - 0.275) ^ 2.0) + (Float64(x - 0.275) ^ 2.0)))
	t_1 = fmax(fmax(fmax(y, Float64(y - 0.275)), Float64(x - 0.55)), Float64(0.45 - x))
	t_2 = fmax(fmax(fmax(y, Float64(y - 2.0)), Float64(x - 0.1)), Float64(-x))
	t_3 = fmax(fmax(fmax(Float64(y - 0.55), Float64(x - 0.55)), Float64(-x)), Float64(0.275 - y))
	t_4 = fmax(fmax(t_3, Float64(0.725 - Float64(x + y))), Float64(Float64(x + y) - 0.825))
	t_5 = fmax(fmax(fmax(Float64(y - 0.55), y), Float64(x - 0.825)), Float64(0.725 - x))
	tmp = 0.0
	if (fmin(fmin(fmin(fmin(fmax(fmax(fmax(Float64(y - 0.55), Float64(-y)), Float64(x - 0.825)), Float64(0.725 - x)), Float64(sqrt(Float64((Float64(y - 0.7) ^ 2.0) + (Float64(x - 0.775) ^ 2.0))) - 0.075)), fmax(fmax(fmax(Float64(-y), Float64(y - 0.275)), Float64(x - 0.55)), Float64(0.45 - x))), fmax(fmax(fmax(Float64(-y), Float64(y - 1.0)), Float64(x - 0.1)), Float64(-x))), fmax(fmax(t_3, Float64(0.175 - t_0)), Float64(t_0 - 0.275))) <= 1.0)
		tmp = fmin(fmin(fmin(fmin(t_5, Float64(Float64(-0.775 * Float64(y - 1.475)) - 0.075)), t_1), t_2), t_4);
	else
		tmp = fmin(fmin(fmin(fmin(t_5, Float64(Float64(x + y) - 1.55)), t_1), t_2), t_4);
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = sqrt((((y - 0.275) ^ 2.0) + ((x - 0.275) ^ 2.0)));
	t_1 = max(max(max(y, (y - 0.275)), (x - 0.55)), (0.45 - x));
	t_2 = max(max(max(y, (y - 2.0)), (x - 0.1)), -x);
	t_3 = max(max(max((y - 0.55), (x - 0.55)), -x), (0.275 - y));
	t_4 = max(max(t_3, (0.725 - (x + y))), ((x + y) - 0.825));
	t_5 = max(max(max((y - 0.55), y), (x - 0.825)), (0.725 - x));
	tmp = 0.0;
	if (min(min(min(min(max(max(max((y - 0.55), -y), (x - 0.825)), (0.725 - x)), (sqrt((((y - 0.7) ^ 2.0) + ((x - 0.775) ^ 2.0))) - 0.075)), max(max(max(-y, (y - 0.275)), (x - 0.55)), (0.45 - x))), max(max(max(-y, (y - 1.0)), (x - 0.1)), -x)), max(max(t_3, (0.175 - t_0)), (t_0 - 0.275))) <= 1.0)
		tmp = min(min(min(min(t_5, ((-0.775 * (y - 1.475)) - 0.075)), t_1), t_2), t_4);
	else
		tmp = min(min(min(min(t_5, ((x + y) - 1.55)), t_1), t_2), t_4);
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[Sqrt[N[(N[Power[N[(y - 0.275), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(x - 0.275), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Max[N[Max[N[Max[y, N[(y - 0.275), $MachinePrecision]], $MachinePrecision], N[(x - 0.55), $MachinePrecision]], $MachinePrecision], N[(0.45 - x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Max[N[Max[N[Max[y, N[(y - 2.0), $MachinePrecision]], $MachinePrecision], N[(x - 0.1), $MachinePrecision]], $MachinePrecision], (-x)], $MachinePrecision]}, Block[{t$95$3 = N[Max[N[Max[N[Max[N[(y - 0.55), $MachinePrecision], N[(x - 0.55), $MachinePrecision]], $MachinePrecision], (-x)], $MachinePrecision], N[(0.275 - y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[Max[N[Max[t$95$3, N[(0.725 - N[(x + y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[(x + y), $MachinePrecision] - 0.825), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$5 = N[Max[N[Max[N[Max[N[(y - 0.55), $MachinePrecision], y], $MachinePrecision], N[(x - 0.825), $MachinePrecision]], $MachinePrecision], N[(0.725 - x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[Min[N[Min[N[Min[N[Min[N[Max[N[Max[N[Max[N[(y - 0.55), $MachinePrecision], (-y)], $MachinePrecision], N[(x - 0.825), $MachinePrecision]], $MachinePrecision], N[(0.725 - x), $MachinePrecision]], $MachinePrecision], N[(N[Sqrt[N[(N[Power[N[(y - 0.7), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(x - 0.775), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.075), $MachinePrecision]], $MachinePrecision], N[Max[N[Max[N[Max[(-y), N[(y - 0.275), $MachinePrecision]], $MachinePrecision], N[(x - 0.55), $MachinePrecision]], $MachinePrecision], N[(0.45 - x), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], N[Max[N[Max[N[Max[(-y), N[(y - 1.0), $MachinePrecision]], $MachinePrecision], N[(x - 0.1), $MachinePrecision]], $MachinePrecision], (-x)], $MachinePrecision]], $MachinePrecision], N[Max[N[Max[t$95$3, N[(0.175 - t$95$0), $MachinePrecision]], $MachinePrecision], N[(t$95$0 - 0.275), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], 1.0], N[Min[N[Min[N[Min[N[Min[t$95$5, N[(N[(-0.775 * N[(y - 1.475), $MachinePrecision]), $MachinePrecision] - 0.075), $MachinePrecision]], $MachinePrecision], t$95$1], $MachinePrecision], t$95$2], $MachinePrecision], t$95$4], $MachinePrecision], N[Min[N[Min[N[Min[N[Min[t$95$5, N[(N[(x + y), $MachinePrecision] - 1.55), $MachinePrecision]], $MachinePrecision], t$95$1], $MachinePrecision], t$95$2], $MachinePrecision], t$95$4], $MachinePrecision]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sqrt{{\left(y - 0.275\right)}^{2} + {\left(x - 0.275\right)}^{2}}\\
t_1 := \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\\
t_2 := \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\\
t_3 := \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right)\\
t_4 := \mathsf{max}\left(\mathsf{max}\left(t\_3, 0.725 - \left(x + y\right)\right), \left(x + y\right) - 0.825\right)\\
t_5 := \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right)\\
\mathbf{if}\;\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, -y\right), x - 0.825\right), 0.725 - x\right), \sqrt{{\left(y - 0.7\right)}^{2} + {\left(x - 0.775\right)}^{2}} - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 1\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(t\_3, 0.175 - t\_0\right), t\_0 - 0.275\right)\right) \leq 1:\\
\;\;\;\;\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(t\_5, -0.775 \cdot \left(y - 1.475\right) - 0.075\right), t\_1\right), t\_2\right), t\_4\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(t\_5, \left(x + y\right) - 1.55\right), t\_1\right), t\_2\right), t\_4\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (fmin.f64 (fmin.f64 (fmin.f64 (fmin.f64 (fmax.f64 (fmax.f64 (fmax.f64 (-.f64 y #s(literal 11/20 binary64)) (neg.f64 y)) (-.f64 x #s(literal 33/40 binary64))) (-.f64 #s(literal 29/40 binary64) x)) (-.f64 (sqrt.f64 (+.f64 (pow.f64 (-.f64 y #s(literal 7/10 binary64)) #s(literal 2 binary64)) (pow.f64 (-.f64 x #s(literal 31/40 binary64)) #s(literal 2 binary64)))) #s(literal 3/40 binary64))) (fmax.f64 (fmax.f64 (fmax.f64 (neg.f64 y) (-.f64 y #s(literal 11/40 binary64))) (-.f64 x #s(literal 11/20 binary64))) (-.f64 #s(literal 9/20 binary64) x))) (fmax.f64 (fmax.f64 (fmax.f64 (neg.f64 y) (-.f64 y #s(literal 1 binary64))) (-.f64 x #s(literal 1/10 binary64))) (neg.f64 x))) (fmax.f64 (fmax.f64 (fmax.f64 (fmax.f64 (fmax.f64 (-.f64 y #s(literal 11/20 binary64)) (-.f64 x #s(literal 11/20 binary64))) (neg.f64 x)) (-.f64 #s(literal 11/40 binary64) y)) (-.f64 #s(literal 7/40 binary64) (sqrt.f64 (+.f64 (pow.f64 (-.f64 y #s(literal 11/40 binary64)) #s(literal 2 binary64)) (pow.f64 (-.f64 x #s(literal 11/40 binary64)) #s(literal 2 binary64)))))) (-.f64 (sqrt.f64 (+.f64 (pow.f64 (-.f64 y #s(literal 11/40 binary64)) #s(literal 2 binary64)) (pow.f64 (-.f64 x #s(literal 11/40 binary64)) #s(literal 2 binary64)))) #s(literal 11/40 binary64)))) < 1

    1. Initial program 100.0%

      \[\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, -y\right), x - 0.825\right), 0.725 - x\right), \sqrt{{\left(y - 0.7\right)}^{2} + {\left(x - 0.775\right)}^{2}} - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 1\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \sqrt{{\left(y - 0.275\right)}^{2} + {\left(x - 0.275\right)}^{2}}\right), \sqrt{{\left(y - 0.275\right)}^{2} + {\left(x - 0.275\right)}^{2}} - 0.275\right)\right) \]
    2. Applied rewrites38.1%

      \[\leadsto \color{blue}{\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), \left(\left(x - 0.775\right) - \left(0.7 - y\right)\right) - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right)\right), \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right) - 0.275\right)\right)} \]
    3. Applied rewrites48.3%

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), \color{blue}{\left(\left(x - 0.775\right) - \left(0.7 - y\right)\right) \cdot \left(x - 0.775\right)} - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right)\right), \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right) - 0.275\right)\right) \]
    4. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, y\right), x - \frac{33}{40}\right), \frac{29}{40} - x\right), \left(x - \frac{31}{40}\right) \cdot \left(\left(x + y\right) - \frac{59}{40}\right) - \frac{3}{40}\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - \frac{11}{40}\right), x - \frac{11}{20}\right), \frac{9}{20} - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - \frac{1}{10}\right), \mathsf{neg}\left(x\right)\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, x - \frac{11}{20}\right), \mathsf{neg}\left(x\right)\right), \frac{11}{40} - y\right), \frac{29}{40} - \left(x + y\right)\right), \left(x + y\right) - \frac{33}{40}\right)\right)} \]
    5. Applied rewrites48.3%

      \[\leadsto \color{blue}{\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), \left(x - 0.775\right) \cdot \left(\left(x + y\right) - 1.475\right) - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.725 - \left(x + y\right)\right), \left(x + y\right) - 0.825\right)\right)} \]
    6. Taylor expanded in x around 0

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, y\right), x - \frac{33}{40}\right), \frac{29}{40} - x\right), \frac{-31}{40} \cdot \left(y - \frac{59}{40}\right) - \frac{3}{40}\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - \frac{11}{40}\right), x - \frac{11}{20}\right), \frac{9}{20} - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - \frac{1}{10}\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, x - \frac{11}{20}\right), -\color{blue}{x}\right), \frac{11}{40} - y\right), \frac{29}{40} - \left(x + y\right)\right), \left(x + y\right) - \frac{33}{40}\right)\right) \]
    7. Applied rewrites9.6%

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), -0.775 \cdot \left(y - 1.475\right) - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -\color{blue}{x}\right), 0.275 - y\right), 0.725 - \left(x + y\right)\right), \left(x + y\right) - 0.825\right)\right) \]

    if 1 < (fmin.f64 (fmin.f64 (fmin.f64 (fmin.f64 (fmax.f64 (fmax.f64 (fmax.f64 (-.f64 y #s(literal 11/20 binary64)) (neg.f64 y)) (-.f64 x #s(literal 33/40 binary64))) (-.f64 #s(literal 29/40 binary64) x)) (-.f64 (sqrt.f64 (+.f64 (pow.f64 (-.f64 y #s(literal 7/10 binary64)) #s(literal 2 binary64)) (pow.f64 (-.f64 x #s(literal 31/40 binary64)) #s(literal 2 binary64)))) #s(literal 3/40 binary64))) (fmax.f64 (fmax.f64 (fmax.f64 (neg.f64 y) (-.f64 y #s(literal 11/40 binary64))) (-.f64 x #s(literal 11/20 binary64))) (-.f64 #s(literal 9/20 binary64) x))) (fmax.f64 (fmax.f64 (fmax.f64 (neg.f64 y) (-.f64 y #s(literal 1 binary64))) (-.f64 x #s(literal 1/10 binary64))) (neg.f64 x))) (fmax.f64 (fmax.f64 (fmax.f64 (fmax.f64 (fmax.f64 (-.f64 y #s(literal 11/20 binary64)) (-.f64 x #s(literal 11/20 binary64))) (neg.f64 x)) (-.f64 #s(literal 11/40 binary64) y)) (-.f64 #s(literal 7/40 binary64) (sqrt.f64 (+.f64 (pow.f64 (-.f64 y #s(literal 11/40 binary64)) #s(literal 2 binary64)) (pow.f64 (-.f64 x #s(literal 11/40 binary64)) #s(literal 2 binary64)))))) (-.f64 (sqrt.f64 (+.f64 (pow.f64 (-.f64 y #s(literal 11/40 binary64)) #s(literal 2 binary64)) (pow.f64 (-.f64 x #s(literal 11/40 binary64)) #s(literal 2 binary64)))) #s(literal 11/40 binary64))))

    1. Initial program 100.0%

      \[\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, -y\right), x - 0.825\right), 0.725 - x\right), \sqrt{{\left(y - 0.7\right)}^{2} + {\left(x - 0.775\right)}^{2}} - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 1\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \sqrt{{\left(y - 0.275\right)}^{2} + {\left(x - 0.275\right)}^{2}}\right), \sqrt{{\left(y - 0.275\right)}^{2} + {\left(x - 0.275\right)}^{2}} - 0.275\right)\right) \]
    2. Applied rewrites38.1%

      \[\leadsto \color{blue}{\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), \left(\left(x - 0.775\right) - \left(0.7 - y\right)\right) - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right)\right), \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right) - 0.275\right)\right)} \]
    3. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, y\right), x - \frac{33}{40}\right), \frac{29}{40} - x\right), \left(x + y\right) - \frac{31}{20}\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - \frac{11}{40}\right), x - \frac{11}{20}\right), \frac{9}{20} - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - \frac{1}{10}\right), \mathsf{neg}\left(x\right)\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, x - \frac{11}{20}\right), \mathsf{neg}\left(x\right)\right), \frac{11}{40} - y\right), \frac{29}{40} - \left(x + y\right)\right), \left(x + y\right) - \frac{33}{40}\right)\right)} \]
    4. Applied rewrites38.1%

      \[\leadsto \color{blue}{\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), \left(x + y\right) - 1.55\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.725 - \left(x + y\right)\right), \left(x + y\right) - 0.825\right)\right)} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 9: 39.8% accurate, 2.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right)\\ t_1 := \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\\ t_2 := \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\\ t_3 := \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.725 - \left(x + y\right)\right), \left(x + y\right) - 0.825\right)\\ \mathbf{if}\;x \leq -1 \cdot 10^{+183}:\\ \;\;\;\;\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(t\_0, y \cdot \left(x - 0.775\right)\right), t\_2\right), t\_1\right), t\_3\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(t\_0, \left(x + y\right) - 1.55\right), t\_2\right), t\_1\right), t\_3\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (fmax (fmax (fmax (- y 0.55) y) (- x 0.825)) (- 0.725 x)))
        (t_1 (fmax (fmax (fmax y (- y 2.0)) (- x 0.1)) (- x)))
        (t_2 (fmax (fmax (fmax y (- y 0.275)) (- x 0.55)) (- 0.45 x)))
        (t_3
         (fmax
          (fmax
           (fmax (fmax (fmax (- y 0.55) (- x 0.55)) (- x)) (- 0.275 y))
           (- 0.725 (+ x y)))
          (- (+ x y) 0.825))))
   (if (<= x -1e+183)
     (fmin (fmin (fmin (fmin t_0 (* y (- x 0.775))) t_2) t_1) t_3)
     (fmin (fmin (fmin (fmin t_0 (- (+ x y) 1.55)) t_2) t_1) t_3))))
double code(double x, double y) {
	double t_0 = fmax(fmax(fmax((y - 0.55), y), (x - 0.825)), (0.725 - x));
	double t_1 = fmax(fmax(fmax(y, (y - 2.0)), (x - 0.1)), -x);
	double t_2 = fmax(fmax(fmax(y, (y - 0.275)), (x - 0.55)), (0.45 - x));
	double t_3 = fmax(fmax(fmax(fmax(fmax((y - 0.55), (x - 0.55)), -x), (0.275 - y)), (0.725 - (x + y))), ((x + y) - 0.825));
	double tmp;
	if (x <= -1e+183) {
		tmp = fmin(fmin(fmin(fmin(t_0, (y * (x - 0.775))), t_2), t_1), t_3);
	} else {
		tmp = fmin(fmin(fmin(fmin(t_0, ((x + y) - 1.55)), t_2), t_1), t_3);
	}
	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)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: tmp
    t_0 = fmax(fmax(fmax((y - 0.55d0), y), (x - 0.825d0)), (0.725d0 - x))
    t_1 = fmax(fmax(fmax(y, (y - 2.0d0)), (x - 0.1d0)), -x)
    t_2 = fmax(fmax(fmax(y, (y - 0.275d0)), (x - 0.55d0)), (0.45d0 - x))
    t_3 = fmax(fmax(fmax(fmax(fmax((y - 0.55d0), (x - 0.55d0)), -x), (0.275d0 - y)), (0.725d0 - (x + y))), ((x + y) - 0.825d0))
    if (x <= (-1d+183)) then
        tmp = fmin(fmin(fmin(fmin(t_0, (y * (x - 0.775d0))), t_2), t_1), t_3)
    else
        tmp = fmin(fmin(fmin(fmin(t_0, ((x + y) - 1.55d0)), t_2), t_1), t_3)
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = fmax(fmax(fmax((y - 0.55), y), (x - 0.825)), (0.725 - x));
	double t_1 = fmax(fmax(fmax(y, (y - 2.0)), (x - 0.1)), -x);
	double t_2 = fmax(fmax(fmax(y, (y - 0.275)), (x - 0.55)), (0.45 - x));
	double t_3 = fmax(fmax(fmax(fmax(fmax((y - 0.55), (x - 0.55)), -x), (0.275 - y)), (0.725 - (x + y))), ((x + y) - 0.825));
	double tmp;
	if (x <= -1e+183) {
		tmp = fmin(fmin(fmin(fmin(t_0, (y * (x - 0.775))), t_2), t_1), t_3);
	} else {
		tmp = fmin(fmin(fmin(fmin(t_0, ((x + y) - 1.55)), t_2), t_1), t_3);
	}
	return tmp;
}
def code(x, y):
	t_0 = fmax(fmax(fmax((y - 0.55), y), (x - 0.825)), (0.725 - x))
	t_1 = fmax(fmax(fmax(y, (y - 2.0)), (x - 0.1)), -x)
	t_2 = fmax(fmax(fmax(y, (y - 0.275)), (x - 0.55)), (0.45 - x))
	t_3 = fmax(fmax(fmax(fmax(fmax((y - 0.55), (x - 0.55)), -x), (0.275 - y)), (0.725 - (x + y))), ((x + y) - 0.825))
	tmp = 0
	if x <= -1e+183:
		tmp = fmin(fmin(fmin(fmin(t_0, (y * (x - 0.775))), t_2), t_1), t_3)
	else:
		tmp = fmin(fmin(fmin(fmin(t_0, ((x + y) - 1.55)), t_2), t_1), t_3)
	return tmp
function code(x, y)
	t_0 = fmax(fmax(fmax(Float64(y - 0.55), y), Float64(x - 0.825)), Float64(0.725 - x))
	t_1 = fmax(fmax(fmax(y, Float64(y - 2.0)), Float64(x - 0.1)), Float64(-x))
	t_2 = fmax(fmax(fmax(y, Float64(y - 0.275)), Float64(x - 0.55)), Float64(0.45 - x))
	t_3 = fmax(fmax(fmax(fmax(fmax(Float64(y - 0.55), Float64(x - 0.55)), Float64(-x)), Float64(0.275 - y)), Float64(0.725 - Float64(x + y))), Float64(Float64(x + y) - 0.825))
	tmp = 0.0
	if (x <= -1e+183)
		tmp = fmin(fmin(fmin(fmin(t_0, Float64(y * Float64(x - 0.775))), t_2), t_1), t_3);
	else
		tmp = fmin(fmin(fmin(fmin(t_0, Float64(Float64(x + y) - 1.55)), t_2), t_1), t_3);
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = max(max(max((y - 0.55), y), (x - 0.825)), (0.725 - x));
	t_1 = max(max(max(y, (y - 2.0)), (x - 0.1)), -x);
	t_2 = max(max(max(y, (y - 0.275)), (x - 0.55)), (0.45 - x));
	t_3 = max(max(max(max(max((y - 0.55), (x - 0.55)), -x), (0.275 - y)), (0.725 - (x + y))), ((x + y) - 0.825));
	tmp = 0.0;
	if (x <= -1e+183)
		tmp = min(min(min(min(t_0, (y * (x - 0.775))), t_2), t_1), t_3);
	else
		tmp = min(min(min(min(t_0, ((x + y) - 1.55)), t_2), t_1), t_3);
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[Max[N[Max[N[Max[N[(y - 0.55), $MachinePrecision], y], $MachinePrecision], N[(x - 0.825), $MachinePrecision]], $MachinePrecision], N[(0.725 - x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Max[N[Max[N[Max[y, N[(y - 2.0), $MachinePrecision]], $MachinePrecision], N[(x - 0.1), $MachinePrecision]], $MachinePrecision], (-x)], $MachinePrecision]}, Block[{t$95$2 = N[Max[N[Max[N[Max[y, N[(y - 0.275), $MachinePrecision]], $MachinePrecision], N[(x - 0.55), $MachinePrecision]], $MachinePrecision], N[(0.45 - x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Max[N[Max[N[Max[N[Max[N[Max[N[(y - 0.55), $MachinePrecision], N[(x - 0.55), $MachinePrecision]], $MachinePrecision], (-x)], $MachinePrecision], N[(0.275 - y), $MachinePrecision]], $MachinePrecision], N[(0.725 - N[(x + y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[(x + y), $MachinePrecision] - 0.825), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -1e+183], N[Min[N[Min[N[Min[N[Min[t$95$0, N[(y * N[(x - 0.775), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$2], $MachinePrecision], t$95$1], $MachinePrecision], t$95$3], $MachinePrecision], N[Min[N[Min[N[Min[N[Min[t$95$0, N[(N[(x + y), $MachinePrecision] - 1.55), $MachinePrecision]], $MachinePrecision], t$95$2], $MachinePrecision], t$95$1], $MachinePrecision], t$95$3], $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right)\\
t_1 := \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\\
t_2 := \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\\
t_3 := \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.725 - \left(x + y\right)\right), \left(x + y\right) - 0.825\right)\\
\mathbf{if}\;x \leq -1 \cdot 10^{+183}:\\
\;\;\;\;\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(t\_0, y \cdot \left(x - 0.775\right)\right), t\_2\right), t\_1\right), t\_3\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(t\_0, \left(x + y\right) - 1.55\right), t\_2\right), t\_1\right), t\_3\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -9.99999999999999947e182

    1. Initial program 100.0%

      \[\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, -y\right), x - 0.825\right), 0.725 - x\right), \sqrt{{\left(y - 0.7\right)}^{2} + {\left(x - 0.775\right)}^{2}} - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 1\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \sqrt{{\left(y - 0.275\right)}^{2} + {\left(x - 0.275\right)}^{2}}\right), \sqrt{{\left(y - 0.275\right)}^{2} + {\left(x - 0.275\right)}^{2}} - 0.275\right)\right) \]
    2. Applied rewrites38.1%

      \[\leadsto \color{blue}{\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), \left(\left(x - 0.775\right) - \left(0.7 - y\right)\right) - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right)\right), \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right) - 0.275\right)\right)} \]
    3. Applied rewrites48.3%

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), \color{blue}{\left(\left(x - 0.775\right) - \left(0.7 - y\right)\right) \cdot \left(x - 0.775\right)} - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right)\right), \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right) - 0.275\right)\right) \]
    4. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, y\right), x - \frac{33}{40}\right), \frac{29}{40} - x\right), \left(x - \frac{31}{40}\right) \cdot \left(\left(x + y\right) - \frac{59}{40}\right) - \frac{3}{40}\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - \frac{11}{40}\right), x - \frac{11}{20}\right), \frac{9}{20} - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - \frac{1}{10}\right), \mathsf{neg}\left(x\right)\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, x - \frac{11}{20}\right), \mathsf{neg}\left(x\right)\right), \frac{11}{40} - y\right), \frac{29}{40} - \left(x + y\right)\right), \left(x + y\right) - \frac{33}{40}\right)\right)} \]
    5. Applied rewrites48.3%

      \[\leadsto \color{blue}{\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), \left(x - 0.775\right) \cdot \left(\left(x + y\right) - 1.475\right) - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.725 - \left(x + y\right)\right), \left(x + y\right) - 0.825\right)\right)} \]
    6. Taylor expanded in y around inf

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, y\right), x - \frac{33}{40}\right), \frac{29}{40} - x\right), y \cdot \left(x - \frac{31}{40}\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - \frac{11}{40}\right), x - \frac{11}{20}\right), \frac{9}{20} - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - \frac{1}{10}\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, x - \frac{11}{20}\right), \color{blue}{-x}\right), \frac{11}{40} - y\right), \frac{29}{40} - \left(x + y\right)\right), \left(x + y\right) - \frac{33}{40}\right)\right) \]
    7. Applied rewrites12.4%

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), y \cdot \left(x - 0.775\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), \color{blue}{-x}\right), 0.275 - y\right), 0.725 - \left(x + y\right)\right), \left(x + y\right) - 0.825\right)\right) \]

    if -9.99999999999999947e182 < x

    1. Initial program 100.0%

      \[\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, -y\right), x - 0.825\right), 0.725 - x\right), \sqrt{{\left(y - 0.7\right)}^{2} + {\left(x - 0.775\right)}^{2}} - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 1\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \sqrt{{\left(y - 0.275\right)}^{2} + {\left(x - 0.275\right)}^{2}}\right), \sqrt{{\left(y - 0.275\right)}^{2} + {\left(x - 0.275\right)}^{2}} - 0.275\right)\right) \]
    2. Applied rewrites38.1%

      \[\leadsto \color{blue}{\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), \left(\left(x - 0.775\right) - \left(0.7 - y\right)\right) - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right)\right), \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right) - 0.275\right)\right)} \]
    3. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, y\right), x - \frac{33}{40}\right), \frac{29}{40} - x\right), \left(x + y\right) - \frac{31}{20}\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - \frac{11}{40}\right), x - \frac{11}{20}\right), \frac{9}{20} - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - \frac{1}{10}\right), \mathsf{neg}\left(x\right)\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, x - \frac{11}{20}\right), \mathsf{neg}\left(x\right)\right), \frac{11}{40} - y\right), \frac{29}{40} - \left(x + y\right)\right), \left(x + y\right) - \frac{33}{40}\right)\right)} \]
    4. Applied rewrites38.1%

      \[\leadsto \color{blue}{\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), \left(x + y\right) - 1.55\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.725 - \left(x + y\right)\right), \left(x + y\right) - 0.825\right)\right)} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 10: 38.1% accurate, 2.2× speedup?

\[\begin{array}{l} \\ \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), \left(x + y\right) - 1.55\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.725 - \left(x + y\right)\right), \left(x + y\right) - 0.825\right)\right) \end{array} \]
(FPCore (x y)
 :precision binary64
 (fmin
  (fmin
   (fmin
    (fmin
     (fmax (fmax (fmax (- y 0.55) y) (- x 0.825)) (- 0.725 x))
     (- (+ x y) 1.55))
    (fmax (fmax (fmax y (- y 0.275)) (- x 0.55)) (- 0.45 x)))
   (fmax (fmax (fmax y (- y 2.0)) (- x 0.1)) (- x)))
  (fmax
   (fmax
    (fmax (fmax (fmax (- y 0.55) (- x 0.55)) (- x)) (- 0.275 y))
    (- 0.725 (+ x y)))
   (- (+ x y) 0.825))))
double code(double x, double y) {
	return fmin(fmin(fmin(fmin(fmax(fmax(fmax((y - 0.55), y), (x - 0.825)), (0.725 - x)), ((x + y) - 1.55)), fmax(fmax(fmax(y, (y - 0.275)), (x - 0.55)), (0.45 - x))), fmax(fmax(fmax(y, (y - 2.0)), (x - 0.1)), -x)), fmax(fmax(fmax(fmax(fmax((y - 0.55), (x - 0.55)), -x), (0.275 - y)), (0.725 - (x + y))), ((x + y) - 0.825)));
}
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)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = fmin(fmin(fmin(fmin(fmax(fmax(fmax((y - 0.55d0), y), (x - 0.825d0)), (0.725d0 - x)), ((x + y) - 1.55d0)), fmax(fmax(fmax(y, (y - 0.275d0)), (x - 0.55d0)), (0.45d0 - x))), fmax(fmax(fmax(y, (y - 2.0d0)), (x - 0.1d0)), -x)), fmax(fmax(fmax(fmax(fmax((y - 0.55d0), (x - 0.55d0)), -x), (0.275d0 - y)), (0.725d0 - (x + y))), ((x + y) - 0.825d0)))
end function
public static double code(double x, double y) {
	return fmin(fmin(fmin(fmin(fmax(fmax(fmax((y - 0.55), y), (x - 0.825)), (0.725 - x)), ((x + y) - 1.55)), fmax(fmax(fmax(y, (y - 0.275)), (x - 0.55)), (0.45 - x))), fmax(fmax(fmax(y, (y - 2.0)), (x - 0.1)), -x)), fmax(fmax(fmax(fmax(fmax((y - 0.55), (x - 0.55)), -x), (0.275 - y)), (0.725 - (x + y))), ((x + y) - 0.825)));
}
def code(x, y):
	return fmin(fmin(fmin(fmin(fmax(fmax(fmax((y - 0.55), y), (x - 0.825)), (0.725 - x)), ((x + y) - 1.55)), fmax(fmax(fmax(y, (y - 0.275)), (x - 0.55)), (0.45 - x))), fmax(fmax(fmax(y, (y - 2.0)), (x - 0.1)), -x)), fmax(fmax(fmax(fmax(fmax((y - 0.55), (x - 0.55)), -x), (0.275 - y)), (0.725 - (x + y))), ((x + y) - 0.825)))
function code(x, y)
	return fmin(fmin(fmin(fmin(fmax(fmax(fmax(Float64(y - 0.55), y), Float64(x - 0.825)), Float64(0.725 - x)), Float64(Float64(x + y) - 1.55)), fmax(fmax(fmax(y, Float64(y - 0.275)), Float64(x - 0.55)), Float64(0.45 - x))), fmax(fmax(fmax(y, Float64(y - 2.0)), Float64(x - 0.1)), Float64(-x))), fmax(fmax(fmax(fmax(fmax(Float64(y - 0.55), Float64(x - 0.55)), Float64(-x)), Float64(0.275 - y)), Float64(0.725 - Float64(x + y))), Float64(Float64(x + y) - 0.825)))
end
function tmp = code(x, y)
	tmp = min(min(min(min(max(max(max((y - 0.55), y), (x - 0.825)), (0.725 - x)), ((x + y) - 1.55)), max(max(max(y, (y - 0.275)), (x - 0.55)), (0.45 - x))), max(max(max(y, (y - 2.0)), (x - 0.1)), -x)), max(max(max(max(max((y - 0.55), (x - 0.55)), -x), (0.275 - y)), (0.725 - (x + y))), ((x + y) - 0.825)));
end
code[x_, y_] := N[Min[N[Min[N[Min[N[Min[N[Max[N[Max[N[Max[N[(y - 0.55), $MachinePrecision], y], $MachinePrecision], N[(x - 0.825), $MachinePrecision]], $MachinePrecision], N[(0.725 - x), $MachinePrecision]], $MachinePrecision], N[(N[(x + y), $MachinePrecision] - 1.55), $MachinePrecision]], $MachinePrecision], N[Max[N[Max[N[Max[y, N[(y - 0.275), $MachinePrecision]], $MachinePrecision], N[(x - 0.55), $MachinePrecision]], $MachinePrecision], N[(0.45 - x), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], N[Max[N[Max[N[Max[y, N[(y - 2.0), $MachinePrecision]], $MachinePrecision], N[(x - 0.1), $MachinePrecision]], $MachinePrecision], (-x)], $MachinePrecision]], $MachinePrecision], N[Max[N[Max[N[Max[N[Max[N[Max[N[(y - 0.55), $MachinePrecision], N[(x - 0.55), $MachinePrecision]], $MachinePrecision], (-x)], $MachinePrecision], N[(0.275 - y), $MachinePrecision]], $MachinePrecision], N[(0.725 - N[(x + y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[(x + y), $MachinePrecision] - 0.825), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), \left(x + y\right) - 1.55\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.725 - \left(x + y\right)\right), \left(x + y\right) - 0.825\right)\right)
\end{array}
Derivation
  1. Initial program 100.0%

    \[\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, -y\right), x - 0.825\right), 0.725 - x\right), \sqrt{{\left(y - 0.7\right)}^{2} + {\left(x - 0.775\right)}^{2}} - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 1\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \sqrt{{\left(y - 0.275\right)}^{2} + {\left(x - 0.275\right)}^{2}}\right), \sqrt{{\left(y - 0.275\right)}^{2} + {\left(x - 0.275\right)}^{2}} - 0.275\right)\right) \]
  2. Applied rewrites38.1%

    \[\leadsto \color{blue}{\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), \left(\left(x - 0.775\right) - \left(0.7 - y\right)\right) - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right)\right), \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right) - 0.275\right)\right)} \]
  3. Taylor expanded in x around 0

    \[\leadsto \color{blue}{\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, y\right), x - \frac{33}{40}\right), \frac{29}{40} - x\right), \left(x + y\right) - \frac{31}{20}\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - \frac{11}{40}\right), x - \frac{11}{20}\right), \frac{9}{20} - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - \frac{1}{10}\right), \mathsf{neg}\left(x\right)\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, x - \frac{11}{20}\right), \mathsf{neg}\left(x\right)\right), \frac{11}{40} - y\right), \frac{29}{40} - \left(x + y\right)\right), \left(x + y\right) - \frac{33}{40}\right)\right)} \]
  4. Applied rewrites38.1%

    \[\leadsto \color{blue}{\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), \left(x + y\right) - 1.55\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.725 - \left(x + y\right)\right), \left(x + y\right) - 0.825\right)\right)} \]
  5. Add Preprocessing

Alternative 11: 35.8% accurate, 2.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{max}\left(y, y - 0.275\right)\\ t_1 := \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right)\\ t_2 := \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\\ \mathbf{if}\;x \leq 1.7:\\ \;\;\;\;\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(t\_1, y - 1.55\right), \mathsf{max}\left(\mathsf{max}\left(t\_0, -0.55\right), 0.45 - x\right)\right), t\_2\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, -0.55\right), -x\right), 0.275 - y\right), 0.725 - y\right), y - 0.825\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(t\_1, \left(\left(x - 0.775\right) - 0.7\right) - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(t\_0, x - 0.55\right), 0.45 - x\right)\right), t\_2\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275\right), 0.175 - \left(y - 0.55\right)\right), \left(y - 0.55\right) - 0.275\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (fmax y (- y 0.275)))
        (t_1 (fmax (fmax (fmax (- y 0.55) y) (- x 0.825)) (- 0.725 x)))
        (t_2 (fmax (fmax (fmax y (- y 2.0)) (- x 0.1)) (- x))))
   (if (<= x 1.7)
     (fmin
      (fmin
       (fmin (fmin t_1 (- y 1.55)) (fmax (fmax t_0 -0.55) (- 0.45 x)))
       t_2)
      (fmax
       (fmax
        (fmax (fmax (fmax (- y 0.55) -0.55) (- x)) (- 0.275 y))
        (- 0.725 y))
       (- y 0.825)))
     (fmin
      (fmin
       (fmin
        (fmin t_1 (- (- (- x 0.775) 0.7) 0.075))
        (fmax (fmax t_0 (- x 0.55)) (- 0.45 x)))
       t_2)
      (fmax
       (fmax
        (fmax (fmax (fmax (- y 0.55) (- x 0.55)) (- x)) 0.275)
        (- 0.175 (- y 0.55)))
       (- (- y 0.55) 0.275))))))
double code(double x, double y) {
	double t_0 = fmax(y, (y - 0.275));
	double t_1 = fmax(fmax(fmax((y - 0.55), y), (x - 0.825)), (0.725 - x));
	double t_2 = fmax(fmax(fmax(y, (y - 2.0)), (x - 0.1)), -x);
	double tmp;
	if (x <= 1.7) {
		tmp = fmin(fmin(fmin(fmin(t_1, (y - 1.55)), fmax(fmax(t_0, -0.55), (0.45 - x))), t_2), fmax(fmax(fmax(fmax(fmax((y - 0.55), -0.55), -x), (0.275 - y)), (0.725 - y)), (y - 0.825)));
	} else {
		tmp = fmin(fmin(fmin(fmin(t_1, (((x - 0.775) - 0.7) - 0.075)), fmax(fmax(t_0, (x - 0.55)), (0.45 - x))), t_2), fmax(fmax(fmax(fmax(fmax((y - 0.55), (x - 0.55)), -x), 0.275), (0.175 - (y - 0.55))), ((y - 0.55) - 0.275)));
	}
	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)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_0 = fmax(y, (y - 0.275d0))
    t_1 = fmax(fmax(fmax((y - 0.55d0), y), (x - 0.825d0)), (0.725d0 - x))
    t_2 = fmax(fmax(fmax(y, (y - 2.0d0)), (x - 0.1d0)), -x)
    if (x <= 1.7d0) then
        tmp = fmin(fmin(fmin(fmin(t_1, (y - 1.55d0)), fmax(fmax(t_0, (-0.55d0)), (0.45d0 - x))), t_2), fmax(fmax(fmax(fmax(fmax((y - 0.55d0), (-0.55d0)), -x), (0.275d0 - y)), (0.725d0 - y)), (y - 0.825d0)))
    else
        tmp = fmin(fmin(fmin(fmin(t_1, (((x - 0.775d0) - 0.7d0) - 0.075d0)), fmax(fmax(t_0, (x - 0.55d0)), (0.45d0 - x))), t_2), fmax(fmax(fmax(fmax(fmax((y - 0.55d0), (x - 0.55d0)), -x), 0.275d0), (0.175d0 - (y - 0.55d0))), ((y - 0.55d0) - 0.275d0)))
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = fmax(y, (y - 0.275));
	double t_1 = fmax(fmax(fmax((y - 0.55), y), (x - 0.825)), (0.725 - x));
	double t_2 = fmax(fmax(fmax(y, (y - 2.0)), (x - 0.1)), -x);
	double tmp;
	if (x <= 1.7) {
		tmp = fmin(fmin(fmin(fmin(t_1, (y - 1.55)), fmax(fmax(t_0, -0.55), (0.45 - x))), t_2), fmax(fmax(fmax(fmax(fmax((y - 0.55), -0.55), -x), (0.275 - y)), (0.725 - y)), (y - 0.825)));
	} else {
		tmp = fmin(fmin(fmin(fmin(t_1, (((x - 0.775) - 0.7) - 0.075)), fmax(fmax(t_0, (x - 0.55)), (0.45 - x))), t_2), fmax(fmax(fmax(fmax(fmax((y - 0.55), (x - 0.55)), -x), 0.275), (0.175 - (y - 0.55))), ((y - 0.55) - 0.275)));
	}
	return tmp;
}
def code(x, y):
	t_0 = fmax(y, (y - 0.275))
	t_1 = fmax(fmax(fmax((y - 0.55), y), (x - 0.825)), (0.725 - x))
	t_2 = fmax(fmax(fmax(y, (y - 2.0)), (x - 0.1)), -x)
	tmp = 0
	if x <= 1.7:
		tmp = fmin(fmin(fmin(fmin(t_1, (y - 1.55)), fmax(fmax(t_0, -0.55), (0.45 - x))), t_2), fmax(fmax(fmax(fmax(fmax((y - 0.55), -0.55), -x), (0.275 - y)), (0.725 - y)), (y - 0.825)))
	else:
		tmp = fmin(fmin(fmin(fmin(t_1, (((x - 0.775) - 0.7) - 0.075)), fmax(fmax(t_0, (x - 0.55)), (0.45 - x))), t_2), fmax(fmax(fmax(fmax(fmax((y - 0.55), (x - 0.55)), -x), 0.275), (0.175 - (y - 0.55))), ((y - 0.55) - 0.275)))
	return tmp
function code(x, y)
	t_0 = fmax(y, Float64(y - 0.275))
	t_1 = fmax(fmax(fmax(Float64(y - 0.55), y), Float64(x - 0.825)), Float64(0.725 - x))
	t_2 = fmax(fmax(fmax(y, Float64(y - 2.0)), Float64(x - 0.1)), Float64(-x))
	tmp = 0.0
	if (x <= 1.7)
		tmp = fmin(fmin(fmin(fmin(t_1, Float64(y - 1.55)), fmax(fmax(t_0, -0.55), Float64(0.45 - x))), t_2), fmax(fmax(fmax(fmax(fmax(Float64(y - 0.55), -0.55), Float64(-x)), Float64(0.275 - y)), Float64(0.725 - y)), Float64(y - 0.825)));
	else
		tmp = fmin(fmin(fmin(fmin(t_1, Float64(Float64(Float64(x - 0.775) - 0.7) - 0.075)), fmax(fmax(t_0, Float64(x - 0.55)), Float64(0.45 - x))), t_2), fmax(fmax(fmax(fmax(fmax(Float64(y - 0.55), Float64(x - 0.55)), Float64(-x)), 0.275), Float64(0.175 - Float64(y - 0.55))), Float64(Float64(y - 0.55) - 0.275)));
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = max(y, (y - 0.275));
	t_1 = max(max(max((y - 0.55), y), (x - 0.825)), (0.725 - x));
	t_2 = max(max(max(y, (y - 2.0)), (x - 0.1)), -x);
	tmp = 0.0;
	if (x <= 1.7)
		tmp = min(min(min(min(t_1, (y - 1.55)), max(max(t_0, -0.55), (0.45 - x))), t_2), max(max(max(max(max((y - 0.55), -0.55), -x), (0.275 - y)), (0.725 - y)), (y - 0.825)));
	else
		tmp = min(min(min(min(t_1, (((x - 0.775) - 0.7) - 0.075)), max(max(t_0, (x - 0.55)), (0.45 - x))), t_2), max(max(max(max(max((y - 0.55), (x - 0.55)), -x), 0.275), (0.175 - (y - 0.55))), ((y - 0.55) - 0.275)));
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[Max[y, N[(y - 0.275), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Max[N[Max[N[Max[N[(y - 0.55), $MachinePrecision], y], $MachinePrecision], N[(x - 0.825), $MachinePrecision]], $MachinePrecision], N[(0.725 - x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Max[N[Max[N[Max[y, N[(y - 2.0), $MachinePrecision]], $MachinePrecision], N[(x - 0.1), $MachinePrecision]], $MachinePrecision], (-x)], $MachinePrecision]}, If[LessEqual[x, 1.7], N[Min[N[Min[N[Min[N[Min[t$95$1, N[(y - 1.55), $MachinePrecision]], $MachinePrecision], N[Max[N[Max[t$95$0, -0.55], $MachinePrecision], N[(0.45 - x), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], t$95$2], $MachinePrecision], N[Max[N[Max[N[Max[N[Max[N[Max[N[(y - 0.55), $MachinePrecision], -0.55], $MachinePrecision], (-x)], $MachinePrecision], N[(0.275 - y), $MachinePrecision]], $MachinePrecision], N[(0.725 - y), $MachinePrecision]], $MachinePrecision], N[(y - 0.825), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], N[Min[N[Min[N[Min[N[Min[t$95$1, N[(N[(N[(x - 0.775), $MachinePrecision] - 0.7), $MachinePrecision] - 0.075), $MachinePrecision]], $MachinePrecision], N[Max[N[Max[t$95$0, N[(x - 0.55), $MachinePrecision]], $MachinePrecision], N[(0.45 - x), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], t$95$2], $MachinePrecision], N[Max[N[Max[N[Max[N[Max[N[Max[N[(y - 0.55), $MachinePrecision], N[(x - 0.55), $MachinePrecision]], $MachinePrecision], (-x)], $MachinePrecision], 0.275], $MachinePrecision], N[(0.175 - N[(y - 0.55), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[(y - 0.55), $MachinePrecision] - 0.275), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \mathsf{max}\left(y, y - 0.275\right)\\
t_1 := \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right)\\
t_2 := \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\\
\mathbf{if}\;x \leq 1.7:\\
\;\;\;\;\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(t\_1, y - 1.55\right), \mathsf{max}\left(\mathsf{max}\left(t\_0, -0.55\right), 0.45 - x\right)\right), t\_2\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, -0.55\right), -x\right), 0.275 - y\right), 0.725 - y\right), y - 0.825\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(t\_1, \left(\left(x - 0.775\right) - 0.7\right) - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(t\_0, x - 0.55\right), 0.45 - x\right)\right), t\_2\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275\right), 0.175 - \left(y - 0.55\right)\right), \left(y - 0.55\right) - 0.275\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 1.69999999999999996

    1. Initial program 100.0%

      \[\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, -y\right), x - 0.825\right), 0.725 - x\right), \sqrt{{\left(y - 0.7\right)}^{2} + {\left(x - 0.775\right)}^{2}} - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 1\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \sqrt{{\left(y - 0.275\right)}^{2} + {\left(x - 0.275\right)}^{2}}\right), \sqrt{{\left(y - 0.275\right)}^{2} + {\left(x - 0.275\right)}^{2}} - 0.275\right)\right) \]
    2. Applied rewrites38.1%

      \[\leadsto \color{blue}{\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), \left(\left(x - 0.775\right) - \left(0.7 - y\right)\right) - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right)\right), \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right) - 0.275\right)\right)} \]
    3. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, y\right), x - \frac{33}{40}\right), \frac{29}{40} - x\right), \left(x + y\right) - \frac{31}{20}\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - \frac{11}{40}\right), x - \frac{11}{20}\right), \frac{9}{20} - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - \frac{1}{10}\right), \mathsf{neg}\left(x\right)\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, x - \frac{11}{20}\right), \mathsf{neg}\left(x\right)\right), \frac{11}{40} - y\right), \frac{29}{40} - \left(x + y\right)\right), \left(x + y\right) - \frac{33}{40}\right)\right)} \]
    4. Applied rewrites38.1%

      \[\leadsto \color{blue}{\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), \left(x + y\right) - 1.55\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.725 - \left(x + y\right)\right), \left(x + y\right) - 0.825\right)\right)} \]
    5. Taylor expanded in x around 0

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, y\right), x - \frac{33}{40}\right), \frac{29}{40} - x\right), y - \frac{31}{20}\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - \frac{11}{40}\right), x - \frac{11}{20}\right), \frac{9}{20} - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - \frac{1}{10}\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, x - \frac{11}{20}\right), -\color{blue}{x}\right), \frac{11}{40} - y\right), \frac{29}{40} - \left(x + y\right)\right), \left(x + y\right) - \frac{33}{40}\right)\right) \]
    6. Applied rewrites20.3%

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), y - 1.55\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -\color{blue}{x}\right), 0.275 - y\right), 0.725 - \left(x + y\right)\right), \left(x + y\right) - 0.825\right)\right) \]
    7. Taylor expanded in x around 0

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, y\right), x - \frac{33}{40}\right), \frac{29}{40} - x\right), y - \frac{31}{20}\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - \frac{11}{40}\right), x - \frac{11}{20}\right), \frac{9}{20} - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - \frac{1}{10}\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, x - \frac{11}{20}\right), -x\right), \frac{11}{40} - y\right), \frac{29}{40} - y\right), \left(x + y\right) - \frac{33}{40}\right)\right) \]
    8. Applied rewrites20.3%

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), y - 1.55\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.725 - y\right), \left(x + y\right) - 0.825\right)\right) \]
    9. Taylor expanded in x around 0

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, y\right), x - \frac{33}{40}\right), \frac{29}{40} - x\right), y - \frac{31}{20}\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - \frac{11}{40}\right), x - \frac{11}{20}\right), \frac{9}{20} - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - \frac{1}{10}\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, x - \frac{11}{20}\right), -x\right), \frac{11}{40} - y\right), \frac{29}{40} - y\right), y - \frac{33}{40}\right)\right) \]
    10. Applied rewrites20.3%

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), y - 1.55\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.725 - y\right), y - 0.825\right)\right) \]
    11. Taylor expanded in x around 0

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, y\right), x - \frac{33}{40}\right), \frac{29}{40} - x\right), y - \frac{31}{20}\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - \frac{11}{40}\right), \frac{-11}{20}\right), \frac{9}{20} - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - \frac{1}{10}\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, x - \frac{11}{20}\right), -x\right), \frac{11}{40} - y\right), \frac{29}{40} - y\right), y - \frac{33}{40}\right)\right) \]
    12. Applied rewrites20.3%

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), y - 1.55\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), -0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.725 - y\right), y - 0.825\right)\right) \]
    13. Taylor expanded in x around 0

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, y\right), x - \frac{33}{40}\right), \frac{29}{40} - x\right), y - \frac{31}{20}\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - \frac{11}{40}\right), \frac{-11}{20}\right), \frac{9}{20} - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - \frac{1}{10}\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, \frac{-11}{20}\right), -x\right), \frac{11}{40} - y\right), \frac{29}{40} - y\right), y - \frac{33}{40}\right)\right) \]
    14. Applied rewrites20.3%

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), y - 1.55\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), -0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, -0.55\right), -x\right), 0.275 - y\right), 0.725 - y\right), y - 0.825\right)\right) \]

    if 1.69999999999999996 < x

    1. Initial program 100.0%

      \[\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, -y\right), x - 0.825\right), 0.725 - x\right), \sqrt{{\left(y - 0.7\right)}^{2} + {\left(x - 0.775\right)}^{2}} - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 1\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \sqrt{{\left(y - 0.275\right)}^{2} + {\left(x - 0.275\right)}^{2}}\right), \sqrt{{\left(y - 0.275\right)}^{2} + {\left(x - 0.275\right)}^{2}} - 0.275\right)\right) \]
    2. Applied rewrites38.1%

      \[\leadsto \color{blue}{\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), \left(\left(x - 0.775\right) - \left(0.7 - y\right)\right) - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right)\right), \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right) - 0.275\right)\right)} \]
    3. Taylor expanded in y around 0

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, y\right), x - \frac{33}{40}\right), \frac{29}{40} - x\right), \left(\left(x - \frac{31}{40}\right) - \color{blue}{\frac{7}{10}}\right) - \frac{3}{40}\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - \frac{11}{40}\right), x - \frac{11}{20}\right), \frac{9}{20} - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - \frac{1}{10}\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, x - \frac{11}{20}\right), -x\right), \frac{11}{40} - y\right), \frac{7}{40} - \left(\left(x - \frac{11}{40}\right) - \left(\frac{11}{40} - y\right)\right)\right), \left(\left(x - \frac{11}{40}\right) - \left(\frac{11}{40} - y\right)\right) - \frac{11}{40}\right)\right) \]
    4. Applied rewrites20.1%

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), \left(\left(x - 0.775\right) - \color{blue}{0.7}\right) - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right)\right), \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right) - 0.275\right)\right) \]
    5. Taylor expanded in x around 0

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, y\right), x - \frac{33}{40}\right), \frac{29}{40} - x\right), \left(\left(x - \frac{31}{40}\right) - \frac{7}{10}\right) - \frac{3}{40}\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - \frac{11}{40}\right), x - \frac{11}{20}\right), \frac{9}{20} - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - \frac{1}{10}\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, x - \frac{11}{20}\right), -x\right), \frac{11}{40} - y\right), \frac{7}{40} - \color{blue}{\left(y - \frac{11}{20}\right)}\right), \left(\left(x - \frac{11}{40}\right) - \left(\frac{11}{40} - y\right)\right) - \frac{11}{40}\right)\right) \]
    6. Applied rewrites20.1%

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), \left(\left(x - 0.775\right) - 0.7\right) - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \color{blue}{\left(y - 0.55\right)}\right), \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right) - 0.275\right)\right) \]
    7. Taylor expanded in x around 0

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, y\right), x - \frac{33}{40}\right), \frac{29}{40} - x\right), \left(\left(x - \frac{31}{40}\right) - \frac{7}{10}\right) - \frac{3}{40}\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - \frac{11}{40}\right), x - \frac{11}{20}\right), \frac{9}{20} - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - \frac{1}{10}\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, x - \frac{11}{20}\right), -x\right), \frac{11}{40} - y\right), \frac{7}{40} - \left(y - \frac{11}{20}\right)\right), \color{blue}{\left(y - \frac{11}{20}\right)} - \frac{11}{40}\right)\right) \]
    8. Applied rewrites20.1%

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), \left(\left(x - 0.775\right) - 0.7\right) - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \left(y - 0.55\right)\right), \color{blue}{\left(y - 0.55\right)} - 0.275\right)\right) \]
    9. Taylor expanded in y around 0

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, y\right), x - \frac{33}{40}\right), \frac{29}{40} - x\right), \left(\left(x - \frac{31}{40}\right) - \frac{7}{10}\right) - \frac{3}{40}\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - \frac{11}{40}\right), x - \frac{11}{20}\right), \frac{9}{20} - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - \frac{1}{10}\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, x - \frac{11}{20}\right), -x\right), \color{blue}{\frac{11}{40}}\right), \frac{7}{40} - \left(y - \frac{11}{20}\right)\right), \left(y - \frac{11}{20}\right) - \frac{11}{40}\right)\right) \]
    10. Applied rewrites20.1%

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), \left(\left(x - 0.775\right) - 0.7\right) - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), \color{blue}{0.275}\right), 0.175 - \left(y - 0.55\right)\right), \left(y - 0.55\right) - 0.275\right)\right) \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 12: 35.8% accurate, 2.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{max}\left(y, y - 0.275\right)\\ t_1 := \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right)\\ t_2 := \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\\ \mathbf{if}\;x \leq 1.7:\\ \;\;\;\;\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(t\_1, y - 1.55\right), \mathsf{max}\left(\mathsf{max}\left(t\_0, -0.55\right), 0.45 - x\right)\right), t\_2\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, -0.55\right), -x\right), 0.275 - y\right), 0.725 - y\right), y - 0.825\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(t\_1, x - 1.55\right), \mathsf{max}\left(\mathsf{max}\left(t\_0, x - 0.55\right), 0.45 - x\right)\right), t\_2\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.725 - y\right), y - 0.825\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (fmax y (- y 0.275)))
        (t_1 (fmax (fmax (fmax (- y 0.55) y) (- x 0.825)) (- 0.725 x)))
        (t_2 (fmax (fmax (fmax y (- y 2.0)) (- x 0.1)) (- x))))
   (if (<= x 1.7)
     (fmin
      (fmin
       (fmin (fmin t_1 (- y 1.55)) (fmax (fmax t_0 -0.55) (- 0.45 x)))
       t_2)
      (fmax
       (fmax
        (fmax (fmax (fmax (- y 0.55) -0.55) (- x)) (- 0.275 y))
        (- 0.725 y))
       (- y 0.825)))
     (fmin
      (fmin
       (fmin (fmin t_1 (- x 1.55)) (fmax (fmax t_0 (- x 0.55)) (- 0.45 x)))
       t_2)
      (fmax
       (fmax
        (fmax (fmax (fmax (- y 0.55) (- x 0.55)) (- x)) (- 0.275 y))
        (- 0.725 y))
       (- y 0.825))))))
double code(double x, double y) {
	double t_0 = fmax(y, (y - 0.275));
	double t_1 = fmax(fmax(fmax((y - 0.55), y), (x - 0.825)), (0.725 - x));
	double t_2 = fmax(fmax(fmax(y, (y - 2.0)), (x - 0.1)), -x);
	double tmp;
	if (x <= 1.7) {
		tmp = fmin(fmin(fmin(fmin(t_1, (y - 1.55)), fmax(fmax(t_0, -0.55), (0.45 - x))), t_2), fmax(fmax(fmax(fmax(fmax((y - 0.55), -0.55), -x), (0.275 - y)), (0.725 - y)), (y - 0.825)));
	} else {
		tmp = fmin(fmin(fmin(fmin(t_1, (x - 1.55)), fmax(fmax(t_0, (x - 0.55)), (0.45 - x))), t_2), fmax(fmax(fmax(fmax(fmax((y - 0.55), (x - 0.55)), -x), (0.275 - y)), (0.725 - y)), (y - 0.825)));
	}
	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)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_0 = fmax(y, (y - 0.275d0))
    t_1 = fmax(fmax(fmax((y - 0.55d0), y), (x - 0.825d0)), (0.725d0 - x))
    t_2 = fmax(fmax(fmax(y, (y - 2.0d0)), (x - 0.1d0)), -x)
    if (x <= 1.7d0) then
        tmp = fmin(fmin(fmin(fmin(t_1, (y - 1.55d0)), fmax(fmax(t_0, (-0.55d0)), (0.45d0 - x))), t_2), fmax(fmax(fmax(fmax(fmax((y - 0.55d0), (-0.55d0)), -x), (0.275d0 - y)), (0.725d0 - y)), (y - 0.825d0)))
    else
        tmp = fmin(fmin(fmin(fmin(t_1, (x - 1.55d0)), fmax(fmax(t_0, (x - 0.55d0)), (0.45d0 - x))), t_2), fmax(fmax(fmax(fmax(fmax((y - 0.55d0), (x - 0.55d0)), -x), (0.275d0 - y)), (0.725d0 - y)), (y - 0.825d0)))
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = fmax(y, (y - 0.275));
	double t_1 = fmax(fmax(fmax((y - 0.55), y), (x - 0.825)), (0.725 - x));
	double t_2 = fmax(fmax(fmax(y, (y - 2.0)), (x - 0.1)), -x);
	double tmp;
	if (x <= 1.7) {
		tmp = fmin(fmin(fmin(fmin(t_1, (y - 1.55)), fmax(fmax(t_0, -0.55), (0.45 - x))), t_2), fmax(fmax(fmax(fmax(fmax((y - 0.55), -0.55), -x), (0.275 - y)), (0.725 - y)), (y - 0.825)));
	} else {
		tmp = fmin(fmin(fmin(fmin(t_1, (x - 1.55)), fmax(fmax(t_0, (x - 0.55)), (0.45 - x))), t_2), fmax(fmax(fmax(fmax(fmax((y - 0.55), (x - 0.55)), -x), (0.275 - y)), (0.725 - y)), (y - 0.825)));
	}
	return tmp;
}
def code(x, y):
	t_0 = fmax(y, (y - 0.275))
	t_1 = fmax(fmax(fmax((y - 0.55), y), (x - 0.825)), (0.725 - x))
	t_2 = fmax(fmax(fmax(y, (y - 2.0)), (x - 0.1)), -x)
	tmp = 0
	if x <= 1.7:
		tmp = fmin(fmin(fmin(fmin(t_1, (y - 1.55)), fmax(fmax(t_0, -0.55), (0.45 - x))), t_2), fmax(fmax(fmax(fmax(fmax((y - 0.55), -0.55), -x), (0.275 - y)), (0.725 - y)), (y - 0.825)))
	else:
		tmp = fmin(fmin(fmin(fmin(t_1, (x - 1.55)), fmax(fmax(t_0, (x - 0.55)), (0.45 - x))), t_2), fmax(fmax(fmax(fmax(fmax((y - 0.55), (x - 0.55)), -x), (0.275 - y)), (0.725 - y)), (y - 0.825)))
	return tmp
function code(x, y)
	t_0 = fmax(y, Float64(y - 0.275))
	t_1 = fmax(fmax(fmax(Float64(y - 0.55), y), Float64(x - 0.825)), Float64(0.725 - x))
	t_2 = fmax(fmax(fmax(y, Float64(y - 2.0)), Float64(x - 0.1)), Float64(-x))
	tmp = 0.0
	if (x <= 1.7)
		tmp = fmin(fmin(fmin(fmin(t_1, Float64(y - 1.55)), fmax(fmax(t_0, -0.55), Float64(0.45 - x))), t_2), fmax(fmax(fmax(fmax(fmax(Float64(y - 0.55), -0.55), Float64(-x)), Float64(0.275 - y)), Float64(0.725 - y)), Float64(y - 0.825)));
	else
		tmp = fmin(fmin(fmin(fmin(t_1, Float64(x - 1.55)), fmax(fmax(t_0, Float64(x - 0.55)), Float64(0.45 - x))), t_2), fmax(fmax(fmax(fmax(fmax(Float64(y - 0.55), Float64(x - 0.55)), Float64(-x)), Float64(0.275 - y)), Float64(0.725 - y)), Float64(y - 0.825)));
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = max(y, (y - 0.275));
	t_1 = max(max(max((y - 0.55), y), (x - 0.825)), (0.725 - x));
	t_2 = max(max(max(y, (y - 2.0)), (x - 0.1)), -x);
	tmp = 0.0;
	if (x <= 1.7)
		tmp = min(min(min(min(t_1, (y - 1.55)), max(max(t_0, -0.55), (0.45 - x))), t_2), max(max(max(max(max((y - 0.55), -0.55), -x), (0.275 - y)), (0.725 - y)), (y - 0.825)));
	else
		tmp = min(min(min(min(t_1, (x - 1.55)), max(max(t_0, (x - 0.55)), (0.45 - x))), t_2), max(max(max(max(max((y - 0.55), (x - 0.55)), -x), (0.275 - y)), (0.725 - y)), (y - 0.825)));
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[Max[y, N[(y - 0.275), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Max[N[Max[N[Max[N[(y - 0.55), $MachinePrecision], y], $MachinePrecision], N[(x - 0.825), $MachinePrecision]], $MachinePrecision], N[(0.725 - x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Max[N[Max[N[Max[y, N[(y - 2.0), $MachinePrecision]], $MachinePrecision], N[(x - 0.1), $MachinePrecision]], $MachinePrecision], (-x)], $MachinePrecision]}, If[LessEqual[x, 1.7], N[Min[N[Min[N[Min[N[Min[t$95$1, N[(y - 1.55), $MachinePrecision]], $MachinePrecision], N[Max[N[Max[t$95$0, -0.55], $MachinePrecision], N[(0.45 - x), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], t$95$2], $MachinePrecision], N[Max[N[Max[N[Max[N[Max[N[Max[N[(y - 0.55), $MachinePrecision], -0.55], $MachinePrecision], (-x)], $MachinePrecision], N[(0.275 - y), $MachinePrecision]], $MachinePrecision], N[(0.725 - y), $MachinePrecision]], $MachinePrecision], N[(y - 0.825), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], N[Min[N[Min[N[Min[N[Min[t$95$1, N[(x - 1.55), $MachinePrecision]], $MachinePrecision], N[Max[N[Max[t$95$0, N[(x - 0.55), $MachinePrecision]], $MachinePrecision], N[(0.45 - x), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], t$95$2], $MachinePrecision], N[Max[N[Max[N[Max[N[Max[N[Max[N[(y - 0.55), $MachinePrecision], N[(x - 0.55), $MachinePrecision]], $MachinePrecision], (-x)], $MachinePrecision], N[(0.275 - y), $MachinePrecision]], $MachinePrecision], N[(0.725 - y), $MachinePrecision]], $MachinePrecision], N[(y - 0.825), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \mathsf{max}\left(y, y - 0.275\right)\\
t_1 := \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right)\\
t_2 := \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\\
\mathbf{if}\;x \leq 1.7:\\
\;\;\;\;\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(t\_1, y - 1.55\right), \mathsf{max}\left(\mathsf{max}\left(t\_0, -0.55\right), 0.45 - x\right)\right), t\_2\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, -0.55\right), -x\right), 0.275 - y\right), 0.725 - y\right), y - 0.825\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(t\_1, x - 1.55\right), \mathsf{max}\left(\mathsf{max}\left(t\_0, x - 0.55\right), 0.45 - x\right)\right), t\_2\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.725 - y\right), y - 0.825\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 1.69999999999999996

    1. Initial program 100.0%

      \[\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, -y\right), x - 0.825\right), 0.725 - x\right), \sqrt{{\left(y - 0.7\right)}^{2} + {\left(x - 0.775\right)}^{2}} - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 1\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \sqrt{{\left(y - 0.275\right)}^{2} + {\left(x - 0.275\right)}^{2}}\right), \sqrt{{\left(y - 0.275\right)}^{2} + {\left(x - 0.275\right)}^{2}} - 0.275\right)\right) \]
    2. Applied rewrites38.1%

      \[\leadsto \color{blue}{\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), \left(\left(x - 0.775\right) - \left(0.7 - y\right)\right) - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right)\right), \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right) - 0.275\right)\right)} \]
    3. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, y\right), x - \frac{33}{40}\right), \frac{29}{40} - x\right), \left(x + y\right) - \frac{31}{20}\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - \frac{11}{40}\right), x - \frac{11}{20}\right), \frac{9}{20} - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - \frac{1}{10}\right), \mathsf{neg}\left(x\right)\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, x - \frac{11}{20}\right), \mathsf{neg}\left(x\right)\right), \frac{11}{40} - y\right), \frac{29}{40} - \left(x + y\right)\right), \left(x + y\right) - \frac{33}{40}\right)\right)} \]
    4. Applied rewrites38.1%

      \[\leadsto \color{blue}{\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), \left(x + y\right) - 1.55\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.725 - \left(x + y\right)\right), \left(x + y\right) - 0.825\right)\right)} \]
    5. Taylor expanded in x around 0

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, y\right), x - \frac{33}{40}\right), \frac{29}{40} - x\right), y - \frac{31}{20}\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - \frac{11}{40}\right), x - \frac{11}{20}\right), \frac{9}{20} - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - \frac{1}{10}\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, x - \frac{11}{20}\right), -\color{blue}{x}\right), \frac{11}{40} - y\right), \frac{29}{40} - \left(x + y\right)\right), \left(x + y\right) - \frac{33}{40}\right)\right) \]
    6. Applied rewrites20.3%

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), y - 1.55\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -\color{blue}{x}\right), 0.275 - y\right), 0.725 - \left(x + y\right)\right), \left(x + y\right) - 0.825\right)\right) \]
    7. Taylor expanded in x around 0

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, y\right), x - \frac{33}{40}\right), \frac{29}{40} - x\right), y - \frac{31}{20}\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - \frac{11}{40}\right), x - \frac{11}{20}\right), \frac{9}{20} - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - \frac{1}{10}\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, x - \frac{11}{20}\right), -x\right), \frac{11}{40} - y\right), \frac{29}{40} - y\right), \left(x + y\right) - \frac{33}{40}\right)\right) \]
    8. Applied rewrites20.3%

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), y - 1.55\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.725 - y\right), \left(x + y\right) - 0.825\right)\right) \]
    9. Taylor expanded in x around 0

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, y\right), x - \frac{33}{40}\right), \frac{29}{40} - x\right), y - \frac{31}{20}\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - \frac{11}{40}\right), x - \frac{11}{20}\right), \frac{9}{20} - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - \frac{1}{10}\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, x - \frac{11}{20}\right), -x\right), \frac{11}{40} - y\right), \frac{29}{40} - y\right), y - \frac{33}{40}\right)\right) \]
    10. Applied rewrites20.3%

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), y - 1.55\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.725 - y\right), y - 0.825\right)\right) \]
    11. Taylor expanded in x around 0

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, y\right), x - \frac{33}{40}\right), \frac{29}{40} - x\right), y - \frac{31}{20}\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - \frac{11}{40}\right), \frac{-11}{20}\right), \frac{9}{20} - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - \frac{1}{10}\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, x - \frac{11}{20}\right), -x\right), \frac{11}{40} - y\right), \frac{29}{40} - y\right), y - \frac{33}{40}\right)\right) \]
    12. Applied rewrites20.3%

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), y - 1.55\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), -0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.725 - y\right), y - 0.825\right)\right) \]
    13. Taylor expanded in x around 0

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, y\right), x - \frac{33}{40}\right), \frac{29}{40} - x\right), y - \frac{31}{20}\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - \frac{11}{40}\right), \frac{-11}{20}\right), \frac{9}{20} - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - \frac{1}{10}\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, \frac{-11}{20}\right), -x\right), \frac{11}{40} - y\right), \frac{29}{40} - y\right), y - \frac{33}{40}\right)\right) \]
    14. Applied rewrites20.3%

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), y - 1.55\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), -0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, -0.55\right), -x\right), 0.275 - y\right), 0.725 - y\right), y - 0.825\right)\right) \]

    if 1.69999999999999996 < x

    1. Initial program 100.0%

      \[\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, -y\right), x - 0.825\right), 0.725 - x\right), \sqrt{{\left(y - 0.7\right)}^{2} + {\left(x - 0.775\right)}^{2}} - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 1\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \sqrt{{\left(y - 0.275\right)}^{2} + {\left(x - 0.275\right)}^{2}}\right), \sqrt{{\left(y - 0.275\right)}^{2} + {\left(x - 0.275\right)}^{2}} - 0.275\right)\right) \]
    2. Applied rewrites38.1%

      \[\leadsto \color{blue}{\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), \left(\left(x - 0.775\right) - \left(0.7 - y\right)\right) - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right)\right), \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right) - 0.275\right)\right)} \]
    3. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, y\right), x - \frac{33}{40}\right), \frac{29}{40} - x\right), \left(x + y\right) - \frac{31}{20}\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - \frac{11}{40}\right), x - \frac{11}{20}\right), \frac{9}{20} - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - \frac{1}{10}\right), \mathsf{neg}\left(x\right)\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, x - \frac{11}{20}\right), \mathsf{neg}\left(x\right)\right), \frac{11}{40} - y\right), \frac{29}{40} - \left(x + y\right)\right), \left(x + y\right) - \frac{33}{40}\right)\right)} \]
    4. Applied rewrites38.1%

      \[\leadsto \color{blue}{\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), \left(x + y\right) - 1.55\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.725 - \left(x + y\right)\right), \left(x + y\right) - 0.825\right)\right)} \]
    5. Taylor expanded in x around 0

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, y\right), x - \frac{33}{40}\right), \frac{29}{40} - x\right), y - \frac{31}{20}\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - \frac{11}{40}\right), x - \frac{11}{20}\right), \frac{9}{20} - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - \frac{1}{10}\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, x - \frac{11}{20}\right), -\color{blue}{x}\right), \frac{11}{40} - y\right), \frac{29}{40} - \left(x + y\right)\right), \left(x + y\right) - \frac{33}{40}\right)\right) \]
    6. Applied rewrites20.3%

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), y - 1.55\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -\color{blue}{x}\right), 0.275 - y\right), 0.725 - \left(x + y\right)\right), \left(x + y\right) - 0.825\right)\right) \]
    7. Taylor expanded in x around 0

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, y\right), x - \frac{33}{40}\right), \frac{29}{40} - x\right), y - \frac{31}{20}\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - \frac{11}{40}\right), x - \frac{11}{20}\right), \frac{9}{20} - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - \frac{1}{10}\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, x - \frac{11}{20}\right), -x\right), \frac{11}{40} - y\right), \frac{29}{40} - y\right), \left(x + y\right) - \frac{33}{40}\right)\right) \]
    8. Applied rewrites20.3%

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), y - 1.55\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.725 - y\right), \left(x + y\right) - 0.825\right)\right) \]
    9. Taylor expanded in x around 0

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, y\right), x - \frac{33}{40}\right), \frac{29}{40} - x\right), y - \frac{31}{20}\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - \frac{11}{40}\right), x - \frac{11}{20}\right), \frac{9}{20} - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - \frac{1}{10}\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, x - \frac{11}{20}\right), -x\right), \frac{11}{40} - y\right), \frac{29}{40} - y\right), y - \frac{33}{40}\right)\right) \]
    10. Applied rewrites20.3%

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), y - 1.55\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.725 - y\right), y - 0.825\right)\right) \]
    11. Taylor expanded in y around 0

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, y\right), x - \frac{33}{40}\right), \frac{29}{40} - x\right), x - \frac{31}{20}\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - \frac{11}{40}\right), x - \frac{11}{20}\right), \frac{9}{20} - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - \frac{1}{10}\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, x - \frac{11}{20}\right), \color{blue}{-x}\right), \frac{11}{40} - y\right), \frac{29}{40} - y\right), y - \frac{33}{40}\right)\right) \]
    12. Applied rewrites20.1%

      \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), x - 1.55\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), \color{blue}{-x}\right), 0.275 - y\right), 0.725 - y\right), y - 0.825\right)\right) \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 13: 20.3% accurate, 2.5× speedup?

\[\begin{array}{l} \\ \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), y - 1.55\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), -0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, -0.55\right), -x\right), 0.275 - y\right), 0.725 - y\right), y - 0.825\right)\right) \end{array} \]
(FPCore (x y)
 :precision binary64
 (fmin
  (fmin
   (fmin
    (fmin (fmax (fmax (fmax (- y 0.55) y) (- x 0.825)) (- 0.725 x)) (- y 1.55))
    (fmax (fmax (fmax y (- y 0.275)) -0.55) (- 0.45 x)))
   (fmax (fmax (fmax y (- y 2.0)) (- x 0.1)) (- x)))
  (fmax
   (fmax (fmax (fmax (fmax (- y 0.55) -0.55) (- x)) (- 0.275 y)) (- 0.725 y))
   (- y 0.825))))
double code(double x, double y) {
	return fmin(fmin(fmin(fmin(fmax(fmax(fmax((y - 0.55), y), (x - 0.825)), (0.725 - x)), (y - 1.55)), fmax(fmax(fmax(y, (y - 0.275)), -0.55), (0.45 - x))), fmax(fmax(fmax(y, (y - 2.0)), (x - 0.1)), -x)), fmax(fmax(fmax(fmax(fmax((y - 0.55), -0.55), -x), (0.275 - y)), (0.725 - y)), (y - 0.825)));
}
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)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = fmin(fmin(fmin(fmin(fmax(fmax(fmax((y - 0.55d0), y), (x - 0.825d0)), (0.725d0 - x)), (y - 1.55d0)), fmax(fmax(fmax(y, (y - 0.275d0)), (-0.55d0)), (0.45d0 - x))), fmax(fmax(fmax(y, (y - 2.0d0)), (x - 0.1d0)), -x)), fmax(fmax(fmax(fmax(fmax((y - 0.55d0), (-0.55d0)), -x), (0.275d0 - y)), (0.725d0 - y)), (y - 0.825d0)))
end function
public static double code(double x, double y) {
	return fmin(fmin(fmin(fmin(fmax(fmax(fmax((y - 0.55), y), (x - 0.825)), (0.725 - x)), (y - 1.55)), fmax(fmax(fmax(y, (y - 0.275)), -0.55), (0.45 - x))), fmax(fmax(fmax(y, (y - 2.0)), (x - 0.1)), -x)), fmax(fmax(fmax(fmax(fmax((y - 0.55), -0.55), -x), (0.275 - y)), (0.725 - y)), (y - 0.825)));
}
def code(x, y):
	return fmin(fmin(fmin(fmin(fmax(fmax(fmax((y - 0.55), y), (x - 0.825)), (0.725 - x)), (y - 1.55)), fmax(fmax(fmax(y, (y - 0.275)), -0.55), (0.45 - x))), fmax(fmax(fmax(y, (y - 2.0)), (x - 0.1)), -x)), fmax(fmax(fmax(fmax(fmax((y - 0.55), -0.55), -x), (0.275 - y)), (0.725 - y)), (y - 0.825)))
function code(x, y)
	return fmin(fmin(fmin(fmin(fmax(fmax(fmax(Float64(y - 0.55), y), Float64(x - 0.825)), Float64(0.725 - x)), Float64(y - 1.55)), fmax(fmax(fmax(y, Float64(y - 0.275)), -0.55), Float64(0.45 - x))), fmax(fmax(fmax(y, Float64(y - 2.0)), Float64(x - 0.1)), Float64(-x))), fmax(fmax(fmax(fmax(fmax(Float64(y - 0.55), -0.55), Float64(-x)), Float64(0.275 - y)), Float64(0.725 - y)), Float64(y - 0.825)))
end
function tmp = code(x, y)
	tmp = min(min(min(min(max(max(max((y - 0.55), y), (x - 0.825)), (0.725 - x)), (y - 1.55)), max(max(max(y, (y - 0.275)), -0.55), (0.45 - x))), max(max(max(y, (y - 2.0)), (x - 0.1)), -x)), max(max(max(max(max((y - 0.55), -0.55), -x), (0.275 - y)), (0.725 - y)), (y - 0.825)));
end
code[x_, y_] := N[Min[N[Min[N[Min[N[Min[N[Max[N[Max[N[Max[N[(y - 0.55), $MachinePrecision], y], $MachinePrecision], N[(x - 0.825), $MachinePrecision]], $MachinePrecision], N[(0.725 - x), $MachinePrecision]], $MachinePrecision], N[(y - 1.55), $MachinePrecision]], $MachinePrecision], N[Max[N[Max[N[Max[y, N[(y - 0.275), $MachinePrecision]], $MachinePrecision], -0.55], $MachinePrecision], N[(0.45 - x), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], N[Max[N[Max[N[Max[y, N[(y - 2.0), $MachinePrecision]], $MachinePrecision], N[(x - 0.1), $MachinePrecision]], $MachinePrecision], (-x)], $MachinePrecision]], $MachinePrecision], N[Max[N[Max[N[Max[N[Max[N[Max[N[(y - 0.55), $MachinePrecision], -0.55], $MachinePrecision], (-x)], $MachinePrecision], N[(0.275 - y), $MachinePrecision]], $MachinePrecision], N[(0.725 - y), $MachinePrecision]], $MachinePrecision], N[(y - 0.825), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), y - 1.55\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), -0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, -0.55\right), -x\right), 0.275 - y\right), 0.725 - y\right), y - 0.825\right)\right)
\end{array}
Derivation
  1. Initial program 100.0%

    \[\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, -y\right), x - 0.825\right), 0.725 - x\right), \sqrt{{\left(y - 0.7\right)}^{2} + {\left(x - 0.775\right)}^{2}} - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(-y, y - 1\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \sqrt{{\left(y - 0.275\right)}^{2} + {\left(x - 0.275\right)}^{2}}\right), \sqrt{{\left(y - 0.275\right)}^{2} + {\left(x - 0.275\right)}^{2}} - 0.275\right)\right) \]
  2. Applied rewrites38.1%

    \[\leadsto \color{blue}{\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), \left(\left(x - 0.775\right) - \left(0.7 - y\right)\right) - 0.075\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.175 - \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right)\right), \left(\left(x - 0.275\right) - \left(0.275 - y\right)\right) - 0.275\right)\right)} \]
  3. Taylor expanded in x around 0

    \[\leadsto \color{blue}{\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, y\right), x - \frac{33}{40}\right), \frac{29}{40} - x\right), \left(x + y\right) - \frac{31}{20}\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - \frac{11}{40}\right), x - \frac{11}{20}\right), \frac{9}{20} - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - \frac{1}{10}\right), \mathsf{neg}\left(x\right)\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, x - \frac{11}{20}\right), \mathsf{neg}\left(x\right)\right), \frac{11}{40} - y\right), \frac{29}{40} - \left(x + y\right)\right), \left(x + y\right) - \frac{33}{40}\right)\right)} \]
  4. Applied rewrites38.1%

    \[\leadsto \color{blue}{\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), \left(x + y\right) - 1.55\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.725 - \left(x + y\right)\right), \left(x + y\right) - 0.825\right)\right)} \]
  5. Taylor expanded in x around 0

    \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, y\right), x - \frac{33}{40}\right), \frac{29}{40} - x\right), y - \frac{31}{20}\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - \frac{11}{40}\right), x - \frac{11}{20}\right), \frac{9}{20} - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - \frac{1}{10}\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, x - \frac{11}{20}\right), -\color{blue}{x}\right), \frac{11}{40} - y\right), \frac{29}{40} - \left(x + y\right)\right), \left(x + y\right) - \frac{33}{40}\right)\right) \]
  6. Applied rewrites20.3%

    \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), y - 1.55\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -\color{blue}{x}\right), 0.275 - y\right), 0.725 - \left(x + y\right)\right), \left(x + y\right) - 0.825\right)\right) \]
  7. Taylor expanded in x around 0

    \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, y\right), x - \frac{33}{40}\right), \frac{29}{40} - x\right), y - \frac{31}{20}\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - \frac{11}{40}\right), x - \frac{11}{20}\right), \frac{9}{20} - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - \frac{1}{10}\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, x - \frac{11}{20}\right), -x\right), \frac{11}{40} - y\right), \frac{29}{40} - y\right), \left(x + y\right) - \frac{33}{40}\right)\right) \]
  8. Applied rewrites20.3%

    \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), y - 1.55\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.725 - y\right), \left(x + y\right) - 0.825\right)\right) \]
  9. Taylor expanded in x around 0

    \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, y\right), x - \frac{33}{40}\right), \frac{29}{40} - x\right), y - \frac{31}{20}\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - \frac{11}{40}\right), x - \frac{11}{20}\right), \frac{9}{20} - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - \frac{1}{10}\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, x - \frac{11}{20}\right), -x\right), \frac{11}{40} - y\right), \frac{29}{40} - y\right), y - \frac{33}{40}\right)\right) \]
  10. Applied rewrites20.3%

    \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), y - 1.55\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), x - 0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.725 - y\right), y - 0.825\right)\right) \]
  11. Taylor expanded in x around 0

    \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, y\right), x - \frac{33}{40}\right), \frac{29}{40} - x\right), y - \frac{31}{20}\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - \frac{11}{40}\right), \frac{-11}{20}\right), \frac{9}{20} - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - \frac{1}{10}\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, x - \frac{11}{20}\right), -x\right), \frac{11}{40} - y\right), \frac{29}{40} - y\right), y - \frac{33}{40}\right)\right) \]
  12. Applied rewrites20.3%

    \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), y - 1.55\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), -0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, x - 0.55\right), -x\right), 0.275 - y\right), 0.725 - y\right), y - 0.825\right)\right) \]
  13. Taylor expanded in x around 0

    \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, y\right), x - \frac{33}{40}\right), \frac{29}{40} - x\right), y - \frac{31}{20}\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - \frac{11}{40}\right), \frac{-11}{20}\right), \frac{9}{20} - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - \frac{1}{10}\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - \frac{11}{20}, \frac{-11}{20}\right), -x\right), \frac{11}{40} - y\right), \frac{29}{40} - y\right), y - \frac{33}{40}\right)\right) \]
  14. Applied rewrites20.3%

    \[\leadsto \mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{min}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, y\right), x - 0.825\right), 0.725 - x\right), y - 1.55\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 0.275\right), -0.55\right), 0.45 - x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y, y - 2\right), x - 0.1\right), -x\right)\right), \mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(\mathsf{max}\left(y - 0.55, -0.55\right), -x\right), 0.275 - y\right), 0.725 - y\right), y - 0.825\right)\right) \]
  15. Add Preprocessing

Reproduce

?
herbie shell --seed 2025159 
(FPCore (x y)
  :name "The letters hi in the upper-right quadrant"
  :precision binary64
  (fmin (fmin (fmin (fmin (fmax (fmax (fmax (- y 0.55) (- y)) (- x 0.825)) (- 0.725 x)) (- (sqrt (+ (pow (- y 0.7) 2.0) (pow (- x 0.775) 2.0))) 0.075)) (fmax (fmax (fmax (- y) (- y 0.275)) (- x 0.55)) (- 0.45 x))) (fmax (fmax (fmax (- y) (- y 1.0)) (- x 0.1)) (- x))) (fmax (fmax (fmax (fmax (fmax (- y 0.55) (- x 0.55)) (- x)) (- 0.275 y)) (- 0.175 (sqrt (+ (pow (- y 0.275) 2.0) (pow (- x 0.275) 2.0))))) (- (sqrt (+ (pow (- y 0.275) 2.0) (pow (- x 0.275) 2.0))) 0.275))))