(/ (+ (* (- (* (- (* 1/4 z0) -3333333333333333/10000000000000000) z0) -1/2) (* z0 z0)) z0) (+ (/ z3 (* z4 z4)) (/ z1 (* z2 z2))))

Percentage Accurate: 66.3% → 78.2%
Time: 4.9s
Alternatives: 19
Speedup: 0.9×

Specification

?
\[\frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}} \]
(FPCore (z0 z3 z4 z1 z2)
  :precision binary64
  (/
 (+
  (* (- (* (- (* 0.25 z0) -0.3333333333333333) z0) -0.5) (* z0 z0))
  z0)
 (+ (/ z3 (* z4 z4)) (/ z1 (* z2 z2)))))
double code(double z0, double z3, double z4, double z1, double z2) {
	return ((((((0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * (z0 * z0)) + z0) / ((z3 / (z4 * z4)) + (z1 / (z2 * z2)));
}
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(z0, z3, z4, z1, z2)
use fmin_fmax_functions
    real(8), intent (in) :: z0
    real(8), intent (in) :: z3
    real(8), intent (in) :: z4
    real(8), intent (in) :: z1
    real(8), intent (in) :: z2
    code = ((((((0.25d0 * z0) - (-0.3333333333333333d0)) * z0) - (-0.5d0)) * (z0 * z0)) + z0) / ((z3 / (z4 * z4)) + (z1 / (z2 * z2)))
end function
public static double code(double z0, double z3, double z4, double z1, double z2) {
	return ((((((0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * (z0 * z0)) + z0) / ((z3 / (z4 * z4)) + (z1 / (z2 * z2)));
}
def code(z0, z3, z4, z1, z2):
	return ((((((0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * (z0 * z0)) + z0) / ((z3 / (z4 * z4)) + (z1 / (z2 * z2)))
function code(z0, z3, z4, z1, z2)
	return Float64(Float64(Float64(Float64(Float64(Float64(Float64(0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * Float64(z0 * z0)) + z0) / Float64(Float64(z3 / Float64(z4 * z4)) + Float64(z1 / Float64(z2 * z2))))
end
function tmp = code(z0, z3, z4, z1, z2)
	tmp = ((((((0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * (z0 * z0)) + z0) / ((z3 / (z4 * z4)) + (z1 / (z2 * z2)));
end
code[z0_, z3_, z4_, z1_, z2_] := N[(N[(N[(N[(N[(N[(N[(0.25 * z0), $MachinePrecision] - -0.3333333333333333), $MachinePrecision] * z0), $MachinePrecision] - -0.5), $MachinePrecision] * N[(z0 * z0), $MachinePrecision]), $MachinePrecision] + z0), $MachinePrecision] / N[(N[(z3 / N[(z4 * z4), $MachinePrecision]), $MachinePrecision] + N[(z1 / N[(z2 * z2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}}

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 19 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: 66.3% accurate, 1.0× speedup?

\[\frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}} \]
(FPCore (z0 z3 z4 z1 z2)
  :precision binary64
  (/
 (+
  (* (- (* (- (* 0.25 z0) -0.3333333333333333) z0) -0.5) (* z0 z0))
  z0)
 (+ (/ z3 (* z4 z4)) (/ z1 (* z2 z2)))))
double code(double z0, double z3, double z4, double z1, double z2) {
	return ((((((0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * (z0 * z0)) + z0) / ((z3 / (z4 * z4)) + (z1 / (z2 * z2)));
}
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(z0, z3, z4, z1, z2)
use fmin_fmax_functions
    real(8), intent (in) :: z0
    real(8), intent (in) :: z3
    real(8), intent (in) :: z4
    real(8), intent (in) :: z1
    real(8), intent (in) :: z2
    code = ((((((0.25d0 * z0) - (-0.3333333333333333d0)) * z0) - (-0.5d0)) * (z0 * z0)) + z0) / ((z3 / (z4 * z4)) + (z1 / (z2 * z2)))
end function
public static double code(double z0, double z3, double z4, double z1, double z2) {
	return ((((((0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * (z0 * z0)) + z0) / ((z3 / (z4 * z4)) + (z1 / (z2 * z2)));
}
def code(z0, z3, z4, z1, z2):
	return ((((((0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * (z0 * z0)) + z0) / ((z3 / (z4 * z4)) + (z1 / (z2 * z2)))
function code(z0, z3, z4, z1, z2)
	return Float64(Float64(Float64(Float64(Float64(Float64(Float64(0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * Float64(z0 * z0)) + z0) / Float64(Float64(z3 / Float64(z4 * z4)) + Float64(z1 / Float64(z2 * z2))))
end
function tmp = code(z0, z3, z4, z1, z2)
	tmp = ((((((0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * (z0 * z0)) + z0) / ((z3 / (z4 * z4)) + (z1 / (z2 * z2)));
end
code[z0_, z3_, z4_, z1_, z2_] := N[(N[(N[(N[(N[(N[(N[(0.25 * z0), $MachinePrecision] - -0.3333333333333333), $MachinePrecision] * z0), $MachinePrecision] - -0.5), $MachinePrecision] * N[(z0 * z0), $MachinePrecision]), $MachinePrecision] + z0), $MachinePrecision] / N[(N[(z3 / N[(z4 * z4), $MachinePrecision]), $MachinePrecision] + N[(z1 / N[(z2 * z2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}}

Alternative 1: 78.2% accurate, 0.8× speedup?

\[\begin{array}{l} \mathbf{if}\;\left|z4\right| \leq 5 \cdot 10^{+25}:\\ \;\;\;\;\left(\left|z4\right| \cdot \left(\frac{\left|z4\right|}{\left(\frac{z1}{z2 \cdot z2} \cdot \left|z4\right|\right) \cdot \left|z4\right| + z3} \cdot \left(\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot z0 - -1\right)\right)\right) \cdot z0\\ \mathbf{else}:\\ \;\;\;\;\frac{z0 - \left(\left(-0.5 - \left(z0 \cdot 0.25 - -0.3333333333333333\right) \cdot z0\right) \cdot z0\right) \cdot z0}{\frac{z3}{\left|z4\right| \cdot \left|z4\right|} + \frac{\frac{z1}{z2}}{z2}}\\ \end{array} \]
(FPCore (z0 z3 z4 z1 z2)
  :precision binary64
  (if (<= (fabs z4) 5e+25)
  (*
   (*
    (fabs z4)
    (*
     (/ (fabs z4) (+ (* (* (/ z1 (* z2 z2)) (fabs z4)) (fabs z4)) z3))
     (-
      (* (- (* (- (* 0.25 z0) -0.3333333333333333) z0) -0.5) z0)
      -1.0)))
   z0)
  (/
   (-
    z0
    (* (* (- -0.5 (* (- (* z0 0.25) -0.3333333333333333) z0)) z0) z0))
   (+ (/ z3 (* (fabs z4) (fabs z4))) (/ (/ z1 z2) z2)))))
double code(double z0, double z3, double z4, double z1, double z2) {
	double tmp;
	if (fabs(z4) <= 5e+25) {
		tmp = (fabs(z4) * ((fabs(z4) / ((((z1 / (z2 * z2)) * fabs(z4)) * fabs(z4)) + z3)) * ((((((0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * z0) - -1.0))) * z0;
	} else {
		tmp = (z0 - (((-0.5 - (((z0 * 0.25) - -0.3333333333333333) * z0)) * z0) * z0)) / ((z3 / (fabs(z4) * fabs(z4))) + ((z1 / z2) / z2));
	}
	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(z0, z3, z4, z1, z2)
use fmin_fmax_functions
    real(8), intent (in) :: z0
    real(8), intent (in) :: z3
    real(8), intent (in) :: z4
    real(8), intent (in) :: z1
    real(8), intent (in) :: z2
    real(8) :: tmp
    if (abs(z4) <= 5d+25) then
        tmp = (abs(z4) * ((abs(z4) / ((((z1 / (z2 * z2)) * abs(z4)) * abs(z4)) + z3)) * ((((((0.25d0 * z0) - (-0.3333333333333333d0)) * z0) - (-0.5d0)) * z0) - (-1.0d0)))) * z0
    else
        tmp = (z0 - ((((-0.5d0) - (((z0 * 0.25d0) - (-0.3333333333333333d0)) * z0)) * z0) * z0)) / ((z3 / (abs(z4) * abs(z4))) + ((z1 / z2) / z2))
    end if
    code = tmp
end function
public static double code(double z0, double z3, double z4, double z1, double z2) {
	double tmp;
	if (Math.abs(z4) <= 5e+25) {
		tmp = (Math.abs(z4) * ((Math.abs(z4) / ((((z1 / (z2 * z2)) * Math.abs(z4)) * Math.abs(z4)) + z3)) * ((((((0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * z0) - -1.0))) * z0;
	} else {
		tmp = (z0 - (((-0.5 - (((z0 * 0.25) - -0.3333333333333333) * z0)) * z0) * z0)) / ((z3 / (Math.abs(z4) * Math.abs(z4))) + ((z1 / z2) / z2));
	}
	return tmp;
}
def code(z0, z3, z4, z1, z2):
	tmp = 0
	if math.fabs(z4) <= 5e+25:
		tmp = (math.fabs(z4) * ((math.fabs(z4) / ((((z1 / (z2 * z2)) * math.fabs(z4)) * math.fabs(z4)) + z3)) * ((((((0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * z0) - -1.0))) * z0
	else:
		tmp = (z0 - (((-0.5 - (((z0 * 0.25) - -0.3333333333333333) * z0)) * z0) * z0)) / ((z3 / (math.fabs(z4) * math.fabs(z4))) + ((z1 / z2) / z2))
	return tmp
function code(z0, z3, z4, z1, z2)
	tmp = 0.0
	if (abs(z4) <= 5e+25)
		tmp = Float64(Float64(abs(z4) * Float64(Float64(abs(z4) / Float64(Float64(Float64(Float64(z1 / Float64(z2 * z2)) * abs(z4)) * abs(z4)) + z3)) * Float64(Float64(Float64(Float64(Float64(Float64(0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * z0) - -1.0))) * z0);
	else
		tmp = Float64(Float64(z0 - Float64(Float64(Float64(-0.5 - Float64(Float64(Float64(z0 * 0.25) - -0.3333333333333333) * z0)) * z0) * z0)) / Float64(Float64(z3 / Float64(abs(z4) * abs(z4))) + Float64(Float64(z1 / z2) / z2)));
	end
	return tmp
end
function tmp_2 = code(z0, z3, z4, z1, z2)
	tmp = 0.0;
	if (abs(z4) <= 5e+25)
		tmp = (abs(z4) * ((abs(z4) / ((((z1 / (z2 * z2)) * abs(z4)) * abs(z4)) + z3)) * ((((((0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * z0) - -1.0))) * z0;
	else
		tmp = (z0 - (((-0.5 - (((z0 * 0.25) - -0.3333333333333333) * z0)) * z0) * z0)) / ((z3 / (abs(z4) * abs(z4))) + ((z1 / z2) / z2));
	end
	tmp_2 = tmp;
end
code[z0_, z3_, z4_, z1_, z2_] := If[LessEqual[N[Abs[z4], $MachinePrecision], 5e+25], N[(N[(N[Abs[z4], $MachinePrecision] * N[(N[(N[Abs[z4], $MachinePrecision] / N[(N[(N[(N[(z1 / N[(z2 * z2), $MachinePrecision]), $MachinePrecision] * N[Abs[z4], $MachinePrecision]), $MachinePrecision] * N[Abs[z4], $MachinePrecision]), $MachinePrecision] + z3), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(N[(N[(0.25 * z0), $MachinePrecision] - -0.3333333333333333), $MachinePrecision] * z0), $MachinePrecision] - -0.5), $MachinePrecision] * z0), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * z0), $MachinePrecision], N[(N[(z0 - N[(N[(N[(-0.5 - N[(N[(N[(z0 * 0.25), $MachinePrecision] - -0.3333333333333333), $MachinePrecision] * z0), $MachinePrecision]), $MachinePrecision] * z0), $MachinePrecision] * z0), $MachinePrecision]), $MachinePrecision] / N[(N[(z3 / N[(N[Abs[z4], $MachinePrecision] * N[Abs[z4], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(z1 / z2), $MachinePrecision] / z2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\left|z4\right| \leq 5 \cdot 10^{+25}:\\
\;\;\;\;\left(\left|z4\right| \cdot \left(\frac{\left|z4\right|}{\left(\frac{z1}{z2 \cdot z2} \cdot \left|z4\right|\right) \cdot \left|z4\right| + z3} \cdot \left(\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot z0 - -1\right)\right)\right) \cdot z0\\

\mathbf{else}:\\
\;\;\;\;\frac{z0 - \left(\left(-0.5 - \left(z0 \cdot 0.25 - -0.3333333333333333\right) \cdot z0\right) \cdot z0\right) \cdot z0}{\frac{z3}{\left|z4\right| \cdot \left|z4\right|} + \frac{\frac{z1}{z2}}{z2}}\\


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z4 < 5.0000000000000002e25

    1. Initial program 66.3%

      \[\frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}} \]
    2. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{z1}{z2 \cdot z2}}} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{\color{blue}{z2 \cdot z2}}} \]
      3. associate-/r*N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\frac{z1}{z2}}{z2}}} \]
      4. lower-/.f64N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\frac{z1}{z2}}{z2}}} \]
      5. lower-/.f6470.6%

        \[\leadsto \frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{\color{blue}{\frac{z1}{z2}}}{z2}} \]
    3. Applied rewrites70.6%

      \[\leadsto \frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\frac{z1}{z2}}{z2}}} \]
    4. Applied rewrites56.4%

      \[\leadsto \color{blue}{\left(\frac{z4 \cdot z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3} \cdot \left(\left(\left(z0 \cdot 0.25 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot z0 - -1\right)\right) \cdot z0} \]
    5. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(\frac{z4 \cdot z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3} \cdot \left(\left(\left(z0 \cdot \frac{1}{4} - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0 - -1\right)\right)} \cdot z0 \]
      2. lift-/.f64N/A

        \[\leadsto \left(\color{blue}{\frac{z4 \cdot z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3}} \cdot \left(\left(\left(z0 \cdot \frac{1}{4} - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0 - -1\right)\right) \cdot z0 \]
      3. lift-*.f64N/A

        \[\leadsto \left(\frac{\color{blue}{z4 \cdot z4}}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3} \cdot \left(\left(\left(z0 \cdot \frac{1}{4} - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0 - -1\right)\right) \cdot z0 \]
      4. associate-/l*N/A

        \[\leadsto \left(\color{blue}{\left(z4 \cdot \frac{z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3}\right)} \cdot \left(\left(\left(z0 \cdot \frac{1}{4} - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0 - -1\right)\right) \cdot z0 \]
      5. associate-*l*N/A

        \[\leadsto \color{blue}{\left(z4 \cdot \left(\frac{z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3} \cdot \left(\left(\left(z0 \cdot \frac{1}{4} - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0 - -1\right)\right)\right)} \cdot z0 \]
      6. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(z4 \cdot \left(\frac{z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3} \cdot \left(\left(\left(z0 \cdot \frac{1}{4} - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0 - -1\right)\right)\right)} \cdot z0 \]
      7. lower-*.f64N/A

        \[\leadsto \left(z4 \cdot \color{blue}{\left(\frac{z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3} \cdot \left(\left(\left(z0 \cdot \frac{1}{4} - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0 - -1\right)\right)}\right) \cdot z0 \]
      8. lower-/.f6469.1%

        \[\leadsto \left(z4 \cdot \left(\color{blue}{\frac{z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3}} \cdot \left(\left(\left(z0 \cdot 0.25 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot z0 - -1\right)\right)\right) \cdot z0 \]
    6. Applied rewrites69.1%

      \[\leadsto \color{blue}{\left(z4 \cdot \left(\frac{z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3} \cdot \left(\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot z0 - -1\right)\right)\right)} \cdot z0 \]

    if 5.0000000000000002e25 < z4

    1. Initial program 66.3%

      \[\frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}} \]
    2. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{z1}{z2 \cdot z2}}} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{\color{blue}{z2 \cdot z2}}} \]
      3. associate-/r*N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\frac{z1}{z2}}{z2}}} \]
      4. lower-/.f64N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\frac{z1}{z2}}{z2}}} \]
      5. lower-/.f6470.6%

        \[\leadsto \frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{\color{blue}{\frac{z1}{z2}}}{z2}} \]
    3. Applied rewrites70.6%

      \[\leadsto \frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\frac{z1}{z2}}{z2}}} \]
    4. Step-by-step derivation
      1. lift-+.f64N/A

        \[\leadsto \frac{\color{blue}{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}}{\frac{z3}{z4 \cdot z4} + \frac{\frac{z1}{z2}}{z2}} \]
      2. +-commutativeN/A

        \[\leadsto \frac{\color{blue}{z0 + \left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right)}}{\frac{z3}{z4 \cdot z4} + \frac{\frac{z1}{z2}}{z2}} \]
      3. add-flipN/A

        \[\leadsto \frac{\color{blue}{z0 - \left(\mathsf{neg}\left(\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right)\right)\right)}}{\frac{z3}{z4 \cdot z4} + \frac{\frac{z1}{z2}}{z2}} \]
      4. lift-*.f64N/A

        \[\leadsto \frac{z0 - \left(\mathsf{neg}\left(\color{blue}{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right)}\right)\right)}{\frac{z3}{z4 \cdot z4} + \frac{\frac{z1}{z2}}{z2}} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{z0 - \left(\mathsf{neg}\left(\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \color{blue}{\left(z0 \cdot z0\right)}\right)\right)}{\frac{z3}{z4 \cdot z4} + \frac{\frac{z1}{z2}}{z2}} \]
      6. associate-*r*N/A

        \[\leadsto \frac{z0 - \left(\mathsf{neg}\left(\color{blue}{\left(\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0\right) \cdot z0}\right)\right)}{\frac{z3}{z4 \cdot z4} + \frac{\frac{z1}{z2}}{z2}} \]
      7. lift-*.f64N/A

        \[\leadsto \frac{z0 - \left(\mathsf{neg}\left(\left(\left(\left(\color{blue}{\frac{1}{4} \cdot z0} - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0\right) \cdot z0\right)\right)}{\frac{z3}{z4 \cdot z4} + \frac{\frac{z1}{z2}}{z2}} \]
      8. *-commutativeN/A

        \[\leadsto \frac{z0 - \left(\mathsf{neg}\left(\left(\left(\left(\color{blue}{z0 \cdot \frac{1}{4}} - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0\right) \cdot z0\right)\right)}{\frac{z3}{z4 \cdot z4} + \frac{\frac{z1}{z2}}{z2}} \]
      9. lift-*.f64N/A

        \[\leadsto \frac{z0 - \left(\mathsf{neg}\left(\left(\left(\left(\color{blue}{z0 \cdot \frac{1}{4}} - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0\right) \cdot z0\right)\right)}{\frac{z3}{z4 \cdot z4} + \frac{\frac{z1}{z2}}{z2}} \]
      10. lift-*.f64N/A

        \[\leadsto \frac{z0 - \left(\mathsf{neg}\left(\color{blue}{\left(\left(\left(z0 \cdot \frac{1}{4} - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0\right)} \cdot z0\right)\right)}{\frac{z3}{z4 \cdot z4} + \frac{\frac{z1}{z2}}{z2}} \]
      11. lift-*.f64N/A

        \[\leadsto \frac{z0 - \left(\mathsf{neg}\left(\color{blue}{\left(\left(\left(z0 \cdot \frac{1}{4} - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0\right) \cdot z0}\right)\right)}{\frac{z3}{z4 \cdot z4} + \frac{\frac{z1}{z2}}{z2}} \]
      12. lower--.f64N/A

        \[\leadsto \frac{\color{blue}{z0 - \left(\mathsf{neg}\left(\left(\left(\left(z0 \cdot \frac{1}{4} - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0\right) \cdot z0\right)\right)}}{\frac{z3}{z4 \cdot z4} + \frac{\frac{z1}{z2}}{z2}} \]
      13. lift-*.f64N/A

        \[\leadsto \frac{z0 - \left(\mathsf{neg}\left(\color{blue}{\left(\left(\left(z0 \cdot \frac{1}{4} - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0\right) \cdot z0}\right)\right)}{\frac{z3}{z4 \cdot z4} + \frac{\frac{z1}{z2}}{z2}} \]
    5. Applied rewrites70.6%

      \[\leadsto \frac{\color{blue}{z0 - \left(\left(-0.5 - \left(z0 \cdot 0.25 - -0.3333333333333333\right) \cdot z0\right) \cdot z0\right) \cdot z0}}{\frac{z3}{z4 \cdot z4} + \frac{\frac{z1}{z2}}{z2}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 2: 78.0% accurate, 0.8× speedup?

\[\begin{array}{l} \mathbf{if}\;\left|z4\right| \leq 2.9 \cdot 10^{-5}:\\ \;\;\;\;\left(\left|z4\right| \cdot \left(\frac{\left|z4\right|}{\left(\frac{z1}{z2 \cdot z2} \cdot \left|z4\right|\right) \cdot \left|z4\right| + z3} \cdot \left(\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot z0 - -1\right)\right)\right) \cdot z0\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(\left(\left(z0 \cdot 0.25 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot z0 - -1\right) \cdot z0}{z2 \cdot \frac{z3}{\left|z4\right| \cdot \left|z4\right|} + \frac{z1}{z2}} \cdot z2\\ \end{array} \]
(FPCore (z0 z3 z4 z1 z2)
  :precision binary64
  (if (<= (fabs z4) 2.9e-5)
  (*
   (*
    (fabs z4)
    (*
     (/ (fabs z4) (+ (* (* (/ z1 (* z2 z2)) (fabs z4)) (fabs z4)) z3))
     (-
      (* (- (* (- (* 0.25 z0) -0.3333333333333333) z0) -0.5) z0)
      -1.0)))
   z0)
  (*
   (/
    (*
     (-
      (* (- (* (- (* z0 0.25) -0.3333333333333333) z0) -0.5) z0)
      -1.0)
     z0)
    (+ (* z2 (/ z3 (* (fabs z4) (fabs z4)))) (/ z1 z2)))
   z2)))
double code(double z0, double z3, double z4, double z1, double z2) {
	double tmp;
	if (fabs(z4) <= 2.9e-5) {
		tmp = (fabs(z4) * ((fabs(z4) / ((((z1 / (z2 * z2)) * fabs(z4)) * fabs(z4)) + z3)) * ((((((0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * z0) - -1.0))) * z0;
	} else {
		tmp = ((((((((z0 * 0.25) - -0.3333333333333333) * z0) - -0.5) * z0) - -1.0) * z0) / ((z2 * (z3 / (fabs(z4) * fabs(z4)))) + (z1 / z2))) * z2;
	}
	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(z0, z3, z4, z1, z2)
use fmin_fmax_functions
    real(8), intent (in) :: z0
    real(8), intent (in) :: z3
    real(8), intent (in) :: z4
    real(8), intent (in) :: z1
    real(8), intent (in) :: z2
    real(8) :: tmp
    if (abs(z4) <= 2.9d-5) then
        tmp = (abs(z4) * ((abs(z4) / ((((z1 / (z2 * z2)) * abs(z4)) * abs(z4)) + z3)) * ((((((0.25d0 * z0) - (-0.3333333333333333d0)) * z0) - (-0.5d0)) * z0) - (-1.0d0)))) * z0
    else
        tmp = ((((((((z0 * 0.25d0) - (-0.3333333333333333d0)) * z0) - (-0.5d0)) * z0) - (-1.0d0)) * z0) / ((z2 * (z3 / (abs(z4) * abs(z4)))) + (z1 / z2))) * z2
    end if
    code = tmp
end function
public static double code(double z0, double z3, double z4, double z1, double z2) {
	double tmp;
	if (Math.abs(z4) <= 2.9e-5) {
		tmp = (Math.abs(z4) * ((Math.abs(z4) / ((((z1 / (z2 * z2)) * Math.abs(z4)) * Math.abs(z4)) + z3)) * ((((((0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * z0) - -1.0))) * z0;
	} else {
		tmp = ((((((((z0 * 0.25) - -0.3333333333333333) * z0) - -0.5) * z0) - -1.0) * z0) / ((z2 * (z3 / (Math.abs(z4) * Math.abs(z4)))) + (z1 / z2))) * z2;
	}
	return tmp;
}
def code(z0, z3, z4, z1, z2):
	tmp = 0
	if math.fabs(z4) <= 2.9e-5:
		tmp = (math.fabs(z4) * ((math.fabs(z4) / ((((z1 / (z2 * z2)) * math.fabs(z4)) * math.fabs(z4)) + z3)) * ((((((0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * z0) - -1.0))) * z0
	else:
		tmp = ((((((((z0 * 0.25) - -0.3333333333333333) * z0) - -0.5) * z0) - -1.0) * z0) / ((z2 * (z3 / (math.fabs(z4) * math.fabs(z4)))) + (z1 / z2))) * z2
	return tmp
function code(z0, z3, z4, z1, z2)
	tmp = 0.0
	if (abs(z4) <= 2.9e-5)
		tmp = Float64(Float64(abs(z4) * Float64(Float64(abs(z4) / Float64(Float64(Float64(Float64(z1 / Float64(z2 * z2)) * abs(z4)) * abs(z4)) + z3)) * Float64(Float64(Float64(Float64(Float64(Float64(0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * z0) - -1.0))) * z0);
	else
		tmp = Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(z0 * 0.25) - -0.3333333333333333) * z0) - -0.5) * z0) - -1.0) * z0) / Float64(Float64(z2 * Float64(z3 / Float64(abs(z4) * abs(z4)))) + Float64(z1 / z2))) * z2);
	end
	return tmp
end
function tmp_2 = code(z0, z3, z4, z1, z2)
	tmp = 0.0;
	if (abs(z4) <= 2.9e-5)
		tmp = (abs(z4) * ((abs(z4) / ((((z1 / (z2 * z2)) * abs(z4)) * abs(z4)) + z3)) * ((((((0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * z0) - -1.0))) * z0;
	else
		tmp = ((((((((z0 * 0.25) - -0.3333333333333333) * z0) - -0.5) * z0) - -1.0) * z0) / ((z2 * (z3 / (abs(z4) * abs(z4)))) + (z1 / z2))) * z2;
	end
	tmp_2 = tmp;
end
code[z0_, z3_, z4_, z1_, z2_] := If[LessEqual[N[Abs[z4], $MachinePrecision], 2.9e-5], N[(N[(N[Abs[z4], $MachinePrecision] * N[(N[(N[Abs[z4], $MachinePrecision] / N[(N[(N[(N[(z1 / N[(z2 * z2), $MachinePrecision]), $MachinePrecision] * N[Abs[z4], $MachinePrecision]), $MachinePrecision] * N[Abs[z4], $MachinePrecision]), $MachinePrecision] + z3), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(N[(N[(0.25 * z0), $MachinePrecision] - -0.3333333333333333), $MachinePrecision] * z0), $MachinePrecision] - -0.5), $MachinePrecision] * z0), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * z0), $MachinePrecision], N[(N[(N[(N[(N[(N[(N[(N[(N[(z0 * 0.25), $MachinePrecision] - -0.3333333333333333), $MachinePrecision] * z0), $MachinePrecision] - -0.5), $MachinePrecision] * z0), $MachinePrecision] - -1.0), $MachinePrecision] * z0), $MachinePrecision] / N[(N[(z2 * N[(z3 / N[(N[Abs[z4], $MachinePrecision] * N[Abs[z4], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(z1 / z2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * z2), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\left|z4\right| \leq 2.9 \cdot 10^{-5}:\\
\;\;\;\;\left(\left|z4\right| \cdot \left(\frac{\left|z4\right|}{\left(\frac{z1}{z2 \cdot z2} \cdot \left|z4\right|\right) \cdot \left|z4\right| + z3} \cdot \left(\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot z0 - -1\right)\right)\right) \cdot z0\\

\mathbf{else}:\\
\;\;\;\;\frac{\left(\left(\left(z0 \cdot 0.25 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot z0 - -1\right) \cdot z0}{z2 \cdot \frac{z3}{\left|z4\right| \cdot \left|z4\right|} + \frac{z1}{z2}} \cdot z2\\


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z4 < 2.9e-5

    1. Initial program 66.3%

      \[\frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}} \]
    2. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{z1}{z2 \cdot z2}}} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{\color{blue}{z2 \cdot z2}}} \]
      3. associate-/r*N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\frac{z1}{z2}}{z2}}} \]
      4. lower-/.f64N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\frac{z1}{z2}}{z2}}} \]
      5. lower-/.f6470.6%

        \[\leadsto \frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{\color{blue}{\frac{z1}{z2}}}{z2}} \]
    3. Applied rewrites70.6%

      \[\leadsto \frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\frac{z1}{z2}}{z2}}} \]
    4. Applied rewrites56.4%

      \[\leadsto \color{blue}{\left(\frac{z4 \cdot z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3} \cdot \left(\left(\left(z0 \cdot 0.25 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot z0 - -1\right)\right) \cdot z0} \]
    5. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(\frac{z4 \cdot z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3} \cdot \left(\left(\left(z0 \cdot \frac{1}{4} - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0 - -1\right)\right)} \cdot z0 \]
      2. lift-/.f64N/A

        \[\leadsto \left(\color{blue}{\frac{z4 \cdot z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3}} \cdot \left(\left(\left(z0 \cdot \frac{1}{4} - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0 - -1\right)\right) \cdot z0 \]
      3. lift-*.f64N/A

        \[\leadsto \left(\frac{\color{blue}{z4 \cdot z4}}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3} \cdot \left(\left(\left(z0 \cdot \frac{1}{4} - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0 - -1\right)\right) \cdot z0 \]
      4. associate-/l*N/A

        \[\leadsto \left(\color{blue}{\left(z4 \cdot \frac{z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3}\right)} \cdot \left(\left(\left(z0 \cdot \frac{1}{4} - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0 - -1\right)\right) \cdot z0 \]
      5. associate-*l*N/A

        \[\leadsto \color{blue}{\left(z4 \cdot \left(\frac{z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3} \cdot \left(\left(\left(z0 \cdot \frac{1}{4} - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0 - -1\right)\right)\right)} \cdot z0 \]
      6. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(z4 \cdot \left(\frac{z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3} \cdot \left(\left(\left(z0 \cdot \frac{1}{4} - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0 - -1\right)\right)\right)} \cdot z0 \]
      7. lower-*.f64N/A

        \[\leadsto \left(z4 \cdot \color{blue}{\left(\frac{z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3} \cdot \left(\left(\left(z0 \cdot \frac{1}{4} - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0 - -1\right)\right)}\right) \cdot z0 \]
      8. lower-/.f6469.1%

        \[\leadsto \left(z4 \cdot \left(\color{blue}{\frac{z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3}} \cdot \left(\left(\left(z0 \cdot 0.25 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot z0 - -1\right)\right)\right) \cdot z0 \]
    6. Applied rewrites69.1%

      \[\leadsto \color{blue}{\left(z4 \cdot \left(\frac{z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3} \cdot \left(\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot z0 - -1\right)\right)\right)} \cdot z0 \]

    if 2.9e-5 < z4

    1. Initial program 66.3%

      \[\frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}} \]
    2. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{z1}{z2 \cdot z2}}} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{\color{blue}{z2 \cdot z2}}} \]
      3. associate-/r*N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\frac{z1}{z2}}{z2}}} \]
      4. lower-/.f64N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\frac{z1}{z2}}{z2}}} \]
      5. lower-/.f6470.6%

        \[\leadsto \frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{\color{blue}{\frac{z1}{z2}}}{z2}} \]
    3. Applied rewrites70.6%

      \[\leadsto \frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\frac{z1}{z2}}{z2}}} \]
    4. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{\frac{z1}{z2}}{z2}}} \]
      2. lift-+.f64N/A

        \[\leadsto \frac{\color{blue}{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}}{\frac{z3}{z4 \cdot z4} + \frac{\frac{z1}{z2}}{z2}} \]
    5. Applied rewrites69.9%

      \[\leadsto \color{blue}{\frac{\left(\left(\left(z0 \cdot 0.25 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot z0 - -1\right) \cdot z0}{z2 \cdot \frac{z3}{z4 \cdot z4} + \frac{z1}{z2}} \cdot z2} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 3: 77.5% accurate, 0.8× speedup?

\[\begin{array}{l} \mathbf{if}\;\left|z4\right| \leq 3.2 \cdot 10^{-11}:\\ \;\;\;\;\left(\left|z4\right| \cdot \left(\frac{\left|z4\right|}{\left(\frac{z1}{z2 \cdot z2} \cdot \left|z4\right|\right) \cdot \left|z4\right| + z3} \cdot \left(\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot z0 - -1\right)\right)\right) \cdot z0\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{z2}{z2 \cdot \frac{z3}{\left|z4\right| \cdot \left|z4\right|} + \frac{z1}{z2}} \cdot \left(\left(\left(z0 \cdot 0.25 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot z0 - -1\right)\right) \cdot z0\\ \end{array} \]
(FPCore (z0 z3 z4 z1 z2)
  :precision binary64
  (if (<= (fabs z4) 3.2e-11)
  (*
   (*
    (fabs z4)
    (*
     (/ (fabs z4) (+ (* (* (/ z1 (* z2 z2)) (fabs z4)) (fabs z4)) z3))
     (-
      (* (- (* (- (* 0.25 z0) -0.3333333333333333) z0) -0.5) z0)
      -1.0)))
   z0)
  (*
   (*
    (/ z2 (+ (* z2 (/ z3 (* (fabs z4) (fabs z4)))) (/ z1 z2)))
    (-
     (* (- (* (- (* z0 0.25) -0.3333333333333333) z0) -0.5) z0)
     -1.0))
   z0)))
double code(double z0, double z3, double z4, double z1, double z2) {
	double tmp;
	if (fabs(z4) <= 3.2e-11) {
		tmp = (fabs(z4) * ((fabs(z4) / ((((z1 / (z2 * z2)) * fabs(z4)) * fabs(z4)) + z3)) * ((((((0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * z0) - -1.0))) * z0;
	} else {
		tmp = ((z2 / ((z2 * (z3 / (fabs(z4) * fabs(z4)))) + (z1 / z2))) * ((((((z0 * 0.25) - -0.3333333333333333) * z0) - -0.5) * z0) - -1.0)) * z0;
	}
	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(z0, z3, z4, z1, z2)
use fmin_fmax_functions
    real(8), intent (in) :: z0
    real(8), intent (in) :: z3
    real(8), intent (in) :: z4
    real(8), intent (in) :: z1
    real(8), intent (in) :: z2
    real(8) :: tmp
    if (abs(z4) <= 3.2d-11) then
        tmp = (abs(z4) * ((abs(z4) / ((((z1 / (z2 * z2)) * abs(z4)) * abs(z4)) + z3)) * ((((((0.25d0 * z0) - (-0.3333333333333333d0)) * z0) - (-0.5d0)) * z0) - (-1.0d0)))) * z0
    else
        tmp = ((z2 / ((z2 * (z3 / (abs(z4) * abs(z4)))) + (z1 / z2))) * ((((((z0 * 0.25d0) - (-0.3333333333333333d0)) * z0) - (-0.5d0)) * z0) - (-1.0d0))) * z0
    end if
    code = tmp
end function
public static double code(double z0, double z3, double z4, double z1, double z2) {
	double tmp;
	if (Math.abs(z4) <= 3.2e-11) {
		tmp = (Math.abs(z4) * ((Math.abs(z4) / ((((z1 / (z2 * z2)) * Math.abs(z4)) * Math.abs(z4)) + z3)) * ((((((0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * z0) - -1.0))) * z0;
	} else {
		tmp = ((z2 / ((z2 * (z3 / (Math.abs(z4) * Math.abs(z4)))) + (z1 / z2))) * ((((((z0 * 0.25) - -0.3333333333333333) * z0) - -0.5) * z0) - -1.0)) * z0;
	}
	return tmp;
}
def code(z0, z3, z4, z1, z2):
	tmp = 0
	if math.fabs(z4) <= 3.2e-11:
		tmp = (math.fabs(z4) * ((math.fabs(z4) / ((((z1 / (z2 * z2)) * math.fabs(z4)) * math.fabs(z4)) + z3)) * ((((((0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * z0) - -1.0))) * z0
	else:
		tmp = ((z2 / ((z2 * (z3 / (math.fabs(z4) * math.fabs(z4)))) + (z1 / z2))) * ((((((z0 * 0.25) - -0.3333333333333333) * z0) - -0.5) * z0) - -1.0)) * z0
	return tmp
function code(z0, z3, z4, z1, z2)
	tmp = 0.0
	if (abs(z4) <= 3.2e-11)
		tmp = Float64(Float64(abs(z4) * Float64(Float64(abs(z4) / Float64(Float64(Float64(Float64(z1 / Float64(z2 * z2)) * abs(z4)) * abs(z4)) + z3)) * Float64(Float64(Float64(Float64(Float64(Float64(0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * z0) - -1.0))) * z0);
	else
		tmp = Float64(Float64(Float64(z2 / Float64(Float64(z2 * Float64(z3 / Float64(abs(z4) * abs(z4)))) + Float64(z1 / z2))) * Float64(Float64(Float64(Float64(Float64(Float64(z0 * 0.25) - -0.3333333333333333) * z0) - -0.5) * z0) - -1.0)) * z0);
	end
	return tmp
end
function tmp_2 = code(z0, z3, z4, z1, z2)
	tmp = 0.0;
	if (abs(z4) <= 3.2e-11)
		tmp = (abs(z4) * ((abs(z4) / ((((z1 / (z2 * z2)) * abs(z4)) * abs(z4)) + z3)) * ((((((0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * z0) - -1.0))) * z0;
	else
		tmp = ((z2 / ((z2 * (z3 / (abs(z4) * abs(z4)))) + (z1 / z2))) * ((((((z0 * 0.25) - -0.3333333333333333) * z0) - -0.5) * z0) - -1.0)) * z0;
	end
	tmp_2 = tmp;
end
code[z0_, z3_, z4_, z1_, z2_] := If[LessEqual[N[Abs[z4], $MachinePrecision], 3.2e-11], N[(N[(N[Abs[z4], $MachinePrecision] * N[(N[(N[Abs[z4], $MachinePrecision] / N[(N[(N[(N[(z1 / N[(z2 * z2), $MachinePrecision]), $MachinePrecision] * N[Abs[z4], $MachinePrecision]), $MachinePrecision] * N[Abs[z4], $MachinePrecision]), $MachinePrecision] + z3), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(N[(N[(0.25 * z0), $MachinePrecision] - -0.3333333333333333), $MachinePrecision] * z0), $MachinePrecision] - -0.5), $MachinePrecision] * z0), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * z0), $MachinePrecision], N[(N[(N[(z2 / N[(N[(z2 * N[(z3 / N[(N[Abs[z4], $MachinePrecision] * N[Abs[z4], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(z1 / z2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(N[(N[(z0 * 0.25), $MachinePrecision] - -0.3333333333333333), $MachinePrecision] * z0), $MachinePrecision] - -0.5), $MachinePrecision] * z0), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision] * z0), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\left|z4\right| \leq 3.2 \cdot 10^{-11}:\\
\;\;\;\;\left(\left|z4\right| \cdot \left(\frac{\left|z4\right|}{\left(\frac{z1}{z2 \cdot z2} \cdot \left|z4\right|\right) \cdot \left|z4\right| + z3} \cdot \left(\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot z0 - -1\right)\right)\right) \cdot z0\\

\mathbf{else}:\\
\;\;\;\;\left(\frac{z2}{z2 \cdot \frac{z3}{\left|z4\right| \cdot \left|z4\right|} + \frac{z1}{z2}} \cdot \left(\left(\left(z0 \cdot 0.25 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot z0 - -1\right)\right) \cdot z0\\


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z4 < 3.1999999999999999e-11

    1. Initial program 66.3%

      \[\frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}} \]
    2. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{z1}{z2 \cdot z2}}} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{\color{blue}{z2 \cdot z2}}} \]
      3. associate-/r*N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\frac{z1}{z2}}{z2}}} \]
      4. lower-/.f64N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\frac{z1}{z2}}{z2}}} \]
      5. lower-/.f6470.6%

        \[\leadsto \frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{\color{blue}{\frac{z1}{z2}}}{z2}} \]
    3. Applied rewrites70.6%

      \[\leadsto \frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\frac{z1}{z2}}{z2}}} \]
    4. Applied rewrites56.4%

      \[\leadsto \color{blue}{\left(\frac{z4 \cdot z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3} \cdot \left(\left(\left(z0 \cdot 0.25 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot z0 - -1\right)\right) \cdot z0} \]
    5. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(\frac{z4 \cdot z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3} \cdot \left(\left(\left(z0 \cdot \frac{1}{4} - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0 - -1\right)\right)} \cdot z0 \]
      2. lift-/.f64N/A

        \[\leadsto \left(\color{blue}{\frac{z4 \cdot z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3}} \cdot \left(\left(\left(z0 \cdot \frac{1}{4} - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0 - -1\right)\right) \cdot z0 \]
      3. lift-*.f64N/A

        \[\leadsto \left(\frac{\color{blue}{z4 \cdot z4}}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3} \cdot \left(\left(\left(z0 \cdot \frac{1}{4} - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0 - -1\right)\right) \cdot z0 \]
      4. associate-/l*N/A

        \[\leadsto \left(\color{blue}{\left(z4 \cdot \frac{z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3}\right)} \cdot \left(\left(\left(z0 \cdot \frac{1}{4} - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0 - -1\right)\right) \cdot z0 \]
      5. associate-*l*N/A

        \[\leadsto \color{blue}{\left(z4 \cdot \left(\frac{z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3} \cdot \left(\left(\left(z0 \cdot \frac{1}{4} - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0 - -1\right)\right)\right)} \cdot z0 \]
      6. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(z4 \cdot \left(\frac{z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3} \cdot \left(\left(\left(z0 \cdot \frac{1}{4} - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0 - -1\right)\right)\right)} \cdot z0 \]
      7. lower-*.f64N/A

        \[\leadsto \left(z4 \cdot \color{blue}{\left(\frac{z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3} \cdot \left(\left(\left(z0 \cdot \frac{1}{4} - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0 - -1\right)\right)}\right) \cdot z0 \]
      8. lower-/.f6469.1%

        \[\leadsto \left(z4 \cdot \left(\color{blue}{\frac{z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3}} \cdot \left(\left(\left(z0 \cdot 0.25 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot z0 - -1\right)\right)\right) \cdot z0 \]
    6. Applied rewrites69.1%

      \[\leadsto \color{blue}{\left(z4 \cdot \left(\frac{z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3} \cdot \left(\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot z0 - -1\right)\right)\right)} \cdot z0 \]

    if 3.1999999999999999e-11 < z4

    1. Initial program 66.3%

      \[\frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}} \]
    2. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{z1}{z2 \cdot z2}}} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{\color{blue}{z2 \cdot z2}}} \]
      3. associate-/r*N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\frac{z1}{z2}}{z2}}} \]
      4. lower-/.f64N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\frac{z1}{z2}}{z2}}} \]
      5. lower-/.f6470.6%

        \[\leadsto \frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{\color{blue}{\frac{z1}{z2}}}{z2}} \]
    3. Applied rewrites70.6%

      \[\leadsto \frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\frac{z1}{z2}}{z2}}} \]
    4. Applied rewrites56.4%

      \[\leadsto \color{blue}{\left(\frac{z4 \cdot z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3} \cdot \left(\left(\left(z0 \cdot 0.25 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot z0 - -1\right)\right) \cdot z0} \]
    5. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \left(\color{blue}{\frac{z4 \cdot z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3}} \cdot \left(\left(\left(z0 \cdot \frac{1}{4} - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0 - -1\right)\right) \cdot z0 \]
      2. div-flip-revN/A

        \[\leadsto \left(\color{blue}{\frac{1}{\frac{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3}{z4 \cdot z4}}} \cdot \left(\left(\left(z0 \cdot \frac{1}{4} - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0 - -1\right)\right) \cdot z0 \]
      3. lift-+.f64N/A

        \[\leadsto \left(\frac{1}{\frac{\color{blue}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3}}{z4 \cdot z4}} \cdot \left(\left(\left(z0 \cdot \frac{1}{4} - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0 - -1\right)\right) \cdot z0 \]
      4. lift-*.f64N/A

        \[\leadsto \left(\frac{1}{\frac{\color{blue}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4} + z3}{z4 \cdot z4}} \cdot \left(\left(\left(z0 \cdot \frac{1}{4} - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0 - -1\right)\right) \cdot z0 \]
      5. lift-*.f64N/A

        \[\leadsto \left(\frac{1}{\frac{\color{blue}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right)} \cdot z4 + z3}{z4 \cdot z4}} \cdot \left(\left(\left(z0 \cdot \frac{1}{4} - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0 - -1\right)\right) \cdot z0 \]
      6. associate-*l*N/A

        \[\leadsto \left(\frac{1}{\frac{\color{blue}{\frac{z1}{z2 \cdot z2} \cdot \left(z4 \cdot z4\right)} + z3}{z4 \cdot z4}} \cdot \left(\left(\left(z0 \cdot \frac{1}{4} - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0 - -1\right)\right) \cdot z0 \]
      7. lift-*.f64N/A

        \[\leadsto \left(\frac{1}{\frac{\frac{z1}{z2 \cdot z2} \cdot \color{blue}{\left(z4 \cdot z4\right)} + z3}{z4 \cdot z4}} \cdot \left(\left(\left(z0 \cdot \frac{1}{4} - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0 - -1\right)\right) \cdot z0 \]
      8. add-to-fractionN/A

        \[\leadsto \left(\frac{1}{\color{blue}{\frac{z1}{z2 \cdot z2} + \frac{z3}{z4 \cdot z4}}} \cdot \left(\left(\left(z0 \cdot \frac{1}{4} - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0 - -1\right)\right) \cdot z0 \]
      9. lift-/.f64N/A

        \[\leadsto \left(\frac{1}{\frac{z1}{z2 \cdot z2} + \color{blue}{\frac{z3}{z4 \cdot z4}}} \cdot \left(\left(\left(z0 \cdot \frac{1}{4} - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0 - -1\right)\right) \cdot z0 \]
      10. +-commutativeN/A

        \[\leadsto \left(\frac{1}{\color{blue}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}}} \cdot \left(\left(\left(z0 \cdot \frac{1}{4} - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0 - -1\right)\right) \cdot z0 \]
      11. lift-/.f64N/A

        \[\leadsto \left(\frac{1}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{z1}{z2 \cdot z2}}} \cdot \left(\left(\left(z0 \cdot \frac{1}{4} - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0 - -1\right)\right) \cdot z0 \]
      12. lift-*.f64N/A

        \[\leadsto \left(\frac{1}{\frac{z3}{z4 \cdot z4} + \frac{z1}{\color{blue}{z2 \cdot z2}}} \cdot \left(\left(\left(z0 \cdot \frac{1}{4} - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0 - -1\right)\right) \cdot z0 \]
      13. associate-/l/N/A

        \[\leadsto \left(\frac{1}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\frac{z1}{z2}}{z2}}} \cdot \left(\left(\left(z0 \cdot \frac{1}{4} - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0 - -1\right)\right) \cdot z0 \]
      14. lift-/.f64N/A

        \[\leadsto \left(\frac{1}{\frac{z3}{z4 \cdot z4} + \frac{\color{blue}{\frac{z1}{z2}}}{z2}} \cdot \left(\left(\left(z0 \cdot \frac{1}{4} - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0 - -1\right)\right) \cdot z0 \]
      15. add-to-fractionN/A

        \[\leadsto \left(\frac{1}{\color{blue}{\frac{\frac{z3}{z4 \cdot z4} \cdot z2 + \frac{z1}{z2}}{z2}}} \cdot \left(\left(\left(z0 \cdot \frac{1}{4} - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0 - -1\right)\right) \cdot z0 \]
      16. div-flip-revN/A

        \[\leadsto \left(\color{blue}{\frac{z2}{\frac{z3}{z4 \cdot z4} \cdot z2 + \frac{z1}{z2}}} \cdot \left(\left(\left(z0 \cdot \frac{1}{4} - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0 - -1\right)\right) \cdot z0 \]
      17. lower-/.f64N/A

        \[\leadsto \left(\color{blue}{\frac{z2}{\frac{z3}{z4 \cdot z4} \cdot z2 + \frac{z1}{z2}}} \cdot \left(\left(\left(z0 \cdot \frac{1}{4} - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0 - -1\right)\right) \cdot z0 \]
    6. Applied rewrites70.0%

      \[\leadsto \left(\color{blue}{\frac{z2}{z2 \cdot \frac{z3}{z4 \cdot z4} + \frac{z1}{z2}}} \cdot \left(\left(\left(z0 \cdot 0.25 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot z0 - -1\right)\right) \cdot z0 \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 4: 74.9% accurate, 0.8× speedup?

\[\begin{array}{l} t_0 := \frac{z3}{\left|z4\right| \cdot \left|z4\right|}\\ \mathbf{if}\;\left|z4\right| \leq 5 \cdot 10^{+25}:\\ \;\;\;\;\left(\left|z4\right| \cdot \left(\frac{\left|z4\right|}{\left(\frac{z1}{z2 \cdot z2} \cdot \left|z4\right|\right) \cdot \left|z4\right| + z3} \cdot \left(\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot z0 - -1\right)\right)\right) \cdot z0\\ \mathbf{elif}\;\left|z4\right| \leq 3.5 \cdot 10^{+164}:\\ \;\;\;\;\frac{\left(-z0\right) - \left(\left(\left(z0 \cdot 0.25 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot z0\right) \cdot z0}{\frac{z1}{\left(-z2\right) \cdot z2} - t\_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{z0 \cdot \left(1 + 0.5 \cdot z0\right)}{t\_0 + \frac{\frac{z1}{z2}}{z2}}\\ \end{array} \]
(FPCore (z0 z3 z4 z1 z2)
  :precision binary64
  (let* ((t_0 (/ z3 (* (fabs z4) (fabs z4)))))
  (if (<= (fabs z4) 5e+25)
    (*
     (*
      (fabs z4)
      (*
       (/
        (fabs z4)
        (+ (* (* (/ z1 (* z2 z2)) (fabs z4)) (fabs z4)) z3))
       (-
        (* (- (* (- (* 0.25 z0) -0.3333333333333333) z0) -0.5) z0)
        -1.0)))
     z0)
    (if (<= (fabs z4) 3.5e+164)
      (/
       (-
        (- z0)
        (*
         (* (- (* (- (* z0 0.25) -0.3333333333333333) z0) -0.5) z0)
         z0))
       (- (/ z1 (* (- z2) z2)) t_0))
      (/ (* z0 (+ 1.0 (* 0.5 z0))) (+ t_0 (/ (/ z1 z2) z2)))))))
double code(double z0, double z3, double z4, double z1, double z2) {
	double t_0 = z3 / (fabs(z4) * fabs(z4));
	double tmp;
	if (fabs(z4) <= 5e+25) {
		tmp = (fabs(z4) * ((fabs(z4) / ((((z1 / (z2 * z2)) * fabs(z4)) * fabs(z4)) + z3)) * ((((((0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * z0) - -1.0))) * z0;
	} else if (fabs(z4) <= 3.5e+164) {
		tmp = (-z0 - ((((((z0 * 0.25) - -0.3333333333333333) * z0) - -0.5) * z0) * z0)) / ((z1 / (-z2 * z2)) - t_0);
	} else {
		tmp = (z0 * (1.0 + (0.5 * z0))) / (t_0 + ((z1 / z2) / z2));
	}
	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(z0, z3, z4, z1, z2)
use fmin_fmax_functions
    real(8), intent (in) :: z0
    real(8), intent (in) :: z3
    real(8), intent (in) :: z4
    real(8), intent (in) :: z1
    real(8), intent (in) :: z2
    real(8) :: t_0
    real(8) :: tmp
    t_0 = z3 / (abs(z4) * abs(z4))
    if (abs(z4) <= 5d+25) then
        tmp = (abs(z4) * ((abs(z4) / ((((z1 / (z2 * z2)) * abs(z4)) * abs(z4)) + z3)) * ((((((0.25d0 * z0) - (-0.3333333333333333d0)) * z0) - (-0.5d0)) * z0) - (-1.0d0)))) * z0
    else if (abs(z4) <= 3.5d+164) then
        tmp = (-z0 - ((((((z0 * 0.25d0) - (-0.3333333333333333d0)) * z0) - (-0.5d0)) * z0) * z0)) / ((z1 / (-z2 * z2)) - t_0)
    else
        tmp = (z0 * (1.0d0 + (0.5d0 * z0))) / (t_0 + ((z1 / z2) / z2))
    end if
    code = tmp
end function
public static double code(double z0, double z3, double z4, double z1, double z2) {
	double t_0 = z3 / (Math.abs(z4) * Math.abs(z4));
	double tmp;
	if (Math.abs(z4) <= 5e+25) {
		tmp = (Math.abs(z4) * ((Math.abs(z4) / ((((z1 / (z2 * z2)) * Math.abs(z4)) * Math.abs(z4)) + z3)) * ((((((0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * z0) - -1.0))) * z0;
	} else if (Math.abs(z4) <= 3.5e+164) {
		tmp = (-z0 - ((((((z0 * 0.25) - -0.3333333333333333) * z0) - -0.5) * z0) * z0)) / ((z1 / (-z2 * z2)) - t_0);
	} else {
		tmp = (z0 * (1.0 + (0.5 * z0))) / (t_0 + ((z1 / z2) / z2));
	}
	return tmp;
}
def code(z0, z3, z4, z1, z2):
	t_0 = z3 / (math.fabs(z4) * math.fabs(z4))
	tmp = 0
	if math.fabs(z4) <= 5e+25:
		tmp = (math.fabs(z4) * ((math.fabs(z4) / ((((z1 / (z2 * z2)) * math.fabs(z4)) * math.fabs(z4)) + z3)) * ((((((0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * z0) - -1.0))) * z0
	elif math.fabs(z4) <= 3.5e+164:
		tmp = (-z0 - ((((((z0 * 0.25) - -0.3333333333333333) * z0) - -0.5) * z0) * z0)) / ((z1 / (-z2 * z2)) - t_0)
	else:
		tmp = (z0 * (1.0 + (0.5 * z0))) / (t_0 + ((z1 / z2) / z2))
	return tmp
function code(z0, z3, z4, z1, z2)
	t_0 = Float64(z3 / Float64(abs(z4) * abs(z4)))
	tmp = 0.0
	if (abs(z4) <= 5e+25)
		tmp = Float64(Float64(abs(z4) * Float64(Float64(abs(z4) / Float64(Float64(Float64(Float64(z1 / Float64(z2 * z2)) * abs(z4)) * abs(z4)) + z3)) * Float64(Float64(Float64(Float64(Float64(Float64(0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * z0) - -1.0))) * z0);
	elseif (abs(z4) <= 3.5e+164)
		tmp = Float64(Float64(Float64(-z0) - Float64(Float64(Float64(Float64(Float64(Float64(z0 * 0.25) - -0.3333333333333333) * z0) - -0.5) * z0) * z0)) / Float64(Float64(z1 / Float64(Float64(-z2) * z2)) - t_0));
	else
		tmp = Float64(Float64(z0 * Float64(1.0 + Float64(0.5 * z0))) / Float64(t_0 + Float64(Float64(z1 / z2) / z2)));
	end
	return tmp
end
function tmp_2 = code(z0, z3, z4, z1, z2)
	t_0 = z3 / (abs(z4) * abs(z4));
	tmp = 0.0;
	if (abs(z4) <= 5e+25)
		tmp = (abs(z4) * ((abs(z4) / ((((z1 / (z2 * z2)) * abs(z4)) * abs(z4)) + z3)) * ((((((0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * z0) - -1.0))) * z0;
	elseif (abs(z4) <= 3.5e+164)
		tmp = (-z0 - ((((((z0 * 0.25) - -0.3333333333333333) * z0) - -0.5) * z0) * z0)) / ((z1 / (-z2 * z2)) - t_0);
	else
		tmp = (z0 * (1.0 + (0.5 * z0))) / (t_0 + ((z1 / z2) / z2));
	end
	tmp_2 = tmp;
end
code[z0_, z3_, z4_, z1_, z2_] := Block[{t$95$0 = N[(z3 / N[(N[Abs[z4], $MachinePrecision] * N[Abs[z4], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[z4], $MachinePrecision], 5e+25], N[(N[(N[Abs[z4], $MachinePrecision] * N[(N[(N[Abs[z4], $MachinePrecision] / N[(N[(N[(N[(z1 / N[(z2 * z2), $MachinePrecision]), $MachinePrecision] * N[Abs[z4], $MachinePrecision]), $MachinePrecision] * N[Abs[z4], $MachinePrecision]), $MachinePrecision] + z3), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(N[(N[(0.25 * z0), $MachinePrecision] - -0.3333333333333333), $MachinePrecision] * z0), $MachinePrecision] - -0.5), $MachinePrecision] * z0), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * z0), $MachinePrecision], If[LessEqual[N[Abs[z4], $MachinePrecision], 3.5e+164], N[(N[((-z0) - N[(N[(N[(N[(N[(N[(z0 * 0.25), $MachinePrecision] - -0.3333333333333333), $MachinePrecision] * z0), $MachinePrecision] - -0.5), $MachinePrecision] * z0), $MachinePrecision] * z0), $MachinePrecision]), $MachinePrecision] / N[(N[(z1 / N[((-z2) * z2), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(z0 * N[(1.0 + N[(0.5 * z0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 + N[(N[(z1 / z2), $MachinePrecision] / z2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \frac{z3}{\left|z4\right| \cdot \left|z4\right|}\\
\mathbf{if}\;\left|z4\right| \leq 5 \cdot 10^{+25}:\\
\;\;\;\;\left(\left|z4\right| \cdot \left(\frac{\left|z4\right|}{\left(\frac{z1}{z2 \cdot z2} \cdot \left|z4\right|\right) \cdot \left|z4\right| + z3} \cdot \left(\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot z0 - -1\right)\right)\right) \cdot z0\\

\mathbf{elif}\;\left|z4\right| \leq 3.5 \cdot 10^{+164}:\\
\;\;\;\;\frac{\left(-z0\right) - \left(\left(\left(z0 \cdot 0.25 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot z0\right) \cdot z0}{\frac{z1}{\left(-z2\right) \cdot z2} - t\_0}\\

\mathbf{else}:\\
\;\;\;\;\frac{z0 \cdot \left(1 + 0.5 \cdot z0\right)}{t\_0 + \frac{\frac{z1}{z2}}{z2}}\\


\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z4 < 5.0000000000000002e25

    1. Initial program 66.3%

      \[\frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}} \]
    2. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{z1}{z2 \cdot z2}}} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{\color{blue}{z2 \cdot z2}}} \]
      3. associate-/r*N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\frac{z1}{z2}}{z2}}} \]
      4. lower-/.f64N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\frac{z1}{z2}}{z2}}} \]
      5. lower-/.f6470.6%

        \[\leadsto \frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{\color{blue}{\frac{z1}{z2}}}{z2}} \]
    3. Applied rewrites70.6%

      \[\leadsto \frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\frac{z1}{z2}}{z2}}} \]
    4. Applied rewrites56.4%

      \[\leadsto \color{blue}{\left(\frac{z4 \cdot z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3} \cdot \left(\left(\left(z0 \cdot 0.25 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot z0 - -1\right)\right) \cdot z0} \]
    5. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(\frac{z4 \cdot z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3} \cdot \left(\left(\left(z0 \cdot \frac{1}{4} - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0 - -1\right)\right)} \cdot z0 \]
      2. lift-/.f64N/A

        \[\leadsto \left(\color{blue}{\frac{z4 \cdot z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3}} \cdot \left(\left(\left(z0 \cdot \frac{1}{4} - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0 - -1\right)\right) \cdot z0 \]
      3. lift-*.f64N/A

        \[\leadsto \left(\frac{\color{blue}{z4 \cdot z4}}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3} \cdot \left(\left(\left(z0 \cdot \frac{1}{4} - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0 - -1\right)\right) \cdot z0 \]
      4. associate-/l*N/A

        \[\leadsto \left(\color{blue}{\left(z4 \cdot \frac{z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3}\right)} \cdot \left(\left(\left(z0 \cdot \frac{1}{4} - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0 - -1\right)\right) \cdot z0 \]
      5. associate-*l*N/A

        \[\leadsto \color{blue}{\left(z4 \cdot \left(\frac{z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3} \cdot \left(\left(\left(z0 \cdot \frac{1}{4} - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0 - -1\right)\right)\right)} \cdot z0 \]
      6. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(z4 \cdot \left(\frac{z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3} \cdot \left(\left(\left(z0 \cdot \frac{1}{4} - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0 - -1\right)\right)\right)} \cdot z0 \]
      7. lower-*.f64N/A

        \[\leadsto \left(z4 \cdot \color{blue}{\left(\frac{z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3} \cdot \left(\left(\left(z0 \cdot \frac{1}{4} - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0 - -1\right)\right)}\right) \cdot z0 \]
      8. lower-/.f6469.1%

        \[\leadsto \left(z4 \cdot \left(\color{blue}{\frac{z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3}} \cdot \left(\left(\left(z0 \cdot 0.25 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot z0 - -1\right)\right)\right) \cdot z0 \]
    6. Applied rewrites69.1%

      \[\leadsto \color{blue}{\left(z4 \cdot \left(\frac{z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3} \cdot \left(\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot z0 - -1\right)\right)\right)} \cdot z0 \]

    if 5.0000000000000002e25 < z4 < 3.4999999999999998e164

    1. Initial program 66.3%

      \[\frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}} \]
    2. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}}} \]
      2. frac-2negN/A

        \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\left(\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0\right)\right)}{\mathsf{neg}\left(\left(\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}\right)\right)}} \]
      3. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\left(\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0\right)\right)}{\mathsf{neg}\left(\left(\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}\right)\right)}} \]
    3. Applied rewrites66.0%

      \[\leadsto \color{blue}{\frac{\left(-z0\right) - \left(\left(\left(z0 \cdot 0.25 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot z0\right) \cdot z0}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}}} \]

    if 3.4999999999999998e164 < z4

    1. Initial program 66.3%

      \[\frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}} \]
    2. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{z1}{z2 \cdot z2}}} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{\color{blue}{z2 \cdot z2}}} \]
      3. associate-/r*N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\frac{z1}{z2}}{z2}}} \]
      4. lower-/.f64N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\frac{z1}{z2}}{z2}}} \]
      5. lower-/.f6470.6%

        \[\leadsto \frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{\color{blue}{\frac{z1}{z2}}}{z2}} \]
    3. Applied rewrites70.6%

      \[\leadsto \frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\frac{z1}{z2}}{z2}}} \]
    4. Taylor expanded in z0 around 0

      \[\leadsto \frac{\color{blue}{z0 \cdot \left(1 + \frac{1}{2} \cdot z0\right)}}{\frac{z3}{z4 \cdot z4} + \frac{\frac{z1}{z2}}{z2}} \]
    5. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \frac{z0 \cdot \color{blue}{\left(1 + \frac{1}{2} \cdot z0\right)}}{\frac{z3}{z4 \cdot z4} + \frac{\frac{z1}{z2}}{z2}} \]
      2. lower-+.f64N/A

        \[\leadsto \frac{z0 \cdot \left(1 + \color{blue}{\frac{1}{2} \cdot z0}\right)}{\frac{z3}{z4 \cdot z4} + \frac{\frac{z1}{z2}}{z2}} \]
      3. lower-*.f6463.6%

        \[\leadsto \frac{z0 \cdot \left(1 + 0.5 \cdot \color{blue}{z0}\right)}{\frac{z3}{z4 \cdot z4} + \frac{\frac{z1}{z2}}{z2}} \]
    6. Applied rewrites63.6%

      \[\leadsto \frac{\color{blue}{z0 \cdot \left(1 + 0.5 \cdot z0\right)}}{\frac{z3}{z4 \cdot z4} + \frac{\frac{z1}{z2}}{z2}} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 5: 74.3% accurate, 0.8× speedup?

\[\begin{array}{l} t_0 := \frac{z1}{z2 \cdot z2}\\ t_1 := \frac{z3}{\left|z4\right| \cdot \left|z4\right|}\\ \mathbf{if}\;\left|z4\right| \leq 0.0092:\\ \;\;\;\;\left(\left|z4\right| \cdot \left(\frac{\left|z4\right|}{\left(t\_0 \cdot \left|z4\right|\right) \cdot \left|z4\right| + z3} \cdot \left(\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot z0 - -1\right)\right)\right) \cdot z0\\ \mathbf{elif}\;\left|z4\right| \leq 1.8 \cdot 10^{+120}:\\ \;\;\;\;\frac{z0 \cdot \left(-0.5 \cdot z0 - 1\right)}{\frac{-z1}{z2} \cdot \frac{1}{z2} - t\_1}\\ \mathbf{else}:\\ \;\;\;\;\frac{z0}{t\_0 + t\_1} \cdot \left(\left(\left(z0 \cdot 0.25 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot z0 - -1\right)\\ \end{array} \]
(FPCore (z0 z3 z4 z1 z2)
  :precision binary64
  (let* ((t_0 (/ z1 (* z2 z2))) (t_1 (/ z3 (* (fabs z4) (fabs z4)))))
  (if (<= (fabs z4) 0.0092)
    (*
     (*
      (fabs z4)
      (*
       (/ (fabs z4) (+ (* (* t_0 (fabs z4)) (fabs z4)) z3))
       (-
        (* (- (* (- (* 0.25 z0) -0.3333333333333333) z0) -0.5) z0)
        -1.0)))
     z0)
    (if (<= (fabs z4) 1.8e+120)
      (/
       (* z0 (- (* -0.5 z0) 1.0))
       (- (* (/ (- z1) z2) (/ 1.0 z2)) t_1))
      (*
       (/ z0 (+ t_0 t_1))
       (-
        (* (- (* (- (* z0 0.25) -0.3333333333333333) z0) -0.5) z0)
        -1.0))))))
double code(double z0, double z3, double z4, double z1, double z2) {
	double t_0 = z1 / (z2 * z2);
	double t_1 = z3 / (fabs(z4) * fabs(z4));
	double tmp;
	if (fabs(z4) <= 0.0092) {
		tmp = (fabs(z4) * ((fabs(z4) / (((t_0 * fabs(z4)) * fabs(z4)) + z3)) * ((((((0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * z0) - -1.0))) * z0;
	} else if (fabs(z4) <= 1.8e+120) {
		tmp = (z0 * ((-0.5 * z0) - 1.0)) / (((-z1 / z2) * (1.0 / z2)) - t_1);
	} else {
		tmp = (z0 / (t_0 + t_1)) * ((((((z0 * 0.25) - -0.3333333333333333) * z0) - -0.5) * z0) - -1.0);
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(z0, z3, z4, z1, z2)
use fmin_fmax_functions
    real(8), intent (in) :: z0
    real(8), intent (in) :: z3
    real(8), intent (in) :: z4
    real(8), intent (in) :: z1
    real(8), intent (in) :: z2
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = z1 / (z2 * z2)
    t_1 = z3 / (abs(z4) * abs(z4))
    if (abs(z4) <= 0.0092d0) then
        tmp = (abs(z4) * ((abs(z4) / (((t_0 * abs(z4)) * abs(z4)) + z3)) * ((((((0.25d0 * z0) - (-0.3333333333333333d0)) * z0) - (-0.5d0)) * z0) - (-1.0d0)))) * z0
    else if (abs(z4) <= 1.8d+120) then
        tmp = (z0 * (((-0.5d0) * z0) - 1.0d0)) / (((-z1 / z2) * (1.0d0 / z2)) - t_1)
    else
        tmp = (z0 / (t_0 + t_1)) * ((((((z0 * 0.25d0) - (-0.3333333333333333d0)) * z0) - (-0.5d0)) * z0) - (-1.0d0))
    end if
    code = tmp
end function
public static double code(double z0, double z3, double z4, double z1, double z2) {
	double t_0 = z1 / (z2 * z2);
	double t_1 = z3 / (Math.abs(z4) * Math.abs(z4));
	double tmp;
	if (Math.abs(z4) <= 0.0092) {
		tmp = (Math.abs(z4) * ((Math.abs(z4) / (((t_0 * Math.abs(z4)) * Math.abs(z4)) + z3)) * ((((((0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * z0) - -1.0))) * z0;
	} else if (Math.abs(z4) <= 1.8e+120) {
		tmp = (z0 * ((-0.5 * z0) - 1.0)) / (((-z1 / z2) * (1.0 / z2)) - t_1);
	} else {
		tmp = (z0 / (t_0 + t_1)) * ((((((z0 * 0.25) - -0.3333333333333333) * z0) - -0.5) * z0) - -1.0);
	}
	return tmp;
}
def code(z0, z3, z4, z1, z2):
	t_0 = z1 / (z2 * z2)
	t_1 = z3 / (math.fabs(z4) * math.fabs(z4))
	tmp = 0
	if math.fabs(z4) <= 0.0092:
		tmp = (math.fabs(z4) * ((math.fabs(z4) / (((t_0 * math.fabs(z4)) * math.fabs(z4)) + z3)) * ((((((0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * z0) - -1.0))) * z0
	elif math.fabs(z4) <= 1.8e+120:
		tmp = (z0 * ((-0.5 * z0) - 1.0)) / (((-z1 / z2) * (1.0 / z2)) - t_1)
	else:
		tmp = (z0 / (t_0 + t_1)) * ((((((z0 * 0.25) - -0.3333333333333333) * z0) - -0.5) * z0) - -1.0)
	return tmp
function code(z0, z3, z4, z1, z2)
	t_0 = Float64(z1 / Float64(z2 * z2))
	t_1 = Float64(z3 / Float64(abs(z4) * abs(z4)))
	tmp = 0.0
	if (abs(z4) <= 0.0092)
		tmp = Float64(Float64(abs(z4) * Float64(Float64(abs(z4) / Float64(Float64(Float64(t_0 * abs(z4)) * abs(z4)) + z3)) * Float64(Float64(Float64(Float64(Float64(Float64(0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * z0) - -1.0))) * z0);
	elseif (abs(z4) <= 1.8e+120)
		tmp = Float64(Float64(z0 * Float64(Float64(-0.5 * z0) - 1.0)) / Float64(Float64(Float64(Float64(-z1) / z2) * Float64(1.0 / z2)) - t_1));
	else
		tmp = Float64(Float64(z0 / Float64(t_0 + t_1)) * Float64(Float64(Float64(Float64(Float64(Float64(z0 * 0.25) - -0.3333333333333333) * z0) - -0.5) * z0) - -1.0));
	end
	return tmp
end
function tmp_2 = code(z0, z3, z4, z1, z2)
	t_0 = z1 / (z2 * z2);
	t_1 = z3 / (abs(z4) * abs(z4));
	tmp = 0.0;
	if (abs(z4) <= 0.0092)
		tmp = (abs(z4) * ((abs(z4) / (((t_0 * abs(z4)) * abs(z4)) + z3)) * ((((((0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * z0) - -1.0))) * z0;
	elseif (abs(z4) <= 1.8e+120)
		tmp = (z0 * ((-0.5 * z0) - 1.0)) / (((-z1 / z2) * (1.0 / z2)) - t_1);
	else
		tmp = (z0 / (t_0 + t_1)) * ((((((z0 * 0.25) - -0.3333333333333333) * z0) - -0.5) * z0) - -1.0);
	end
	tmp_2 = tmp;
end
code[z0_, z3_, z4_, z1_, z2_] := Block[{t$95$0 = N[(z1 / N[(z2 * z2), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(z3 / N[(N[Abs[z4], $MachinePrecision] * N[Abs[z4], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[z4], $MachinePrecision], 0.0092], N[(N[(N[Abs[z4], $MachinePrecision] * N[(N[(N[Abs[z4], $MachinePrecision] / N[(N[(N[(t$95$0 * N[Abs[z4], $MachinePrecision]), $MachinePrecision] * N[Abs[z4], $MachinePrecision]), $MachinePrecision] + z3), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(N[(N[(0.25 * z0), $MachinePrecision] - -0.3333333333333333), $MachinePrecision] * z0), $MachinePrecision] - -0.5), $MachinePrecision] * z0), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * z0), $MachinePrecision], If[LessEqual[N[Abs[z4], $MachinePrecision], 1.8e+120], N[(N[(z0 * N[(N[(-0.5 * z0), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision] / N[(N[(N[((-z1) / z2), $MachinePrecision] * N[(1.0 / z2), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(z0 / N[(t$95$0 + t$95$1), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(N[(N[(z0 * 0.25), $MachinePrecision] - -0.3333333333333333), $MachinePrecision] * z0), $MachinePrecision] - -0.5), $MachinePrecision] * z0), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \frac{z1}{z2 \cdot z2}\\
t_1 := \frac{z3}{\left|z4\right| \cdot \left|z4\right|}\\
\mathbf{if}\;\left|z4\right| \leq 0.0092:\\
\;\;\;\;\left(\left|z4\right| \cdot \left(\frac{\left|z4\right|}{\left(t\_0 \cdot \left|z4\right|\right) \cdot \left|z4\right| + z3} \cdot \left(\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot z0 - -1\right)\right)\right) \cdot z0\\

\mathbf{elif}\;\left|z4\right| \leq 1.8 \cdot 10^{+120}:\\
\;\;\;\;\frac{z0 \cdot \left(-0.5 \cdot z0 - 1\right)}{\frac{-z1}{z2} \cdot \frac{1}{z2} - t\_1}\\

\mathbf{else}:\\
\;\;\;\;\frac{z0}{t\_0 + t\_1} \cdot \left(\left(\left(z0 \cdot 0.25 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot z0 - -1\right)\\


\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z4 < 0.0091999999999999998

    1. Initial program 66.3%

      \[\frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}} \]
    2. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{z1}{z2 \cdot z2}}} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{\color{blue}{z2 \cdot z2}}} \]
      3. associate-/r*N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\frac{z1}{z2}}{z2}}} \]
      4. lower-/.f64N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\frac{z1}{z2}}{z2}}} \]
      5. lower-/.f6470.6%

        \[\leadsto \frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{\color{blue}{\frac{z1}{z2}}}{z2}} \]
    3. Applied rewrites70.6%

      \[\leadsto \frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\frac{z1}{z2}}{z2}}} \]
    4. Applied rewrites56.4%

      \[\leadsto \color{blue}{\left(\frac{z4 \cdot z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3} \cdot \left(\left(\left(z0 \cdot 0.25 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot z0 - -1\right)\right) \cdot z0} \]
    5. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(\frac{z4 \cdot z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3} \cdot \left(\left(\left(z0 \cdot \frac{1}{4} - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0 - -1\right)\right)} \cdot z0 \]
      2. lift-/.f64N/A

        \[\leadsto \left(\color{blue}{\frac{z4 \cdot z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3}} \cdot \left(\left(\left(z0 \cdot \frac{1}{4} - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0 - -1\right)\right) \cdot z0 \]
      3. lift-*.f64N/A

        \[\leadsto \left(\frac{\color{blue}{z4 \cdot z4}}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3} \cdot \left(\left(\left(z0 \cdot \frac{1}{4} - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0 - -1\right)\right) \cdot z0 \]
      4. associate-/l*N/A

        \[\leadsto \left(\color{blue}{\left(z4 \cdot \frac{z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3}\right)} \cdot \left(\left(\left(z0 \cdot \frac{1}{4} - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0 - -1\right)\right) \cdot z0 \]
      5. associate-*l*N/A

        \[\leadsto \color{blue}{\left(z4 \cdot \left(\frac{z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3} \cdot \left(\left(\left(z0 \cdot \frac{1}{4} - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0 - -1\right)\right)\right)} \cdot z0 \]
      6. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(z4 \cdot \left(\frac{z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3} \cdot \left(\left(\left(z0 \cdot \frac{1}{4} - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0 - -1\right)\right)\right)} \cdot z0 \]
      7. lower-*.f64N/A

        \[\leadsto \left(z4 \cdot \color{blue}{\left(\frac{z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3} \cdot \left(\left(\left(z0 \cdot \frac{1}{4} - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0 - -1\right)\right)}\right) \cdot z0 \]
      8. lower-/.f6469.1%

        \[\leadsto \left(z4 \cdot \left(\color{blue}{\frac{z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3}} \cdot \left(\left(\left(z0 \cdot 0.25 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot z0 - -1\right)\right)\right) \cdot z0 \]
    6. Applied rewrites69.1%

      \[\leadsto \color{blue}{\left(z4 \cdot \left(\frac{z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3} \cdot \left(\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot z0 - -1\right)\right)\right)} \cdot z0 \]

    if 0.0091999999999999998 < z4 < 1.8000000000000001e120

    1. Initial program 66.3%

      \[\frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}} \]
    2. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}}} \]
      2. frac-2negN/A

        \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\left(\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0\right)\right)}{\mathsf{neg}\left(\left(\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}\right)\right)}} \]
      3. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\left(\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0\right)\right)}{\mathsf{neg}\left(\left(\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}\right)\right)}} \]
    3. Applied rewrites66.0%

      \[\leadsto \color{blue}{\frac{\left(-z0\right) - \left(\left(\left(z0 \cdot 0.25 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot z0\right) \cdot z0}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}}} \]
    4. Taylor expanded in z0 around 0

      \[\leadsto \frac{\color{blue}{z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)}}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
    5. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \frac{z0 \cdot \color{blue}{\left(\frac{-1}{2} \cdot z0 - 1\right)}}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
      2. lower--.f64N/A

        \[\leadsto \frac{z0 \cdot \left(\frac{-1}{2} \cdot z0 - \color{blue}{1}\right)}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
      3. lower-*.f6459.9%

        \[\leadsto \frac{z0 \cdot \left(-0.5 \cdot z0 - 1\right)}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
    6. Applied rewrites59.9%

      \[\leadsto \frac{\color{blue}{z0 \cdot \left(-0.5 \cdot z0 - 1\right)}}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
    7. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \frac{z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)}{\color{blue}{\frac{z1}{\left(-z2\right) \cdot z2}} - \frac{z3}{z4 \cdot z4}} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)}{\frac{z1}{\color{blue}{\left(-z2\right) \cdot z2}} - \frac{z3}{z4 \cdot z4}} \]
      3. associate-/r*N/A

        \[\leadsto \frac{z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)}{\color{blue}{\frac{\frac{z1}{-z2}}{z2}} - \frac{z3}{z4 \cdot z4}} \]
      4. mult-flipN/A

        \[\leadsto \frac{z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)}{\color{blue}{\frac{z1}{-z2} \cdot \frac{1}{z2}} - \frac{z3}{z4 \cdot z4}} \]
      5. lift-neg.f64N/A

        \[\leadsto \frac{z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)}{\frac{z1}{\color{blue}{\mathsf{neg}\left(z2\right)}} \cdot \frac{1}{z2} - \frac{z3}{z4 \cdot z4}} \]
      6. distribute-neg-frac2N/A

        \[\leadsto \frac{z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)}{\color{blue}{\left(\mathsf{neg}\left(\frac{z1}{z2}\right)\right)} \cdot \frac{1}{z2} - \frac{z3}{z4 \cdot z4}} \]
      7. lift-/.f64N/A

        \[\leadsto \frac{z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)}{\left(\mathsf{neg}\left(\color{blue}{\frac{z1}{z2}}\right)\right) \cdot \frac{1}{z2} - \frac{z3}{z4 \cdot z4}} \]
      8. lower-*.f64N/A

        \[\leadsto \frac{z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)}{\color{blue}{\left(\mathsf{neg}\left(\frac{z1}{z2}\right)\right) \cdot \frac{1}{z2}} - \frac{z3}{z4 \cdot z4}} \]
      9. lift-/.f64N/A

        \[\leadsto \frac{z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)}{\left(\mathsf{neg}\left(\color{blue}{\frac{z1}{z2}}\right)\right) \cdot \frac{1}{z2} - \frac{z3}{z4 \cdot z4}} \]
      10. distribute-neg-fracN/A

        \[\leadsto \frac{z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)}{\color{blue}{\frac{\mathsf{neg}\left(z1\right)}{z2}} \cdot \frac{1}{z2} - \frac{z3}{z4 \cdot z4}} \]
      11. lower-/.f64N/A

        \[\leadsto \frac{z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)}{\color{blue}{\frac{\mathsf{neg}\left(z1\right)}{z2}} \cdot \frac{1}{z2} - \frac{z3}{z4 \cdot z4}} \]
      12. lower-neg.f64N/A

        \[\leadsto \frac{z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)}{\frac{\color{blue}{-z1}}{z2} \cdot \frac{1}{z2} - \frac{z3}{z4 \cdot z4}} \]
      13. lower-/.f6463.2%

        \[\leadsto \frac{z0 \cdot \left(-0.5 \cdot z0 - 1\right)}{\frac{-z1}{z2} \cdot \color{blue}{\frac{1}{z2}} - \frac{z3}{z4 \cdot z4}} \]
    8. Applied rewrites63.2%

      \[\leadsto \frac{z0 \cdot \left(-0.5 \cdot z0 - 1\right)}{\color{blue}{\frac{-z1}{z2} \cdot \frac{1}{z2}} - \frac{z3}{z4 \cdot z4}} \]

    if 1.8000000000000001e120 < z4

    1. Initial program 66.3%

      \[\frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}} \]
    2. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{z1}{z2 \cdot z2}}} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{\color{blue}{z2 \cdot z2}}} \]
      3. associate-/r*N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\frac{z1}{z2}}{z2}}} \]
      4. lower-/.f64N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\frac{z1}{z2}}{z2}}} \]
      5. lower-/.f6470.6%

        \[\leadsto \frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{\color{blue}{\frac{z1}{z2}}}{z2}} \]
    3. Applied rewrites70.6%

      \[\leadsto \frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\frac{z1}{z2}}{z2}}} \]
    4. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{\frac{z1}{z2}}{z2}}} \]
      2. lift-+.f64N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\color{blue}{\frac{z3}{z4 \cdot z4} + \frac{\frac{z1}{z2}}{z2}}} \]
      3. lift-/.f64N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\frac{z1}{z2}}{z2}}} \]
      4. lift-/.f64N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{\color{blue}{\frac{z1}{z2}}}{z2}} \]
      5. associate-/l/N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{z1}{z2 \cdot z2}}} \]
      6. lift-*.f64N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{\color{blue}{z2 \cdot z2}}} \]
      7. lift-/.f64N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{z1}{z2 \cdot z2}}} \]
      8. +-commutativeN/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\color{blue}{\frac{z1}{z2 \cdot z2} + \frac{z3}{z4 \cdot z4}}} \]
      9. lift-+.f64N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\color{blue}{\frac{z1}{z2 \cdot z2} + \frac{z3}{z4 \cdot z4}}} \]
    5. Applied rewrites67.3%

      \[\leadsto \color{blue}{\frac{z0}{\frac{z1}{z2 \cdot z2} + \frac{z3}{z4 \cdot z4}} \cdot \left(\left(\left(z0 \cdot 0.25 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot z0 - -1\right)} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 6: 73.7% accurate, 0.8× speedup?

\[\begin{array}{l} t_0 := \frac{z1}{z2 \cdot z2}\\ \mathbf{if}\;\left|z4\right| \leq 9 \cdot 10^{-8}:\\ \;\;\;\;\left|z4\right| \cdot \left(\frac{\left|z4\right|}{\left(t\_0 \cdot \left|z4\right|\right) \cdot \left|z4\right| + z3} \cdot \left(z0 - \left(\left(-0.5 - \left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0\right) \cdot z0\right) \cdot z0\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{z0}{t\_0 + \frac{z3}{\left|z4\right| \cdot \left|z4\right|}} \cdot \left(\left(\left(z0 \cdot 0.25 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot z0 - -1\right)\\ \end{array} \]
(FPCore (z0 z3 z4 z1 z2)
  :precision binary64
  (let* ((t_0 (/ z1 (* z2 z2))))
  (if (<= (fabs z4) 9e-8)
    (*
     (fabs z4)
     (*
      (/ (fabs z4) (+ (* (* t_0 (fabs z4)) (fabs z4)) z3))
      (-
       z0
       (*
        (* (- -0.5 (* (- (* 0.25 z0) -0.3333333333333333) z0)) z0)
        z0))))
    (*
     (/ z0 (+ t_0 (/ z3 (* (fabs z4) (fabs z4)))))
     (-
      (* (- (* (- (* z0 0.25) -0.3333333333333333) z0) -0.5) z0)
      -1.0)))))
double code(double z0, double z3, double z4, double z1, double z2) {
	double t_0 = z1 / (z2 * z2);
	double tmp;
	if (fabs(z4) <= 9e-8) {
		tmp = fabs(z4) * ((fabs(z4) / (((t_0 * fabs(z4)) * fabs(z4)) + z3)) * (z0 - (((-0.5 - (((0.25 * z0) - -0.3333333333333333) * z0)) * z0) * z0)));
	} else {
		tmp = (z0 / (t_0 + (z3 / (fabs(z4) * fabs(z4))))) * ((((((z0 * 0.25) - -0.3333333333333333) * z0) - -0.5) * z0) - -1.0);
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(z0, z3, z4, z1, z2)
use fmin_fmax_functions
    real(8), intent (in) :: z0
    real(8), intent (in) :: z3
    real(8), intent (in) :: z4
    real(8), intent (in) :: z1
    real(8), intent (in) :: z2
    real(8) :: t_0
    real(8) :: tmp
    t_0 = z1 / (z2 * z2)
    if (abs(z4) <= 9d-8) then
        tmp = abs(z4) * ((abs(z4) / (((t_0 * abs(z4)) * abs(z4)) + z3)) * (z0 - ((((-0.5d0) - (((0.25d0 * z0) - (-0.3333333333333333d0)) * z0)) * z0) * z0)))
    else
        tmp = (z0 / (t_0 + (z3 / (abs(z4) * abs(z4))))) * ((((((z0 * 0.25d0) - (-0.3333333333333333d0)) * z0) - (-0.5d0)) * z0) - (-1.0d0))
    end if
    code = tmp
end function
public static double code(double z0, double z3, double z4, double z1, double z2) {
	double t_0 = z1 / (z2 * z2);
	double tmp;
	if (Math.abs(z4) <= 9e-8) {
		tmp = Math.abs(z4) * ((Math.abs(z4) / (((t_0 * Math.abs(z4)) * Math.abs(z4)) + z3)) * (z0 - (((-0.5 - (((0.25 * z0) - -0.3333333333333333) * z0)) * z0) * z0)));
	} else {
		tmp = (z0 / (t_0 + (z3 / (Math.abs(z4) * Math.abs(z4))))) * ((((((z0 * 0.25) - -0.3333333333333333) * z0) - -0.5) * z0) - -1.0);
	}
	return tmp;
}
def code(z0, z3, z4, z1, z2):
	t_0 = z1 / (z2 * z2)
	tmp = 0
	if math.fabs(z4) <= 9e-8:
		tmp = math.fabs(z4) * ((math.fabs(z4) / (((t_0 * math.fabs(z4)) * math.fabs(z4)) + z3)) * (z0 - (((-0.5 - (((0.25 * z0) - -0.3333333333333333) * z0)) * z0) * z0)))
	else:
		tmp = (z0 / (t_0 + (z3 / (math.fabs(z4) * math.fabs(z4))))) * ((((((z0 * 0.25) - -0.3333333333333333) * z0) - -0.5) * z0) - -1.0)
	return tmp
function code(z0, z3, z4, z1, z2)
	t_0 = Float64(z1 / Float64(z2 * z2))
	tmp = 0.0
	if (abs(z4) <= 9e-8)
		tmp = Float64(abs(z4) * Float64(Float64(abs(z4) / Float64(Float64(Float64(t_0 * abs(z4)) * abs(z4)) + z3)) * Float64(z0 - Float64(Float64(Float64(-0.5 - Float64(Float64(Float64(0.25 * z0) - -0.3333333333333333) * z0)) * z0) * z0))));
	else
		tmp = Float64(Float64(z0 / Float64(t_0 + Float64(z3 / Float64(abs(z4) * abs(z4))))) * Float64(Float64(Float64(Float64(Float64(Float64(z0 * 0.25) - -0.3333333333333333) * z0) - -0.5) * z0) - -1.0));
	end
	return tmp
end
function tmp_2 = code(z0, z3, z4, z1, z2)
	t_0 = z1 / (z2 * z2);
	tmp = 0.0;
	if (abs(z4) <= 9e-8)
		tmp = abs(z4) * ((abs(z4) / (((t_0 * abs(z4)) * abs(z4)) + z3)) * (z0 - (((-0.5 - (((0.25 * z0) - -0.3333333333333333) * z0)) * z0) * z0)));
	else
		tmp = (z0 / (t_0 + (z3 / (abs(z4) * abs(z4))))) * ((((((z0 * 0.25) - -0.3333333333333333) * z0) - -0.5) * z0) - -1.0);
	end
	tmp_2 = tmp;
end
code[z0_, z3_, z4_, z1_, z2_] := Block[{t$95$0 = N[(z1 / N[(z2 * z2), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[z4], $MachinePrecision], 9e-8], N[(N[Abs[z4], $MachinePrecision] * N[(N[(N[Abs[z4], $MachinePrecision] / N[(N[(N[(t$95$0 * N[Abs[z4], $MachinePrecision]), $MachinePrecision] * N[Abs[z4], $MachinePrecision]), $MachinePrecision] + z3), $MachinePrecision]), $MachinePrecision] * N[(z0 - N[(N[(N[(-0.5 - N[(N[(N[(0.25 * z0), $MachinePrecision] - -0.3333333333333333), $MachinePrecision] * z0), $MachinePrecision]), $MachinePrecision] * z0), $MachinePrecision] * z0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z0 / N[(t$95$0 + N[(z3 / N[(N[Abs[z4], $MachinePrecision] * N[Abs[z4], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(N[(N[(z0 * 0.25), $MachinePrecision] - -0.3333333333333333), $MachinePrecision] * z0), $MachinePrecision] - -0.5), $MachinePrecision] * z0), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \frac{z1}{z2 \cdot z2}\\
\mathbf{if}\;\left|z4\right| \leq 9 \cdot 10^{-8}:\\
\;\;\;\;\left|z4\right| \cdot \left(\frac{\left|z4\right|}{\left(t\_0 \cdot \left|z4\right|\right) \cdot \left|z4\right| + z3} \cdot \left(z0 - \left(\left(-0.5 - \left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0\right) \cdot z0\right) \cdot z0\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{z0}{t\_0 + \frac{z3}{\left|z4\right| \cdot \left|z4\right|}} \cdot \left(\left(\left(z0 \cdot 0.25 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot z0 - -1\right)\\


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z4 < 8.9999999999999999e-8

    1. Initial program 66.3%

      \[\frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}} \]
    2. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{z1}{z2 \cdot z2}}} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{\color{blue}{z2 \cdot z2}}} \]
      3. associate-/r*N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\frac{z1}{z2}}{z2}}} \]
      4. lower-/.f64N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\frac{z1}{z2}}{z2}}} \]
      5. lower-/.f6470.6%

        \[\leadsto \frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{\color{blue}{\frac{z1}{z2}}}{z2}} \]
    3. Applied rewrites70.6%

      \[\leadsto \frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\frac{z1}{z2}}{z2}}} \]
    4. Step-by-step derivation
      1. lift-+.f64N/A

        \[\leadsto \frac{\color{blue}{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}}{\frac{z3}{z4 \cdot z4} + \frac{\frac{z1}{z2}}{z2}} \]
      2. +-commutativeN/A

        \[\leadsto \frac{\color{blue}{z0 + \left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right)}}{\frac{z3}{z4 \cdot z4} + \frac{\frac{z1}{z2}}{z2}} \]
      3. add-flipN/A

        \[\leadsto \frac{\color{blue}{z0 - \left(\mathsf{neg}\left(\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right)\right)\right)}}{\frac{z3}{z4 \cdot z4} + \frac{\frac{z1}{z2}}{z2}} \]
      4. lift-*.f64N/A

        \[\leadsto \frac{z0 - \left(\mathsf{neg}\left(\color{blue}{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right)}\right)\right)}{\frac{z3}{z4 \cdot z4} + \frac{\frac{z1}{z2}}{z2}} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{z0 - \left(\mathsf{neg}\left(\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \color{blue}{\left(z0 \cdot z0\right)}\right)\right)}{\frac{z3}{z4 \cdot z4} + \frac{\frac{z1}{z2}}{z2}} \]
      6. associate-*r*N/A

        \[\leadsto \frac{z0 - \left(\mathsf{neg}\left(\color{blue}{\left(\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0\right) \cdot z0}\right)\right)}{\frac{z3}{z4 \cdot z4} + \frac{\frac{z1}{z2}}{z2}} \]
      7. lift-*.f64N/A

        \[\leadsto \frac{z0 - \left(\mathsf{neg}\left(\left(\left(\left(\color{blue}{\frac{1}{4} \cdot z0} - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0\right) \cdot z0\right)\right)}{\frac{z3}{z4 \cdot z4} + \frac{\frac{z1}{z2}}{z2}} \]
      8. *-commutativeN/A

        \[\leadsto \frac{z0 - \left(\mathsf{neg}\left(\left(\left(\left(\color{blue}{z0 \cdot \frac{1}{4}} - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0\right) \cdot z0\right)\right)}{\frac{z3}{z4 \cdot z4} + \frac{\frac{z1}{z2}}{z2}} \]
      9. lift-*.f64N/A

        \[\leadsto \frac{z0 - \left(\mathsf{neg}\left(\left(\left(\left(\color{blue}{z0 \cdot \frac{1}{4}} - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0\right) \cdot z0\right)\right)}{\frac{z3}{z4 \cdot z4} + \frac{\frac{z1}{z2}}{z2}} \]
      10. lift-*.f64N/A

        \[\leadsto \frac{z0 - \left(\mathsf{neg}\left(\color{blue}{\left(\left(\left(z0 \cdot \frac{1}{4} - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0\right)} \cdot z0\right)\right)}{\frac{z3}{z4 \cdot z4} + \frac{\frac{z1}{z2}}{z2}} \]
      11. lift-*.f64N/A

        \[\leadsto \frac{z0 - \left(\mathsf{neg}\left(\color{blue}{\left(\left(\left(z0 \cdot \frac{1}{4} - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0\right) \cdot z0}\right)\right)}{\frac{z3}{z4 \cdot z4} + \frac{\frac{z1}{z2}}{z2}} \]
      12. lower--.f64N/A

        \[\leadsto \frac{\color{blue}{z0 - \left(\mathsf{neg}\left(\left(\left(\left(z0 \cdot \frac{1}{4} - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0\right) \cdot z0\right)\right)}}{\frac{z3}{z4 \cdot z4} + \frac{\frac{z1}{z2}}{z2}} \]
      13. lift-*.f64N/A

        \[\leadsto \frac{z0 - \left(\mathsf{neg}\left(\color{blue}{\left(\left(\left(z0 \cdot \frac{1}{4} - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot z0\right) \cdot z0}\right)\right)}{\frac{z3}{z4 \cdot z4} + \frac{\frac{z1}{z2}}{z2}} \]
    5. Applied rewrites70.6%

      \[\leadsto \frac{\color{blue}{z0 - \left(\left(-0.5 - \left(z0 \cdot 0.25 - -0.3333333333333333\right) \cdot z0\right) \cdot z0\right) \cdot z0}}{\frac{z3}{z4 \cdot z4} + \frac{\frac{z1}{z2}}{z2}} \]
    6. Applied rewrites68.0%

      \[\leadsto \color{blue}{z4 \cdot \left(\frac{z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3} \cdot \left(z0 - \left(\left(-0.5 - \left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0\right) \cdot z0\right) \cdot z0\right)\right)} \]

    if 8.9999999999999999e-8 < z4

    1. Initial program 66.3%

      \[\frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}} \]
    2. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{z1}{z2 \cdot z2}}} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{\color{blue}{z2 \cdot z2}}} \]
      3. associate-/r*N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\frac{z1}{z2}}{z2}}} \]
      4. lower-/.f64N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\frac{z1}{z2}}{z2}}} \]
      5. lower-/.f6470.6%

        \[\leadsto \frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{\color{blue}{\frac{z1}{z2}}}{z2}} \]
    3. Applied rewrites70.6%

      \[\leadsto \frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\frac{z1}{z2}}{z2}}} \]
    4. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{\frac{z1}{z2}}{z2}}} \]
      2. lift-+.f64N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\color{blue}{\frac{z3}{z4 \cdot z4} + \frac{\frac{z1}{z2}}{z2}}} \]
      3. lift-/.f64N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\frac{z1}{z2}}{z2}}} \]
      4. lift-/.f64N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{\color{blue}{\frac{z1}{z2}}}{z2}} \]
      5. associate-/l/N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{z1}{z2 \cdot z2}}} \]
      6. lift-*.f64N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{\color{blue}{z2 \cdot z2}}} \]
      7. lift-/.f64N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{z1}{z2 \cdot z2}}} \]
      8. +-commutativeN/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\color{blue}{\frac{z1}{z2 \cdot z2} + \frac{z3}{z4 \cdot z4}}} \]
      9. lift-+.f64N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\color{blue}{\frac{z1}{z2 \cdot z2} + \frac{z3}{z4 \cdot z4}}} \]
    5. Applied rewrites67.3%

      \[\leadsto \color{blue}{\frac{z0}{\frac{z1}{z2 \cdot z2} + \frac{z3}{z4 \cdot z4}} \cdot \left(\left(\left(z0 \cdot 0.25 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot z0 - -1\right)} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 7: 73.4% accurate, 0.5× speedup?

\[\begin{array}{l} t_0 := \frac{z3}{z4 \cdot z4}\\ t_1 := \frac{z1}{z2 \cdot z2}\\ \mathbf{if}\;\frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{t\_0 + t\_1} \leq \infty:\\ \;\;\;\;\frac{z0}{t\_1 + t\_0} \cdot \left(\left(\left(z0 \cdot 0.25 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot z0 - -1\right)\\ \mathbf{else}:\\ \;\;\;\;\left(-\left(\left(-0.5 \cdot z0 - 1\right) \cdot z0\right) \cdot \frac{z4}{\left(z4 \cdot t\_1\right) \cdot z4 + z3}\right) \cdot z4\\ \end{array} \]
(FPCore (z0 z3 z4 z1 z2)
  :precision binary64
  (let* ((t_0 (/ z3 (* z4 z4))) (t_1 (/ z1 (* z2 z2))))
  (if (<=
       (/
        (+
         (*
          (- (* (- (* 0.25 z0) -0.3333333333333333) z0) -0.5)
          (* z0 z0))
         z0)
        (+ t_0 t_1))
       INFINITY)
    (*
     (/ z0 (+ t_1 t_0))
     (-
      (* (- (* (- (* z0 0.25) -0.3333333333333333) z0) -0.5) z0)
      -1.0))
    (*
     (-
      (* (* (- (* -0.5 z0) 1.0) z0) (/ z4 (+ (* (* z4 t_1) z4) z3))))
     z4))))
double code(double z0, double z3, double z4, double z1, double z2) {
	double t_0 = z3 / (z4 * z4);
	double t_1 = z1 / (z2 * z2);
	double tmp;
	if ((((((((0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * (z0 * z0)) + z0) / (t_0 + t_1)) <= ((double) INFINITY)) {
		tmp = (z0 / (t_1 + t_0)) * ((((((z0 * 0.25) - -0.3333333333333333) * z0) - -0.5) * z0) - -1.0);
	} else {
		tmp = -((((-0.5 * z0) - 1.0) * z0) * (z4 / (((z4 * t_1) * z4) + z3))) * z4;
	}
	return tmp;
}
public static double code(double z0, double z3, double z4, double z1, double z2) {
	double t_0 = z3 / (z4 * z4);
	double t_1 = z1 / (z2 * z2);
	double tmp;
	if ((((((((0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * (z0 * z0)) + z0) / (t_0 + t_1)) <= Double.POSITIVE_INFINITY) {
		tmp = (z0 / (t_1 + t_0)) * ((((((z0 * 0.25) - -0.3333333333333333) * z0) - -0.5) * z0) - -1.0);
	} else {
		tmp = -((((-0.5 * z0) - 1.0) * z0) * (z4 / (((z4 * t_1) * z4) + z3))) * z4;
	}
	return tmp;
}
def code(z0, z3, z4, z1, z2):
	t_0 = z3 / (z4 * z4)
	t_1 = z1 / (z2 * z2)
	tmp = 0
	if (((((((0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * (z0 * z0)) + z0) / (t_0 + t_1)) <= math.inf:
		tmp = (z0 / (t_1 + t_0)) * ((((((z0 * 0.25) - -0.3333333333333333) * z0) - -0.5) * z0) - -1.0)
	else:
		tmp = -((((-0.5 * z0) - 1.0) * z0) * (z4 / (((z4 * t_1) * z4) + z3))) * z4
	return tmp
function code(z0, z3, z4, z1, z2)
	t_0 = Float64(z3 / Float64(z4 * z4))
	t_1 = Float64(z1 / Float64(z2 * z2))
	tmp = 0.0
	if (Float64(Float64(Float64(Float64(Float64(Float64(Float64(0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * Float64(z0 * z0)) + z0) / Float64(t_0 + t_1)) <= Inf)
		tmp = Float64(Float64(z0 / Float64(t_1 + t_0)) * Float64(Float64(Float64(Float64(Float64(Float64(z0 * 0.25) - -0.3333333333333333) * z0) - -0.5) * z0) - -1.0));
	else
		tmp = Float64(Float64(-Float64(Float64(Float64(Float64(-0.5 * z0) - 1.0) * z0) * Float64(z4 / Float64(Float64(Float64(z4 * t_1) * z4) + z3)))) * z4);
	end
	return tmp
end
function tmp_2 = code(z0, z3, z4, z1, z2)
	t_0 = z3 / (z4 * z4);
	t_1 = z1 / (z2 * z2);
	tmp = 0.0;
	if ((((((((0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * (z0 * z0)) + z0) / (t_0 + t_1)) <= Inf)
		tmp = (z0 / (t_1 + t_0)) * ((((((z0 * 0.25) - -0.3333333333333333) * z0) - -0.5) * z0) - -1.0);
	else
		tmp = -((((-0.5 * z0) - 1.0) * z0) * (z4 / (((z4 * t_1) * z4) + z3))) * z4;
	end
	tmp_2 = tmp;
end
code[z0_, z3_, z4_, z1_, z2_] := Block[{t$95$0 = N[(z3 / N[(z4 * z4), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(z1 / N[(z2 * z2), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(N[(N[(N[(N[(N[(0.25 * z0), $MachinePrecision] - -0.3333333333333333), $MachinePrecision] * z0), $MachinePrecision] - -0.5), $MachinePrecision] * N[(z0 * z0), $MachinePrecision]), $MachinePrecision] + z0), $MachinePrecision] / N[(t$95$0 + t$95$1), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(z0 / N[(t$95$1 + t$95$0), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(N[(N[(z0 * 0.25), $MachinePrecision] - -0.3333333333333333), $MachinePrecision] * z0), $MachinePrecision] - -0.5), $MachinePrecision] * z0), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision], N[((-N[(N[(N[(N[(-0.5 * z0), $MachinePrecision] - 1.0), $MachinePrecision] * z0), $MachinePrecision] * N[(z4 / N[(N[(N[(z4 * t$95$1), $MachinePrecision] * z4), $MachinePrecision] + z3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) * z4), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \frac{z3}{z4 \cdot z4}\\
t_1 := \frac{z1}{z2 \cdot z2}\\
\mathbf{if}\;\frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{t\_0 + t\_1} \leq \infty:\\
\;\;\;\;\frac{z0}{t\_1 + t\_0} \cdot \left(\left(\left(z0 \cdot 0.25 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot z0 - -1\right)\\

\mathbf{else}:\\
\;\;\;\;\left(-\left(\left(-0.5 \cdot z0 - 1\right) \cdot z0\right) \cdot \frac{z4}{\left(z4 \cdot t\_1\right) \cdot z4 + z3}\right) \cdot z4\\


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (+.f64 (*.f64 (-.f64 (*.f64 (-.f64 (*.f64 #s(literal 1/4 binary64) z0) #s(literal -3333333333333333/10000000000000000 binary64)) z0) #s(literal -1/2 binary64)) (*.f64 z0 z0)) z0) (+.f64 (/.f64 z3 (*.f64 z4 z4)) (/.f64 z1 (*.f64 z2 z2)))) < +inf.0

    1. Initial program 66.3%

      \[\frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}} \]
    2. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{z1}{z2 \cdot z2}}} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{\color{blue}{z2 \cdot z2}}} \]
      3. associate-/r*N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\frac{z1}{z2}}{z2}}} \]
      4. lower-/.f64N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\frac{z1}{z2}}{z2}}} \]
      5. lower-/.f6470.6%

        \[\leadsto \frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{\color{blue}{\frac{z1}{z2}}}{z2}} \]
    3. Applied rewrites70.6%

      \[\leadsto \frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\frac{z1}{z2}}{z2}}} \]
    4. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{\frac{z1}{z2}}{z2}}} \]
      2. lift-+.f64N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\color{blue}{\frac{z3}{z4 \cdot z4} + \frac{\frac{z1}{z2}}{z2}}} \]
      3. lift-/.f64N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\frac{z1}{z2}}{z2}}} \]
      4. lift-/.f64N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{\color{blue}{\frac{z1}{z2}}}{z2}} \]
      5. associate-/l/N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{z1}{z2 \cdot z2}}} \]
      6. lift-*.f64N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{\color{blue}{z2 \cdot z2}}} \]
      7. lift-/.f64N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{z1}{z2 \cdot z2}}} \]
      8. +-commutativeN/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\color{blue}{\frac{z1}{z2 \cdot z2} + \frac{z3}{z4 \cdot z4}}} \]
      9. lift-+.f64N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\color{blue}{\frac{z1}{z2 \cdot z2} + \frac{z3}{z4 \cdot z4}}} \]
    5. Applied rewrites67.3%

      \[\leadsto \color{blue}{\frac{z0}{\frac{z1}{z2 \cdot z2} + \frac{z3}{z4 \cdot z4}} \cdot \left(\left(\left(z0 \cdot 0.25 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot z0 - -1\right)} \]

    if +inf.0 < (/.f64 (+.f64 (*.f64 (-.f64 (*.f64 (-.f64 (*.f64 #s(literal 1/4 binary64) z0) #s(literal -3333333333333333/10000000000000000 binary64)) z0) #s(literal -1/2 binary64)) (*.f64 z0 z0)) z0) (+.f64 (/.f64 z3 (*.f64 z4 z4)) (/.f64 z1 (*.f64 z2 z2))))

    1. Initial program 66.3%

      \[\frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}} \]
    2. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}}} \]
      2. frac-2negN/A

        \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\left(\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0\right)\right)}{\mathsf{neg}\left(\left(\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}\right)\right)}} \]
      3. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\left(\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0\right)\right)}{\mathsf{neg}\left(\left(\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}\right)\right)}} \]
    3. Applied rewrites66.0%

      \[\leadsto \color{blue}{\frac{\left(-z0\right) - \left(\left(\left(z0 \cdot 0.25 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot z0\right) \cdot z0}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}}} \]
    4. Taylor expanded in z0 around 0

      \[\leadsto \frac{\color{blue}{z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)}}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
    5. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \frac{z0 \cdot \color{blue}{\left(\frac{-1}{2} \cdot z0 - 1\right)}}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
      2. lower--.f64N/A

        \[\leadsto \frac{z0 \cdot \left(\frac{-1}{2} \cdot z0 - \color{blue}{1}\right)}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
      3. lower-*.f6459.9%

        \[\leadsto \frac{z0 \cdot \left(-0.5 \cdot z0 - 1\right)}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
    6. Applied rewrites59.9%

      \[\leadsto \frac{\color{blue}{z0 \cdot \left(-0.5 \cdot z0 - 1\right)}}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
    7. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}}} \]
      2. frac-2negN/A

        \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)}{\mathsf{neg}\left(\left(\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}\right)\right)}} \]
      3. mult-flipN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\mathsf{neg}\left(\left(\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}\right)\right)}} \]
      4. lift--.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\mathsf{neg}\left(\color{blue}{\left(\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}\right)}\right)} \]
      5. sub-negate-revN/A

        \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\color{blue}{\frac{z3}{z4 \cdot z4} - \frac{z1}{\left(-z2\right) \cdot z2}}} \]
      6. lift-/.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} - \color{blue}{\frac{z1}{\left(-z2\right) \cdot z2}}} \]
      7. mult-flipN/A

        \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} - \color{blue}{z1 \cdot \frac{1}{\left(-z2\right) \cdot z2}}} \]
      8. fp-cancel-sub-sign-invN/A

        \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\color{blue}{\frac{z3}{z4 \cdot z4} + \left(\mathsf{neg}\left(z1\right)\right) \cdot \frac{1}{\left(-z2\right) \cdot z2}}} \]
      9. mult-flipN/A

        \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\mathsf{neg}\left(z1\right)}{\left(-z2\right) \cdot z2}}} \]
      10. lift-*.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} + \frac{\mathsf{neg}\left(z1\right)}{\color{blue}{\left(-z2\right) \cdot z2}}} \]
      11. lift-neg.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} + \frac{\mathsf{neg}\left(z1\right)}{\color{blue}{\left(\mathsf{neg}\left(z2\right)\right)} \cdot z2}} \]
      12. distribute-lft-neg-outN/A

        \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} + \frac{\mathsf{neg}\left(z1\right)}{\color{blue}{\mathsf{neg}\left(z2 \cdot z2\right)}}} \]
      13. lift-*.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} + \frac{\mathsf{neg}\left(z1\right)}{\mathsf{neg}\left(\color{blue}{z2 \cdot z2}\right)}} \]
    8. Applied rewrites60.0%

      \[\leadsto \color{blue}{\left(-\left(-0.5 \cdot z0 - 1\right) \cdot z0\right) \cdot \left(\frac{z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3} \cdot z4\right)} \]
    9. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(-\left(\frac{-1}{2} \cdot z0 - 1\right) \cdot z0\right) \cdot \left(\frac{z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3} \cdot z4\right)} \]
      2. lift-*.f64N/A

        \[\leadsto \left(-\left(\frac{-1}{2} \cdot z0 - 1\right) \cdot z0\right) \cdot \color{blue}{\left(\frac{z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3} \cdot z4\right)} \]
      3. associate-*r*N/A

        \[\leadsto \color{blue}{\left(\left(-\left(\frac{-1}{2} \cdot z0 - 1\right) \cdot z0\right) \cdot \frac{z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3}\right) \cdot z4} \]
      4. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(\left(-\left(\frac{-1}{2} \cdot z0 - 1\right) \cdot z0\right) \cdot \frac{z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3}\right) \cdot z4} \]
    10. Applied rewrites62.5%

      \[\leadsto \color{blue}{\left(-\left(\left(-0.5 \cdot z0 - 1\right) \cdot z0\right) \cdot \frac{z4}{\left(z4 \cdot \frac{z1}{z2 \cdot z2}\right) \cdot z4 + z3}\right) \cdot z4} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 8: 69.4% accurate, 0.9× speedup?

\[\begin{array}{l} \mathbf{if}\;\left|z4\right| \leq 10^{-44}:\\ \;\;\;\;\left(-\left(\left(-0.5 \cdot z0 - 1\right) \cdot z0\right) \cdot \frac{\left|z4\right|}{\left(\left|z4\right| \cdot \frac{z1}{z2 \cdot z2}\right) \cdot \left|z4\right| + z3}\right) \cdot \left|z4\right|\\ \mathbf{else}:\\ \;\;\;\;\frac{z0 \cdot \left(1 + 0.5 \cdot z0\right)}{\frac{z3}{\left|z4\right| \cdot \left|z4\right|} + \frac{\frac{z1}{z2}}{z2}}\\ \end{array} \]
(FPCore (z0 z3 z4 z1 z2)
  :precision binary64
  (if (<= (fabs z4) 1e-44)
  (*
   (-
    (*
     (* (- (* -0.5 z0) 1.0) z0)
     (/
      (fabs z4)
      (+ (* (* (fabs z4) (/ z1 (* z2 z2))) (fabs z4)) z3))))
   (fabs z4))
  (/
   (* z0 (+ 1.0 (* 0.5 z0)))
   (+ (/ z3 (* (fabs z4) (fabs z4))) (/ (/ z1 z2) z2)))))
double code(double z0, double z3, double z4, double z1, double z2) {
	double tmp;
	if (fabs(z4) <= 1e-44) {
		tmp = -((((-0.5 * z0) - 1.0) * z0) * (fabs(z4) / (((fabs(z4) * (z1 / (z2 * z2))) * fabs(z4)) + z3))) * fabs(z4);
	} else {
		tmp = (z0 * (1.0 + (0.5 * z0))) / ((z3 / (fabs(z4) * fabs(z4))) + ((z1 / z2) / z2));
	}
	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(z0, z3, z4, z1, z2)
use fmin_fmax_functions
    real(8), intent (in) :: z0
    real(8), intent (in) :: z3
    real(8), intent (in) :: z4
    real(8), intent (in) :: z1
    real(8), intent (in) :: z2
    real(8) :: tmp
    if (abs(z4) <= 1d-44) then
        tmp = -(((((-0.5d0) * z0) - 1.0d0) * z0) * (abs(z4) / (((abs(z4) * (z1 / (z2 * z2))) * abs(z4)) + z3))) * abs(z4)
    else
        tmp = (z0 * (1.0d0 + (0.5d0 * z0))) / ((z3 / (abs(z4) * abs(z4))) + ((z1 / z2) / z2))
    end if
    code = tmp
end function
public static double code(double z0, double z3, double z4, double z1, double z2) {
	double tmp;
	if (Math.abs(z4) <= 1e-44) {
		tmp = -((((-0.5 * z0) - 1.0) * z0) * (Math.abs(z4) / (((Math.abs(z4) * (z1 / (z2 * z2))) * Math.abs(z4)) + z3))) * Math.abs(z4);
	} else {
		tmp = (z0 * (1.0 + (0.5 * z0))) / ((z3 / (Math.abs(z4) * Math.abs(z4))) + ((z1 / z2) / z2));
	}
	return tmp;
}
def code(z0, z3, z4, z1, z2):
	tmp = 0
	if math.fabs(z4) <= 1e-44:
		tmp = -((((-0.5 * z0) - 1.0) * z0) * (math.fabs(z4) / (((math.fabs(z4) * (z1 / (z2 * z2))) * math.fabs(z4)) + z3))) * math.fabs(z4)
	else:
		tmp = (z0 * (1.0 + (0.5 * z0))) / ((z3 / (math.fabs(z4) * math.fabs(z4))) + ((z1 / z2) / z2))
	return tmp
function code(z0, z3, z4, z1, z2)
	tmp = 0.0
	if (abs(z4) <= 1e-44)
		tmp = Float64(Float64(-Float64(Float64(Float64(Float64(-0.5 * z0) - 1.0) * z0) * Float64(abs(z4) / Float64(Float64(Float64(abs(z4) * Float64(z1 / Float64(z2 * z2))) * abs(z4)) + z3)))) * abs(z4));
	else
		tmp = Float64(Float64(z0 * Float64(1.0 + Float64(0.5 * z0))) / Float64(Float64(z3 / Float64(abs(z4) * abs(z4))) + Float64(Float64(z1 / z2) / z2)));
	end
	return tmp
end
function tmp_2 = code(z0, z3, z4, z1, z2)
	tmp = 0.0;
	if (abs(z4) <= 1e-44)
		tmp = -((((-0.5 * z0) - 1.0) * z0) * (abs(z4) / (((abs(z4) * (z1 / (z2 * z2))) * abs(z4)) + z3))) * abs(z4);
	else
		tmp = (z0 * (1.0 + (0.5 * z0))) / ((z3 / (abs(z4) * abs(z4))) + ((z1 / z2) / z2));
	end
	tmp_2 = tmp;
end
code[z0_, z3_, z4_, z1_, z2_] := If[LessEqual[N[Abs[z4], $MachinePrecision], 1e-44], N[((-N[(N[(N[(N[(-0.5 * z0), $MachinePrecision] - 1.0), $MachinePrecision] * z0), $MachinePrecision] * N[(N[Abs[z4], $MachinePrecision] / N[(N[(N[(N[Abs[z4], $MachinePrecision] * N[(z1 / N[(z2 * z2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Abs[z4], $MachinePrecision]), $MachinePrecision] + z3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) * N[Abs[z4], $MachinePrecision]), $MachinePrecision], N[(N[(z0 * N[(1.0 + N[(0.5 * z0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(z3 / N[(N[Abs[z4], $MachinePrecision] * N[Abs[z4], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(z1 / z2), $MachinePrecision] / z2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\left|z4\right| \leq 10^{-44}:\\
\;\;\;\;\left(-\left(\left(-0.5 \cdot z0 - 1\right) \cdot z0\right) \cdot \frac{\left|z4\right|}{\left(\left|z4\right| \cdot \frac{z1}{z2 \cdot z2}\right) \cdot \left|z4\right| + z3}\right) \cdot \left|z4\right|\\

\mathbf{else}:\\
\;\;\;\;\frac{z0 \cdot \left(1 + 0.5 \cdot z0\right)}{\frac{z3}{\left|z4\right| \cdot \left|z4\right|} + \frac{\frac{z1}{z2}}{z2}}\\


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z4 < 9.9999999999999995e-45

    1. Initial program 66.3%

      \[\frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}} \]
    2. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}}} \]
      2. frac-2negN/A

        \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\left(\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0\right)\right)}{\mathsf{neg}\left(\left(\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}\right)\right)}} \]
      3. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\left(\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0\right)\right)}{\mathsf{neg}\left(\left(\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}\right)\right)}} \]
    3. Applied rewrites66.0%

      \[\leadsto \color{blue}{\frac{\left(-z0\right) - \left(\left(\left(z0 \cdot 0.25 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot z0\right) \cdot z0}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}}} \]
    4. Taylor expanded in z0 around 0

      \[\leadsto \frac{\color{blue}{z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)}}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
    5. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \frac{z0 \cdot \color{blue}{\left(\frac{-1}{2} \cdot z0 - 1\right)}}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
      2. lower--.f64N/A

        \[\leadsto \frac{z0 \cdot \left(\frac{-1}{2} \cdot z0 - \color{blue}{1}\right)}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
      3. lower-*.f6459.9%

        \[\leadsto \frac{z0 \cdot \left(-0.5 \cdot z0 - 1\right)}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
    6. Applied rewrites59.9%

      \[\leadsto \frac{\color{blue}{z0 \cdot \left(-0.5 \cdot z0 - 1\right)}}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
    7. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}}} \]
      2. frac-2negN/A

        \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)}{\mathsf{neg}\left(\left(\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}\right)\right)}} \]
      3. mult-flipN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\mathsf{neg}\left(\left(\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}\right)\right)}} \]
      4. lift--.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\mathsf{neg}\left(\color{blue}{\left(\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}\right)}\right)} \]
      5. sub-negate-revN/A

        \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\color{blue}{\frac{z3}{z4 \cdot z4} - \frac{z1}{\left(-z2\right) \cdot z2}}} \]
      6. lift-/.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} - \color{blue}{\frac{z1}{\left(-z2\right) \cdot z2}}} \]
      7. mult-flipN/A

        \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} - \color{blue}{z1 \cdot \frac{1}{\left(-z2\right) \cdot z2}}} \]
      8. fp-cancel-sub-sign-invN/A

        \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\color{blue}{\frac{z3}{z4 \cdot z4} + \left(\mathsf{neg}\left(z1\right)\right) \cdot \frac{1}{\left(-z2\right) \cdot z2}}} \]
      9. mult-flipN/A

        \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\mathsf{neg}\left(z1\right)}{\left(-z2\right) \cdot z2}}} \]
      10. lift-*.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} + \frac{\mathsf{neg}\left(z1\right)}{\color{blue}{\left(-z2\right) \cdot z2}}} \]
      11. lift-neg.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} + \frac{\mathsf{neg}\left(z1\right)}{\color{blue}{\left(\mathsf{neg}\left(z2\right)\right)} \cdot z2}} \]
      12. distribute-lft-neg-outN/A

        \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} + \frac{\mathsf{neg}\left(z1\right)}{\color{blue}{\mathsf{neg}\left(z2 \cdot z2\right)}}} \]
      13. lift-*.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} + \frac{\mathsf{neg}\left(z1\right)}{\mathsf{neg}\left(\color{blue}{z2 \cdot z2}\right)}} \]
    8. Applied rewrites60.0%

      \[\leadsto \color{blue}{\left(-\left(-0.5 \cdot z0 - 1\right) \cdot z0\right) \cdot \left(\frac{z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3} \cdot z4\right)} \]
    9. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(-\left(\frac{-1}{2} \cdot z0 - 1\right) \cdot z0\right) \cdot \left(\frac{z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3} \cdot z4\right)} \]
      2. lift-*.f64N/A

        \[\leadsto \left(-\left(\frac{-1}{2} \cdot z0 - 1\right) \cdot z0\right) \cdot \color{blue}{\left(\frac{z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3} \cdot z4\right)} \]
      3. associate-*r*N/A

        \[\leadsto \color{blue}{\left(\left(-\left(\frac{-1}{2} \cdot z0 - 1\right) \cdot z0\right) \cdot \frac{z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3}\right) \cdot z4} \]
      4. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(\left(-\left(\frac{-1}{2} \cdot z0 - 1\right) \cdot z0\right) \cdot \frac{z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3}\right) \cdot z4} \]
    10. Applied rewrites62.5%

      \[\leadsto \color{blue}{\left(-\left(\left(-0.5 \cdot z0 - 1\right) \cdot z0\right) \cdot \frac{z4}{\left(z4 \cdot \frac{z1}{z2 \cdot z2}\right) \cdot z4 + z3}\right) \cdot z4} \]

    if 9.9999999999999995e-45 < z4

    1. Initial program 66.3%

      \[\frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}} \]
    2. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{z1}{z2 \cdot z2}}} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{\color{blue}{z2 \cdot z2}}} \]
      3. associate-/r*N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\frac{z1}{z2}}{z2}}} \]
      4. lower-/.f64N/A

        \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\frac{z1}{z2}}{z2}}} \]
      5. lower-/.f6470.6%

        \[\leadsto \frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{\color{blue}{\frac{z1}{z2}}}{z2}} \]
    3. Applied rewrites70.6%

      \[\leadsto \frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\frac{z1}{z2}}{z2}}} \]
    4. Taylor expanded in z0 around 0

      \[\leadsto \frac{\color{blue}{z0 \cdot \left(1 + \frac{1}{2} \cdot z0\right)}}{\frac{z3}{z4 \cdot z4} + \frac{\frac{z1}{z2}}{z2}} \]
    5. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \frac{z0 \cdot \color{blue}{\left(1 + \frac{1}{2} \cdot z0\right)}}{\frac{z3}{z4 \cdot z4} + \frac{\frac{z1}{z2}}{z2}} \]
      2. lower-+.f64N/A

        \[\leadsto \frac{z0 \cdot \left(1 + \color{blue}{\frac{1}{2} \cdot z0}\right)}{\frac{z3}{z4 \cdot z4} + \frac{\frac{z1}{z2}}{z2}} \]
      3. lower-*.f6463.6%

        \[\leadsto \frac{z0 \cdot \left(1 + 0.5 \cdot \color{blue}{z0}\right)}{\frac{z3}{z4 \cdot z4} + \frac{\frac{z1}{z2}}{z2}} \]
    6. Applied rewrites63.6%

      \[\leadsto \frac{\color{blue}{z0 \cdot \left(1 + 0.5 \cdot z0\right)}}{\frac{z3}{z4 \cdot z4} + \frac{\frac{z1}{z2}}{z2}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 9: 69.3% accurate, 0.9× speedup?

\[\begin{array}{l} \mathbf{if}\;\left|z4\right| \leq 5 \cdot 10^{-17}:\\ \;\;\;\;\left(-\left(\left(-0.5 \cdot z0 - 1\right) \cdot z0\right) \cdot \frac{\left|z4\right|}{\left(\left|z4\right| \cdot \frac{z1}{z2 \cdot z2}\right) \cdot \left|z4\right| + z3}\right) \cdot \left|z4\right|\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(0.5 \cdot z0 + 1\right) \cdot z0}{z2 \cdot \frac{z3}{\left|z4\right| \cdot \left|z4\right|} + \frac{z1}{z2}} \cdot z2\\ \end{array} \]
(FPCore (z0 z3 z4 z1 z2)
  :precision binary64
  (if (<= (fabs z4) 5e-17)
  (*
   (-
    (*
     (* (- (* -0.5 z0) 1.0) z0)
     (/
      (fabs z4)
      (+ (* (* (fabs z4) (/ z1 (* z2 z2))) (fabs z4)) z3))))
   (fabs z4))
  (*
   (/
    (* (+ (* 0.5 z0) 1.0) z0)
    (+ (* z2 (/ z3 (* (fabs z4) (fabs z4)))) (/ z1 z2)))
   z2)))
double code(double z0, double z3, double z4, double z1, double z2) {
	double tmp;
	if (fabs(z4) <= 5e-17) {
		tmp = -((((-0.5 * z0) - 1.0) * z0) * (fabs(z4) / (((fabs(z4) * (z1 / (z2 * z2))) * fabs(z4)) + z3))) * fabs(z4);
	} else {
		tmp = ((((0.5 * z0) + 1.0) * z0) / ((z2 * (z3 / (fabs(z4) * fabs(z4)))) + (z1 / z2))) * z2;
	}
	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(z0, z3, z4, z1, z2)
use fmin_fmax_functions
    real(8), intent (in) :: z0
    real(8), intent (in) :: z3
    real(8), intent (in) :: z4
    real(8), intent (in) :: z1
    real(8), intent (in) :: z2
    real(8) :: tmp
    if (abs(z4) <= 5d-17) then
        tmp = -(((((-0.5d0) * z0) - 1.0d0) * z0) * (abs(z4) / (((abs(z4) * (z1 / (z2 * z2))) * abs(z4)) + z3))) * abs(z4)
    else
        tmp = ((((0.5d0 * z0) + 1.0d0) * z0) / ((z2 * (z3 / (abs(z4) * abs(z4)))) + (z1 / z2))) * z2
    end if
    code = tmp
end function
public static double code(double z0, double z3, double z4, double z1, double z2) {
	double tmp;
	if (Math.abs(z4) <= 5e-17) {
		tmp = -((((-0.5 * z0) - 1.0) * z0) * (Math.abs(z4) / (((Math.abs(z4) * (z1 / (z2 * z2))) * Math.abs(z4)) + z3))) * Math.abs(z4);
	} else {
		tmp = ((((0.5 * z0) + 1.0) * z0) / ((z2 * (z3 / (Math.abs(z4) * Math.abs(z4)))) + (z1 / z2))) * z2;
	}
	return tmp;
}
def code(z0, z3, z4, z1, z2):
	tmp = 0
	if math.fabs(z4) <= 5e-17:
		tmp = -((((-0.5 * z0) - 1.0) * z0) * (math.fabs(z4) / (((math.fabs(z4) * (z1 / (z2 * z2))) * math.fabs(z4)) + z3))) * math.fabs(z4)
	else:
		tmp = ((((0.5 * z0) + 1.0) * z0) / ((z2 * (z3 / (math.fabs(z4) * math.fabs(z4)))) + (z1 / z2))) * z2
	return tmp
function code(z0, z3, z4, z1, z2)
	tmp = 0.0
	if (abs(z4) <= 5e-17)
		tmp = Float64(Float64(-Float64(Float64(Float64(Float64(-0.5 * z0) - 1.0) * z0) * Float64(abs(z4) / Float64(Float64(Float64(abs(z4) * Float64(z1 / Float64(z2 * z2))) * abs(z4)) + z3)))) * abs(z4));
	else
		tmp = Float64(Float64(Float64(Float64(Float64(0.5 * z0) + 1.0) * z0) / Float64(Float64(z2 * Float64(z3 / Float64(abs(z4) * abs(z4)))) + Float64(z1 / z2))) * z2);
	end
	return tmp
end
function tmp_2 = code(z0, z3, z4, z1, z2)
	tmp = 0.0;
	if (abs(z4) <= 5e-17)
		tmp = -((((-0.5 * z0) - 1.0) * z0) * (abs(z4) / (((abs(z4) * (z1 / (z2 * z2))) * abs(z4)) + z3))) * abs(z4);
	else
		tmp = ((((0.5 * z0) + 1.0) * z0) / ((z2 * (z3 / (abs(z4) * abs(z4)))) + (z1 / z2))) * z2;
	end
	tmp_2 = tmp;
end
code[z0_, z3_, z4_, z1_, z2_] := If[LessEqual[N[Abs[z4], $MachinePrecision], 5e-17], N[((-N[(N[(N[(N[(-0.5 * z0), $MachinePrecision] - 1.0), $MachinePrecision] * z0), $MachinePrecision] * N[(N[Abs[z4], $MachinePrecision] / N[(N[(N[(N[Abs[z4], $MachinePrecision] * N[(z1 / N[(z2 * z2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Abs[z4], $MachinePrecision]), $MachinePrecision] + z3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) * N[Abs[z4], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(0.5 * z0), $MachinePrecision] + 1.0), $MachinePrecision] * z0), $MachinePrecision] / N[(N[(z2 * N[(z3 / N[(N[Abs[z4], $MachinePrecision] * N[Abs[z4], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(z1 / z2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * z2), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\left|z4\right| \leq 5 \cdot 10^{-17}:\\
\;\;\;\;\left(-\left(\left(-0.5 \cdot z0 - 1\right) \cdot z0\right) \cdot \frac{\left|z4\right|}{\left(\left|z4\right| \cdot \frac{z1}{z2 \cdot z2}\right) \cdot \left|z4\right| + z3}\right) \cdot \left|z4\right|\\

\mathbf{else}:\\
\;\;\;\;\frac{\left(0.5 \cdot z0 + 1\right) \cdot z0}{z2 \cdot \frac{z3}{\left|z4\right| \cdot \left|z4\right|} + \frac{z1}{z2}} \cdot z2\\


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z4 < 4.9999999999999999e-17

    1. Initial program 66.3%

      \[\frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}} \]
    2. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}}} \]
      2. frac-2negN/A

        \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\left(\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0\right)\right)}{\mathsf{neg}\left(\left(\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}\right)\right)}} \]
      3. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\left(\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0\right)\right)}{\mathsf{neg}\left(\left(\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}\right)\right)}} \]
    3. Applied rewrites66.0%

      \[\leadsto \color{blue}{\frac{\left(-z0\right) - \left(\left(\left(z0 \cdot 0.25 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot z0\right) \cdot z0}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}}} \]
    4. Taylor expanded in z0 around 0

      \[\leadsto \frac{\color{blue}{z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)}}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
    5. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \frac{z0 \cdot \color{blue}{\left(\frac{-1}{2} \cdot z0 - 1\right)}}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
      2. lower--.f64N/A

        \[\leadsto \frac{z0 \cdot \left(\frac{-1}{2} \cdot z0 - \color{blue}{1}\right)}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
      3. lower-*.f6459.9%

        \[\leadsto \frac{z0 \cdot \left(-0.5 \cdot z0 - 1\right)}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
    6. Applied rewrites59.9%

      \[\leadsto \frac{\color{blue}{z0 \cdot \left(-0.5 \cdot z0 - 1\right)}}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
    7. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}}} \]
      2. frac-2negN/A

        \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)}{\mathsf{neg}\left(\left(\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}\right)\right)}} \]
      3. mult-flipN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\mathsf{neg}\left(\left(\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}\right)\right)}} \]
      4. lift--.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\mathsf{neg}\left(\color{blue}{\left(\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}\right)}\right)} \]
      5. sub-negate-revN/A

        \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\color{blue}{\frac{z3}{z4 \cdot z4} - \frac{z1}{\left(-z2\right) \cdot z2}}} \]
      6. lift-/.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} - \color{blue}{\frac{z1}{\left(-z2\right) \cdot z2}}} \]
      7. mult-flipN/A

        \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} - \color{blue}{z1 \cdot \frac{1}{\left(-z2\right) \cdot z2}}} \]
      8. fp-cancel-sub-sign-invN/A

        \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\color{blue}{\frac{z3}{z4 \cdot z4} + \left(\mathsf{neg}\left(z1\right)\right) \cdot \frac{1}{\left(-z2\right) \cdot z2}}} \]
      9. mult-flipN/A

        \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\mathsf{neg}\left(z1\right)}{\left(-z2\right) \cdot z2}}} \]
      10. lift-*.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} + \frac{\mathsf{neg}\left(z1\right)}{\color{blue}{\left(-z2\right) \cdot z2}}} \]
      11. lift-neg.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} + \frac{\mathsf{neg}\left(z1\right)}{\color{blue}{\left(\mathsf{neg}\left(z2\right)\right)} \cdot z2}} \]
      12. distribute-lft-neg-outN/A

        \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} + \frac{\mathsf{neg}\left(z1\right)}{\color{blue}{\mathsf{neg}\left(z2 \cdot z2\right)}}} \]
      13. lift-*.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} + \frac{\mathsf{neg}\left(z1\right)}{\mathsf{neg}\left(\color{blue}{z2 \cdot z2}\right)}} \]
    8. Applied rewrites60.0%

      \[\leadsto \color{blue}{\left(-\left(-0.5 \cdot z0 - 1\right) \cdot z0\right) \cdot \left(\frac{z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3} \cdot z4\right)} \]
    9. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(-\left(\frac{-1}{2} \cdot z0 - 1\right) \cdot z0\right) \cdot \left(\frac{z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3} \cdot z4\right)} \]
      2. lift-*.f64N/A

        \[\leadsto \left(-\left(\frac{-1}{2} \cdot z0 - 1\right) \cdot z0\right) \cdot \color{blue}{\left(\frac{z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3} \cdot z4\right)} \]
      3. associate-*r*N/A

        \[\leadsto \color{blue}{\left(\left(-\left(\frac{-1}{2} \cdot z0 - 1\right) \cdot z0\right) \cdot \frac{z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3}\right) \cdot z4} \]
      4. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(\left(-\left(\frac{-1}{2} \cdot z0 - 1\right) \cdot z0\right) \cdot \frac{z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3}\right) \cdot z4} \]
    10. Applied rewrites62.5%

      \[\leadsto \color{blue}{\left(-\left(\left(-0.5 \cdot z0 - 1\right) \cdot z0\right) \cdot \frac{z4}{\left(z4 \cdot \frac{z1}{z2 \cdot z2}\right) \cdot z4 + z3}\right) \cdot z4} \]

    if 4.9999999999999999e-17 < z4

    1. Initial program 66.3%

      \[\frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}} \]
    2. Taylor expanded in z0 around 0

      \[\leadsto \frac{\color{blue}{\frac{1}{2}} \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}} \]
    3. Step-by-step derivation
      1. Applied rewrites60.1%

        \[\leadsto \frac{\color{blue}{0.5} \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}} \]
      2. Step-by-step derivation
        1. lift-/.f64N/A

          \[\leadsto \color{blue}{\frac{\frac{1}{2} \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}}} \]
        2. lift-+.f64N/A

          \[\leadsto \frac{\frac{1}{2} \cdot \left(z0 \cdot z0\right) + z0}{\color{blue}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}}} \]
        3. lift-/.f64N/A

          \[\leadsto \frac{\frac{1}{2} \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{z1}{z2 \cdot z2}}} \]
        4. lift-*.f64N/A

          \[\leadsto \frac{\frac{1}{2} \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{\color{blue}{z2 \cdot z2}}} \]
        5. associate-/l/N/A

          \[\leadsto \frac{\frac{1}{2} \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\frac{z1}{z2}}{z2}}} \]
        6. lift-/.f64N/A

          \[\leadsto \frac{\frac{1}{2} \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{\color{blue}{\frac{z1}{z2}}}{z2}} \]
        7. add-to-fractionN/A

          \[\leadsto \frac{\frac{1}{2} \cdot \left(z0 \cdot z0\right) + z0}{\color{blue}{\frac{\frac{z3}{z4 \cdot z4} \cdot z2 + \frac{z1}{z2}}{z2}}} \]
        8. associate-/r/N/A

          \[\leadsto \color{blue}{\frac{\frac{1}{2} \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} \cdot z2 + \frac{z1}{z2}} \cdot z2} \]
        9. lower-*.f64N/A

          \[\leadsto \color{blue}{\frac{\frac{1}{2} \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} \cdot z2 + \frac{z1}{z2}} \cdot z2} \]
      3. Applied rewrites63.4%

        \[\leadsto \color{blue}{\frac{\left(0.5 \cdot z0 + 1\right) \cdot z0}{z2 \cdot \frac{z3}{z4 \cdot z4} + \frac{z1}{z2}} \cdot z2} \]
    4. Recombined 2 regimes into one program.
    5. Add Preprocessing

    Alternative 10: 67.9% accurate, 0.9× speedup?

    \[\begin{array}{l} t_0 := \left|z4\right| \cdot \left|z4\right|\\ t_1 := \left(0.5 \cdot z0 + 1\right) \cdot z0\\ \mathbf{if}\;\left|z4\right| \leq 3.9 \cdot 10^{-187}:\\ \;\;\;\;\left(-\left(-0.5 \cdot z0 - 1\right) \cdot z0\right) \cdot \left(\frac{\left|z4\right|}{z3} \cdot \left|z4\right|\right)\\ \mathbf{elif}\;\left|z4\right| \leq 9 \cdot 10^{-8}:\\ \;\;\;\;\frac{t\_1}{\left(\frac{z1}{z2 \cdot z2} \cdot \left|z4\right|\right) \cdot \left|z4\right| + z3} \cdot t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{t\_1}{z2 \cdot \frac{z3}{t\_0} + \frac{z1}{z2}} \cdot z2\\ \end{array} \]
    (FPCore (z0 z3 z4 z1 z2)
      :precision binary64
      (let* ((t_0 (* (fabs z4) (fabs z4))) (t_1 (* (+ (* 0.5 z0) 1.0) z0)))
      (if (<= (fabs z4) 3.9e-187)
        (* (- (* (- (* -0.5 z0) 1.0) z0)) (* (/ (fabs z4) z3) (fabs z4)))
        (if (<= (fabs z4) 9e-8)
          (*
           (/ t_1 (+ (* (* (/ z1 (* z2 z2)) (fabs z4)) (fabs z4)) z3))
           t_0)
          (* (/ t_1 (+ (* z2 (/ z3 t_0)) (/ z1 z2))) z2)))))
    double code(double z0, double z3, double z4, double z1, double z2) {
    	double t_0 = fabs(z4) * fabs(z4);
    	double t_1 = ((0.5 * z0) + 1.0) * z0;
    	double tmp;
    	if (fabs(z4) <= 3.9e-187) {
    		tmp = -(((-0.5 * z0) - 1.0) * z0) * ((fabs(z4) / z3) * fabs(z4));
    	} else if (fabs(z4) <= 9e-8) {
    		tmp = (t_1 / ((((z1 / (z2 * z2)) * fabs(z4)) * fabs(z4)) + z3)) * t_0;
    	} else {
    		tmp = (t_1 / ((z2 * (z3 / t_0)) + (z1 / z2))) * z2;
    	}
    	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(z0, z3, z4, z1, z2)
    use fmin_fmax_functions
        real(8), intent (in) :: z0
        real(8), intent (in) :: z3
        real(8), intent (in) :: z4
        real(8), intent (in) :: z1
        real(8), intent (in) :: z2
        real(8) :: t_0
        real(8) :: t_1
        real(8) :: tmp
        t_0 = abs(z4) * abs(z4)
        t_1 = ((0.5d0 * z0) + 1.0d0) * z0
        if (abs(z4) <= 3.9d-187) then
            tmp = -((((-0.5d0) * z0) - 1.0d0) * z0) * ((abs(z4) / z3) * abs(z4))
        else if (abs(z4) <= 9d-8) then
            tmp = (t_1 / ((((z1 / (z2 * z2)) * abs(z4)) * abs(z4)) + z3)) * t_0
        else
            tmp = (t_1 / ((z2 * (z3 / t_0)) + (z1 / z2))) * z2
        end if
        code = tmp
    end function
    
    public static double code(double z0, double z3, double z4, double z1, double z2) {
    	double t_0 = Math.abs(z4) * Math.abs(z4);
    	double t_1 = ((0.5 * z0) + 1.0) * z0;
    	double tmp;
    	if (Math.abs(z4) <= 3.9e-187) {
    		tmp = -(((-0.5 * z0) - 1.0) * z0) * ((Math.abs(z4) / z3) * Math.abs(z4));
    	} else if (Math.abs(z4) <= 9e-8) {
    		tmp = (t_1 / ((((z1 / (z2 * z2)) * Math.abs(z4)) * Math.abs(z4)) + z3)) * t_0;
    	} else {
    		tmp = (t_1 / ((z2 * (z3 / t_0)) + (z1 / z2))) * z2;
    	}
    	return tmp;
    }
    
    def code(z0, z3, z4, z1, z2):
    	t_0 = math.fabs(z4) * math.fabs(z4)
    	t_1 = ((0.5 * z0) + 1.0) * z0
    	tmp = 0
    	if math.fabs(z4) <= 3.9e-187:
    		tmp = -(((-0.5 * z0) - 1.0) * z0) * ((math.fabs(z4) / z3) * math.fabs(z4))
    	elif math.fabs(z4) <= 9e-8:
    		tmp = (t_1 / ((((z1 / (z2 * z2)) * math.fabs(z4)) * math.fabs(z4)) + z3)) * t_0
    	else:
    		tmp = (t_1 / ((z2 * (z3 / t_0)) + (z1 / z2))) * z2
    	return tmp
    
    function code(z0, z3, z4, z1, z2)
    	t_0 = Float64(abs(z4) * abs(z4))
    	t_1 = Float64(Float64(Float64(0.5 * z0) + 1.0) * z0)
    	tmp = 0.0
    	if (abs(z4) <= 3.9e-187)
    		tmp = Float64(Float64(-Float64(Float64(Float64(-0.5 * z0) - 1.0) * z0)) * Float64(Float64(abs(z4) / z3) * abs(z4)));
    	elseif (abs(z4) <= 9e-8)
    		tmp = Float64(Float64(t_1 / Float64(Float64(Float64(Float64(z1 / Float64(z2 * z2)) * abs(z4)) * abs(z4)) + z3)) * t_0);
    	else
    		tmp = Float64(Float64(t_1 / Float64(Float64(z2 * Float64(z3 / t_0)) + Float64(z1 / z2))) * z2);
    	end
    	return tmp
    end
    
    function tmp_2 = code(z0, z3, z4, z1, z2)
    	t_0 = abs(z4) * abs(z4);
    	t_1 = ((0.5 * z0) + 1.0) * z0;
    	tmp = 0.0;
    	if (abs(z4) <= 3.9e-187)
    		tmp = -(((-0.5 * z0) - 1.0) * z0) * ((abs(z4) / z3) * abs(z4));
    	elseif (abs(z4) <= 9e-8)
    		tmp = (t_1 / ((((z1 / (z2 * z2)) * abs(z4)) * abs(z4)) + z3)) * t_0;
    	else
    		tmp = (t_1 / ((z2 * (z3 / t_0)) + (z1 / z2))) * z2;
    	end
    	tmp_2 = tmp;
    end
    
    code[z0_, z3_, z4_, z1_, z2_] := Block[{t$95$0 = N[(N[Abs[z4], $MachinePrecision] * N[Abs[z4], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(0.5 * z0), $MachinePrecision] + 1.0), $MachinePrecision] * z0), $MachinePrecision]}, If[LessEqual[N[Abs[z4], $MachinePrecision], 3.9e-187], N[((-N[(N[(N[(-0.5 * z0), $MachinePrecision] - 1.0), $MachinePrecision] * z0), $MachinePrecision]) * N[(N[(N[Abs[z4], $MachinePrecision] / z3), $MachinePrecision] * N[Abs[z4], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Abs[z4], $MachinePrecision], 9e-8], N[(N[(t$95$1 / N[(N[(N[(N[(z1 / N[(z2 * z2), $MachinePrecision]), $MachinePrecision] * N[Abs[z4], $MachinePrecision]), $MachinePrecision] * N[Abs[z4], $MachinePrecision]), $MachinePrecision] + z3), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[(t$95$1 / N[(N[(z2 * N[(z3 / t$95$0), $MachinePrecision]), $MachinePrecision] + N[(z1 / z2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * z2), $MachinePrecision]]]]]
    
    \begin{array}{l}
    t_0 := \left|z4\right| \cdot \left|z4\right|\\
    t_1 := \left(0.5 \cdot z0 + 1\right) \cdot z0\\
    \mathbf{if}\;\left|z4\right| \leq 3.9 \cdot 10^{-187}:\\
    \;\;\;\;\left(-\left(-0.5 \cdot z0 - 1\right) \cdot z0\right) \cdot \left(\frac{\left|z4\right|}{z3} \cdot \left|z4\right|\right)\\
    
    \mathbf{elif}\;\left|z4\right| \leq 9 \cdot 10^{-8}:\\
    \;\;\;\;\frac{t\_1}{\left(\frac{z1}{z2 \cdot z2} \cdot \left|z4\right|\right) \cdot \left|z4\right| + z3} \cdot t\_0\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{t\_1}{z2 \cdot \frac{z3}{t\_0} + \frac{z1}{z2}} \cdot z2\\
    
    
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if z4 < 3.8999999999999999e-187

      1. Initial program 66.3%

        \[\frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}} \]
      2. Step-by-step derivation
        1. lift-/.f64N/A

          \[\leadsto \color{blue}{\frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}}} \]
        2. frac-2negN/A

          \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\left(\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0\right)\right)}{\mathsf{neg}\left(\left(\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}\right)\right)}} \]
        3. lower-/.f64N/A

          \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\left(\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0\right)\right)}{\mathsf{neg}\left(\left(\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}\right)\right)}} \]
      3. Applied rewrites66.0%

        \[\leadsto \color{blue}{\frac{\left(-z0\right) - \left(\left(\left(z0 \cdot 0.25 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot z0\right) \cdot z0}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}}} \]
      4. Taylor expanded in z0 around 0

        \[\leadsto \frac{\color{blue}{z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)}}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
      5. Step-by-step derivation
        1. lower-*.f64N/A

          \[\leadsto \frac{z0 \cdot \color{blue}{\left(\frac{-1}{2} \cdot z0 - 1\right)}}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
        2. lower--.f64N/A

          \[\leadsto \frac{z0 \cdot \left(\frac{-1}{2} \cdot z0 - \color{blue}{1}\right)}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
        3. lower-*.f6459.9%

          \[\leadsto \frac{z0 \cdot \left(-0.5 \cdot z0 - 1\right)}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
      6. Applied rewrites59.9%

        \[\leadsto \frac{\color{blue}{z0 \cdot \left(-0.5 \cdot z0 - 1\right)}}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
      7. Step-by-step derivation
        1. lift-/.f64N/A

          \[\leadsto \color{blue}{\frac{z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}}} \]
        2. frac-2negN/A

          \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)}{\mathsf{neg}\left(\left(\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}\right)\right)}} \]
        3. mult-flipN/A

          \[\leadsto \color{blue}{\left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\mathsf{neg}\left(\left(\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}\right)\right)}} \]
        4. lift--.f64N/A

          \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\mathsf{neg}\left(\color{blue}{\left(\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}\right)}\right)} \]
        5. sub-negate-revN/A

          \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\color{blue}{\frac{z3}{z4 \cdot z4} - \frac{z1}{\left(-z2\right) \cdot z2}}} \]
        6. lift-/.f64N/A

          \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} - \color{blue}{\frac{z1}{\left(-z2\right) \cdot z2}}} \]
        7. mult-flipN/A

          \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} - \color{blue}{z1 \cdot \frac{1}{\left(-z2\right) \cdot z2}}} \]
        8. fp-cancel-sub-sign-invN/A

          \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\color{blue}{\frac{z3}{z4 \cdot z4} + \left(\mathsf{neg}\left(z1\right)\right) \cdot \frac{1}{\left(-z2\right) \cdot z2}}} \]
        9. mult-flipN/A

          \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\mathsf{neg}\left(z1\right)}{\left(-z2\right) \cdot z2}}} \]
        10. lift-*.f64N/A

          \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} + \frac{\mathsf{neg}\left(z1\right)}{\color{blue}{\left(-z2\right) \cdot z2}}} \]
        11. lift-neg.f64N/A

          \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} + \frac{\mathsf{neg}\left(z1\right)}{\color{blue}{\left(\mathsf{neg}\left(z2\right)\right)} \cdot z2}} \]
        12. distribute-lft-neg-outN/A

          \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} + \frac{\mathsf{neg}\left(z1\right)}{\color{blue}{\mathsf{neg}\left(z2 \cdot z2\right)}}} \]
        13. lift-*.f64N/A

          \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} + \frac{\mathsf{neg}\left(z1\right)}{\mathsf{neg}\left(\color{blue}{z2 \cdot z2}\right)}} \]
      8. Applied rewrites60.0%

        \[\leadsto \color{blue}{\left(-\left(-0.5 \cdot z0 - 1\right) \cdot z0\right) \cdot \left(\frac{z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3} \cdot z4\right)} \]
      9. Taylor expanded in z3 around inf

        \[\leadsto \left(-\left(-0.5 \cdot z0 - 1\right) \cdot z0\right) \cdot \left(\color{blue}{\frac{z4}{z3}} \cdot z4\right) \]
      10. Step-by-step derivation
        1. lower-/.f6445.8%

          \[\leadsto \left(-\left(-0.5 \cdot z0 - 1\right) \cdot z0\right) \cdot \left(\frac{z4}{\color{blue}{z3}} \cdot z4\right) \]
      11. Applied rewrites45.8%

        \[\leadsto \left(-\left(-0.5 \cdot z0 - 1\right) \cdot z0\right) \cdot \left(\color{blue}{\frac{z4}{z3}} \cdot z4\right) \]

      if 3.8999999999999999e-187 < z4 < 8.9999999999999999e-8

      1. Initial program 66.3%

        \[\frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}} \]
      2. Taylor expanded in z0 around 0

        \[\leadsto \frac{\color{blue}{\frac{1}{2}} \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}} \]
      3. Step-by-step derivation
        1. Applied rewrites60.1%

          \[\leadsto \frac{\color{blue}{0.5} \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}} \]
        2. Step-by-step derivation
          1. lift-/.f64N/A

            \[\leadsto \color{blue}{\frac{\frac{1}{2} \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}}} \]
          2. lift-+.f64N/A

            \[\leadsto \frac{\frac{1}{2} \cdot \left(z0 \cdot z0\right) + z0}{\color{blue}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}}} \]
          3. +-commutativeN/A

            \[\leadsto \frac{\frac{1}{2} \cdot \left(z0 \cdot z0\right) + z0}{\color{blue}{\frac{z1}{z2 \cdot z2} + \frac{z3}{z4 \cdot z4}}} \]
          4. lift-/.f64N/A

            \[\leadsto \frac{\frac{1}{2} \cdot \left(z0 \cdot z0\right) + z0}{\frac{z1}{z2 \cdot z2} + \color{blue}{\frac{z3}{z4 \cdot z4}}} \]
          5. add-to-fractionN/A

            \[\leadsto \frac{\frac{1}{2} \cdot \left(z0 \cdot z0\right) + z0}{\color{blue}{\frac{\frac{z1}{z2 \cdot z2} \cdot \left(z4 \cdot z4\right) + z3}{z4 \cdot z4}}} \]
          6. associate-/r/N/A

            \[\leadsto \color{blue}{\frac{\frac{1}{2} \cdot \left(z0 \cdot z0\right) + z0}{\frac{z1}{z2 \cdot z2} \cdot \left(z4 \cdot z4\right) + z3} \cdot \left(z4 \cdot z4\right)} \]
          7. lower-*.f64N/A

            \[\leadsto \color{blue}{\frac{\frac{1}{2} \cdot \left(z0 \cdot z0\right) + z0}{\frac{z1}{z2 \cdot z2} \cdot \left(z4 \cdot z4\right) + z3} \cdot \left(z4 \cdot z4\right)} \]
        3. Applied rewrites51.4%

          \[\leadsto \color{blue}{\frac{\left(0.5 \cdot z0 + 1\right) \cdot z0}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3} \cdot \left(z4 \cdot z4\right)} \]

        if 8.9999999999999999e-8 < z4

        1. Initial program 66.3%

          \[\frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}} \]
        2. Taylor expanded in z0 around 0

          \[\leadsto \frac{\color{blue}{\frac{1}{2}} \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}} \]
        3. Step-by-step derivation
          1. Applied rewrites60.1%

            \[\leadsto \frac{\color{blue}{0.5} \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}} \]
          2. Step-by-step derivation
            1. lift-/.f64N/A

              \[\leadsto \color{blue}{\frac{\frac{1}{2} \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}}} \]
            2. lift-+.f64N/A

              \[\leadsto \frac{\frac{1}{2} \cdot \left(z0 \cdot z0\right) + z0}{\color{blue}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}}} \]
            3. lift-/.f64N/A

              \[\leadsto \frac{\frac{1}{2} \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{z1}{z2 \cdot z2}}} \]
            4. lift-*.f64N/A

              \[\leadsto \frac{\frac{1}{2} \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{\color{blue}{z2 \cdot z2}}} \]
            5. associate-/l/N/A

              \[\leadsto \frac{\frac{1}{2} \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\frac{z1}{z2}}{z2}}} \]
            6. lift-/.f64N/A

              \[\leadsto \frac{\frac{1}{2} \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{\color{blue}{\frac{z1}{z2}}}{z2}} \]
            7. add-to-fractionN/A

              \[\leadsto \frac{\frac{1}{2} \cdot \left(z0 \cdot z0\right) + z0}{\color{blue}{\frac{\frac{z3}{z4 \cdot z4} \cdot z2 + \frac{z1}{z2}}{z2}}} \]
            8. associate-/r/N/A

              \[\leadsto \color{blue}{\frac{\frac{1}{2} \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} \cdot z2 + \frac{z1}{z2}} \cdot z2} \]
            9. lower-*.f64N/A

              \[\leadsto \color{blue}{\frac{\frac{1}{2} \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} \cdot z2 + \frac{z1}{z2}} \cdot z2} \]
          3. Applied rewrites63.4%

            \[\leadsto \color{blue}{\frac{\left(0.5 \cdot z0 + 1\right) \cdot z0}{z2 \cdot \frac{z3}{z4 \cdot z4} + \frac{z1}{z2}} \cdot z2} \]
        4. Recombined 3 regimes into one program.
        5. Add Preprocessing

        Alternative 11: 67.2% accurate, 0.9× speedup?

        \[\begin{array}{l} \mathbf{if}\;\left|z4\right| \leq 5 \cdot 10^{-17}:\\ \;\;\;\;\left(-\left(-0.5 \cdot z0 - 1\right) \cdot z0\right) \cdot \left(\frac{\left|z4\right|}{\left(\frac{z1}{z2 \cdot z2} \cdot \left|z4\right|\right) \cdot \left|z4\right| + z3} \cdot \left|z4\right|\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(0.5 \cdot z0 + 1\right) \cdot z0}{z2 \cdot \frac{z3}{\left|z4\right| \cdot \left|z4\right|} + \frac{z1}{z2}} \cdot z2\\ \end{array} \]
        (FPCore (z0 z3 z4 z1 z2)
          :precision binary64
          (if (<= (fabs z4) 5e-17)
          (*
           (- (* (- (* -0.5 z0) 1.0) z0))
           (*
            (/ (fabs z4) (+ (* (* (/ z1 (* z2 z2)) (fabs z4)) (fabs z4)) z3))
            (fabs z4)))
          (*
           (/
            (* (+ (* 0.5 z0) 1.0) z0)
            (+ (* z2 (/ z3 (* (fabs z4) (fabs z4)))) (/ z1 z2)))
           z2)))
        double code(double z0, double z3, double z4, double z1, double z2) {
        	double tmp;
        	if (fabs(z4) <= 5e-17) {
        		tmp = -(((-0.5 * z0) - 1.0) * z0) * ((fabs(z4) / ((((z1 / (z2 * z2)) * fabs(z4)) * fabs(z4)) + z3)) * fabs(z4));
        	} else {
        		tmp = ((((0.5 * z0) + 1.0) * z0) / ((z2 * (z3 / (fabs(z4) * fabs(z4)))) + (z1 / z2))) * z2;
        	}
        	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(z0, z3, z4, z1, z2)
        use fmin_fmax_functions
            real(8), intent (in) :: z0
            real(8), intent (in) :: z3
            real(8), intent (in) :: z4
            real(8), intent (in) :: z1
            real(8), intent (in) :: z2
            real(8) :: tmp
            if (abs(z4) <= 5d-17) then
                tmp = -((((-0.5d0) * z0) - 1.0d0) * z0) * ((abs(z4) / ((((z1 / (z2 * z2)) * abs(z4)) * abs(z4)) + z3)) * abs(z4))
            else
                tmp = ((((0.5d0 * z0) + 1.0d0) * z0) / ((z2 * (z3 / (abs(z4) * abs(z4)))) + (z1 / z2))) * z2
            end if
            code = tmp
        end function
        
        public static double code(double z0, double z3, double z4, double z1, double z2) {
        	double tmp;
        	if (Math.abs(z4) <= 5e-17) {
        		tmp = -(((-0.5 * z0) - 1.0) * z0) * ((Math.abs(z4) / ((((z1 / (z2 * z2)) * Math.abs(z4)) * Math.abs(z4)) + z3)) * Math.abs(z4));
        	} else {
        		tmp = ((((0.5 * z0) + 1.0) * z0) / ((z2 * (z3 / (Math.abs(z4) * Math.abs(z4)))) + (z1 / z2))) * z2;
        	}
        	return tmp;
        }
        
        def code(z0, z3, z4, z1, z2):
        	tmp = 0
        	if math.fabs(z4) <= 5e-17:
        		tmp = -(((-0.5 * z0) - 1.0) * z0) * ((math.fabs(z4) / ((((z1 / (z2 * z2)) * math.fabs(z4)) * math.fabs(z4)) + z3)) * math.fabs(z4))
        	else:
        		tmp = ((((0.5 * z0) + 1.0) * z0) / ((z2 * (z3 / (math.fabs(z4) * math.fabs(z4)))) + (z1 / z2))) * z2
        	return tmp
        
        function code(z0, z3, z4, z1, z2)
        	tmp = 0.0
        	if (abs(z4) <= 5e-17)
        		tmp = Float64(Float64(-Float64(Float64(Float64(-0.5 * z0) - 1.0) * z0)) * Float64(Float64(abs(z4) / Float64(Float64(Float64(Float64(z1 / Float64(z2 * z2)) * abs(z4)) * abs(z4)) + z3)) * abs(z4)));
        	else
        		tmp = Float64(Float64(Float64(Float64(Float64(0.5 * z0) + 1.0) * z0) / Float64(Float64(z2 * Float64(z3 / Float64(abs(z4) * abs(z4)))) + Float64(z1 / z2))) * z2);
        	end
        	return tmp
        end
        
        function tmp_2 = code(z0, z3, z4, z1, z2)
        	tmp = 0.0;
        	if (abs(z4) <= 5e-17)
        		tmp = -(((-0.5 * z0) - 1.0) * z0) * ((abs(z4) / ((((z1 / (z2 * z2)) * abs(z4)) * abs(z4)) + z3)) * abs(z4));
        	else
        		tmp = ((((0.5 * z0) + 1.0) * z0) / ((z2 * (z3 / (abs(z4) * abs(z4)))) + (z1 / z2))) * z2;
        	end
        	tmp_2 = tmp;
        end
        
        code[z0_, z3_, z4_, z1_, z2_] := If[LessEqual[N[Abs[z4], $MachinePrecision], 5e-17], N[((-N[(N[(N[(-0.5 * z0), $MachinePrecision] - 1.0), $MachinePrecision] * z0), $MachinePrecision]) * N[(N[(N[Abs[z4], $MachinePrecision] / N[(N[(N[(N[(z1 / N[(z2 * z2), $MachinePrecision]), $MachinePrecision] * N[Abs[z4], $MachinePrecision]), $MachinePrecision] * N[Abs[z4], $MachinePrecision]), $MachinePrecision] + z3), $MachinePrecision]), $MachinePrecision] * N[Abs[z4], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(0.5 * z0), $MachinePrecision] + 1.0), $MachinePrecision] * z0), $MachinePrecision] / N[(N[(z2 * N[(z3 / N[(N[Abs[z4], $MachinePrecision] * N[Abs[z4], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(z1 / z2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * z2), $MachinePrecision]]
        
        \begin{array}{l}
        \mathbf{if}\;\left|z4\right| \leq 5 \cdot 10^{-17}:\\
        \;\;\;\;\left(-\left(-0.5 \cdot z0 - 1\right) \cdot z0\right) \cdot \left(\frac{\left|z4\right|}{\left(\frac{z1}{z2 \cdot z2} \cdot \left|z4\right|\right) \cdot \left|z4\right| + z3} \cdot \left|z4\right|\right)\\
        
        \mathbf{else}:\\
        \;\;\;\;\frac{\left(0.5 \cdot z0 + 1\right) \cdot z0}{z2 \cdot \frac{z3}{\left|z4\right| \cdot \left|z4\right|} + \frac{z1}{z2}} \cdot z2\\
        
        
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if z4 < 4.9999999999999999e-17

          1. Initial program 66.3%

            \[\frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}} \]
          2. Step-by-step derivation
            1. lift-/.f64N/A

              \[\leadsto \color{blue}{\frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}}} \]
            2. frac-2negN/A

              \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\left(\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0\right)\right)}{\mathsf{neg}\left(\left(\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}\right)\right)}} \]
            3. lower-/.f64N/A

              \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\left(\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0\right)\right)}{\mathsf{neg}\left(\left(\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}\right)\right)}} \]
          3. Applied rewrites66.0%

            \[\leadsto \color{blue}{\frac{\left(-z0\right) - \left(\left(\left(z0 \cdot 0.25 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot z0\right) \cdot z0}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}}} \]
          4. Taylor expanded in z0 around 0

            \[\leadsto \frac{\color{blue}{z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)}}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
          5. Step-by-step derivation
            1. lower-*.f64N/A

              \[\leadsto \frac{z0 \cdot \color{blue}{\left(\frac{-1}{2} \cdot z0 - 1\right)}}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
            2. lower--.f64N/A

              \[\leadsto \frac{z0 \cdot \left(\frac{-1}{2} \cdot z0 - \color{blue}{1}\right)}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
            3. lower-*.f6459.9%

              \[\leadsto \frac{z0 \cdot \left(-0.5 \cdot z0 - 1\right)}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
          6. Applied rewrites59.9%

            \[\leadsto \frac{\color{blue}{z0 \cdot \left(-0.5 \cdot z0 - 1\right)}}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
          7. Step-by-step derivation
            1. lift-/.f64N/A

              \[\leadsto \color{blue}{\frac{z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}}} \]
            2. frac-2negN/A

              \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)}{\mathsf{neg}\left(\left(\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}\right)\right)}} \]
            3. mult-flipN/A

              \[\leadsto \color{blue}{\left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\mathsf{neg}\left(\left(\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}\right)\right)}} \]
            4. lift--.f64N/A

              \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\mathsf{neg}\left(\color{blue}{\left(\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}\right)}\right)} \]
            5. sub-negate-revN/A

              \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\color{blue}{\frac{z3}{z4 \cdot z4} - \frac{z1}{\left(-z2\right) \cdot z2}}} \]
            6. lift-/.f64N/A

              \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} - \color{blue}{\frac{z1}{\left(-z2\right) \cdot z2}}} \]
            7. mult-flipN/A

              \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} - \color{blue}{z1 \cdot \frac{1}{\left(-z2\right) \cdot z2}}} \]
            8. fp-cancel-sub-sign-invN/A

              \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\color{blue}{\frac{z3}{z4 \cdot z4} + \left(\mathsf{neg}\left(z1\right)\right) \cdot \frac{1}{\left(-z2\right) \cdot z2}}} \]
            9. mult-flipN/A

              \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\mathsf{neg}\left(z1\right)}{\left(-z2\right) \cdot z2}}} \]
            10. lift-*.f64N/A

              \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} + \frac{\mathsf{neg}\left(z1\right)}{\color{blue}{\left(-z2\right) \cdot z2}}} \]
            11. lift-neg.f64N/A

              \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} + \frac{\mathsf{neg}\left(z1\right)}{\color{blue}{\left(\mathsf{neg}\left(z2\right)\right)} \cdot z2}} \]
            12. distribute-lft-neg-outN/A

              \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} + \frac{\mathsf{neg}\left(z1\right)}{\color{blue}{\mathsf{neg}\left(z2 \cdot z2\right)}}} \]
            13. lift-*.f64N/A

              \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} + \frac{\mathsf{neg}\left(z1\right)}{\mathsf{neg}\left(\color{blue}{z2 \cdot z2}\right)}} \]
          8. Applied rewrites60.0%

            \[\leadsto \color{blue}{\left(-\left(-0.5 \cdot z0 - 1\right) \cdot z0\right) \cdot \left(\frac{z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3} \cdot z4\right)} \]

          if 4.9999999999999999e-17 < z4

          1. Initial program 66.3%

            \[\frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}} \]
          2. Taylor expanded in z0 around 0

            \[\leadsto \frac{\color{blue}{\frac{1}{2}} \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}} \]
          3. Step-by-step derivation
            1. Applied rewrites60.1%

              \[\leadsto \frac{\color{blue}{0.5} \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}} \]
            2. Step-by-step derivation
              1. lift-/.f64N/A

                \[\leadsto \color{blue}{\frac{\frac{1}{2} \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}}} \]
              2. lift-+.f64N/A

                \[\leadsto \frac{\frac{1}{2} \cdot \left(z0 \cdot z0\right) + z0}{\color{blue}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}}} \]
              3. lift-/.f64N/A

                \[\leadsto \frac{\frac{1}{2} \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{z1}{z2 \cdot z2}}} \]
              4. lift-*.f64N/A

                \[\leadsto \frac{\frac{1}{2} \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{\color{blue}{z2 \cdot z2}}} \]
              5. associate-/l/N/A

                \[\leadsto \frac{\frac{1}{2} \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\frac{z1}{z2}}{z2}}} \]
              6. lift-/.f64N/A

                \[\leadsto \frac{\frac{1}{2} \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{\color{blue}{\frac{z1}{z2}}}{z2}} \]
              7. add-to-fractionN/A

                \[\leadsto \frac{\frac{1}{2} \cdot \left(z0 \cdot z0\right) + z0}{\color{blue}{\frac{\frac{z3}{z4 \cdot z4} \cdot z2 + \frac{z1}{z2}}{z2}}} \]
              8. associate-/r/N/A

                \[\leadsto \color{blue}{\frac{\frac{1}{2} \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} \cdot z2 + \frac{z1}{z2}} \cdot z2} \]
              9. lower-*.f64N/A

                \[\leadsto \color{blue}{\frac{\frac{1}{2} \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} \cdot z2 + \frac{z1}{z2}} \cdot z2} \]
            3. Applied rewrites63.4%

              \[\leadsto \color{blue}{\frac{\left(0.5 \cdot z0 + 1\right) \cdot z0}{z2 \cdot \frac{z3}{z4 \cdot z4} + \frac{z1}{z2}} \cdot z2} \]
          4. Recombined 2 regimes into one program.
          5. Add Preprocessing

          Alternative 12: 65.9% accurate, 0.5× speedup?

          \[\begin{array}{l} t_0 := \frac{z3}{z4 \cdot z4}\\ t_1 := -0.5 \cdot z0 - 1\\ \mathbf{if}\;\frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{t\_0 + \frac{z1}{z2 \cdot z2}} \leq \infty:\\ \;\;\;\;\frac{z0 \cdot t\_1}{\frac{z1}{\left(-z2\right) \cdot z2} - t\_0}\\ \mathbf{else}:\\ \;\;\;\;\left(-t\_1 \cdot z0\right) \cdot \left(\frac{z4}{z3} \cdot z4\right)\\ \end{array} \]
          (FPCore (z0 z3 z4 z1 z2)
            :precision binary64
            (let* ((t_0 (/ z3 (* z4 z4))) (t_1 (- (* -0.5 z0) 1.0)))
            (if (<=
                 (/
                  (+
                   (*
                    (- (* (- (* 0.25 z0) -0.3333333333333333) z0) -0.5)
                    (* z0 z0))
                   z0)
                  (+ t_0 (/ z1 (* z2 z2))))
                 INFINITY)
              (/ (* z0 t_1) (- (/ z1 (* (- z2) z2)) t_0))
              (* (- (* t_1 z0)) (* (/ z4 z3) z4)))))
          double code(double z0, double z3, double z4, double z1, double z2) {
          	double t_0 = z3 / (z4 * z4);
          	double t_1 = (-0.5 * z0) - 1.0;
          	double tmp;
          	if ((((((((0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * (z0 * z0)) + z0) / (t_0 + (z1 / (z2 * z2)))) <= ((double) INFINITY)) {
          		tmp = (z0 * t_1) / ((z1 / (-z2 * z2)) - t_0);
          	} else {
          		tmp = -(t_1 * z0) * ((z4 / z3) * z4);
          	}
          	return tmp;
          }
          
          public static double code(double z0, double z3, double z4, double z1, double z2) {
          	double t_0 = z3 / (z4 * z4);
          	double t_1 = (-0.5 * z0) - 1.0;
          	double tmp;
          	if ((((((((0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * (z0 * z0)) + z0) / (t_0 + (z1 / (z2 * z2)))) <= Double.POSITIVE_INFINITY) {
          		tmp = (z0 * t_1) / ((z1 / (-z2 * z2)) - t_0);
          	} else {
          		tmp = -(t_1 * z0) * ((z4 / z3) * z4);
          	}
          	return tmp;
          }
          
          def code(z0, z3, z4, z1, z2):
          	t_0 = z3 / (z4 * z4)
          	t_1 = (-0.5 * z0) - 1.0
          	tmp = 0
          	if (((((((0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * (z0 * z0)) + z0) / (t_0 + (z1 / (z2 * z2)))) <= math.inf:
          		tmp = (z0 * t_1) / ((z1 / (-z2 * z2)) - t_0)
          	else:
          		tmp = -(t_1 * z0) * ((z4 / z3) * z4)
          	return tmp
          
          function code(z0, z3, z4, z1, z2)
          	t_0 = Float64(z3 / Float64(z4 * z4))
          	t_1 = Float64(Float64(-0.5 * z0) - 1.0)
          	tmp = 0.0
          	if (Float64(Float64(Float64(Float64(Float64(Float64(Float64(0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * Float64(z0 * z0)) + z0) / Float64(t_0 + Float64(z1 / Float64(z2 * z2)))) <= Inf)
          		tmp = Float64(Float64(z0 * t_1) / Float64(Float64(z1 / Float64(Float64(-z2) * z2)) - t_0));
          	else
          		tmp = Float64(Float64(-Float64(t_1 * z0)) * Float64(Float64(z4 / z3) * z4));
          	end
          	return tmp
          end
          
          function tmp_2 = code(z0, z3, z4, z1, z2)
          	t_0 = z3 / (z4 * z4);
          	t_1 = (-0.5 * z0) - 1.0;
          	tmp = 0.0;
          	if ((((((((0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * (z0 * z0)) + z0) / (t_0 + (z1 / (z2 * z2)))) <= Inf)
          		tmp = (z0 * t_1) / ((z1 / (-z2 * z2)) - t_0);
          	else
          		tmp = -(t_1 * z0) * ((z4 / z3) * z4);
          	end
          	tmp_2 = tmp;
          end
          
          code[z0_, z3_, z4_, z1_, z2_] := Block[{t$95$0 = N[(z3 / N[(z4 * z4), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(-0.5 * z0), $MachinePrecision] - 1.0), $MachinePrecision]}, If[LessEqual[N[(N[(N[(N[(N[(N[(N[(0.25 * z0), $MachinePrecision] - -0.3333333333333333), $MachinePrecision] * z0), $MachinePrecision] - -0.5), $MachinePrecision] * N[(z0 * z0), $MachinePrecision]), $MachinePrecision] + z0), $MachinePrecision] / N[(t$95$0 + N[(z1 / N[(z2 * z2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(z0 * t$95$1), $MachinePrecision] / N[(N[(z1 / N[((-z2) * z2), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]), $MachinePrecision], N[((-N[(t$95$1 * z0), $MachinePrecision]) * N[(N[(z4 / z3), $MachinePrecision] * z4), $MachinePrecision]), $MachinePrecision]]]]
          
          \begin{array}{l}
          t_0 := \frac{z3}{z4 \cdot z4}\\
          t_1 := -0.5 \cdot z0 - 1\\
          \mathbf{if}\;\frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{t\_0 + \frac{z1}{z2 \cdot z2}} \leq \infty:\\
          \;\;\;\;\frac{z0 \cdot t\_1}{\frac{z1}{\left(-z2\right) \cdot z2} - t\_0}\\
          
          \mathbf{else}:\\
          \;\;\;\;\left(-t\_1 \cdot z0\right) \cdot \left(\frac{z4}{z3} \cdot z4\right)\\
          
          
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if (/.f64 (+.f64 (*.f64 (-.f64 (*.f64 (-.f64 (*.f64 #s(literal 1/4 binary64) z0) #s(literal -3333333333333333/10000000000000000 binary64)) z0) #s(literal -1/2 binary64)) (*.f64 z0 z0)) z0) (+.f64 (/.f64 z3 (*.f64 z4 z4)) (/.f64 z1 (*.f64 z2 z2)))) < +inf.0

            1. Initial program 66.3%

              \[\frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}} \]
            2. Step-by-step derivation
              1. lift-/.f64N/A

                \[\leadsto \color{blue}{\frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}}} \]
              2. frac-2negN/A

                \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\left(\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0\right)\right)}{\mathsf{neg}\left(\left(\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}\right)\right)}} \]
              3. lower-/.f64N/A

                \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\left(\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0\right)\right)}{\mathsf{neg}\left(\left(\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}\right)\right)}} \]
            3. Applied rewrites66.0%

              \[\leadsto \color{blue}{\frac{\left(-z0\right) - \left(\left(\left(z0 \cdot 0.25 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot z0\right) \cdot z0}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}}} \]
            4. Taylor expanded in z0 around 0

              \[\leadsto \frac{\color{blue}{z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)}}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
            5. Step-by-step derivation
              1. lower-*.f64N/A

                \[\leadsto \frac{z0 \cdot \color{blue}{\left(\frac{-1}{2} \cdot z0 - 1\right)}}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
              2. lower--.f64N/A

                \[\leadsto \frac{z0 \cdot \left(\frac{-1}{2} \cdot z0 - \color{blue}{1}\right)}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
              3. lower-*.f6459.9%

                \[\leadsto \frac{z0 \cdot \left(-0.5 \cdot z0 - 1\right)}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
            6. Applied rewrites59.9%

              \[\leadsto \frac{\color{blue}{z0 \cdot \left(-0.5 \cdot z0 - 1\right)}}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]

            if +inf.0 < (/.f64 (+.f64 (*.f64 (-.f64 (*.f64 (-.f64 (*.f64 #s(literal 1/4 binary64) z0) #s(literal -3333333333333333/10000000000000000 binary64)) z0) #s(literal -1/2 binary64)) (*.f64 z0 z0)) z0) (+.f64 (/.f64 z3 (*.f64 z4 z4)) (/.f64 z1 (*.f64 z2 z2))))

            1. Initial program 66.3%

              \[\frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}} \]
            2. Step-by-step derivation
              1. lift-/.f64N/A

                \[\leadsto \color{blue}{\frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}}} \]
              2. frac-2negN/A

                \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\left(\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0\right)\right)}{\mathsf{neg}\left(\left(\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}\right)\right)}} \]
              3. lower-/.f64N/A

                \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\left(\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0\right)\right)}{\mathsf{neg}\left(\left(\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}\right)\right)}} \]
            3. Applied rewrites66.0%

              \[\leadsto \color{blue}{\frac{\left(-z0\right) - \left(\left(\left(z0 \cdot 0.25 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot z0\right) \cdot z0}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}}} \]
            4. Taylor expanded in z0 around 0

              \[\leadsto \frac{\color{blue}{z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)}}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
            5. Step-by-step derivation
              1. lower-*.f64N/A

                \[\leadsto \frac{z0 \cdot \color{blue}{\left(\frac{-1}{2} \cdot z0 - 1\right)}}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
              2. lower--.f64N/A

                \[\leadsto \frac{z0 \cdot \left(\frac{-1}{2} \cdot z0 - \color{blue}{1}\right)}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
              3. lower-*.f6459.9%

                \[\leadsto \frac{z0 \cdot \left(-0.5 \cdot z0 - 1\right)}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
            6. Applied rewrites59.9%

              \[\leadsto \frac{\color{blue}{z0 \cdot \left(-0.5 \cdot z0 - 1\right)}}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
            7. Step-by-step derivation
              1. lift-/.f64N/A

                \[\leadsto \color{blue}{\frac{z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}}} \]
              2. frac-2negN/A

                \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)}{\mathsf{neg}\left(\left(\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}\right)\right)}} \]
              3. mult-flipN/A

                \[\leadsto \color{blue}{\left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\mathsf{neg}\left(\left(\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}\right)\right)}} \]
              4. lift--.f64N/A

                \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\mathsf{neg}\left(\color{blue}{\left(\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}\right)}\right)} \]
              5. sub-negate-revN/A

                \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\color{blue}{\frac{z3}{z4 \cdot z4} - \frac{z1}{\left(-z2\right) \cdot z2}}} \]
              6. lift-/.f64N/A

                \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} - \color{blue}{\frac{z1}{\left(-z2\right) \cdot z2}}} \]
              7. mult-flipN/A

                \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} - \color{blue}{z1 \cdot \frac{1}{\left(-z2\right) \cdot z2}}} \]
              8. fp-cancel-sub-sign-invN/A

                \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\color{blue}{\frac{z3}{z4 \cdot z4} + \left(\mathsf{neg}\left(z1\right)\right) \cdot \frac{1}{\left(-z2\right) \cdot z2}}} \]
              9. mult-flipN/A

                \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\mathsf{neg}\left(z1\right)}{\left(-z2\right) \cdot z2}}} \]
              10. lift-*.f64N/A

                \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} + \frac{\mathsf{neg}\left(z1\right)}{\color{blue}{\left(-z2\right) \cdot z2}}} \]
              11. lift-neg.f64N/A

                \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} + \frac{\mathsf{neg}\left(z1\right)}{\color{blue}{\left(\mathsf{neg}\left(z2\right)\right)} \cdot z2}} \]
              12. distribute-lft-neg-outN/A

                \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} + \frac{\mathsf{neg}\left(z1\right)}{\color{blue}{\mathsf{neg}\left(z2 \cdot z2\right)}}} \]
              13. lift-*.f64N/A

                \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} + \frac{\mathsf{neg}\left(z1\right)}{\mathsf{neg}\left(\color{blue}{z2 \cdot z2}\right)}} \]
            8. Applied rewrites60.0%

              \[\leadsto \color{blue}{\left(-\left(-0.5 \cdot z0 - 1\right) \cdot z0\right) \cdot \left(\frac{z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3} \cdot z4\right)} \]
            9. Taylor expanded in z3 around inf

              \[\leadsto \left(-\left(-0.5 \cdot z0 - 1\right) \cdot z0\right) \cdot \left(\color{blue}{\frac{z4}{z3}} \cdot z4\right) \]
            10. Step-by-step derivation
              1. lower-/.f6445.8%

                \[\leadsto \left(-\left(-0.5 \cdot z0 - 1\right) \cdot z0\right) \cdot \left(\frac{z4}{\color{blue}{z3}} \cdot z4\right) \]
            11. Applied rewrites45.8%

              \[\leadsto \left(-\left(-0.5 \cdot z0 - 1\right) \cdot z0\right) \cdot \left(\color{blue}{\frac{z4}{z3}} \cdot z4\right) \]
          3. Recombined 2 regimes into one program.
          4. Add Preprocessing

          Alternative 13: 65.6% accurate, 0.5× speedup?

          \[\begin{array}{l} t_0 := \frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}\\ \mathbf{if}\;\frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{t\_0} \leq \infty:\\ \;\;\;\;\frac{0.5 \cdot \left(z0 \cdot z0\right) + z0}{t\_0}\\ \mathbf{else}:\\ \;\;\;\;\left(-\left(-0.5 \cdot z0 - 1\right) \cdot z0\right) \cdot \left(\frac{z4}{z3} \cdot z4\right)\\ \end{array} \]
          (FPCore (z0 z3 z4 z1 z2)
            :precision binary64
            (let* ((t_0 (+ (/ z3 (* z4 z4)) (/ z1 (* z2 z2)))))
            (if (<=
                 (/
                  (+
                   (*
                    (- (* (- (* 0.25 z0) -0.3333333333333333) z0) -0.5)
                    (* z0 z0))
                   z0)
                  t_0)
                 INFINITY)
              (/ (+ (* 0.5 (* z0 z0)) z0) t_0)
              (* (- (* (- (* -0.5 z0) 1.0) z0)) (* (/ z4 z3) z4)))))
          double code(double z0, double z3, double z4, double z1, double z2) {
          	double t_0 = (z3 / (z4 * z4)) + (z1 / (z2 * z2));
          	double tmp;
          	if ((((((((0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * (z0 * z0)) + z0) / t_0) <= ((double) INFINITY)) {
          		tmp = ((0.5 * (z0 * z0)) + z0) / t_0;
          	} else {
          		tmp = -(((-0.5 * z0) - 1.0) * z0) * ((z4 / z3) * z4);
          	}
          	return tmp;
          }
          
          public static double code(double z0, double z3, double z4, double z1, double z2) {
          	double t_0 = (z3 / (z4 * z4)) + (z1 / (z2 * z2));
          	double tmp;
          	if ((((((((0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * (z0 * z0)) + z0) / t_0) <= Double.POSITIVE_INFINITY) {
          		tmp = ((0.5 * (z0 * z0)) + z0) / t_0;
          	} else {
          		tmp = -(((-0.5 * z0) - 1.0) * z0) * ((z4 / z3) * z4);
          	}
          	return tmp;
          }
          
          def code(z0, z3, z4, z1, z2):
          	t_0 = (z3 / (z4 * z4)) + (z1 / (z2 * z2))
          	tmp = 0
          	if (((((((0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * (z0 * z0)) + z0) / t_0) <= math.inf:
          		tmp = ((0.5 * (z0 * z0)) + z0) / t_0
          	else:
          		tmp = -(((-0.5 * z0) - 1.0) * z0) * ((z4 / z3) * z4)
          	return tmp
          
          function code(z0, z3, z4, z1, z2)
          	t_0 = Float64(Float64(z3 / Float64(z4 * z4)) + Float64(z1 / Float64(z2 * z2)))
          	tmp = 0.0
          	if (Float64(Float64(Float64(Float64(Float64(Float64(Float64(0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * Float64(z0 * z0)) + z0) / t_0) <= Inf)
          		tmp = Float64(Float64(Float64(0.5 * Float64(z0 * z0)) + z0) / t_0);
          	else
          		tmp = Float64(Float64(-Float64(Float64(Float64(-0.5 * z0) - 1.0) * z0)) * Float64(Float64(z4 / z3) * z4));
          	end
          	return tmp
          end
          
          function tmp_2 = code(z0, z3, z4, z1, z2)
          	t_0 = (z3 / (z4 * z4)) + (z1 / (z2 * z2));
          	tmp = 0.0;
          	if ((((((((0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * (z0 * z0)) + z0) / t_0) <= Inf)
          		tmp = ((0.5 * (z0 * z0)) + z0) / t_0;
          	else
          		tmp = -(((-0.5 * z0) - 1.0) * z0) * ((z4 / z3) * z4);
          	end
          	tmp_2 = tmp;
          end
          
          code[z0_, z3_, z4_, z1_, z2_] := Block[{t$95$0 = N[(N[(z3 / N[(z4 * z4), $MachinePrecision]), $MachinePrecision] + N[(z1 / N[(z2 * z2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(N[(N[(N[(N[(N[(0.25 * z0), $MachinePrecision] - -0.3333333333333333), $MachinePrecision] * z0), $MachinePrecision] - -0.5), $MachinePrecision] * N[(z0 * z0), $MachinePrecision]), $MachinePrecision] + z0), $MachinePrecision] / t$95$0), $MachinePrecision], Infinity], N[(N[(N[(0.5 * N[(z0 * z0), $MachinePrecision]), $MachinePrecision] + z0), $MachinePrecision] / t$95$0), $MachinePrecision], N[((-N[(N[(N[(-0.5 * z0), $MachinePrecision] - 1.0), $MachinePrecision] * z0), $MachinePrecision]) * N[(N[(z4 / z3), $MachinePrecision] * z4), $MachinePrecision]), $MachinePrecision]]]
          
          \begin{array}{l}
          t_0 := \frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}\\
          \mathbf{if}\;\frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{t\_0} \leq \infty:\\
          \;\;\;\;\frac{0.5 \cdot \left(z0 \cdot z0\right) + z0}{t\_0}\\
          
          \mathbf{else}:\\
          \;\;\;\;\left(-\left(-0.5 \cdot z0 - 1\right) \cdot z0\right) \cdot \left(\frac{z4}{z3} \cdot z4\right)\\
          
          
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if (/.f64 (+.f64 (*.f64 (-.f64 (*.f64 (-.f64 (*.f64 #s(literal 1/4 binary64) z0) #s(literal -3333333333333333/10000000000000000 binary64)) z0) #s(literal -1/2 binary64)) (*.f64 z0 z0)) z0) (+.f64 (/.f64 z3 (*.f64 z4 z4)) (/.f64 z1 (*.f64 z2 z2)))) < +inf.0

            1. Initial program 66.3%

              \[\frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}} \]
            2. Taylor expanded in z0 around 0

              \[\leadsto \frac{\color{blue}{\frac{1}{2}} \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}} \]
            3. Step-by-step derivation
              1. Applied rewrites60.1%

                \[\leadsto \frac{\color{blue}{0.5} \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}} \]

              if +inf.0 < (/.f64 (+.f64 (*.f64 (-.f64 (*.f64 (-.f64 (*.f64 #s(literal 1/4 binary64) z0) #s(literal -3333333333333333/10000000000000000 binary64)) z0) #s(literal -1/2 binary64)) (*.f64 z0 z0)) z0) (+.f64 (/.f64 z3 (*.f64 z4 z4)) (/.f64 z1 (*.f64 z2 z2))))

              1. Initial program 66.3%

                \[\frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}} \]
              2. Step-by-step derivation
                1. lift-/.f64N/A

                  \[\leadsto \color{blue}{\frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}}} \]
                2. frac-2negN/A

                  \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\left(\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0\right)\right)}{\mathsf{neg}\left(\left(\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}\right)\right)}} \]
                3. lower-/.f64N/A

                  \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\left(\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0\right)\right)}{\mathsf{neg}\left(\left(\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}\right)\right)}} \]
              3. Applied rewrites66.0%

                \[\leadsto \color{blue}{\frac{\left(-z0\right) - \left(\left(\left(z0 \cdot 0.25 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot z0\right) \cdot z0}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}}} \]
              4. Taylor expanded in z0 around 0

                \[\leadsto \frac{\color{blue}{z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)}}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
              5. Step-by-step derivation
                1. lower-*.f64N/A

                  \[\leadsto \frac{z0 \cdot \color{blue}{\left(\frac{-1}{2} \cdot z0 - 1\right)}}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
                2. lower--.f64N/A

                  \[\leadsto \frac{z0 \cdot \left(\frac{-1}{2} \cdot z0 - \color{blue}{1}\right)}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
                3. lower-*.f6459.9%

                  \[\leadsto \frac{z0 \cdot \left(-0.5 \cdot z0 - 1\right)}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
              6. Applied rewrites59.9%

                \[\leadsto \frac{\color{blue}{z0 \cdot \left(-0.5 \cdot z0 - 1\right)}}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
              7. Step-by-step derivation
                1. lift-/.f64N/A

                  \[\leadsto \color{blue}{\frac{z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}}} \]
                2. frac-2negN/A

                  \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)}{\mathsf{neg}\left(\left(\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}\right)\right)}} \]
                3. mult-flipN/A

                  \[\leadsto \color{blue}{\left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\mathsf{neg}\left(\left(\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}\right)\right)}} \]
                4. lift--.f64N/A

                  \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\mathsf{neg}\left(\color{blue}{\left(\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}\right)}\right)} \]
                5. sub-negate-revN/A

                  \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\color{blue}{\frac{z3}{z4 \cdot z4} - \frac{z1}{\left(-z2\right) \cdot z2}}} \]
                6. lift-/.f64N/A

                  \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} - \color{blue}{\frac{z1}{\left(-z2\right) \cdot z2}}} \]
                7. mult-flipN/A

                  \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} - \color{blue}{z1 \cdot \frac{1}{\left(-z2\right) \cdot z2}}} \]
                8. fp-cancel-sub-sign-invN/A

                  \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\color{blue}{\frac{z3}{z4 \cdot z4} + \left(\mathsf{neg}\left(z1\right)\right) \cdot \frac{1}{\left(-z2\right) \cdot z2}}} \]
                9. mult-flipN/A

                  \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\mathsf{neg}\left(z1\right)}{\left(-z2\right) \cdot z2}}} \]
                10. lift-*.f64N/A

                  \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} + \frac{\mathsf{neg}\left(z1\right)}{\color{blue}{\left(-z2\right) \cdot z2}}} \]
                11. lift-neg.f64N/A

                  \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} + \frac{\mathsf{neg}\left(z1\right)}{\color{blue}{\left(\mathsf{neg}\left(z2\right)\right)} \cdot z2}} \]
                12. distribute-lft-neg-outN/A

                  \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} + \frac{\mathsf{neg}\left(z1\right)}{\color{blue}{\mathsf{neg}\left(z2 \cdot z2\right)}}} \]
                13. lift-*.f64N/A

                  \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} + \frac{\mathsf{neg}\left(z1\right)}{\mathsf{neg}\left(\color{blue}{z2 \cdot z2}\right)}} \]
              8. Applied rewrites60.0%

                \[\leadsto \color{blue}{\left(-\left(-0.5 \cdot z0 - 1\right) \cdot z0\right) \cdot \left(\frac{z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3} \cdot z4\right)} \]
              9. Taylor expanded in z3 around inf

                \[\leadsto \left(-\left(-0.5 \cdot z0 - 1\right) \cdot z0\right) \cdot \left(\color{blue}{\frac{z4}{z3}} \cdot z4\right) \]
              10. Step-by-step derivation
                1. lower-/.f6445.8%

                  \[\leadsto \left(-\left(-0.5 \cdot z0 - 1\right) \cdot z0\right) \cdot \left(\frac{z4}{\color{blue}{z3}} \cdot z4\right) \]
              11. Applied rewrites45.8%

                \[\leadsto \left(-\left(-0.5 \cdot z0 - 1\right) \cdot z0\right) \cdot \left(\color{blue}{\frac{z4}{z3}} \cdot z4\right) \]
            4. Recombined 2 regimes into one program.
            5. Add Preprocessing

            Alternative 14: 64.0% accurate, 0.8× speedup?

            \[\begin{array}{l} \mathbf{if}\;\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0 \leq 10^{+280}:\\ \;\;\;\;\frac{z0 \cdot -1}{\frac{\frac{-z1}{z2}}{z2} - \frac{z3}{z4 \cdot z4}}\\ \mathbf{else}:\\ \;\;\;\;\left(-\left(-0.5 \cdot z0 - 1\right) \cdot z0\right) \cdot \left(\frac{z4}{z3} \cdot z4\right)\\ \end{array} \]
            (FPCore (z0 z3 z4 z1 z2)
              :precision binary64
              (if (<=
                 (+
                  (*
                   (- (* (- (* 0.25 z0) -0.3333333333333333) z0) -0.5)
                   (* z0 z0))
                  z0)
                 1e+280)
              (/ (* z0 -1.0) (- (/ (/ (- z1) z2) z2) (/ z3 (* z4 z4))))
              (* (- (* (- (* -0.5 z0) 1.0) z0)) (* (/ z4 z3) z4))))
            double code(double z0, double z3, double z4, double z1, double z2) {
            	double tmp;
            	if (((((((0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * (z0 * z0)) + z0) <= 1e+280) {
            		tmp = (z0 * -1.0) / (((-z1 / z2) / z2) - (z3 / (z4 * z4)));
            	} else {
            		tmp = -(((-0.5 * z0) - 1.0) * z0) * ((z4 / z3) * z4);
            	}
            	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(z0, z3, z4, z1, z2)
            use fmin_fmax_functions
                real(8), intent (in) :: z0
                real(8), intent (in) :: z3
                real(8), intent (in) :: z4
                real(8), intent (in) :: z1
                real(8), intent (in) :: z2
                real(8) :: tmp
                if (((((((0.25d0 * z0) - (-0.3333333333333333d0)) * z0) - (-0.5d0)) * (z0 * z0)) + z0) <= 1d+280) then
                    tmp = (z0 * (-1.0d0)) / (((-z1 / z2) / z2) - (z3 / (z4 * z4)))
                else
                    tmp = -((((-0.5d0) * z0) - 1.0d0) * z0) * ((z4 / z3) * z4)
                end if
                code = tmp
            end function
            
            public static double code(double z0, double z3, double z4, double z1, double z2) {
            	double tmp;
            	if (((((((0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * (z0 * z0)) + z0) <= 1e+280) {
            		tmp = (z0 * -1.0) / (((-z1 / z2) / z2) - (z3 / (z4 * z4)));
            	} else {
            		tmp = -(((-0.5 * z0) - 1.0) * z0) * ((z4 / z3) * z4);
            	}
            	return tmp;
            }
            
            def code(z0, z3, z4, z1, z2):
            	tmp = 0
            	if ((((((0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * (z0 * z0)) + z0) <= 1e+280:
            		tmp = (z0 * -1.0) / (((-z1 / z2) / z2) - (z3 / (z4 * z4)))
            	else:
            		tmp = -(((-0.5 * z0) - 1.0) * z0) * ((z4 / z3) * z4)
            	return tmp
            
            function code(z0, z3, z4, z1, z2)
            	tmp = 0.0
            	if (Float64(Float64(Float64(Float64(Float64(Float64(0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * Float64(z0 * z0)) + z0) <= 1e+280)
            		tmp = Float64(Float64(z0 * -1.0) / Float64(Float64(Float64(Float64(-z1) / z2) / z2) - Float64(z3 / Float64(z4 * z4))));
            	else
            		tmp = Float64(Float64(-Float64(Float64(Float64(-0.5 * z0) - 1.0) * z0)) * Float64(Float64(z4 / z3) * z4));
            	end
            	return tmp
            end
            
            function tmp_2 = code(z0, z3, z4, z1, z2)
            	tmp = 0.0;
            	if (((((((0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * (z0 * z0)) + z0) <= 1e+280)
            		tmp = (z0 * -1.0) / (((-z1 / z2) / z2) - (z3 / (z4 * z4)));
            	else
            		tmp = -(((-0.5 * z0) - 1.0) * z0) * ((z4 / z3) * z4);
            	end
            	tmp_2 = tmp;
            end
            
            code[z0_, z3_, z4_, z1_, z2_] := If[LessEqual[N[(N[(N[(N[(N[(N[(0.25 * z0), $MachinePrecision] - -0.3333333333333333), $MachinePrecision] * z0), $MachinePrecision] - -0.5), $MachinePrecision] * N[(z0 * z0), $MachinePrecision]), $MachinePrecision] + z0), $MachinePrecision], 1e+280], N[(N[(z0 * -1.0), $MachinePrecision] / N[(N[(N[((-z1) / z2), $MachinePrecision] / z2), $MachinePrecision] - N[(z3 / N[(z4 * z4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-N[(N[(N[(-0.5 * z0), $MachinePrecision] - 1.0), $MachinePrecision] * z0), $MachinePrecision]) * N[(N[(z4 / z3), $MachinePrecision] * z4), $MachinePrecision]), $MachinePrecision]]
            
            \begin{array}{l}
            \mathbf{if}\;\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0 \leq 10^{+280}:\\
            \;\;\;\;\frac{z0 \cdot -1}{\frac{\frac{-z1}{z2}}{z2} - \frac{z3}{z4 \cdot z4}}\\
            
            \mathbf{else}:\\
            \;\;\;\;\left(-\left(-0.5 \cdot z0 - 1\right) \cdot z0\right) \cdot \left(\frac{z4}{z3} \cdot z4\right)\\
            
            
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if (+.f64 (*.f64 (-.f64 (*.f64 (-.f64 (*.f64 #s(literal 1/4 binary64) z0) #s(literal -3333333333333333/10000000000000000 binary64)) z0) #s(literal -1/2 binary64)) (*.f64 z0 z0)) z0) < 1e280

              1. Initial program 66.3%

                \[\frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}} \]
              2. Step-by-step derivation
                1. lift-/.f64N/A

                  \[\leadsto \color{blue}{\frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}}} \]
                2. frac-2negN/A

                  \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\left(\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0\right)\right)}{\mathsf{neg}\left(\left(\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}\right)\right)}} \]
                3. lower-/.f64N/A

                  \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\left(\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0\right)\right)}{\mathsf{neg}\left(\left(\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}\right)\right)}} \]
              3. Applied rewrites66.0%

                \[\leadsto \color{blue}{\frac{\left(-z0\right) - \left(\left(\left(z0 \cdot 0.25 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot z0\right) \cdot z0}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}}} \]
              4. Taylor expanded in z0 around 0

                \[\leadsto \frac{\color{blue}{z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)}}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
              5. Step-by-step derivation
                1. lower-*.f64N/A

                  \[\leadsto \frac{z0 \cdot \color{blue}{\left(\frac{-1}{2} \cdot z0 - 1\right)}}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
                2. lower--.f64N/A

                  \[\leadsto \frac{z0 \cdot \left(\frac{-1}{2} \cdot z0 - \color{blue}{1}\right)}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
                3. lower-*.f6459.9%

                  \[\leadsto \frac{z0 \cdot \left(-0.5 \cdot z0 - 1\right)}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
              6. Applied rewrites59.9%

                \[\leadsto \frac{\color{blue}{z0 \cdot \left(-0.5 \cdot z0 - 1\right)}}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
              7. Taylor expanded in z0 around 0

                \[\leadsto \frac{z0 \cdot -1}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
              8. Step-by-step derivation
                1. Applied rewrites49.3%

                  \[\leadsto \frac{z0 \cdot -1}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
                2. Step-by-step derivation
                  1. lift-/.f64N/A

                    \[\leadsto \frac{z0 \cdot -1}{\color{blue}{\frac{z1}{\left(-z2\right) \cdot z2}} - \frac{z3}{z4 \cdot z4}} \]
                  2. lift-*.f64N/A

                    \[\leadsto \frac{z0 \cdot -1}{\frac{z1}{\color{blue}{\left(-z2\right) \cdot z2}} - \frac{z3}{z4 \cdot z4}} \]
                  3. associate-/r*N/A

                    \[\leadsto \frac{z0 \cdot -1}{\color{blue}{\frac{\frac{z1}{-z2}}{z2}} - \frac{z3}{z4 \cdot z4}} \]
                  4. lower-/.f64N/A

                    \[\leadsto \frac{z0 \cdot -1}{\color{blue}{\frac{\frac{z1}{-z2}}{z2}} - \frac{z3}{z4 \cdot z4}} \]
                  5. lift-neg.f64N/A

                    \[\leadsto \frac{z0 \cdot -1}{\frac{\frac{z1}{\color{blue}{\mathsf{neg}\left(z2\right)}}}{z2} - \frac{z3}{z4 \cdot z4}} \]
                  6. distribute-neg-frac2N/A

                    \[\leadsto \frac{z0 \cdot -1}{\frac{\color{blue}{\mathsf{neg}\left(\frac{z1}{z2}\right)}}{z2} - \frac{z3}{z4 \cdot z4}} \]
                  7. distribute-frac-negN/A

                    \[\leadsto \frac{z0 \cdot -1}{\frac{\color{blue}{\frac{\mathsf{neg}\left(z1\right)}{z2}}}{z2} - \frac{z3}{z4 \cdot z4}} \]
                  8. lift-neg.f64N/A

                    \[\leadsto \frac{z0 \cdot -1}{\frac{\frac{\color{blue}{-z1}}{z2}}{z2} - \frac{z3}{z4 \cdot z4}} \]
                  9. lift-/.f6451.2%

                    \[\leadsto \frac{z0 \cdot -1}{\frac{\color{blue}{\frac{-z1}{z2}}}{z2} - \frac{z3}{z4 \cdot z4}} \]
                3. Applied rewrites51.2%

                  \[\leadsto \frac{z0 \cdot -1}{\color{blue}{\frac{\frac{-z1}{z2}}{z2}} - \frac{z3}{z4 \cdot z4}} \]

                if 1e280 < (+.f64 (*.f64 (-.f64 (*.f64 (-.f64 (*.f64 #s(literal 1/4 binary64) z0) #s(literal -3333333333333333/10000000000000000 binary64)) z0) #s(literal -1/2 binary64)) (*.f64 z0 z0)) z0)

                1. Initial program 66.3%

                  \[\frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}} \]
                2. Step-by-step derivation
                  1. lift-/.f64N/A

                    \[\leadsto \color{blue}{\frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}}} \]
                  2. frac-2negN/A

                    \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\left(\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0\right)\right)}{\mathsf{neg}\left(\left(\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}\right)\right)}} \]
                  3. lower-/.f64N/A

                    \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\left(\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0\right)\right)}{\mathsf{neg}\left(\left(\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}\right)\right)}} \]
                3. Applied rewrites66.0%

                  \[\leadsto \color{blue}{\frac{\left(-z0\right) - \left(\left(\left(z0 \cdot 0.25 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot z0\right) \cdot z0}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}}} \]
                4. Taylor expanded in z0 around 0

                  \[\leadsto \frac{\color{blue}{z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)}}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
                5. Step-by-step derivation
                  1. lower-*.f64N/A

                    \[\leadsto \frac{z0 \cdot \color{blue}{\left(\frac{-1}{2} \cdot z0 - 1\right)}}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
                  2. lower--.f64N/A

                    \[\leadsto \frac{z0 \cdot \left(\frac{-1}{2} \cdot z0 - \color{blue}{1}\right)}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
                  3. lower-*.f6459.9%

                    \[\leadsto \frac{z0 \cdot \left(-0.5 \cdot z0 - 1\right)}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
                6. Applied rewrites59.9%

                  \[\leadsto \frac{\color{blue}{z0 \cdot \left(-0.5 \cdot z0 - 1\right)}}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
                7. Step-by-step derivation
                  1. lift-/.f64N/A

                    \[\leadsto \color{blue}{\frac{z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}}} \]
                  2. frac-2negN/A

                    \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)}{\mathsf{neg}\left(\left(\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}\right)\right)}} \]
                  3. mult-flipN/A

                    \[\leadsto \color{blue}{\left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\mathsf{neg}\left(\left(\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}\right)\right)}} \]
                  4. lift--.f64N/A

                    \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\mathsf{neg}\left(\color{blue}{\left(\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}\right)}\right)} \]
                  5. sub-negate-revN/A

                    \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\color{blue}{\frac{z3}{z4 \cdot z4} - \frac{z1}{\left(-z2\right) \cdot z2}}} \]
                  6. lift-/.f64N/A

                    \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} - \color{blue}{\frac{z1}{\left(-z2\right) \cdot z2}}} \]
                  7. mult-flipN/A

                    \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} - \color{blue}{z1 \cdot \frac{1}{\left(-z2\right) \cdot z2}}} \]
                  8. fp-cancel-sub-sign-invN/A

                    \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\color{blue}{\frac{z3}{z4 \cdot z4} + \left(\mathsf{neg}\left(z1\right)\right) \cdot \frac{1}{\left(-z2\right) \cdot z2}}} \]
                  9. mult-flipN/A

                    \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\mathsf{neg}\left(z1\right)}{\left(-z2\right) \cdot z2}}} \]
                  10. lift-*.f64N/A

                    \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} + \frac{\mathsf{neg}\left(z1\right)}{\color{blue}{\left(-z2\right) \cdot z2}}} \]
                  11. lift-neg.f64N/A

                    \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} + \frac{\mathsf{neg}\left(z1\right)}{\color{blue}{\left(\mathsf{neg}\left(z2\right)\right)} \cdot z2}} \]
                  12. distribute-lft-neg-outN/A

                    \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} + \frac{\mathsf{neg}\left(z1\right)}{\color{blue}{\mathsf{neg}\left(z2 \cdot z2\right)}}} \]
                  13. lift-*.f64N/A

                    \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} + \frac{\mathsf{neg}\left(z1\right)}{\mathsf{neg}\left(\color{blue}{z2 \cdot z2}\right)}} \]
                8. Applied rewrites60.0%

                  \[\leadsto \color{blue}{\left(-\left(-0.5 \cdot z0 - 1\right) \cdot z0\right) \cdot \left(\frac{z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3} \cdot z4\right)} \]
                9. Taylor expanded in z3 around inf

                  \[\leadsto \left(-\left(-0.5 \cdot z0 - 1\right) \cdot z0\right) \cdot \left(\color{blue}{\frac{z4}{z3}} \cdot z4\right) \]
                10. Step-by-step derivation
                  1. lower-/.f6445.8%

                    \[\leadsto \left(-\left(-0.5 \cdot z0 - 1\right) \cdot z0\right) \cdot \left(\frac{z4}{\color{blue}{z3}} \cdot z4\right) \]
                11. Applied rewrites45.8%

                  \[\leadsto \left(-\left(-0.5 \cdot z0 - 1\right) \cdot z0\right) \cdot \left(\color{blue}{\frac{z4}{z3}} \cdot z4\right) \]
              9. Recombined 2 regimes into one program.
              10. Add Preprocessing

              Alternative 15: 63.7% accurate, 0.4× speedup?

              \[\begin{array}{l} t_0 := \frac{z3}{z4 \cdot z4}\\ t_1 := \frac{z1}{z2 \cdot z2}\\ t_2 := \frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{t\_0 + t\_1}\\ t_3 := \left(-\left(-0.5 \cdot z0 - 1\right) \cdot z0\right) \cdot \left(\frac{z4}{z3} \cdot z4\right)\\ \mathbf{if}\;t\_2 \leq -\infty:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;t\_2 \leq 4 \cdot 10^{+202}:\\ \;\;\;\;\frac{z0}{t\_1 + t\_0} \cdot 1\\ \mathbf{else}:\\ \;\;\;\;t\_3\\ \end{array} \]
              (FPCore (z0 z3 z4 z1 z2)
                :precision binary64
                (let* ((t_0 (/ z3 (* z4 z4)))
                     (t_1 (/ z1 (* z2 z2)))
                     (t_2
                      (/
                       (+
                        (*
                         (- (* (- (* 0.25 z0) -0.3333333333333333) z0) -0.5)
                         (* z0 z0))
                        z0)
                       (+ t_0 t_1)))
                     (t_3 (* (- (* (- (* -0.5 z0) 1.0) z0)) (* (/ z4 z3) z4))))
                (if (<= t_2 (- INFINITY))
                  t_3
                  (if (<= t_2 4e+202) (* (/ z0 (+ t_1 t_0)) 1.0) t_3))))
              double code(double z0, double z3, double z4, double z1, double z2) {
              	double t_0 = z3 / (z4 * z4);
              	double t_1 = z1 / (z2 * z2);
              	double t_2 = ((((((0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * (z0 * z0)) + z0) / (t_0 + t_1);
              	double t_3 = -(((-0.5 * z0) - 1.0) * z0) * ((z4 / z3) * z4);
              	double tmp;
              	if (t_2 <= -((double) INFINITY)) {
              		tmp = t_3;
              	} else if (t_2 <= 4e+202) {
              		tmp = (z0 / (t_1 + t_0)) * 1.0;
              	} else {
              		tmp = t_3;
              	}
              	return tmp;
              }
              
              public static double code(double z0, double z3, double z4, double z1, double z2) {
              	double t_0 = z3 / (z4 * z4);
              	double t_1 = z1 / (z2 * z2);
              	double t_2 = ((((((0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * (z0 * z0)) + z0) / (t_0 + t_1);
              	double t_3 = -(((-0.5 * z0) - 1.0) * z0) * ((z4 / z3) * z4);
              	double tmp;
              	if (t_2 <= -Double.POSITIVE_INFINITY) {
              		tmp = t_3;
              	} else if (t_2 <= 4e+202) {
              		tmp = (z0 / (t_1 + t_0)) * 1.0;
              	} else {
              		tmp = t_3;
              	}
              	return tmp;
              }
              
              def code(z0, z3, z4, z1, z2):
              	t_0 = z3 / (z4 * z4)
              	t_1 = z1 / (z2 * z2)
              	t_2 = ((((((0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * (z0 * z0)) + z0) / (t_0 + t_1)
              	t_3 = -(((-0.5 * z0) - 1.0) * z0) * ((z4 / z3) * z4)
              	tmp = 0
              	if t_2 <= -math.inf:
              		tmp = t_3
              	elif t_2 <= 4e+202:
              		tmp = (z0 / (t_1 + t_0)) * 1.0
              	else:
              		tmp = t_3
              	return tmp
              
              function code(z0, z3, z4, z1, z2)
              	t_0 = Float64(z3 / Float64(z4 * z4))
              	t_1 = Float64(z1 / Float64(z2 * z2))
              	t_2 = Float64(Float64(Float64(Float64(Float64(Float64(Float64(0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * Float64(z0 * z0)) + z0) / Float64(t_0 + t_1))
              	t_3 = Float64(Float64(-Float64(Float64(Float64(-0.5 * z0) - 1.0) * z0)) * Float64(Float64(z4 / z3) * z4))
              	tmp = 0.0
              	if (t_2 <= Float64(-Inf))
              		tmp = t_3;
              	elseif (t_2 <= 4e+202)
              		tmp = Float64(Float64(z0 / Float64(t_1 + t_0)) * 1.0);
              	else
              		tmp = t_3;
              	end
              	return tmp
              end
              
              function tmp_2 = code(z0, z3, z4, z1, z2)
              	t_0 = z3 / (z4 * z4);
              	t_1 = z1 / (z2 * z2);
              	t_2 = ((((((0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * (z0 * z0)) + z0) / (t_0 + t_1);
              	t_3 = -(((-0.5 * z0) - 1.0) * z0) * ((z4 / z3) * z4);
              	tmp = 0.0;
              	if (t_2 <= -Inf)
              		tmp = t_3;
              	elseif (t_2 <= 4e+202)
              		tmp = (z0 / (t_1 + t_0)) * 1.0;
              	else
              		tmp = t_3;
              	end
              	tmp_2 = tmp;
              end
              
              code[z0_, z3_, z4_, z1_, z2_] := Block[{t$95$0 = N[(z3 / N[(z4 * z4), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(z1 / N[(z2 * z2), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[(N[(N[(N[(0.25 * z0), $MachinePrecision] - -0.3333333333333333), $MachinePrecision] * z0), $MachinePrecision] - -0.5), $MachinePrecision] * N[(z0 * z0), $MachinePrecision]), $MachinePrecision] + z0), $MachinePrecision] / N[(t$95$0 + t$95$1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[((-N[(N[(N[(-0.5 * z0), $MachinePrecision] - 1.0), $MachinePrecision] * z0), $MachinePrecision]) * N[(N[(z4 / z3), $MachinePrecision] * z4), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$3, If[LessEqual[t$95$2, 4e+202], N[(N[(z0 / N[(t$95$1 + t$95$0), $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], t$95$3]]]]]]
              
              \begin{array}{l}
              t_0 := \frac{z3}{z4 \cdot z4}\\
              t_1 := \frac{z1}{z2 \cdot z2}\\
              t_2 := \frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{t\_0 + t\_1}\\
              t_3 := \left(-\left(-0.5 \cdot z0 - 1\right) \cdot z0\right) \cdot \left(\frac{z4}{z3} \cdot z4\right)\\
              \mathbf{if}\;t\_2 \leq -\infty:\\
              \;\;\;\;t\_3\\
              
              \mathbf{elif}\;t\_2 \leq 4 \cdot 10^{+202}:\\
              \;\;\;\;\frac{z0}{t\_1 + t\_0} \cdot 1\\
              
              \mathbf{else}:\\
              \;\;\;\;t\_3\\
              
              
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if (/.f64 (+.f64 (*.f64 (-.f64 (*.f64 (-.f64 (*.f64 #s(literal 1/4 binary64) z0) #s(literal -3333333333333333/10000000000000000 binary64)) z0) #s(literal -1/2 binary64)) (*.f64 z0 z0)) z0) (+.f64 (/.f64 z3 (*.f64 z4 z4)) (/.f64 z1 (*.f64 z2 z2)))) < -inf.0 or 3.9999999999999996e202 < (/.f64 (+.f64 (*.f64 (-.f64 (*.f64 (-.f64 (*.f64 #s(literal 1/4 binary64) z0) #s(literal -3333333333333333/10000000000000000 binary64)) z0) #s(literal -1/2 binary64)) (*.f64 z0 z0)) z0) (+.f64 (/.f64 z3 (*.f64 z4 z4)) (/.f64 z1 (*.f64 z2 z2))))

                1. Initial program 66.3%

                  \[\frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}} \]
                2. Step-by-step derivation
                  1. lift-/.f64N/A

                    \[\leadsto \color{blue}{\frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}}} \]
                  2. frac-2negN/A

                    \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\left(\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0\right)\right)}{\mathsf{neg}\left(\left(\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}\right)\right)}} \]
                  3. lower-/.f64N/A

                    \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\left(\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0\right)\right)}{\mathsf{neg}\left(\left(\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}\right)\right)}} \]
                3. Applied rewrites66.0%

                  \[\leadsto \color{blue}{\frac{\left(-z0\right) - \left(\left(\left(z0 \cdot 0.25 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot z0\right) \cdot z0}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}}} \]
                4. Taylor expanded in z0 around 0

                  \[\leadsto \frac{\color{blue}{z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)}}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
                5. Step-by-step derivation
                  1. lower-*.f64N/A

                    \[\leadsto \frac{z0 \cdot \color{blue}{\left(\frac{-1}{2} \cdot z0 - 1\right)}}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
                  2. lower--.f64N/A

                    \[\leadsto \frac{z0 \cdot \left(\frac{-1}{2} \cdot z0 - \color{blue}{1}\right)}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
                  3. lower-*.f6459.9%

                    \[\leadsto \frac{z0 \cdot \left(-0.5 \cdot z0 - 1\right)}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
                6. Applied rewrites59.9%

                  \[\leadsto \frac{\color{blue}{z0 \cdot \left(-0.5 \cdot z0 - 1\right)}}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
                7. Step-by-step derivation
                  1. lift-/.f64N/A

                    \[\leadsto \color{blue}{\frac{z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}}} \]
                  2. frac-2negN/A

                    \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)}{\mathsf{neg}\left(\left(\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}\right)\right)}} \]
                  3. mult-flipN/A

                    \[\leadsto \color{blue}{\left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\mathsf{neg}\left(\left(\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}\right)\right)}} \]
                  4. lift--.f64N/A

                    \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\mathsf{neg}\left(\color{blue}{\left(\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}\right)}\right)} \]
                  5. sub-negate-revN/A

                    \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\color{blue}{\frac{z3}{z4 \cdot z4} - \frac{z1}{\left(-z2\right) \cdot z2}}} \]
                  6. lift-/.f64N/A

                    \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} - \color{blue}{\frac{z1}{\left(-z2\right) \cdot z2}}} \]
                  7. mult-flipN/A

                    \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} - \color{blue}{z1 \cdot \frac{1}{\left(-z2\right) \cdot z2}}} \]
                  8. fp-cancel-sub-sign-invN/A

                    \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\color{blue}{\frac{z3}{z4 \cdot z4} + \left(\mathsf{neg}\left(z1\right)\right) \cdot \frac{1}{\left(-z2\right) \cdot z2}}} \]
                  9. mult-flipN/A

                    \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\mathsf{neg}\left(z1\right)}{\left(-z2\right) \cdot z2}}} \]
                  10. lift-*.f64N/A

                    \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} + \frac{\mathsf{neg}\left(z1\right)}{\color{blue}{\left(-z2\right) \cdot z2}}} \]
                  11. lift-neg.f64N/A

                    \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} + \frac{\mathsf{neg}\left(z1\right)}{\color{blue}{\left(\mathsf{neg}\left(z2\right)\right)} \cdot z2}} \]
                  12. distribute-lft-neg-outN/A

                    \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} + \frac{\mathsf{neg}\left(z1\right)}{\color{blue}{\mathsf{neg}\left(z2 \cdot z2\right)}}} \]
                  13. lift-*.f64N/A

                    \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} + \frac{\mathsf{neg}\left(z1\right)}{\mathsf{neg}\left(\color{blue}{z2 \cdot z2}\right)}} \]
                8. Applied rewrites60.0%

                  \[\leadsto \color{blue}{\left(-\left(-0.5 \cdot z0 - 1\right) \cdot z0\right) \cdot \left(\frac{z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3} \cdot z4\right)} \]
                9. Taylor expanded in z3 around inf

                  \[\leadsto \left(-\left(-0.5 \cdot z0 - 1\right) \cdot z0\right) \cdot \left(\color{blue}{\frac{z4}{z3}} \cdot z4\right) \]
                10. Step-by-step derivation
                  1. lower-/.f6445.8%

                    \[\leadsto \left(-\left(-0.5 \cdot z0 - 1\right) \cdot z0\right) \cdot \left(\frac{z4}{\color{blue}{z3}} \cdot z4\right) \]
                11. Applied rewrites45.8%

                  \[\leadsto \left(-\left(-0.5 \cdot z0 - 1\right) \cdot z0\right) \cdot \left(\color{blue}{\frac{z4}{z3}} \cdot z4\right) \]

                if -inf.0 < (/.f64 (+.f64 (*.f64 (-.f64 (*.f64 (-.f64 (*.f64 #s(literal 1/4 binary64) z0) #s(literal -3333333333333333/10000000000000000 binary64)) z0) #s(literal -1/2 binary64)) (*.f64 z0 z0)) z0) (+.f64 (/.f64 z3 (*.f64 z4 z4)) (/.f64 z1 (*.f64 z2 z2)))) < 3.9999999999999996e202

                1. Initial program 66.3%

                  \[\frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}} \]
                2. Step-by-step derivation
                  1. lift-/.f64N/A

                    \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{z1}{z2 \cdot z2}}} \]
                  2. lift-*.f64N/A

                    \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{\color{blue}{z2 \cdot z2}}} \]
                  3. associate-/r*N/A

                    \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\frac{z1}{z2}}{z2}}} \]
                  4. lower-/.f64N/A

                    \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\frac{z1}{z2}}{z2}}} \]
                  5. lower-/.f6470.6%

                    \[\leadsto \frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{\color{blue}{\frac{z1}{z2}}}{z2}} \]
                3. Applied rewrites70.6%

                  \[\leadsto \frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\frac{z1}{z2}}{z2}}} \]
                4. Step-by-step derivation
                  1. lift-/.f64N/A

                    \[\leadsto \color{blue}{\frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{\frac{z1}{z2}}{z2}}} \]
                  2. lift-+.f64N/A

                    \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\color{blue}{\frac{z3}{z4 \cdot z4} + \frac{\frac{z1}{z2}}{z2}}} \]
                  3. lift-/.f64N/A

                    \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\frac{z1}{z2}}{z2}}} \]
                  4. lift-/.f64N/A

                    \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{\color{blue}{\frac{z1}{z2}}}{z2}} \]
                  5. associate-/l/N/A

                    \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{z1}{z2 \cdot z2}}} \]
                  6. lift-*.f64N/A

                    \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{\color{blue}{z2 \cdot z2}}} \]
                  7. lift-/.f64N/A

                    \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{z1}{z2 \cdot z2}}} \]
                  8. +-commutativeN/A

                    \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\color{blue}{\frac{z1}{z2 \cdot z2} + \frac{z3}{z4 \cdot z4}}} \]
                  9. lift-+.f64N/A

                    \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\color{blue}{\frac{z1}{z2 \cdot z2} + \frac{z3}{z4 \cdot z4}}} \]
                5. Applied rewrites67.3%

                  \[\leadsto \color{blue}{\frac{z0}{\frac{z1}{z2 \cdot z2} + \frac{z3}{z4 \cdot z4}} \cdot \left(\left(\left(z0 \cdot 0.25 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot z0 - -1\right)} \]
                6. Taylor expanded in z0 around 0

                  \[\leadsto \frac{z0}{\frac{z1}{z2 \cdot z2} + \frac{z3}{z4 \cdot z4}} \cdot \color{blue}{1} \]
                7. Step-by-step derivation
                  1. Applied rewrites49.2%

                    \[\leadsto \frac{z0}{\frac{z1}{z2 \cdot z2} + \frac{z3}{z4 \cdot z4}} \cdot \color{blue}{1} \]
                8. Recombined 2 regimes into one program.
                9. Add Preprocessing

                Alternative 16: 62.5% accurate, 0.5× speedup?

                \[\begin{array}{l} t_0 := \frac{z3}{z4 \cdot z4}\\ t_1 := \frac{z1}{z2 \cdot z2}\\ \mathbf{if}\;\frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{t\_0 + t\_1} \leq 4 \cdot 10^{+202}:\\ \;\;\;\;\frac{z0}{t\_1 + t\_0} \cdot \left(0.5 \cdot z0 - -1\right)\\ \mathbf{else}:\\ \;\;\;\;\left(-\left(-0.5 \cdot z0 - 1\right) \cdot z0\right) \cdot \left(\frac{z4}{z3} \cdot z4\right)\\ \end{array} \]
                (FPCore (z0 z3 z4 z1 z2)
                  :precision binary64
                  (let* ((t_0 (/ z3 (* z4 z4))) (t_1 (/ z1 (* z2 z2))))
                  (if (<=
                       (/
                        (+
                         (*
                          (- (* (- (* 0.25 z0) -0.3333333333333333) z0) -0.5)
                          (* z0 z0))
                         z0)
                        (+ t_0 t_1))
                       4e+202)
                    (* (/ z0 (+ t_1 t_0)) (- (* 0.5 z0) -1.0))
                    (* (- (* (- (* -0.5 z0) 1.0) z0)) (* (/ z4 z3) z4)))))
                double code(double z0, double z3, double z4, double z1, double z2) {
                	double t_0 = z3 / (z4 * z4);
                	double t_1 = z1 / (z2 * z2);
                	double tmp;
                	if ((((((((0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * (z0 * z0)) + z0) / (t_0 + t_1)) <= 4e+202) {
                		tmp = (z0 / (t_1 + t_0)) * ((0.5 * z0) - -1.0);
                	} else {
                		tmp = -(((-0.5 * z0) - 1.0) * z0) * ((z4 / z3) * z4);
                	}
                	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(z0, z3, z4, z1, z2)
                use fmin_fmax_functions
                    real(8), intent (in) :: z0
                    real(8), intent (in) :: z3
                    real(8), intent (in) :: z4
                    real(8), intent (in) :: z1
                    real(8), intent (in) :: z2
                    real(8) :: t_0
                    real(8) :: t_1
                    real(8) :: tmp
                    t_0 = z3 / (z4 * z4)
                    t_1 = z1 / (z2 * z2)
                    if ((((((((0.25d0 * z0) - (-0.3333333333333333d0)) * z0) - (-0.5d0)) * (z0 * z0)) + z0) / (t_0 + t_1)) <= 4d+202) then
                        tmp = (z0 / (t_1 + t_0)) * ((0.5d0 * z0) - (-1.0d0))
                    else
                        tmp = -((((-0.5d0) * z0) - 1.0d0) * z0) * ((z4 / z3) * z4)
                    end if
                    code = tmp
                end function
                
                public static double code(double z0, double z3, double z4, double z1, double z2) {
                	double t_0 = z3 / (z4 * z4);
                	double t_1 = z1 / (z2 * z2);
                	double tmp;
                	if ((((((((0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * (z0 * z0)) + z0) / (t_0 + t_1)) <= 4e+202) {
                		tmp = (z0 / (t_1 + t_0)) * ((0.5 * z0) - -1.0);
                	} else {
                		tmp = -(((-0.5 * z0) - 1.0) * z0) * ((z4 / z3) * z4);
                	}
                	return tmp;
                }
                
                def code(z0, z3, z4, z1, z2):
                	t_0 = z3 / (z4 * z4)
                	t_1 = z1 / (z2 * z2)
                	tmp = 0
                	if (((((((0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * (z0 * z0)) + z0) / (t_0 + t_1)) <= 4e+202:
                		tmp = (z0 / (t_1 + t_0)) * ((0.5 * z0) - -1.0)
                	else:
                		tmp = -(((-0.5 * z0) - 1.0) * z0) * ((z4 / z3) * z4)
                	return tmp
                
                function code(z0, z3, z4, z1, z2)
                	t_0 = Float64(z3 / Float64(z4 * z4))
                	t_1 = Float64(z1 / Float64(z2 * z2))
                	tmp = 0.0
                	if (Float64(Float64(Float64(Float64(Float64(Float64(Float64(0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * Float64(z0 * z0)) + z0) / Float64(t_0 + t_1)) <= 4e+202)
                		tmp = Float64(Float64(z0 / Float64(t_1 + t_0)) * Float64(Float64(0.5 * z0) - -1.0));
                	else
                		tmp = Float64(Float64(-Float64(Float64(Float64(-0.5 * z0) - 1.0) * z0)) * Float64(Float64(z4 / z3) * z4));
                	end
                	return tmp
                end
                
                function tmp_2 = code(z0, z3, z4, z1, z2)
                	t_0 = z3 / (z4 * z4);
                	t_1 = z1 / (z2 * z2);
                	tmp = 0.0;
                	if ((((((((0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * (z0 * z0)) + z0) / (t_0 + t_1)) <= 4e+202)
                		tmp = (z0 / (t_1 + t_0)) * ((0.5 * z0) - -1.0);
                	else
                		tmp = -(((-0.5 * z0) - 1.0) * z0) * ((z4 / z3) * z4);
                	end
                	tmp_2 = tmp;
                end
                
                code[z0_, z3_, z4_, z1_, z2_] := Block[{t$95$0 = N[(z3 / N[(z4 * z4), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(z1 / N[(z2 * z2), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(N[(N[(N[(N[(N[(0.25 * z0), $MachinePrecision] - -0.3333333333333333), $MachinePrecision] * z0), $MachinePrecision] - -0.5), $MachinePrecision] * N[(z0 * z0), $MachinePrecision]), $MachinePrecision] + z0), $MachinePrecision] / N[(t$95$0 + t$95$1), $MachinePrecision]), $MachinePrecision], 4e+202], N[(N[(z0 / N[(t$95$1 + t$95$0), $MachinePrecision]), $MachinePrecision] * N[(N[(0.5 * z0), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision], N[((-N[(N[(N[(-0.5 * z0), $MachinePrecision] - 1.0), $MachinePrecision] * z0), $MachinePrecision]) * N[(N[(z4 / z3), $MachinePrecision] * z4), $MachinePrecision]), $MachinePrecision]]]]
                
                \begin{array}{l}
                t_0 := \frac{z3}{z4 \cdot z4}\\
                t_1 := \frac{z1}{z2 \cdot z2}\\
                \mathbf{if}\;\frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{t\_0 + t\_1} \leq 4 \cdot 10^{+202}:\\
                \;\;\;\;\frac{z0}{t\_1 + t\_0} \cdot \left(0.5 \cdot z0 - -1\right)\\
                
                \mathbf{else}:\\
                \;\;\;\;\left(-\left(-0.5 \cdot z0 - 1\right) \cdot z0\right) \cdot \left(\frac{z4}{z3} \cdot z4\right)\\
                
                
                \end{array}
                
                Derivation
                1. Split input into 2 regimes
                2. if (/.f64 (+.f64 (*.f64 (-.f64 (*.f64 (-.f64 (*.f64 #s(literal 1/4 binary64) z0) #s(literal -3333333333333333/10000000000000000 binary64)) z0) #s(literal -1/2 binary64)) (*.f64 z0 z0)) z0) (+.f64 (/.f64 z3 (*.f64 z4 z4)) (/.f64 z1 (*.f64 z2 z2)))) < 3.9999999999999996e202

                  1. Initial program 66.3%

                    \[\frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}} \]
                  2. Step-by-step derivation
                    1. lift-/.f64N/A

                      \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{z1}{z2 \cdot z2}}} \]
                    2. lift-*.f64N/A

                      \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{\color{blue}{z2 \cdot z2}}} \]
                    3. associate-/r*N/A

                      \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\frac{z1}{z2}}{z2}}} \]
                    4. lower-/.f64N/A

                      \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\frac{z1}{z2}}{z2}}} \]
                    5. lower-/.f6470.6%

                      \[\leadsto \frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{\color{blue}{\frac{z1}{z2}}}{z2}} \]
                  3. Applied rewrites70.6%

                    \[\leadsto \frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\frac{z1}{z2}}{z2}}} \]
                  4. Step-by-step derivation
                    1. lift-/.f64N/A

                      \[\leadsto \color{blue}{\frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{\frac{z1}{z2}}{z2}}} \]
                    2. lift-+.f64N/A

                      \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\color{blue}{\frac{z3}{z4 \cdot z4} + \frac{\frac{z1}{z2}}{z2}}} \]
                    3. lift-/.f64N/A

                      \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\frac{z1}{z2}}{z2}}} \]
                    4. lift-/.f64N/A

                      \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{\color{blue}{\frac{z1}{z2}}}{z2}} \]
                    5. associate-/l/N/A

                      \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{z1}{z2 \cdot z2}}} \]
                    6. lift-*.f64N/A

                      \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{\color{blue}{z2 \cdot z2}}} \]
                    7. lift-/.f64N/A

                      \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{z1}{z2 \cdot z2}}} \]
                    8. +-commutativeN/A

                      \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\color{blue}{\frac{z1}{z2 \cdot z2} + \frac{z3}{z4 \cdot z4}}} \]
                    9. lift-+.f64N/A

                      \[\leadsto \frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\color{blue}{\frac{z1}{z2 \cdot z2} + \frac{z3}{z4 \cdot z4}}} \]
                  5. Applied rewrites67.3%

                    \[\leadsto \color{blue}{\frac{z0}{\frac{z1}{z2 \cdot z2} + \frac{z3}{z4 \cdot z4}} \cdot \left(\left(\left(z0 \cdot 0.25 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot z0 - -1\right)} \]
                  6. Taylor expanded in z0 around 0

                    \[\leadsto \frac{z0}{\frac{z1}{z2 \cdot z2} + \frac{z3}{z4 \cdot z4}} \cdot \left(\color{blue}{\frac{1}{2}} \cdot z0 - -1\right) \]
                  7. Step-by-step derivation
                    1. Applied rewrites57.8%

                      \[\leadsto \frac{z0}{\frac{z1}{z2 \cdot z2} + \frac{z3}{z4 \cdot z4}} \cdot \left(\color{blue}{0.5} \cdot z0 - -1\right) \]

                    if 3.9999999999999996e202 < (/.f64 (+.f64 (*.f64 (-.f64 (*.f64 (-.f64 (*.f64 #s(literal 1/4 binary64) z0) #s(literal -3333333333333333/10000000000000000 binary64)) z0) #s(literal -1/2 binary64)) (*.f64 z0 z0)) z0) (+.f64 (/.f64 z3 (*.f64 z4 z4)) (/.f64 z1 (*.f64 z2 z2))))

                    1. Initial program 66.3%

                      \[\frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}} \]
                    2. Step-by-step derivation
                      1. lift-/.f64N/A

                        \[\leadsto \color{blue}{\frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}}} \]
                      2. frac-2negN/A

                        \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\left(\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0\right)\right)}{\mathsf{neg}\left(\left(\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}\right)\right)}} \]
                      3. lower-/.f64N/A

                        \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\left(\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0\right)\right)}{\mathsf{neg}\left(\left(\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}\right)\right)}} \]
                    3. Applied rewrites66.0%

                      \[\leadsto \color{blue}{\frac{\left(-z0\right) - \left(\left(\left(z0 \cdot 0.25 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot z0\right) \cdot z0}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}}} \]
                    4. Taylor expanded in z0 around 0

                      \[\leadsto \frac{\color{blue}{z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)}}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
                    5. Step-by-step derivation
                      1. lower-*.f64N/A

                        \[\leadsto \frac{z0 \cdot \color{blue}{\left(\frac{-1}{2} \cdot z0 - 1\right)}}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
                      2. lower--.f64N/A

                        \[\leadsto \frac{z0 \cdot \left(\frac{-1}{2} \cdot z0 - \color{blue}{1}\right)}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
                      3. lower-*.f6459.9%

                        \[\leadsto \frac{z0 \cdot \left(-0.5 \cdot z0 - 1\right)}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
                    6. Applied rewrites59.9%

                      \[\leadsto \frac{\color{blue}{z0 \cdot \left(-0.5 \cdot z0 - 1\right)}}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
                    7. Step-by-step derivation
                      1. lift-/.f64N/A

                        \[\leadsto \color{blue}{\frac{z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}}} \]
                      2. frac-2negN/A

                        \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)}{\mathsf{neg}\left(\left(\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}\right)\right)}} \]
                      3. mult-flipN/A

                        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\mathsf{neg}\left(\left(\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}\right)\right)}} \]
                      4. lift--.f64N/A

                        \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\mathsf{neg}\left(\color{blue}{\left(\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}\right)}\right)} \]
                      5. sub-negate-revN/A

                        \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\color{blue}{\frac{z3}{z4 \cdot z4} - \frac{z1}{\left(-z2\right) \cdot z2}}} \]
                      6. lift-/.f64N/A

                        \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} - \color{blue}{\frac{z1}{\left(-z2\right) \cdot z2}}} \]
                      7. mult-flipN/A

                        \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} - \color{blue}{z1 \cdot \frac{1}{\left(-z2\right) \cdot z2}}} \]
                      8. fp-cancel-sub-sign-invN/A

                        \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\color{blue}{\frac{z3}{z4 \cdot z4} + \left(\mathsf{neg}\left(z1\right)\right) \cdot \frac{1}{\left(-z2\right) \cdot z2}}} \]
                      9. mult-flipN/A

                        \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\mathsf{neg}\left(z1\right)}{\left(-z2\right) \cdot z2}}} \]
                      10. lift-*.f64N/A

                        \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} + \frac{\mathsf{neg}\left(z1\right)}{\color{blue}{\left(-z2\right) \cdot z2}}} \]
                      11. lift-neg.f64N/A

                        \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} + \frac{\mathsf{neg}\left(z1\right)}{\color{blue}{\left(\mathsf{neg}\left(z2\right)\right)} \cdot z2}} \]
                      12. distribute-lft-neg-outN/A

                        \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} + \frac{\mathsf{neg}\left(z1\right)}{\color{blue}{\mathsf{neg}\left(z2 \cdot z2\right)}}} \]
                      13. lift-*.f64N/A

                        \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} + \frac{\mathsf{neg}\left(z1\right)}{\mathsf{neg}\left(\color{blue}{z2 \cdot z2}\right)}} \]
                    8. Applied rewrites60.0%

                      \[\leadsto \color{blue}{\left(-\left(-0.5 \cdot z0 - 1\right) \cdot z0\right) \cdot \left(\frac{z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3} \cdot z4\right)} \]
                    9. Taylor expanded in z3 around inf

                      \[\leadsto \left(-\left(-0.5 \cdot z0 - 1\right) \cdot z0\right) \cdot \left(\color{blue}{\frac{z4}{z3}} \cdot z4\right) \]
                    10. Step-by-step derivation
                      1. lower-/.f6445.8%

                        \[\leadsto \left(-\left(-0.5 \cdot z0 - 1\right) \cdot z0\right) \cdot \left(\frac{z4}{\color{blue}{z3}} \cdot z4\right) \]
                    11. Applied rewrites45.8%

                      \[\leadsto \left(-\left(-0.5 \cdot z0 - 1\right) \cdot z0\right) \cdot \left(\color{blue}{\frac{z4}{z3}} \cdot z4\right) \]
                  8. Recombined 2 regimes into one program.
                  9. Add Preprocessing

                  Alternative 17: 61.6% accurate, 0.8× speedup?

                  \[\begin{array}{l} \mathbf{if}\;\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0 \leq 10^{+280}:\\ \;\;\;\;\left(--1 \cdot z0\right) \cdot \left(\frac{z4}{\left(z4 \cdot \frac{z1}{z2 \cdot z2}\right) \cdot z4 + z3} \cdot z4\right)\\ \mathbf{else}:\\ \;\;\;\;\left(-\left(-0.5 \cdot z0 - 1\right) \cdot z0\right) \cdot \left(\frac{z4}{z3} \cdot z4\right)\\ \end{array} \]
                  (FPCore (z0 z3 z4 z1 z2)
                    :precision binary64
                    (if (<=
                       (+
                        (*
                         (- (* (- (* 0.25 z0) -0.3333333333333333) z0) -0.5)
                         (* z0 z0))
                        z0)
                       1e+280)
                    (*
                     (- (* -1.0 z0))
                     (* (/ z4 (+ (* (* z4 (/ z1 (* z2 z2))) z4) z3)) z4))
                    (* (- (* (- (* -0.5 z0) 1.0) z0)) (* (/ z4 z3) z4))))
                  double code(double z0, double z3, double z4, double z1, double z2) {
                  	double tmp;
                  	if (((((((0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * (z0 * z0)) + z0) <= 1e+280) {
                  		tmp = -(-1.0 * z0) * ((z4 / (((z4 * (z1 / (z2 * z2))) * z4) + z3)) * z4);
                  	} else {
                  		tmp = -(((-0.5 * z0) - 1.0) * z0) * ((z4 / z3) * z4);
                  	}
                  	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(z0, z3, z4, z1, z2)
                  use fmin_fmax_functions
                      real(8), intent (in) :: z0
                      real(8), intent (in) :: z3
                      real(8), intent (in) :: z4
                      real(8), intent (in) :: z1
                      real(8), intent (in) :: z2
                      real(8) :: tmp
                      if (((((((0.25d0 * z0) - (-0.3333333333333333d0)) * z0) - (-0.5d0)) * (z0 * z0)) + z0) <= 1d+280) then
                          tmp = -((-1.0d0) * z0) * ((z4 / (((z4 * (z1 / (z2 * z2))) * z4) + z3)) * z4)
                      else
                          tmp = -((((-0.5d0) * z0) - 1.0d0) * z0) * ((z4 / z3) * z4)
                      end if
                      code = tmp
                  end function
                  
                  public static double code(double z0, double z3, double z4, double z1, double z2) {
                  	double tmp;
                  	if (((((((0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * (z0 * z0)) + z0) <= 1e+280) {
                  		tmp = -(-1.0 * z0) * ((z4 / (((z4 * (z1 / (z2 * z2))) * z4) + z3)) * z4);
                  	} else {
                  		tmp = -(((-0.5 * z0) - 1.0) * z0) * ((z4 / z3) * z4);
                  	}
                  	return tmp;
                  }
                  
                  def code(z0, z3, z4, z1, z2):
                  	tmp = 0
                  	if ((((((0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * (z0 * z0)) + z0) <= 1e+280:
                  		tmp = -(-1.0 * z0) * ((z4 / (((z4 * (z1 / (z2 * z2))) * z4) + z3)) * z4)
                  	else:
                  		tmp = -(((-0.5 * z0) - 1.0) * z0) * ((z4 / z3) * z4)
                  	return tmp
                  
                  function code(z0, z3, z4, z1, z2)
                  	tmp = 0.0
                  	if (Float64(Float64(Float64(Float64(Float64(Float64(0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * Float64(z0 * z0)) + z0) <= 1e+280)
                  		tmp = Float64(Float64(-Float64(-1.0 * z0)) * Float64(Float64(z4 / Float64(Float64(Float64(z4 * Float64(z1 / Float64(z2 * z2))) * z4) + z3)) * z4));
                  	else
                  		tmp = Float64(Float64(-Float64(Float64(Float64(-0.5 * z0) - 1.0) * z0)) * Float64(Float64(z4 / z3) * z4));
                  	end
                  	return tmp
                  end
                  
                  function tmp_2 = code(z0, z3, z4, z1, z2)
                  	tmp = 0.0;
                  	if (((((((0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * (z0 * z0)) + z0) <= 1e+280)
                  		tmp = -(-1.0 * z0) * ((z4 / (((z4 * (z1 / (z2 * z2))) * z4) + z3)) * z4);
                  	else
                  		tmp = -(((-0.5 * z0) - 1.0) * z0) * ((z4 / z3) * z4);
                  	end
                  	tmp_2 = tmp;
                  end
                  
                  code[z0_, z3_, z4_, z1_, z2_] := If[LessEqual[N[(N[(N[(N[(N[(N[(0.25 * z0), $MachinePrecision] - -0.3333333333333333), $MachinePrecision] * z0), $MachinePrecision] - -0.5), $MachinePrecision] * N[(z0 * z0), $MachinePrecision]), $MachinePrecision] + z0), $MachinePrecision], 1e+280], N[((-N[(-1.0 * z0), $MachinePrecision]) * N[(N[(z4 / N[(N[(N[(z4 * N[(z1 / N[(z2 * z2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * z4), $MachinePrecision] + z3), $MachinePrecision]), $MachinePrecision] * z4), $MachinePrecision]), $MachinePrecision], N[((-N[(N[(N[(-0.5 * z0), $MachinePrecision] - 1.0), $MachinePrecision] * z0), $MachinePrecision]) * N[(N[(z4 / z3), $MachinePrecision] * z4), $MachinePrecision]), $MachinePrecision]]
                  
                  \begin{array}{l}
                  \mathbf{if}\;\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0 \leq 10^{+280}:\\
                  \;\;\;\;\left(--1 \cdot z0\right) \cdot \left(\frac{z4}{\left(z4 \cdot \frac{z1}{z2 \cdot z2}\right) \cdot z4 + z3} \cdot z4\right)\\
                  
                  \mathbf{else}:\\
                  \;\;\;\;\left(-\left(-0.5 \cdot z0 - 1\right) \cdot z0\right) \cdot \left(\frac{z4}{z3} \cdot z4\right)\\
                  
                  
                  \end{array}
                  
                  Derivation
                  1. Split input into 2 regimes
                  2. if (+.f64 (*.f64 (-.f64 (*.f64 (-.f64 (*.f64 #s(literal 1/4 binary64) z0) #s(literal -3333333333333333/10000000000000000 binary64)) z0) #s(literal -1/2 binary64)) (*.f64 z0 z0)) z0) < 1e280

                    1. Initial program 66.3%

                      \[\frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}} \]
                    2. Step-by-step derivation
                      1. lift-/.f64N/A

                        \[\leadsto \color{blue}{\frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}}} \]
                      2. frac-2negN/A

                        \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\left(\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0\right)\right)}{\mathsf{neg}\left(\left(\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}\right)\right)}} \]
                      3. lower-/.f64N/A

                        \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\left(\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0\right)\right)}{\mathsf{neg}\left(\left(\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}\right)\right)}} \]
                    3. Applied rewrites66.0%

                      \[\leadsto \color{blue}{\frac{\left(-z0\right) - \left(\left(\left(z0 \cdot 0.25 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot z0\right) \cdot z0}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}}} \]
                    4. Taylor expanded in z0 around 0

                      \[\leadsto \frac{\color{blue}{z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)}}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
                    5. Step-by-step derivation
                      1. lower-*.f64N/A

                        \[\leadsto \frac{z0 \cdot \color{blue}{\left(\frac{-1}{2} \cdot z0 - 1\right)}}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
                      2. lower--.f64N/A

                        \[\leadsto \frac{z0 \cdot \left(\frac{-1}{2} \cdot z0 - \color{blue}{1}\right)}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
                      3. lower-*.f6459.9%

                        \[\leadsto \frac{z0 \cdot \left(-0.5 \cdot z0 - 1\right)}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
                    6. Applied rewrites59.9%

                      \[\leadsto \frac{\color{blue}{z0 \cdot \left(-0.5 \cdot z0 - 1\right)}}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
                    7. Taylor expanded in z0 around 0

                      \[\leadsto \frac{z0 \cdot -1}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
                    8. Step-by-step derivation
                      1. Applied rewrites49.3%

                        \[\leadsto \frac{z0 \cdot -1}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
                      2. Applied rewrites50.3%

                        \[\leadsto \color{blue}{\left(--1 \cdot z0\right) \cdot \left(\frac{z4}{\left(z4 \cdot \frac{z1}{z2 \cdot z2}\right) \cdot z4 + z3} \cdot z4\right)} \]

                      if 1e280 < (+.f64 (*.f64 (-.f64 (*.f64 (-.f64 (*.f64 #s(literal 1/4 binary64) z0) #s(literal -3333333333333333/10000000000000000 binary64)) z0) #s(literal -1/2 binary64)) (*.f64 z0 z0)) z0)

                      1. Initial program 66.3%

                        \[\frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}} \]
                      2. Step-by-step derivation
                        1. lift-/.f64N/A

                          \[\leadsto \color{blue}{\frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}}} \]
                        2. frac-2negN/A

                          \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\left(\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0\right)\right)}{\mathsf{neg}\left(\left(\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}\right)\right)}} \]
                        3. lower-/.f64N/A

                          \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\left(\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0\right)\right)}{\mathsf{neg}\left(\left(\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}\right)\right)}} \]
                      3. Applied rewrites66.0%

                        \[\leadsto \color{blue}{\frac{\left(-z0\right) - \left(\left(\left(z0 \cdot 0.25 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot z0\right) \cdot z0}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}}} \]
                      4. Taylor expanded in z0 around 0

                        \[\leadsto \frac{\color{blue}{z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)}}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
                      5. Step-by-step derivation
                        1. lower-*.f64N/A

                          \[\leadsto \frac{z0 \cdot \color{blue}{\left(\frac{-1}{2} \cdot z0 - 1\right)}}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
                        2. lower--.f64N/A

                          \[\leadsto \frac{z0 \cdot \left(\frac{-1}{2} \cdot z0 - \color{blue}{1}\right)}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
                        3. lower-*.f6459.9%

                          \[\leadsto \frac{z0 \cdot \left(-0.5 \cdot z0 - 1\right)}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
                      6. Applied rewrites59.9%

                        \[\leadsto \frac{\color{blue}{z0 \cdot \left(-0.5 \cdot z0 - 1\right)}}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
                      7. Step-by-step derivation
                        1. lift-/.f64N/A

                          \[\leadsto \color{blue}{\frac{z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}}} \]
                        2. frac-2negN/A

                          \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)}{\mathsf{neg}\left(\left(\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}\right)\right)}} \]
                        3. mult-flipN/A

                          \[\leadsto \color{blue}{\left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\mathsf{neg}\left(\left(\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}\right)\right)}} \]
                        4. lift--.f64N/A

                          \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\mathsf{neg}\left(\color{blue}{\left(\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}\right)}\right)} \]
                        5. sub-negate-revN/A

                          \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\color{blue}{\frac{z3}{z4 \cdot z4} - \frac{z1}{\left(-z2\right) \cdot z2}}} \]
                        6. lift-/.f64N/A

                          \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} - \color{blue}{\frac{z1}{\left(-z2\right) \cdot z2}}} \]
                        7. mult-flipN/A

                          \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} - \color{blue}{z1 \cdot \frac{1}{\left(-z2\right) \cdot z2}}} \]
                        8. fp-cancel-sub-sign-invN/A

                          \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\color{blue}{\frac{z3}{z4 \cdot z4} + \left(\mathsf{neg}\left(z1\right)\right) \cdot \frac{1}{\left(-z2\right) \cdot z2}}} \]
                        9. mult-flipN/A

                          \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\mathsf{neg}\left(z1\right)}{\left(-z2\right) \cdot z2}}} \]
                        10. lift-*.f64N/A

                          \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} + \frac{\mathsf{neg}\left(z1\right)}{\color{blue}{\left(-z2\right) \cdot z2}}} \]
                        11. lift-neg.f64N/A

                          \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} + \frac{\mathsf{neg}\left(z1\right)}{\color{blue}{\left(\mathsf{neg}\left(z2\right)\right)} \cdot z2}} \]
                        12. distribute-lft-neg-outN/A

                          \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} + \frac{\mathsf{neg}\left(z1\right)}{\color{blue}{\mathsf{neg}\left(z2 \cdot z2\right)}}} \]
                        13. lift-*.f64N/A

                          \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} + \frac{\mathsf{neg}\left(z1\right)}{\mathsf{neg}\left(\color{blue}{z2 \cdot z2}\right)}} \]
                      8. Applied rewrites60.0%

                        \[\leadsto \color{blue}{\left(-\left(-0.5 \cdot z0 - 1\right) \cdot z0\right) \cdot \left(\frac{z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3} \cdot z4\right)} \]
                      9. Taylor expanded in z3 around inf

                        \[\leadsto \left(-\left(-0.5 \cdot z0 - 1\right) \cdot z0\right) \cdot \left(\color{blue}{\frac{z4}{z3}} \cdot z4\right) \]
                      10. Step-by-step derivation
                        1. lower-/.f6445.8%

                          \[\leadsto \left(-\left(-0.5 \cdot z0 - 1\right) \cdot z0\right) \cdot \left(\frac{z4}{\color{blue}{z3}} \cdot z4\right) \]
                      11. Applied rewrites45.8%

                        \[\leadsto \left(-\left(-0.5 \cdot z0 - 1\right) \cdot z0\right) \cdot \left(\color{blue}{\frac{z4}{z3}} \cdot z4\right) \]
                    9. Recombined 2 regimes into one program.
                    10. Add Preprocessing

                    Alternative 18: 60.4% accurate, 0.9× speedup?

                    \[\begin{array}{l} \mathbf{if}\;\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0 \leq 10^{+280}:\\ \;\;\;\;\frac{z0 \cdot -1}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}}\\ \mathbf{else}:\\ \;\;\;\;\left(-\left(-0.5 \cdot z0 - 1\right) \cdot z0\right) \cdot \left(\frac{z4}{z3} \cdot z4\right)\\ \end{array} \]
                    (FPCore (z0 z3 z4 z1 z2)
                      :precision binary64
                      (if (<=
                         (+
                          (*
                           (- (* (- (* 0.25 z0) -0.3333333333333333) z0) -0.5)
                           (* z0 z0))
                          z0)
                         1e+280)
                      (/ (* z0 -1.0) (- (/ z1 (* (- z2) z2)) (/ z3 (* z4 z4))))
                      (* (- (* (- (* -0.5 z0) 1.0) z0)) (* (/ z4 z3) z4))))
                    double code(double z0, double z3, double z4, double z1, double z2) {
                    	double tmp;
                    	if (((((((0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * (z0 * z0)) + z0) <= 1e+280) {
                    		tmp = (z0 * -1.0) / ((z1 / (-z2 * z2)) - (z3 / (z4 * z4)));
                    	} else {
                    		tmp = -(((-0.5 * z0) - 1.0) * z0) * ((z4 / z3) * z4);
                    	}
                    	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(z0, z3, z4, z1, z2)
                    use fmin_fmax_functions
                        real(8), intent (in) :: z0
                        real(8), intent (in) :: z3
                        real(8), intent (in) :: z4
                        real(8), intent (in) :: z1
                        real(8), intent (in) :: z2
                        real(8) :: tmp
                        if (((((((0.25d0 * z0) - (-0.3333333333333333d0)) * z0) - (-0.5d0)) * (z0 * z0)) + z0) <= 1d+280) then
                            tmp = (z0 * (-1.0d0)) / ((z1 / (-z2 * z2)) - (z3 / (z4 * z4)))
                        else
                            tmp = -((((-0.5d0) * z0) - 1.0d0) * z0) * ((z4 / z3) * z4)
                        end if
                        code = tmp
                    end function
                    
                    public static double code(double z0, double z3, double z4, double z1, double z2) {
                    	double tmp;
                    	if (((((((0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * (z0 * z0)) + z0) <= 1e+280) {
                    		tmp = (z0 * -1.0) / ((z1 / (-z2 * z2)) - (z3 / (z4 * z4)));
                    	} else {
                    		tmp = -(((-0.5 * z0) - 1.0) * z0) * ((z4 / z3) * z4);
                    	}
                    	return tmp;
                    }
                    
                    def code(z0, z3, z4, z1, z2):
                    	tmp = 0
                    	if ((((((0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * (z0 * z0)) + z0) <= 1e+280:
                    		tmp = (z0 * -1.0) / ((z1 / (-z2 * z2)) - (z3 / (z4 * z4)))
                    	else:
                    		tmp = -(((-0.5 * z0) - 1.0) * z0) * ((z4 / z3) * z4)
                    	return tmp
                    
                    function code(z0, z3, z4, z1, z2)
                    	tmp = 0.0
                    	if (Float64(Float64(Float64(Float64(Float64(Float64(0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * Float64(z0 * z0)) + z0) <= 1e+280)
                    		tmp = Float64(Float64(z0 * -1.0) / Float64(Float64(z1 / Float64(Float64(-z2) * z2)) - Float64(z3 / Float64(z4 * z4))));
                    	else
                    		tmp = Float64(Float64(-Float64(Float64(Float64(-0.5 * z0) - 1.0) * z0)) * Float64(Float64(z4 / z3) * z4));
                    	end
                    	return tmp
                    end
                    
                    function tmp_2 = code(z0, z3, z4, z1, z2)
                    	tmp = 0.0;
                    	if (((((((0.25 * z0) - -0.3333333333333333) * z0) - -0.5) * (z0 * z0)) + z0) <= 1e+280)
                    		tmp = (z0 * -1.0) / ((z1 / (-z2 * z2)) - (z3 / (z4 * z4)));
                    	else
                    		tmp = -(((-0.5 * z0) - 1.0) * z0) * ((z4 / z3) * z4);
                    	end
                    	tmp_2 = tmp;
                    end
                    
                    code[z0_, z3_, z4_, z1_, z2_] := If[LessEqual[N[(N[(N[(N[(N[(N[(0.25 * z0), $MachinePrecision] - -0.3333333333333333), $MachinePrecision] * z0), $MachinePrecision] - -0.5), $MachinePrecision] * N[(z0 * z0), $MachinePrecision]), $MachinePrecision] + z0), $MachinePrecision], 1e+280], N[(N[(z0 * -1.0), $MachinePrecision] / N[(N[(z1 / N[((-z2) * z2), $MachinePrecision]), $MachinePrecision] - N[(z3 / N[(z4 * z4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-N[(N[(N[(-0.5 * z0), $MachinePrecision] - 1.0), $MachinePrecision] * z0), $MachinePrecision]) * N[(N[(z4 / z3), $MachinePrecision] * z4), $MachinePrecision]), $MachinePrecision]]
                    
                    \begin{array}{l}
                    \mathbf{if}\;\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0 \leq 10^{+280}:\\
                    \;\;\;\;\frac{z0 \cdot -1}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}}\\
                    
                    \mathbf{else}:\\
                    \;\;\;\;\left(-\left(-0.5 \cdot z0 - 1\right) \cdot z0\right) \cdot \left(\frac{z4}{z3} \cdot z4\right)\\
                    
                    
                    \end{array}
                    
                    Derivation
                    1. Split input into 2 regimes
                    2. if (+.f64 (*.f64 (-.f64 (*.f64 (-.f64 (*.f64 #s(literal 1/4 binary64) z0) #s(literal -3333333333333333/10000000000000000 binary64)) z0) #s(literal -1/2 binary64)) (*.f64 z0 z0)) z0) < 1e280

                      1. Initial program 66.3%

                        \[\frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}} \]
                      2. Step-by-step derivation
                        1. lift-/.f64N/A

                          \[\leadsto \color{blue}{\frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}}} \]
                        2. frac-2negN/A

                          \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\left(\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0\right)\right)}{\mathsf{neg}\left(\left(\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}\right)\right)}} \]
                        3. lower-/.f64N/A

                          \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\left(\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0\right)\right)}{\mathsf{neg}\left(\left(\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}\right)\right)}} \]
                      3. Applied rewrites66.0%

                        \[\leadsto \color{blue}{\frac{\left(-z0\right) - \left(\left(\left(z0 \cdot 0.25 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot z0\right) \cdot z0}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}}} \]
                      4. Taylor expanded in z0 around 0

                        \[\leadsto \frac{\color{blue}{z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)}}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
                      5. Step-by-step derivation
                        1. lower-*.f64N/A

                          \[\leadsto \frac{z0 \cdot \color{blue}{\left(\frac{-1}{2} \cdot z0 - 1\right)}}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
                        2. lower--.f64N/A

                          \[\leadsto \frac{z0 \cdot \left(\frac{-1}{2} \cdot z0 - \color{blue}{1}\right)}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
                        3. lower-*.f6459.9%

                          \[\leadsto \frac{z0 \cdot \left(-0.5 \cdot z0 - 1\right)}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
                      6. Applied rewrites59.9%

                        \[\leadsto \frac{\color{blue}{z0 \cdot \left(-0.5 \cdot z0 - 1\right)}}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
                      7. Taylor expanded in z0 around 0

                        \[\leadsto \frac{z0 \cdot -1}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
                      8. Step-by-step derivation
                        1. Applied rewrites49.3%

                          \[\leadsto \frac{z0 \cdot -1}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]

                        if 1e280 < (+.f64 (*.f64 (-.f64 (*.f64 (-.f64 (*.f64 #s(literal 1/4 binary64) z0) #s(literal -3333333333333333/10000000000000000 binary64)) z0) #s(literal -1/2 binary64)) (*.f64 z0 z0)) z0)

                        1. Initial program 66.3%

                          \[\frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}} \]
                        2. Step-by-step derivation
                          1. lift-/.f64N/A

                            \[\leadsto \color{blue}{\frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}}} \]
                          2. frac-2negN/A

                            \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\left(\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0\right)\right)}{\mathsf{neg}\left(\left(\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}\right)\right)}} \]
                          3. lower-/.f64N/A

                            \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\left(\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0\right)\right)}{\mathsf{neg}\left(\left(\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}\right)\right)}} \]
                        3. Applied rewrites66.0%

                          \[\leadsto \color{blue}{\frac{\left(-z0\right) - \left(\left(\left(z0 \cdot 0.25 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot z0\right) \cdot z0}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}}} \]
                        4. Taylor expanded in z0 around 0

                          \[\leadsto \frac{\color{blue}{z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)}}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
                        5. Step-by-step derivation
                          1. lower-*.f64N/A

                            \[\leadsto \frac{z0 \cdot \color{blue}{\left(\frac{-1}{2} \cdot z0 - 1\right)}}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
                          2. lower--.f64N/A

                            \[\leadsto \frac{z0 \cdot \left(\frac{-1}{2} \cdot z0 - \color{blue}{1}\right)}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
                          3. lower-*.f6459.9%

                            \[\leadsto \frac{z0 \cdot \left(-0.5 \cdot z0 - 1\right)}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
                        6. Applied rewrites59.9%

                          \[\leadsto \frac{\color{blue}{z0 \cdot \left(-0.5 \cdot z0 - 1\right)}}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
                        7. Step-by-step derivation
                          1. lift-/.f64N/A

                            \[\leadsto \color{blue}{\frac{z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}}} \]
                          2. frac-2negN/A

                            \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)}{\mathsf{neg}\left(\left(\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}\right)\right)}} \]
                          3. mult-flipN/A

                            \[\leadsto \color{blue}{\left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\mathsf{neg}\left(\left(\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}\right)\right)}} \]
                          4. lift--.f64N/A

                            \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\mathsf{neg}\left(\color{blue}{\left(\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}\right)}\right)} \]
                          5. sub-negate-revN/A

                            \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\color{blue}{\frac{z3}{z4 \cdot z4} - \frac{z1}{\left(-z2\right) \cdot z2}}} \]
                          6. lift-/.f64N/A

                            \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} - \color{blue}{\frac{z1}{\left(-z2\right) \cdot z2}}} \]
                          7. mult-flipN/A

                            \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} - \color{blue}{z1 \cdot \frac{1}{\left(-z2\right) \cdot z2}}} \]
                          8. fp-cancel-sub-sign-invN/A

                            \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\color{blue}{\frac{z3}{z4 \cdot z4} + \left(\mathsf{neg}\left(z1\right)\right) \cdot \frac{1}{\left(-z2\right) \cdot z2}}} \]
                          9. mult-flipN/A

                            \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\mathsf{neg}\left(z1\right)}{\left(-z2\right) \cdot z2}}} \]
                          10. lift-*.f64N/A

                            \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} + \frac{\mathsf{neg}\left(z1\right)}{\color{blue}{\left(-z2\right) \cdot z2}}} \]
                          11. lift-neg.f64N/A

                            \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} + \frac{\mathsf{neg}\left(z1\right)}{\color{blue}{\left(\mathsf{neg}\left(z2\right)\right)} \cdot z2}} \]
                          12. distribute-lft-neg-outN/A

                            \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} + \frac{\mathsf{neg}\left(z1\right)}{\color{blue}{\mathsf{neg}\left(z2 \cdot z2\right)}}} \]
                          13. lift-*.f64N/A

                            \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} + \frac{\mathsf{neg}\left(z1\right)}{\mathsf{neg}\left(\color{blue}{z2 \cdot z2}\right)}} \]
                        8. Applied rewrites60.0%

                          \[\leadsto \color{blue}{\left(-\left(-0.5 \cdot z0 - 1\right) \cdot z0\right) \cdot \left(\frac{z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3} \cdot z4\right)} \]
                        9. Taylor expanded in z3 around inf

                          \[\leadsto \left(-\left(-0.5 \cdot z0 - 1\right) \cdot z0\right) \cdot \left(\color{blue}{\frac{z4}{z3}} \cdot z4\right) \]
                        10. Step-by-step derivation
                          1. lower-/.f6445.8%

                            \[\leadsto \left(-\left(-0.5 \cdot z0 - 1\right) \cdot z0\right) \cdot \left(\frac{z4}{\color{blue}{z3}} \cdot z4\right) \]
                        11. Applied rewrites45.8%

                          \[\leadsto \left(-\left(-0.5 \cdot z0 - 1\right) \cdot z0\right) \cdot \left(\color{blue}{\frac{z4}{z3}} \cdot z4\right) \]
                      9. Recombined 2 regimes into one program.
                      10. Add Preprocessing

                      Alternative 19: 45.8% accurate, 2.1× speedup?

                      \[\left(-\left(-0.5 \cdot z0 - 1\right) \cdot z0\right) \cdot \left(\frac{z4}{z3} \cdot z4\right) \]
                      (FPCore (z0 z3 z4 z1 z2)
                        :precision binary64
                        (* (- (* (- (* -0.5 z0) 1.0) z0)) (* (/ z4 z3) z4)))
                      double code(double z0, double z3, double z4, double z1, double z2) {
                      	return -(((-0.5 * z0) - 1.0) * z0) * ((z4 / z3) * z4);
                      }
                      
                      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(z0, z3, z4, z1, z2)
                      use fmin_fmax_functions
                          real(8), intent (in) :: z0
                          real(8), intent (in) :: z3
                          real(8), intent (in) :: z4
                          real(8), intent (in) :: z1
                          real(8), intent (in) :: z2
                          code = -((((-0.5d0) * z0) - 1.0d0) * z0) * ((z4 / z3) * z4)
                      end function
                      
                      public static double code(double z0, double z3, double z4, double z1, double z2) {
                      	return -(((-0.5 * z0) - 1.0) * z0) * ((z4 / z3) * z4);
                      }
                      
                      def code(z0, z3, z4, z1, z2):
                      	return -(((-0.5 * z0) - 1.0) * z0) * ((z4 / z3) * z4)
                      
                      function code(z0, z3, z4, z1, z2)
                      	return Float64(Float64(-Float64(Float64(Float64(-0.5 * z0) - 1.0) * z0)) * Float64(Float64(z4 / z3) * z4))
                      end
                      
                      function tmp = code(z0, z3, z4, z1, z2)
                      	tmp = -(((-0.5 * z0) - 1.0) * z0) * ((z4 / z3) * z4);
                      end
                      
                      code[z0_, z3_, z4_, z1_, z2_] := N[((-N[(N[(N[(-0.5 * z0), $MachinePrecision] - 1.0), $MachinePrecision] * z0), $MachinePrecision]) * N[(N[(z4 / z3), $MachinePrecision] * z4), $MachinePrecision]), $MachinePrecision]
                      
                      \left(-\left(-0.5 \cdot z0 - 1\right) \cdot z0\right) \cdot \left(\frac{z4}{z3} \cdot z4\right)
                      
                      Derivation
                      1. Initial program 66.3%

                        \[\frac{\left(\left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}} \]
                      2. Step-by-step derivation
                        1. lift-/.f64N/A

                          \[\leadsto \color{blue}{\frac{\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}}} \]
                        2. frac-2negN/A

                          \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\left(\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0\right)\right)}{\mathsf{neg}\left(\left(\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}\right)\right)}} \]
                        3. lower-/.f64N/A

                          \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\left(\left(\left(\frac{1}{4} \cdot z0 - \frac{-3333333333333333}{10000000000000000}\right) \cdot z0 - \frac{-1}{2}\right) \cdot \left(z0 \cdot z0\right) + z0\right)\right)}{\mathsf{neg}\left(\left(\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}\right)\right)}} \]
                      3. Applied rewrites66.0%

                        \[\leadsto \color{blue}{\frac{\left(-z0\right) - \left(\left(\left(z0 \cdot 0.25 - -0.3333333333333333\right) \cdot z0 - -0.5\right) \cdot z0\right) \cdot z0}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}}} \]
                      4. Taylor expanded in z0 around 0

                        \[\leadsto \frac{\color{blue}{z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)}}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
                      5. Step-by-step derivation
                        1. lower-*.f64N/A

                          \[\leadsto \frac{z0 \cdot \color{blue}{\left(\frac{-1}{2} \cdot z0 - 1\right)}}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
                        2. lower--.f64N/A

                          \[\leadsto \frac{z0 \cdot \left(\frac{-1}{2} \cdot z0 - \color{blue}{1}\right)}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
                        3. lower-*.f6459.9%

                          \[\leadsto \frac{z0 \cdot \left(-0.5 \cdot z0 - 1\right)}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
                      6. Applied rewrites59.9%

                        \[\leadsto \frac{\color{blue}{z0 \cdot \left(-0.5 \cdot z0 - 1\right)}}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}} \]
                      7. Step-by-step derivation
                        1. lift-/.f64N/A

                          \[\leadsto \color{blue}{\frac{z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}}} \]
                        2. frac-2negN/A

                          \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)}{\mathsf{neg}\left(\left(\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}\right)\right)}} \]
                        3. mult-flipN/A

                          \[\leadsto \color{blue}{\left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\mathsf{neg}\left(\left(\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}\right)\right)}} \]
                        4. lift--.f64N/A

                          \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\mathsf{neg}\left(\color{blue}{\left(\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}\right)}\right)} \]
                        5. sub-negate-revN/A

                          \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\color{blue}{\frac{z3}{z4 \cdot z4} - \frac{z1}{\left(-z2\right) \cdot z2}}} \]
                        6. lift-/.f64N/A

                          \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} - \color{blue}{\frac{z1}{\left(-z2\right) \cdot z2}}} \]
                        7. mult-flipN/A

                          \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} - \color{blue}{z1 \cdot \frac{1}{\left(-z2\right) \cdot z2}}} \]
                        8. fp-cancel-sub-sign-invN/A

                          \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\color{blue}{\frac{z3}{z4 \cdot z4} + \left(\mathsf{neg}\left(z1\right)\right) \cdot \frac{1}{\left(-z2\right) \cdot z2}}} \]
                        9. mult-flipN/A

                          \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} + \color{blue}{\frac{\mathsf{neg}\left(z1\right)}{\left(-z2\right) \cdot z2}}} \]
                        10. lift-*.f64N/A

                          \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} + \frac{\mathsf{neg}\left(z1\right)}{\color{blue}{\left(-z2\right) \cdot z2}}} \]
                        11. lift-neg.f64N/A

                          \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} + \frac{\mathsf{neg}\left(z1\right)}{\color{blue}{\left(\mathsf{neg}\left(z2\right)\right)} \cdot z2}} \]
                        12. distribute-lft-neg-outN/A

                          \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} + \frac{\mathsf{neg}\left(z1\right)}{\color{blue}{\mathsf{neg}\left(z2 \cdot z2\right)}}} \]
                        13. lift-*.f64N/A

                          \[\leadsto \left(\mathsf{neg}\left(z0 \cdot \left(\frac{-1}{2} \cdot z0 - 1\right)\right)\right) \cdot \frac{1}{\frac{z3}{z4 \cdot z4} + \frac{\mathsf{neg}\left(z1\right)}{\mathsf{neg}\left(\color{blue}{z2 \cdot z2}\right)}} \]
                      8. Applied rewrites60.0%

                        \[\leadsto \color{blue}{\left(-\left(-0.5 \cdot z0 - 1\right) \cdot z0\right) \cdot \left(\frac{z4}{\left(\frac{z1}{z2 \cdot z2} \cdot z4\right) \cdot z4 + z3} \cdot z4\right)} \]
                      9. Taylor expanded in z3 around inf

                        \[\leadsto \left(-\left(-0.5 \cdot z0 - 1\right) \cdot z0\right) \cdot \left(\color{blue}{\frac{z4}{z3}} \cdot z4\right) \]
                      10. Step-by-step derivation
                        1. lower-/.f6445.8%

                          \[\leadsto \left(-\left(-0.5 \cdot z0 - 1\right) \cdot z0\right) \cdot \left(\frac{z4}{\color{blue}{z3}} \cdot z4\right) \]
                      11. Applied rewrites45.8%

                        \[\leadsto \left(-\left(-0.5 \cdot z0 - 1\right) \cdot z0\right) \cdot \left(\color{blue}{\frac{z4}{z3}} \cdot z4\right) \]
                      12. Add Preprocessing

                      Reproduce

                      ?
                      herbie shell --seed 2025250 
                      (FPCore (z0 z3 z4 z1 z2)
                        :name "(/ (+ (* (- (* (- (* 1/4 z0) -3333333333333333/10000000000000000) z0) -1/2) (* z0 z0)) z0) (+ (/ z3 (* z4 z4)) (/ z1 (* z2 z2))))"
                        :precision binary64
                        (/ (+ (* (- (* (- (* 0.25 z0) -0.3333333333333333) z0) -0.5) (* z0 z0)) z0) (+ (/ z3 (* z4 z4)) (/ z1 (* z2 z2)))))