(/ z1 (+ (* z1 (- z0 -1)) (* (* (sqrt (- (- 1 z1) z1)) 5641895665989011/10000000000000000) (exp (* (- z1) z1)))))

Percentage Accurate: 91.9% → 99.3%
Time: 2.4s
Alternatives: 10
Speedup: 0.4×

Specification

?
\[\frac{z1}{z1 \cdot \left(z0 - -1\right) + \left(\sqrt{\left(1 - z1\right) - z1} \cdot 0.5641895665989011\right) \cdot e^{\left(-z1\right) \cdot z1}} \]
(FPCore (z1 z0)
  :precision binary64
  (/
 z1
 (+
  (* z1 (- z0 -1.0))
  (*
   (* (sqrt (- (- 1.0 z1) z1)) 0.5641895665989011)
   (exp (* (- z1) z1))))))
double code(double z1, double z0) {
	return z1 / ((z1 * (z0 - -1.0)) + ((sqrt(((1.0 - z1) - z1)) * 0.5641895665989011) * exp((-z1 * z1))));
}
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(z1, z0)
use fmin_fmax_functions
    real(8), intent (in) :: z1
    real(8), intent (in) :: z0
    code = z1 / ((z1 * (z0 - (-1.0d0))) + ((sqrt(((1.0d0 - z1) - z1)) * 0.5641895665989011d0) * exp((-z1 * z1))))
end function
public static double code(double z1, double z0) {
	return z1 / ((z1 * (z0 - -1.0)) + ((Math.sqrt(((1.0 - z1) - z1)) * 0.5641895665989011) * Math.exp((-z1 * z1))));
}
def code(z1, z0):
	return z1 / ((z1 * (z0 - -1.0)) + ((math.sqrt(((1.0 - z1) - z1)) * 0.5641895665989011) * math.exp((-z1 * z1))))
function code(z1, z0)
	return Float64(z1 / Float64(Float64(z1 * Float64(z0 - -1.0)) + Float64(Float64(sqrt(Float64(Float64(1.0 - z1) - z1)) * 0.5641895665989011) * exp(Float64(Float64(-z1) * z1)))))
end
function tmp = code(z1, z0)
	tmp = z1 / ((z1 * (z0 - -1.0)) + ((sqrt(((1.0 - z1) - z1)) * 0.5641895665989011) * exp((-z1 * z1))));
end
code[z1_, z0_] := N[(z1 / N[(N[(z1 * N[(z0 - -1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(N[(1.0 - z1), $MachinePrecision] - z1), $MachinePrecision]], $MachinePrecision] * 0.5641895665989011), $MachinePrecision] * N[Exp[N[((-z1) * z1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{z1}{z1 \cdot \left(z0 - -1\right) + \left(\sqrt{\left(1 - z1\right) - z1} \cdot 0.5641895665989011\right) \cdot e^{\left(-z1\right) \cdot z1}}

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 10 alternatives:

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

Initial Program: 91.9% accurate, 1.0× speedup?

\[\frac{z1}{z1 \cdot \left(z0 - -1\right) + \left(\sqrt{\left(1 - z1\right) - z1} \cdot 0.5641895665989011\right) \cdot e^{\left(-z1\right) \cdot z1}} \]
(FPCore (z1 z0)
  :precision binary64
  (/
 z1
 (+
  (* z1 (- z0 -1.0))
  (*
   (* (sqrt (- (- 1.0 z1) z1)) 0.5641895665989011)
   (exp (* (- z1) z1))))))
double code(double z1, double z0) {
	return z1 / ((z1 * (z0 - -1.0)) + ((sqrt(((1.0 - z1) - z1)) * 0.5641895665989011) * exp((-z1 * z1))));
}
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(z1, z0)
use fmin_fmax_functions
    real(8), intent (in) :: z1
    real(8), intent (in) :: z0
    code = z1 / ((z1 * (z0 - (-1.0d0))) + ((sqrt(((1.0d0 - z1) - z1)) * 0.5641895665989011d0) * exp((-z1 * z1))))
end function
public static double code(double z1, double z0) {
	return z1 / ((z1 * (z0 - -1.0)) + ((Math.sqrt(((1.0 - z1) - z1)) * 0.5641895665989011) * Math.exp((-z1 * z1))));
}
def code(z1, z0):
	return z1 / ((z1 * (z0 - -1.0)) + ((math.sqrt(((1.0 - z1) - z1)) * 0.5641895665989011) * math.exp((-z1 * z1))))
function code(z1, z0)
	return Float64(z1 / Float64(Float64(z1 * Float64(z0 - -1.0)) + Float64(Float64(sqrt(Float64(Float64(1.0 - z1) - z1)) * 0.5641895665989011) * exp(Float64(Float64(-z1) * z1)))))
end
function tmp = code(z1, z0)
	tmp = z1 / ((z1 * (z0 - -1.0)) + ((sqrt(((1.0 - z1) - z1)) * 0.5641895665989011) * exp((-z1 * z1))));
end
code[z1_, z0_] := N[(z1 / N[(N[(z1 * N[(z0 - -1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(N[(1.0 - z1), $MachinePrecision] - z1), $MachinePrecision]], $MachinePrecision] * 0.5641895665989011), $MachinePrecision] * N[Exp[N[((-z1) * z1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{z1}{z1 \cdot \left(z0 - -1\right) + \left(\sqrt{\left(1 - z1\right) - z1} \cdot 0.5641895665989011\right) \cdot e^{\left(-z1\right) \cdot z1}}

Alternative 1: 99.3% accurate, 0.3× speedup?

\[\begin{array}{l} t_0 := e^{\left(-z1\right) \cdot z1}\\ t_1 := \sqrt{\left(1 - z1\right) - z1}\\ t_2 := \frac{z1}{z1 \cdot \left(z0 - -1\right) + \left(t\_1 \cdot 0.5641895665989011\right) \cdot t\_0}\\ t_3 := \frac{1}{\frac{t\_0 \cdot \left(0.5641895665989011 \cdot t\_1\right) - \left(-1 - z0\right) \cdot z1}{z1}}\\ \mathbf{if}\;t\_2 \leq -1 \cdot 10^{-304}:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;t\_2 \leq 0:\\ \;\;\;\;\frac{1}{z0}\\ \mathbf{else}:\\ \;\;\;\;t\_3\\ \end{array} \]
(FPCore (z1 z0)
  :precision binary64
  (let* ((t_0 (exp (* (- z1) z1)))
       (t_1 (sqrt (- (- 1.0 z1) z1)))
       (t_2
        (/
         z1
         (+ (* z1 (- z0 -1.0)) (* (* t_1 0.5641895665989011) t_0))))
       (t_3
        (/
         1.0
         (/
          (- (* t_0 (* 0.5641895665989011 t_1)) (* (- -1.0 z0) z1))
          z1))))
  (if (<= t_2 -1e-304) t_3 (if (<= t_2 0.0) (/ 1.0 z0) t_3))))
double code(double z1, double z0) {
	double t_0 = exp((-z1 * z1));
	double t_1 = sqrt(((1.0 - z1) - z1));
	double t_2 = z1 / ((z1 * (z0 - -1.0)) + ((t_1 * 0.5641895665989011) * t_0));
	double t_3 = 1.0 / (((t_0 * (0.5641895665989011 * t_1)) - ((-1.0 - z0) * z1)) / z1);
	double tmp;
	if (t_2 <= -1e-304) {
		tmp = t_3;
	} else if (t_2 <= 0.0) {
		tmp = 1.0 / z0;
	} else {
		tmp = t_3;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(z1, z0)
use fmin_fmax_functions
    real(8), intent (in) :: z1
    real(8), intent (in) :: z0
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: tmp
    t_0 = exp((-z1 * z1))
    t_1 = sqrt(((1.0d0 - z1) - z1))
    t_2 = z1 / ((z1 * (z0 - (-1.0d0))) + ((t_1 * 0.5641895665989011d0) * t_0))
    t_3 = 1.0d0 / (((t_0 * (0.5641895665989011d0 * t_1)) - (((-1.0d0) - z0) * z1)) / z1)
    if (t_2 <= (-1d-304)) then
        tmp = t_3
    else if (t_2 <= 0.0d0) then
        tmp = 1.0d0 / z0
    else
        tmp = t_3
    end if
    code = tmp
end function
public static double code(double z1, double z0) {
	double t_0 = Math.exp((-z1 * z1));
	double t_1 = Math.sqrt(((1.0 - z1) - z1));
	double t_2 = z1 / ((z1 * (z0 - -1.0)) + ((t_1 * 0.5641895665989011) * t_0));
	double t_3 = 1.0 / (((t_0 * (0.5641895665989011 * t_1)) - ((-1.0 - z0) * z1)) / z1);
	double tmp;
	if (t_2 <= -1e-304) {
		tmp = t_3;
	} else if (t_2 <= 0.0) {
		tmp = 1.0 / z0;
	} else {
		tmp = t_3;
	}
	return tmp;
}
def code(z1, z0):
	t_0 = math.exp((-z1 * z1))
	t_1 = math.sqrt(((1.0 - z1) - z1))
	t_2 = z1 / ((z1 * (z0 - -1.0)) + ((t_1 * 0.5641895665989011) * t_0))
	t_3 = 1.0 / (((t_0 * (0.5641895665989011 * t_1)) - ((-1.0 - z0) * z1)) / z1)
	tmp = 0
	if t_2 <= -1e-304:
		tmp = t_3
	elif t_2 <= 0.0:
		tmp = 1.0 / z0
	else:
		tmp = t_3
	return tmp
function code(z1, z0)
	t_0 = exp(Float64(Float64(-z1) * z1))
	t_1 = sqrt(Float64(Float64(1.0 - z1) - z1))
	t_2 = Float64(z1 / Float64(Float64(z1 * Float64(z0 - -1.0)) + Float64(Float64(t_1 * 0.5641895665989011) * t_0)))
	t_3 = Float64(1.0 / Float64(Float64(Float64(t_0 * Float64(0.5641895665989011 * t_1)) - Float64(Float64(-1.0 - z0) * z1)) / z1))
	tmp = 0.0
	if (t_2 <= -1e-304)
		tmp = t_3;
	elseif (t_2 <= 0.0)
		tmp = Float64(1.0 / z0);
	else
		tmp = t_3;
	end
	return tmp
end
function tmp_2 = code(z1, z0)
	t_0 = exp((-z1 * z1));
	t_1 = sqrt(((1.0 - z1) - z1));
	t_2 = z1 / ((z1 * (z0 - -1.0)) + ((t_1 * 0.5641895665989011) * t_0));
	t_3 = 1.0 / (((t_0 * (0.5641895665989011 * t_1)) - ((-1.0 - z0) * z1)) / z1);
	tmp = 0.0;
	if (t_2 <= -1e-304)
		tmp = t_3;
	elseif (t_2 <= 0.0)
		tmp = 1.0 / z0;
	else
		tmp = t_3;
	end
	tmp_2 = tmp;
end
code[z1_, z0_] := Block[{t$95$0 = N[Exp[N[((-z1) * z1), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(N[(1.0 - z1), $MachinePrecision] - z1), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(z1 / N[(N[(z1 * N[(z0 - -1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$1 * 0.5641895665989011), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(1.0 / N[(N[(N[(t$95$0 * N[(0.5641895665989011 * t$95$1), $MachinePrecision]), $MachinePrecision] - N[(N[(-1.0 - z0), $MachinePrecision] * z1), $MachinePrecision]), $MachinePrecision] / z1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1e-304], t$95$3, If[LessEqual[t$95$2, 0.0], N[(1.0 / z0), $MachinePrecision], t$95$3]]]]]]
\begin{array}{l}
t_0 := e^{\left(-z1\right) \cdot z1}\\
t_1 := \sqrt{\left(1 - z1\right) - z1}\\
t_2 := \frac{z1}{z1 \cdot \left(z0 - -1\right) + \left(t\_1 \cdot 0.5641895665989011\right) \cdot t\_0}\\
t_3 := \frac{1}{\frac{t\_0 \cdot \left(0.5641895665989011 \cdot t\_1\right) - \left(-1 - z0\right) \cdot z1}{z1}}\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{-304}:\\
\;\;\;\;t\_3\\

\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;\frac{1}{z0}\\

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


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 z1 (+.f64 (*.f64 z1 (-.f64 z0 #s(literal -1 binary64))) (*.f64 (*.f64 (sqrt.f64 (-.f64 (-.f64 #s(literal 1 binary64) z1) z1)) #s(literal 5641895665989011/10000000000000000 binary64)) (exp.f64 (*.f64 (neg.f64 z1) z1))))) < -9.9999999999999997e-305 or 0.0 < (/.f64 z1 (+.f64 (*.f64 z1 (-.f64 z0 #s(literal -1 binary64))) (*.f64 (*.f64 (sqrt.f64 (-.f64 (-.f64 #s(literal 1 binary64) z1) z1)) #s(literal 5641895665989011/10000000000000000 binary64)) (exp.f64 (*.f64 (neg.f64 z1) z1)))))

    1. Initial program 91.9%

      \[\frac{z1}{z1 \cdot \left(z0 - -1\right) + \left(\sqrt{\left(1 - z1\right) - z1} \cdot 0.5641895665989011\right) \cdot e^{\left(-z1\right) \cdot z1}} \]
    2. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{z1}{z1 \cdot \left(z0 - -1\right) + \left(\sqrt{\left(1 - z1\right) - z1} \cdot \frac{5641895665989011}{10000000000000000}\right) \cdot e^{\left(-z1\right) \cdot z1}}} \]
      2. div-flipN/A

        \[\leadsto \color{blue}{\frac{1}{\frac{z1 \cdot \left(z0 - -1\right) + \left(\sqrt{\left(1 - z1\right) - z1} \cdot \frac{5641895665989011}{10000000000000000}\right) \cdot e^{\left(-z1\right) \cdot z1}}{z1}}} \]
      3. lower-unsound-/.f64N/A

        \[\leadsto \color{blue}{\frac{1}{\frac{z1 \cdot \left(z0 - -1\right) + \left(\sqrt{\left(1 - z1\right) - z1} \cdot \frac{5641895665989011}{10000000000000000}\right) \cdot e^{\left(-z1\right) \cdot z1}}{z1}}} \]
      4. lower-unsound-/.f6491.9%

        \[\leadsto \frac{1}{\color{blue}{\frac{z1 \cdot \left(z0 - -1\right) + \left(\sqrt{\left(1 - z1\right) - z1} \cdot 0.5641895665989011\right) \cdot e^{\left(-z1\right) \cdot z1}}{z1}}} \]
    3. Applied rewrites91.9%

      \[\leadsto \color{blue}{\frac{1}{\frac{e^{\left(-z1\right) \cdot z1} \cdot \left(0.5641895665989011 \cdot \sqrt{\left(1 - z1\right) - z1}\right) - \left(-1 - z0\right) \cdot z1}{z1}}} \]

    if -9.9999999999999997e-305 < (/.f64 z1 (+.f64 (*.f64 z1 (-.f64 z0 #s(literal -1 binary64))) (*.f64 (*.f64 (sqrt.f64 (-.f64 (-.f64 #s(literal 1 binary64) z1) z1)) #s(literal 5641895665989011/10000000000000000 binary64)) (exp.f64 (*.f64 (neg.f64 z1) z1))))) < 0.0

    1. Initial program 91.9%

      \[\frac{z1}{z1 \cdot \left(z0 - -1\right) + \left(\sqrt{\left(1 - z1\right) - z1} \cdot 0.5641895665989011\right) \cdot e^{\left(-z1\right) \cdot z1}} \]
    2. Taylor expanded in z0 around inf

      \[\leadsto \color{blue}{\frac{1}{z0}} \]
    3. Step-by-step derivation
      1. lower-/.f6433.9%

        \[\leadsto \frac{1}{\color{blue}{z0}} \]
    4. Applied rewrites33.9%

      \[\leadsto \color{blue}{\frac{1}{z0}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 2: 99.2% accurate, 0.3× speedup?

\[\begin{array}{l} t_0 := \frac{z1}{z1 \cdot \left(z0 - -1\right) + \left(\sqrt{\left(1 - z1\right) - z1} \cdot 0.5641895665989011\right) \cdot e^{\left(-z1\right) \cdot z1}}\\ \mathbf{if}\;t\_0 \leq -1 \cdot 10^{-304}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;t\_0 \leq 0:\\ \;\;\;\;\frac{1}{z0}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \]
(FPCore (z1 z0)
  :precision binary64
  (let* ((t_0
        (/
         z1
         (+
          (* z1 (- z0 -1.0))
          (*
           (* (sqrt (- (- 1.0 z1) z1)) 0.5641895665989011)
           (exp (* (- z1) z1)))))))
  (if (<= t_0 -1e-304) t_0 (if (<= t_0 0.0) (/ 1.0 z0) t_0))))
double code(double z1, double z0) {
	double t_0 = z1 / ((z1 * (z0 - -1.0)) + ((sqrt(((1.0 - z1) - z1)) * 0.5641895665989011) * exp((-z1 * z1))));
	double tmp;
	if (t_0 <= -1e-304) {
		tmp = t_0;
	} else if (t_0 <= 0.0) {
		tmp = 1.0 / z0;
	} else {
		tmp = t_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(z1, z0)
use fmin_fmax_functions
    real(8), intent (in) :: z1
    real(8), intent (in) :: z0
    real(8) :: t_0
    real(8) :: tmp
    t_0 = z1 / ((z1 * (z0 - (-1.0d0))) + ((sqrt(((1.0d0 - z1) - z1)) * 0.5641895665989011d0) * exp((-z1 * z1))))
    if (t_0 <= (-1d-304)) then
        tmp = t_0
    else if (t_0 <= 0.0d0) then
        tmp = 1.0d0 / z0
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double z1, double z0) {
	double t_0 = z1 / ((z1 * (z0 - -1.0)) + ((Math.sqrt(((1.0 - z1) - z1)) * 0.5641895665989011) * Math.exp((-z1 * z1))));
	double tmp;
	if (t_0 <= -1e-304) {
		tmp = t_0;
	} else if (t_0 <= 0.0) {
		tmp = 1.0 / z0;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(z1, z0):
	t_0 = z1 / ((z1 * (z0 - -1.0)) + ((math.sqrt(((1.0 - z1) - z1)) * 0.5641895665989011) * math.exp((-z1 * z1))))
	tmp = 0
	if t_0 <= -1e-304:
		tmp = t_0
	elif t_0 <= 0.0:
		tmp = 1.0 / z0
	else:
		tmp = t_0
	return tmp
function code(z1, z0)
	t_0 = Float64(z1 / Float64(Float64(z1 * Float64(z0 - -1.0)) + Float64(Float64(sqrt(Float64(Float64(1.0 - z1) - z1)) * 0.5641895665989011) * exp(Float64(Float64(-z1) * z1)))))
	tmp = 0.0
	if (t_0 <= -1e-304)
		tmp = t_0;
	elseif (t_0 <= 0.0)
		tmp = Float64(1.0 / z0);
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(z1, z0)
	t_0 = z1 / ((z1 * (z0 - -1.0)) + ((sqrt(((1.0 - z1) - z1)) * 0.5641895665989011) * exp((-z1 * z1))));
	tmp = 0.0;
	if (t_0 <= -1e-304)
		tmp = t_0;
	elseif (t_0 <= 0.0)
		tmp = 1.0 / z0;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[z1_, z0_] := Block[{t$95$0 = N[(z1 / N[(N[(z1 * N[(z0 - -1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(N[(1.0 - z1), $MachinePrecision] - z1), $MachinePrecision]], $MachinePrecision] * 0.5641895665989011), $MachinePrecision] * N[Exp[N[((-z1) * z1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -1e-304], t$95$0, If[LessEqual[t$95$0, 0.0], N[(1.0 / z0), $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := \frac{z1}{z1 \cdot \left(z0 - -1\right) + \left(\sqrt{\left(1 - z1\right) - z1} \cdot 0.5641895665989011\right) \cdot e^{\left(-z1\right) \cdot z1}}\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{-304}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\frac{1}{z0}\\

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


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 z1 (+.f64 (*.f64 z1 (-.f64 z0 #s(literal -1 binary64))) (*.f64 (*.f64 (sqrt.f64 (-.f64 (-.f64 #s(literal 1 binary64) z1) z1)) #s(literal 5641895665989011/10000000000000000 binary64)) (exp.f64 (*.f64 (neg.f64 z1) z1))))) < -9.9999999999999997e-305 or 0.0 < (/.f64 z1 (+.f64 (*.f64 z1 (-.f64 z0 #s(literal -1 binary64))) (*.f64 (*.f64 (sqrt.f64 (-.f64 (-.f64 #s(literal 1 binary64) z1) z1)) #s(literal 5641895665989011/10000000000000000 binary64)) (exp.f64 (*.f64 (neg.f64 z1) z1)))))

    1. Initial program 91.9%

      \[\frac{z1}{z1 \cdot \left(z0 - -1\right) + \left(\sqrt{\left(1 - z1\right) - z1} \cdot 0.5641895665989011\right) \cdot e^{\left(-z1\right) \cdot z1}} \]

    if -9.9999999999999997e-305 < (/.f64 z1 (+.f64 (*.f64 z1 (-.f64 z0 #s(literal -1 binary64))) (*.f64 (*.f64 (sqrt.f64 (-.f64 (-.f64 #s(literal 1 binary64) z1) z1)) #s(literal 5641895665989011/10000000000000000 binary64)) (exp.f64 (*.f64 (neg.f64 z1) z1))))) < 0.0

    1. Initial program 91.9%

      \[\frac{z1}{z1 \cdot \left(z0 - -1\right) + \left(\sqrt{\left(1 - z1\right) - z1} \cdot 0.5641895665989011\right) \cdot e^{\left(-z1\right) \cdot z1}} \]
    2. Taylor expanded in z0 around inf

      \[\leadsto \color{blue}{\frac{1}{z0}} \]
    3. Step-by-step derivation
      1. lower-/.f6433.9%

        \[\leadsto \frac{1}{\color{blue}{z0}} \]
    4. Applied rewrites33.9%

      \[\leadsto \color{blue}{\frac{1}{z0}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 3: 98.1% accurate, 0.4× speedup?

\[\begin{array}{l} t_0 := \frac{z1}{z1 \cdot \left(z0 - -1\right) + \left(\sqrt{\left(1 - z1\right) - z1} \cdot 0.5641895665989011\right) \cdot e^{\left(-z1\right) \cdot z1}}\\ \mathbf{if}\;t\_0 \leq -1 \cdot 10^{-304}:\\ \;\;\;\;\frac{z1}{0.5641895665989011 + z1 \cdot \left(0.4358104334010989 + z0\right)}\\ \mathbf{elif}\;t\_0 \leq 0:\\ \;\;\;\;\frac{1}{z0}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{1 \cdot 0.5641895665989011 - \left(-1 - z0\right) \cdot z1}{z1}}\\ \end{array} \]
(FPCore (z1 z0)
  :precision binary64
  (let* ((t_0
        (/
         z1
         (+
          (* z1 (- z0 -1.0))
          (*
           (* (sqrt (- (- 1.0 z1) z1)) 0.5641895665989011)
           (exp (* (- z1) z1)))))))
  (if (<= t_0 -1e-304)
    (/ z1 (+ 0.5641895665989011 (* z1 (+ 0.4358104334010989 z0))))
    (if (<= t_0 0.0)
      (/ 1.0 z0)
      (/
       1.0
       (/ (- (* 1.0 0.5641895665989011) (* (- -1.0 z0) z1)) z1))))))
double code(double z1, double z0) {
	double t_0 = z1 / ((z1 * (z0 - -1.0)) + ((sqrt(((1.0 - z1) - z1)) * 0.5641895665989011) * exp((-z1 * z1))));
	double tmp;
	if (t_0 <= -1e-304) {
		tmp = z1 / (0.5641895665989011 + (z1 * (0.4358104334010989 + z0)));
	} else if (t_0 <= 0.0) {
		tmp = 1.0 / z0;
	} else {
		tmp = 1.0 / (((1.0 * 0.5641895665989011) - ((-1.0 - z0) * z1)) / z1);
	}
	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(z1, z0)
use fmin_fmax_functions
    real(8), intent (in) :: z1
    real(8), intent (in) :: z0
    real(8) :: t_0
    real(8) :: tmp
    t_0 = z1 / ((z1 * (z0 - (-1.0d0))) + ((sqrt(((1.0d0 - z1) - z1)) * 0.5641895665989011d0) * exp((-z1 * z1))))
    if (t_0 <= (-1d-304)) then
        tmp = z1 / (0.5641895665989011d0 + (z1 * (0.4358104334010989d0 + z0)))
    else if (t_0 <= 0.0d0) then
        tmp = 1.0d0 / z0
    else
        tmp = 1.0d0 / (((1.0d0 * 0.5641895665989011d0) - (((-1.0d0) - z0) * z1)) / z1)
    end if
    code = tmp
end function
public static double code(double z1, double z0) {
	double t_0 = z1 / ((z1 * (z0 - -1.0)) + ((Math.sqrt(((1.0 - z1) - z1)) * 0.5641895665989011) * Math.exp((-z1 * z1))));
	double tmp;
	if (t_0 <= -1e-304) {
		tmp = z1 / (0.5641895665989011 + (z1 * (0.4358104334010989 + z0)));
	} else if (t_0 <= 0.0) {
		tmp = 1.0 / z0;
	} else {
		tmp = 1.0 / (((1.0 * 0.5641895665989011) - ((-1.0 - z0) * z1)) / z1);
	}
	return tmp;
}
def code(z1, z0):
	t_0 = z1 / ((z1 * (z0 - -1.0)) + ((math.sqrt(((1.0 - z1) - z1)) * 0.5641895665989011) * math.exp((-z1 * z1))))
	tmp = 0
	if t_0 <= -1e-304:
		tmp = z1 / (0.5641895665989011 + (z1 * (0.4358104334010989 + z0)))
	elif t_0 <= 0.0:
		tmp = 1.0 / z0
	else:
		tmp = 1.0 / (((1.0 * 0.5641895665989011) - ((-1.0 - z0) * z1)) / z1)
	return tmp
function code(z1, z0)
	t_0 = Float64(z1 / Float64(Float64(z1 * Float64(z0 - -1.0)) + Float64(Float64(sqrt(Float64(Float64(1.0 - z1) - z1)) * 0.5641895665989011) * exp(Float64(Float64(-z1) * z1)))))
	tmp = 0.0
	if (t_0 <= -1e-304)
		tmp = Float64(z1 / Float64(0.5641895665989011 + Float64(z1 * Float64(0.4358104334010989 + z0))));
	elseif (t_0 <= 0.0)
		tmp = Float64(1.0 / z0);
	else
		tmp = Float64(1.0 / Float64(Float64(Float64(1.0 * 0.5641895665989011) - Float64(Float64(-1.0 - z0) * z1)) / z1));
	end
	return tmp
end
function tmp_2 = code(z1, z0)
	t_0 = z1 / ((z1 * (z0 - -1.0)) + ((sqrt(((1.0 - z1) - z1)) * 0.5641895665989011) * exp((-z1 * z1))));
	tmp = 0.0;
	if (t_0 <= -1e-304)
		tmp = z1 / (0.5641895665989011 + (z1 * (0.4358104334010989 + z0)));
	elseif (t_0 <= 0.0)
		tmp = 1.0 / z0;
	else
		tmp = 1.0 / (((1.0 * 0.5641895665989011) - ((-1.0 - z0) * z1)) / z1);
	end
	tmp_2 = tmp;
end
code[z1_, z0_] := Block[{t$95$0 = N[(z1 / N[(N[(z1 * N[(z0 - -1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(N[(1.0 - z1), $MachinePrecision] - z1), $MachinePrecision]], $MachinePrecision] * 0.5641895665989011), $MachinePrecision] * N[Exp[N[((-z1) * z1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -1e-304], N[(z1 / N[(0.5641895665989011 + N[(z1 * N[(0.4358104334010989 + z0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(1.0 / z0), $MachinePrecision], N[(1.0 / N[(N[(N[(1.0 * 0.5641895665989011), $MachinePrecision] - N[(N[(-1.0 - z0), $MachinePrecision] * z1), $MachinePrecision]), $MachinePrecision] / z1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \frac{z1}{z1 \cdot \left(z0 - -1\right) + \left(\sqrt{\left(1 - z1\right) - z1} \cdot 0.5641895665989011\right) \cdot e^{\left(-z1\right) \cdot z1}}\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{-304}:\\
\;\;\;\;\frac{z1}{0.5641895665989011 + z1 \cdot \left(0.4358104334010989 + z0\right)}\\

\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\frac{1}{z0}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{1 \cdot 0.5641895665989011 - \left(-1 - z0\right) \cdot z1}{z1}}\\


\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 z1 (+.f64 (*.f64 z1 (-.f64 z0 #s(literal -1 binary64))) (*.f64 (*.f64 (sqrt.f64 (-.f64 (-.f64 #s(literal 1 binary64) z1) z1)) #s(literal 5641895665989011/10000000000000000 binary64)) (exp.f64 (*.f64 (neg.f64 z1) z1))))) < -9.9999999999999997e-305

    1. Initial program 91.9%

      \[\frac{z1}{z1 \cdot \left(z0 - -1\right) + \left(\sqrt{\left(1 - z1\right) - z1} \cdot 0.5641895665989011\right) \cdot e^{\left(-z1\right) \cdot z1}} \]
    2. Taylor expanded in z1 around 0

      \[\leadsto \frac{z1}{\color{blue}{\frac{5641895665989011}{10000000000000000} + z1 \cdot \left(\frac{4358104334010989}{10000000000000000} + z0\right)}} \]
    3. Step-by-step derivation
      1. lower-+.f64N/A

        \[\leadsto \frac{z1}{\frac{5641895665989011}{10000000000000000} + \color{blue}{z1 \cdot \left(\frac{4358104334010989}{10000000000000000} + z0\right)}} \]
      2. lower-*.f64N/A

        \[\leadsto \frac{z1}{\frac{5641895665989011}{10000000000000000} + z1 \cdot \color{blue}{\left(\frac{4358104334010989}{10000000000000000} + z0\right)}} \]
      3. lower-+.f6477.2%

        \[\leadsto \frac{z1}{0.5641895665989011 + z1 \cdot \left(0.4358104334010989 + \color{blue}{z0}\right)} \]
    4. Applied rewrites77.2%

      \[\leadsto \frac{z1}{\color{blue}{0.5641895665989011 + z1 \cdot \left(0.4358104334010989 + z0\right)}} \]

    if -9.9999999999999997e-305 < (/.f64 z1 (+.f64 (*.f64 z1 (-.f64 z0 #s(literal -1 binary64))) (*.f64 (*.f64 (sqrt.f64 (-.f64 (-.f64 #s(literal 1 binary64) z1) z1)) #s(literal 5641895665989011/10000000000000000 binary64)) (exp.f64 (*.f64 (neg.f64 z1) z1))))) < 0.0

    1. Initial program 91.9%

      \[\frac{z1}{z1 \cdot \left(z0 - -1\right) + \left(\sqrt{\left(1 - z1\right) - z1} \cdot 0.5641895665989011\right) \cdot e^{\left(-z1\right) \cdot z1}} \]
    2. Taylor expanded in z0 around inf

      \[\leadsto \color{blue}{\frac{1}{z0}} \]
    3. Step-by-step derivation
      1. lower-/.f6433.9%

        \[\leadsto \frac{1}{\color{blue}{z0}} \]
    4. Applied rewrites33.9%

      \[\leadsto \color{blue}{\frac{1}{z0}} \]

    if 0.0 < (/.f64 z1 (+.f64 (*.f64 z1 (-.f64 z0 #s(literal -1 binary64))) (*.f64 (*.f64 (sqrt.f64 (-.f64 (-.f64 #s(literal 1 binary64) z1) z1)) #s(literal 5641895665989011/10000000000000000 binary64)) (exp.f64 (*.f64 (neg.f64 z1) z1)))))

    1. Initial program 91.9%

      \[\frac{z1}{z1 \cdot \left(z0 - -1\right) + \left(\sqrt{\left(1 - z1\right) - z1} \cdot 0.5641895665989011\right) \cdot e^{\left(-z1\right) \cdot z1}} \]
    2. Taylor expanded in z1 around 0

      \[\leadsto \frac{z1}{z1 \cdot \left(z0 - -1\right) + \color{blue}{\frac{5641895665989011}{10000000000000000}} \cdot e^{\left(-z1\right) \cdot z1}} \]
    3. Step-by-step derivation
      1. Applied rewrites91.2%

        \[\leadsto \frac{z1}{z1 \cdot \left(z0 - -1\right) + \color{blue}{0.5641895665989011} \cdot e^{\left(-z1\right) \cdot z1}} \]
      2. Taylor expanded in z1 around 0

        \[\leadsto \frac{z1}{z1 \cdot \left(z0 - -1\right) + 0.5641895665989011 \cdot \color{blue}{1}} \]
      3. Step-by-step derivation
        1. Applied rewrites90.8%

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

            \[\leadsto \color{blue}{\frac{z1}{z1 \cdot \left(z0 - -1\right) + \frac{5641895665989011}{10000000000000000} \cdot 1}} \]
          2. div-flipN/A

            \[\leadsto \color{blue}{\frac{1}{\frac{z1 \cdot \left(z0 - -1\right) + \frac{5641895665989011}{10000000000000000} \cdot 1}{z1}}} \]
          3. lower-unsound-/.f64N/A

            \[\leadsto \color{blue}{\frac{1}{\frac{z1 \cdot \left(z0 - -1\right) + \frac{5641895665989011}{10000000000000000} \cdot 1}{z1}}} \]
          4. lower-unsound-/.f6490.9%

            \[\leadsto \frac{1}{\color{blue}{\frac{z1 \cdot \left(z0 - -1\right) + 0.5641895665989011 \cdot 1}{z1}}} \]
        3. Applied rewrites90.9%

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

      Alternative 4: 98.1% accurate, 0.4× speedup?

      \[\begin{array}{l} t_0 := z1 \cdot \left(z0 - -1\right)\\ t_1 := \frac{z1}{t\_0 + \left(\sqrt{\left(1 - z1\right) - z1} \cdot 0.5641895665989011\right) \cdot e^{\left(-z1\right) \cdot z1}}\\ \mathbf{if}\;t\_1 \leq -1 \cdot 10^{-304}:\\ \;\;\;\;\frac{z1}{0.5641895665989011 + z1 \cdot \left(0.4358104334010989 + z0\right)}\\ \mathbf{elif}\;t\_1 \leq 0:\\ \;\;\;\;\frac{1}{z0}\\ \mathbf{else}:\\ \;\;\;\;\frac{z1}{t\_0 + 0.5641895665989011 \cdot 1}\\ \end{array} \]
      (FPCore (z1 z0)
        :precision binary64
        (let* ((t_0 (* z1 (- z0 -1.0)))
             (t_1
              (/
               z1
               (+
                t_0
                (*
                 (* (sqrt (- (- 1.0 z1) z1)) 0.5641895665989011)
                 (exp (* (- z1) z1)))))))
        (if (<= t_1 -1e-304)
          (/ z1 (+ 0.5641895665989011 (* z1 (+ 0.4358104334010989 z0))))
          (if (<= t_1 0.0)
            (/ 1.0 z0)
            (/ z1 (+ t_0 (* 0.5641895665989011 1.0)))))))
      double code(double z1, double z0) {
      	double t_0 = z1 * (z0 - -1.0);
      	double t_1 = z1 / (t_0 + ((sqrt(((1.0 - z1) - z1)) * 0.5641895665989011) * exp((-z1 * z1))));
      	double tmp;
      	if (t_1 <= -1e-304) {
      		tmp = z1 / (0.5641895665989011 + (z1 * (0.4358104334010989 + z0)));
      	} else if (t_1 <= 0.0) {
      		tmp = 1.0 / z0;
      	} else {
      		tmp = z1 / (t_0 + (0.5641895665989011 * 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(z1, z0)
      use fmin_fmax_functions
          real(8), intent (in) :: z1
          real(8), intent (in) :: z0
          real(8) :: t_0
          real(8) :: t_1
          real(8) :: tmp
          t_0 = z1 * (z0 - (-1.0d0))
          t_1 = z1 / (t_0 + ((sqrt(((1.0d0 - z1) - z1)) * 0.5641895665989011d0) * exp((-z1 * z1))))
          if (t_1 <= (-1d-304)) then
              tmp = z1 / (0.5641895665989011d0 + (z1 * (0.4358104334010989d0 + z0)))
          else if (t_1 <= 0.0d0) then
              tmp = 1.0d0 / z0
          else
              tmp = z1 / (t_0 + (0.5641895665989011d0 * 1.0d0))
          end if
          code = tmp
      end function
      
      public static double code(double z1, double z0) {
      	double t_0 = z1 * (z0 - -1.0);
      	double t_1 = z1 / (t_0 + ((Math.sqrt(((1.0 - z1) - z1)) * 0.5641895665989011) * Math.exp((-z1 * z1))));
      	double tmp;
      	if (t_1 <= -1e-304) {
      		tmp = z1 / (0.5641895665989011 + (z1 * (0.4358104334010989 + z0)));
      	} else if (t_1 <= 0.0) {
      		tmp = 1.0 / z0;
      	} else {
      		tmp = z1 / (t_0 + (0.5641895665989011 * 1.0));
      	}
      	return tmp;
      }
      
      def code(z1, z0):
      	t_0 = z1 * (z0 - -1.0)
      	t_1 = z1 / (t_0 + ((math.sqrt(((1.0 - z1) - z1)) * 0.5641895665989011) * math.exp((-z1 * z1))))
      	tmp = 0
      	if t_1 <= -1e-304:
      		tmp = z1 / (0.5641895665989011 + (z1 * (0.4358104334010989 + z0)))
      	elif t_1 <= 0.0:
      		tmp = 1.0 / z0
      	else:
      		tmp = z1 / (t_0 + (0.5641895665989011 * 1.0))
      	return tmp
      
      function code(z1, z0)
      	t_0 = Float64(z1 * Float64(z0 - -1.0))
      	t_1 = Float64(z1 / Float64(t_0 + Float64(Float64(sqrt(Float64(Float64(1.0 - z1) - z1)) * 0.5641895665989011) * exp(Float64(Float64(-z1) * z1)))))
      	tmp = 0.0
      	if (t_1 <= -1e-304)
      		tmp = Float64(z1 / Float64(0.5641895665989011 + Float64(z1 * Float64(0.4358104334010989 + z0))));
      	elseif (t_1 <= 0.0)
      		tmp = Float64(1.0 / z0);
      	else
      		tmp = Float64(z1 / Float64(t_0 + Float64(0.5641895665989011 * 1.0)));
      	end
      	return tmp
      end
      
      function tmp_2 = code(z1, z0)
      	t_0 = z1 * (z0 - -1.0);
      	t_1 = z1 / (t_0 + ((sqrt(((1.0 - z1) - z1)) * 0.5641895665989011) * exp((-z1 * z1))));
      	tmp = 0.0;
      	if (t_1 <= -1e-304)
      		tmp = z1 / (0.5641895665989011 + (z1 * (0.4358104334010989 + z0)));
      	elseif (t_1 <= 0.0)
      		tmp = 1.0 / z0;
      	else
      		tmp = z1 / (t_0 + (0.5641895665989011 * 1.0));
      	end
      	tmp_2 = tmp;
      end
      
      code[z1_, z0_] := Block[{t$95$0 = N[(z1 * N[(z0 - -1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(z1 / N[(t$95$0 + N[(N[(N[Sqrt[N[(N[(1.0 - z1), $MachinePrecision] - z1), $MachinePrecision]], $MachinePrecision] * 0.5641895665989011), $MachinePrecision] * N[Exp[N[((-z1) * z1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e-304], N[(z1 / N[(0.5641895665989011 + N[(z1 * N[(0.4358104334010989 + z0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(1.0 / z0), $MachinePrecision], N[(z1 / N[(t$95$0 + N[(0.5641895665989011 * 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
      
      \begin{array}{l}
      t_0 := z1 \cdot \left(z0 - -1\right)\\
      t_1 := \frac{z1}{t\_0 + \left(\sqrt{\left(1 - z1\right) - z1} \cdot 0.5641895665989011\right) \cdot e^{\left(-z1\right) \cdot z1}}\\
      \mathbf{if}\;t\_1 \leq -1 \cdot 10^{-304}:\\
      \;\;\;\;\frac{z1}{0.5641895665989011 + z1 \cdot \left(0.4358104334010989 + z0\right)}\\
      
      \mathbf{elif}\;t\_1 \leq 0:\\
      \;\;\;\;\frac{1}{z0}\\
      
      \mathbf{else}:\\
      \;\;\;\;\frac{z1}{t\_0 + 0.5641895665989011 \cdot 1}\\
      
      
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if (/.f64 z1 (+.f64 (*.f64 z1 (-.f64 z0 #s(literal -1 binary64))) (*.f64 (*.f64 (sqrt.f64 (-.f64 (-.f64 #s(literal 1 binary64) z1) z1)) #s(literal 5641895665989011/10000000000000000 binary64)) (exp.f64 (*.f64 (neg.f64 z1) z1))))) < -9.9999999999999997e-305

        1. Initial program 91.9%

          \[\frac{z1}{z1 \cdot \left(z0 - -1\right) + \left(\sqrt{\left(1 - z1\right) - z1} \cdot 0.5641895665989011\right) \cdot e^{\left(-z1\right) \cdot z1}} \]
        2. Taylor expanded in z1 around 0

          \[\leadsto \frac{z1}{\color{blue}{\frac{5641895665989011}{10000000000000000} + z1 \cdot \left(\frac{4358104334010989}{10000000000000000} + z0\right)}} \]
        3. Step-by-step derivation
          1. lower-+.f64N/A

            \[\leadsto \frac{z1}{\frac{5641895665989011}{10000000000000000} + \color{blue}{z1 \cdot \left(\frac{4358104334010989}{10000000000000000} + z0\right)}} \]
          2. lower-*.f64N/A

            \[\leadsto \frac{z1}{\frac{5641895665989011}{10000000000000000} + z1 \cdot \color{blue}{\left(\frac{4358104334010989}{10000000000000000} + z0\right)}} \]
          3. lower-+.f6477.2%

            \[\leadsto \frac{z1}{0.5641895665989011 + z1 \cdot \left(0.4358104334010989 + \color{blue}{z0}\right)} \]
        4. Applied rewrites77.2%

          \[\leadsto \frac{z1}{\color{blue}{0.5641895665989011 + z1 \cdot \left(0.4358104334010989 + z0\right)}} \]

        if -9.9999999999999997e-305 < (/.f64 z1 (+.f64 (*.f64 z1 (-.f64 z0 #s(literal -1 binary64))) (*.f64 (*.f64 (sqrt.f64 (-.f64 (-.f64 #s(literal 1 binary64) z1) z1)) #s(literal 5641895665989011/10000000000000000 binary64)) (exp.f64 (*.f64 (neg.f64 z1) z1))))) < 0.0

        1. Initial program 91.9%

          \[\frac{z1}{z1 \cdot \left(z0 - -1\right) + \left(\sqrt{\left(1 - z1\right) - z1} \cdot 0.5641895665989011\right) \cdot e^{\left(-z1\right) \cdot z1}} \]
        2. Taylor expanded in z0 around inf

          \[\leadsto \color{blue}{\frac{1}{z0}} \]
        3. Step-by-step derivation
          1. lower-/.f6433.9%

            \[\leadsto \frac{1}{\color{blue}{z0}} \]
        4. Applied rewrites33.9%

          \[\leadsto \color{blue}{\frac{1}{z0}} \]

        if 0.0 < (/.f64 z1 (+.f64 (*.f64 z1 (-.f64 z0 #s(literal -1 binary64))) (*.f64 (*.f64 (sqrt.f64 (-.f64 (-.f64 #s(literal 1 binary64) z1) z1)) #s(literal 5641895665989011/10000000000000000 binary64)) (exp.f64 (*.f64 (neg.f64 z1) z1)))))

        1. Initial program 91.9%

          \[\frac{z1}{z1 \cdot \left(z0 - -1\right) + \left(\sqrt{\left(1 - z1\right) - z1} \cdot 0.5641895665989011\right) \cdot e^{\left(-z1\right) \cdot z1}} \]
        2. Taylor expanded in z1 around 0

          \[\leadsto \frac{z1}{z1 \cdot \left(z0 - -1\right) + \color{blue}{\frac{5641895665989011}{10000000000000000}} \cdot e^{\left(-z1\right) \cdot z1}} \]
        3. Step-by-step derivation
          1. Applied rewrites91.2%

            \[\leadsto \frac{z1}{z1 \cdot \left(z0 - -1\right) + \color{blue}{0.5641895665989011} \cdot e^{\left(-z1\right) \cdot z1}} \]
          2. Taylor expanded in z1 around 0

            \[\leadsto \frac{z1}{z1 \cdot \left(z0 - -1\right) + 0.5641895665989011 \cdot \color{blue}{1}} \]
          3. Step-by-step derivation
            1. Applied rewrites90.8%

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

          Alternative 5: 84.6% accurate, 0.5× speedup?

          \[\begin{array}{l} t_0 := \frac{z1}{z1 \cdot \left(z0 - -1\right) + \left(\sqrt{\left(1 - z1\right) - z1} \cdot 0.5641895665989011\right) \cdot e^{\left(-z1\right) \cdot z1}}\\ t_1 := \frac{z1}{0.5641895665989011 + z1 \cdot \left(0.4358104334010989 + z0\right)}\\ \mathbf{if}\;t\_0 \leq -1 \cdot 10^{-304}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_0 \leq 0:\\ \;\;\;\;\frac{1}{z0}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \]
          (FPCore (z1 z0)
            :precision binary64
            (let* ((t_0
                  (/
                   z1
                   (+
                    (* z1 (- z0 -1.0))
                    (*
                     (* (sqrt (- (- 1.0 z1) z1)) 0.5641895665989011)
                     (exp (* (- z1) z1))))))
                 (t_1
                  (/
                   z1
                   (+ 0.5641895665989011 (* z1 (+ 0.4358104334010989 z0))))))
            (if (<= t_0 -1e-304) t_1 (if (<= t_0 0.0) (/ 1.0 z0) t_1))))
          double code(double z1, double z0) {
          	double t_0 = z1 / ((z1 * (z0 - -1.0)) + ((sqrt(((1.0 - z1) - z1)) * 0.5641895665989011) * exp((-z1 * z1))));
          	double t_1 = z1 / (0.5641895665989011 + (z1 * (0.4358104334010989 + z0)));
          	double tmp;
          	if (t_0 <= -1e-304) {
          		tmp = t_1;
          	} else if (t_0 <= 0.0) {
          		tmp = 1.0 / z0;
          	} else {
          		tmp = t_1;
          	}
          	return tmp;
          }
          
          module fmin_fmax_functions
              implicit none
              private
              public fmax
              public fmin
          
              interface fmax
                  module procedure fmax88
                  module procedure fmax44
                  module procedure fmax84
                  module procedure fmax48
              end interface
              interface fmin
                  module procedure fmin88
                  module procedure fmin44
                  module procedure fmin84
                  module procedure fmin48
              end interface
          contains
              real(8) function fmax88(x, y) result (res)
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
              end function
              real(4) function fmax44(x, y) result (res)
                  real(4), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
              end function
              real(8) function fmax84(x, y) result(res)
                  real(8), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
              end function
              real(8) function fmax48(x, y) result(res)
                  real(4), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
              end function
              real(8) function fmin88(x, y) result (res)
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
              end function
              real(4) function fmin44(x, y) result (res)
                  real(4), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
              end function
              real(8) function fmin84(x, y) result(res)
                  real(8), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
              end function
              real(8) function fmin48(x, y) result(res)
                  real(4), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
              end function
          end module
          
          real(8) function code(z1, z0)
          use fmin_fmax_functions
              real(8), intent (in) :: z1
              real(8), intent (in) :: z0
              real(8) :: t_0
              real(8) :: t_1
              real(8) :: tmp
              t_0 = z1 / ((z1 * (z0 - (-1.0d0))) + ((sqrt(((1.0d0 - z1) - z1)) * 0.5641895665989011d0) * exp((-z1 * z1))))
              t_1 = z1 / (0.5641895665989011d0 + (z1 * (0.4358104334010989d0 + z0)))
              if (t_0 <= (-1d-304)) then
                  tmp = t_1
              else if (t_0 <= 0.0d0) then
                  tmp = 1.0d0 / z0
              else
                  tmp = t_1
              end if
              code = tmp
          end function
          
          public static double code(double z1, double z0) {
          	double t_0 = z1 / ((z1 * (z0 - -1.0)) + ((Math.sqrt(((1.0 - z1) - z1)) * 0.5641895665989011) * Math.exp((-z1 * z1))));
          	double t_1 = z1 / (0.5641895665989011 + (z1 * (0.4358104334010989 + z0)));
          	double tmp;
          	if (t_0 <= -1e-304) {
          		tmp = t_1;
          	} else if (t_0 <= 0.0) {
          		tmp = 1.0 / z0;
          	} else {
          		tmp = t_1;
          	}
          	return tmp;
          }
          
          def code(z1, z0):
          	t_0 = z1 / ((z1 * (z0 - -1.0)) + ((math.sqrt(((1.0 - z1) - z1)) * 0.5641895665989011) * math.exp((-z1 * z1))))
          	t_1 = z1 / (0.5641895665989011 + (z1 * (0.4358104334010989 + z0)))
          	tmp = 0
          	if t_0 <= -1e-304:
          		tmp = t_1
          	elif t_0 <= 0.0:
          		tmp = 1.0 / z0
          	else:
          		tmp = t_1
          	return tmp
          
          function code(z1, z0)
          	t_0 = Float64(z1 / Float64(Float64(z1 * Float64(z0 - -1.0)) + Float64(Float64(sqrt(Float64(Float64(1.0 - z1) - z1)) * 0.5641895665989011) * exp(Float64(Float64(-z1) * z1)))))
          	t_1 = Float64(z1 / Float64(0.5641895665989011 + Float64(z1 * Float64(0.4358104334010989 + z0))))
          	tmp = 0.0
          	if (t_0 <= -1e-304)
          		tmp = t_1;
          	elseif (t_0 <= 0.0)
          		tmp = Float64(1.0 / z0);
          	else
          		tmp = t_1;
          	end
          	return tmp
          end
          
          function tmp_2 = code(z1, z0)
          	t_0 = z1 / ((z1 * (z0 - -1.0)) + ((sqrt(((1.0 - z1) - z1)) * 0.5641895665989011) * exp((-z1 * z1))));
          	t_1 = z1 / (0.5641895665989011 + (z1 * (0.4358104334010989 + z0)));
          	tmp = 0.0;
          	if (t_0 <= -1e-304)
          		tmp = t_1;
          	elseif (t_0 <= 0.0)
          		tmp = 1.0 / z0;
          	else
          		tmp = t_1;
          	end
          	tmp_2 = tmp;
          end
          
          code[z1_, z0_] := Block[{t$95$0 = N[(z1 / N[(N[(z1 * N[(z0 - -1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(N[(1.0 - z1), $MachinePrecision] - z1), $MachinePrecision]], $MachinePrecision] * 0.5641895665989011), $MachinePrecision] * N[Exp[N[((-z1) * z1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(z1 / N[(0.5641895665989011 + N[(z1 * N[(0.4358104334010989 + z0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -1e-304], t$95$1, If[LessEqual[t$95$0, 0.0], N[(1.0 / z0), $MachinePrecision], t$95$1]]]]
          
          \begin{array}{l}
          t_0 := \frac{z1}{z1 \cdot \left(z0 - -1\right) + \left(\sqrt{\left(1 - z1\right) - z1} \cdot 0.5641895665989011\right) \cdot e^{\left(-z1\right) \cdot z1}}\\
          t_1 := \frac{z1}{0.5641895665989011 + z1 \cdot \left(0.4358104334010989 + z0\right)}\\
          \mathbf{if}\;t\_0 \leq -1 \cdot 10^{-304}:\\
          \;\;\;\;t\_1\\
          
          \mathbf{elif}\;t\_0 \leq 0:\\
          \;\;\;\;\frac{1}{z0}\\
          
          \mathbf{else}:\\
          \;\;\;\;t\_1\\
          
          
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if (/.f64 z1 (+.f64 (*.f64 z1 (-.f64 z0 #s(literal -1 binary64))) (*.f64 (*.f64 (sqrt.f64 (-.f64 (-.f64 #s(literal 1 binary64) z1) z1)) #s(literal 5641895665989011/10000000000000000 binary64)) (exp.f64 (*.f64 (neg.f64 z1) z1))))) < -9.9999999999999997e-305 or 0.0 < (/.f64 z1 (+.f64 (*.f64 z1 (-.f64 z0 #s(literal -1 binary64))) (*.f64 (*.f64 (sqrt.f64 (-.f64 (-.f64 #s(literal 1 binary64) z1) z1)) #s(literal 5641895665989011/10000000000000000 binary64)) (exp.f64 (*.f64 (neg.f64 z1) z1)))))

            1. Initial program 91.9%

              \[\frac{z1}{z1 \cdot \left(z0 - -1\right) + \left(\sqrt{\left(1 - z1\right) - z1} \cdot 0.5641895665989011\right) \cdot e^{\left(-z1\right) \cdot z1}} \]
            2. Taylor expanded in z1 around 0

              \[\leadsto \frac{z1}{\color{blue}{\frac{5641895665989011}{10000000000000000} + z1 \cdot \left(\frac{4358104334010989}{10000000000000000} + z0\right)}} \]
            3. Step-by-step derivation
              1. lower-+.f64N/A

                \[\leadsto \frac{z1}{\frac{5641895665989011}{10000000000000000} + \color{blue}{z1 \cdot \left(\frac{4358104334010989}{10000000000000000} + z0\right)}} \]
              2. lower-*.f64N/A

                \[\leadsto \frac{z1}{\frac{5641895665989011}{10000000000000000} + z1 \cdot \color{blue}{\left(\frac{4358104334010989}{10000000000000000} + z0\right)}} \]
              3. lower-+.f6477.2%

                \[\leadsto \frac{z1}{0.5641895665989011 + z1 \cdot \left(0.4358104334010989 + \color{blue}{z0}\right)} \]
            4. Applied rewrites77.2%

              \[\leadsto \frac{z1}{\color{blue}{0.5641895665989011 + z1 \cdot \left(0.4358104334010989 + z0\right)}} \]

            if -9.9999999999999997e-305 < (/.f64 z1 (+.f64 (*.f64 z1 (-.f64 z0 #s(literal -1 binary64))) (*.f64 (*.f64 (sqrt.f64 (-.f64 (-.f64 #s(literal 1 binary64) z1) z1)) #s(literal 5641895665989011/10000000000000000 binary64)) (exp.f64 (*.f64 (neg.f64 z1) z1))))) < 0.0

            1. Initial program 91.9%

              \[\frac{z1}{z1 \cdot \left(z0 - -1\right) + \left(\sqrt{\left(1 - z1\right) - z1} \cdot 0.5641895665989011\right) \cdot e^{\left(-z1\right) \cdot z1}} \]
            2. Taylor expanded in z0 around inf

              \[\leadsto \color{blue}{\frac{1}{z0}} \]
            3. Step-by-step derivation
              1. lower-/.f6433.9%

                \[\leadsto \frac{1}{\color{blue}{z0}} \]
            4. Applied rewrites33.9%

              \[\leadsto \color{blue}{\frac{1}{z0}} \]
          3. Recombined 2 regimes into one program.
          4. Add Preprocessing

          Alternative 6: 69.9% accurate, 4.9× speedup?

          \[\begin{array}{l} \mathbf{if}\;z0 \leq -2.8 \cdot 10^{+152}:\\ \;\;\;\;\frac{1}{z0}\\ \mathbf{elif}\;z0 \leq 3.4 \cdot 10^{+120}:\\ \;\;\;\;\frac{z1}{0.5641895665989011 + z1 \cdot 0.4358104334010989}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{z0}\\ \end{array} \]
          (FPCore (z1 z0)
            :precision binary64
            (if (<= z0 -2.8e+152)
            (/ 1.0 z0)
            (if (<= z0 3.4e+120)
              (/ z1 (+ 0.5641895665989011 (* z1 0.4358104334010989)))
              (/ 1.0 z0))))
          double code(double z1, double z0) {
          	double tmp;
          	if (z0 <= -2.8e+152) {
          		tmp = 1.0 / z0;
          	} else if (z0 <= 3.4e+120) {
          		tmp = z1 / (0.5641895665989011 + (z1 * 0.4358104334010989));
          	} else {
          		tmp = 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(z1, z0)
          use fmin_fmax_functions
              real(8), intent (in) :: z1
              real(8), intent (in) :: z0
              real(8) :: tmp
              if (z0 <= (-2.8d+152)) then
                  tmp = 1.0d0 / z0
              else if (z0 <= 3.4d+120) then
                  tmp = z1 / (0.5641895665989011d0 + (z1 * 0.4358104334010989d0))
              else
                  tmp = 1.0d0 / z0
              end if
              code = tmp
          end function
          
          public static double code(double z1, double z0) {
          	double tmp;
          	if (z0 <= -2.8e+152) {
          		tmp = 1.0 / z0;
          	} else if (z0 <= 3.4e+120) {
          		tmp = z1 / (0.5641895665989011 + (z1 * 0.4358104334010989));
          	} else {
          		tmp = 1.0 / z0;
          	}
          	return tmp;
          }
          
          def code(z1, z0):
          	tmp = 0
          	if z0 <= -2.8e+152:
          		tmp = 1.0 / z0
          	elif z0 <= 3.4e+120:
          		tmp = z1 / (0.5641895665989011 + (z1 * 0.4358104334010989))
          	else:
          		tmp = 1.0 / z0
          	return tmp
          
          function code(z1, z0)
          	tmp = 0.0
          	if (z0 <= -2.8e+152)
          		tmp = Float64(1.0 / z0);
          	elseif (z0 <= 3.4e+120)
          		tmp = Float64(z1 / Float64(0.5641895665989011 + Float64(z1 * 0.4358104334010989)));
          	else
          		tmp = Float64(1.0 / z0);
          	end
          	return tmp
          end
          
          function tmp_2 = code(z1, z0)
          	tmp = 0.0;
          	if (z0 <= -2.8e+152)
          		tmp = 1.0 / z0;
          	elseif (z0 <= 3.4e+120)
          		tmp = z1 / (0.5641895665989011 + (z1 * 0.4358104334010989));
          	else
          		tmp = 1.0 / z0;
          	end
          	tmp_2 = tmp;
          end
          
          code[z1_, z0_] := If[LessEqual[z0, -2.8e+152], N[(1.0 / z0), $MachinePrecision], If[LessEqual[z0, 3.4e+120], N[(z1 / N[(0.5641895665989011 + N[(z1 * 0.4358104334010989), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / z0), $MachinePrecision]]]
          
          \begin{array}{l}
          \mathbf{if}\;z0 \leq -2.8 \cdot 10^{+152}:\\
          \;\;\;\;\frac{1}{z0}\\
          
          \mathbf{elif}\;z0 \leq 3.4 \cdot 10^{+120}:\\
          \;\;\;\;\frac{z1}{0.5641895665989011 + z1 \cdot 0.4358104334010989}\\
          
          \mathbf{else}:\\
          \;\;\;\;\frac{1}{z0}\\
          
          
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if z0 < -2.8000000000000002e152 or 3.4e120 < z0

            1. Initial program 91.9%

              \[\frac{z1}{z1 \cdot \left(z0 - -1\right) + \left(\sqrt{\left(1 - z1\right) - z1} \cdot 0.5641895665989011\right) \cdot e^{\left(-z1\right) \cdot z1}} \]
            2. Taylor expanded in z0 around inf

              \[\leadsto \color{blue}{\frac{1}{z0}} \]
            3. Step-by-step derivation
              1. lower-/.f6433.9%

                \[\leadsto \frac{1}{\color{blue}{z0}} \]
            4. Applied rewrites33.9%

              \[\leadsto \color{blue}{\frac{1}{z0}} \]

            if -2.8000000000000002e152 < z0 < 3.4e120

            1. Initial program 91.9%

              \[\frac{z1}{z1 \cdot \left(z0 - -1\right) + \left(\sqrt{\left(1 - z1\right) - z1} \cdot 0.5641895665989011\right) \cdot e^{\left(-z1\right) \cdot z1}} \]
            2. Taylor expanded in z1 around 0

              \[\leadsto \frac{z1}{\color{blue}{\frac{5641895665989011}{10000000000000000} + z1 \cdot \left(\frac{4358104334010989}{10000000000000000} + \left(z0 + \frac{-16925686997967033}{20000000000000000} \cdot z1\right)\right)}} \]
            3. Step-by-step derivation
              1. lower-+.f64N/A

                \[\leadsto \frac{z1}{\frac{5641895665989011}{10000000000000000} + \color{blue}{z1 \cdot \left(\frac{4358104334010989}{10000000000000000} + \left(z0 + \frac{-16925686997967033}{20000000000000000} \cdot z1\right)\right)}} \]
              2. lower-*.f64N/A

                \[\leadsto \frac{z1}{\frac{5641895665989011}{10000000000000000} + z1 \cdot \color{blue}{\left(\frac{4358104334010989}{10000000000000000} + \left(z0 + \frac{-16925686997967033}{20000000000000000} \cdot z1\right)\right)}} \]
              3. lower-+.f64N/A

                \[\leadsto \frac{z1}{\frac{5641895665989011}{10000000000000000} + z1 \cdot \left(\frac{4358104334010989}{10000000000000000} + \color{blue}{\left(z0 + \frac{-16925686997967033}{20000000000000000} \cdot z1\right)}\right)} \]
              4. lower-+.f64N/A

                \[\leadsto \frac{z1}{\frac{5641895665989011}{10000000000000000} + z1 \cdot \left(\frac{4358104334010989}{10000000000000000} + \left(z0 + \color{blue}{\frac{-16925686997967033}{20000000000000000} \cdot z1}\right)\right)} \]
              5. lower-*.f6471.4%

                \[\leadsto \frac{z1}{0.5641895665989011 + z1 \cdot \left(0.4358104334010989 + \left(z0 + -0.8462843498983517 \cdot \color{blue}{z1}\right)\right)} \]
            4. Applied rewrites71.4%

              \[\leadsto \frac{z1}{\color{blue}{0.5641895665989011 + z1 \cdot \left(0.4358104334010989 + \left(z0 + -0.8462843498983517 \cdot z1\right)\right)}} \]
            5. Taylor expanded in z0 around 0

              \[\leadsto \frac{z1}{0.5641895665989011 + z1 \cdot \left(\frac{4358104334010989}{10000000000000000} + \color{blue}{\frac{-16925686997967033}{20000000000000000} \cdot z1}\right)} \]
            6. Step-by-step derivation
              1. lower-+.f64N/A

                \[\leadsto \frac{z1}{\frac{5641895665989011}{10000000000000000} + z1 \cdot \left(\frac{4358104334010989}{10000000000000000} + \frac{-16925686997967033}{20000000000000000} \cdot \color{blue}{z1}\right)} \]
              2. lower-*.f6451.5%

                \[\leadsto \frac{z1}{0.5641895665989011 + z1 \cdot \left(0.4358104334010989 + -0.8462843498983517 \cdot z1\right)} \]
            7. Applied rewrites51.5%

              \[\leadsto \frac{z1}{0.5641895665989011 + z1 \cdot \left(0.4358104334010989 + \color{blue}{-0.8462843498983517 \cdot z1}\right)} \]
            8. Taylor expanded in z1 around 0

              \[\leadsto \frac{z1}{0.5641895665989011 + z1 \cdot \frac{4358104334010989}{10000000000000000}} \]
            9. Step-by-step derivation
              1. Applied rewrites53.5%

                \[\leadsto \frac{z1}{0.5641895665989011 + z1 \cdot 0.4358104334010989} \]
            10. Recombined 2 regimes into one program.
            11. Add Preprocessing

            Alternative 7: 66.8% accurate, 5.0× speedup?

            \[\begin{array}{l} \mathbf{if}\;z0 \leq -2.8 \cdot 10^{+152}:\\ \;\;\;\;\frac{1}{z0}\\ \mathbf{elif}\;z0 \leq 3.4 \cdot 10^{+120}:\\ \;\;\;\;\left(-1.369138938191455 \cdot z1\right) \cdot z1 + 1.7724539041519165 \cdot z1\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{z0}\\ \end{array} \]
            (FPCore (z1 z0)
              :precision binary64
              (if (<= z0 -2.8e+152)
              (/ 1.0 z0)
              (if (<= z0 3.4e+120)
                (+ (* (* -1.369138938191455 z1) z1) (* 1.7724539041519165 z1))
                (/ 1.0 z0))))
            double code(double z1, double z0) {
            	double tmp;
            	if (z0 <= -2.8e+152) {
            		tmp = 1.0 / z0;
            	} else if (z0 <= 3.4e+120) {
            		tmp = ((-1.369138938191455 * z1) * z1) + (1.7724539041519165 * z1);
            	} else {
            		tmp = 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(z1, z0)
            use fmin_fmax_functions
                real(8), intent (in) :: z1
                real(8), intent (in) :: z0
                real(8) :: tmp
                if (z0 <= (-2.8d+152)) then
                    tmp = 1.0d0 / z0
                else if (z0 <= 3.4d+120) then
                    tmp = (((-1.369138938191455d0) * z1) * z1) + (1.7724539041519165d0 * z1)
                else
                    tmp = 1.0d0 / z0
                end if
                code = tmp
            end function
            
            public static double code(double z1, double z0) {
            	double tmp;
            	if (z0 <= -2.8e+152) {
            		tmp = 1.0 / z0;
            	} else if (z0 <= 3.4e+120) {
            		tmp = ((-1.369138938191455 * z1) * z1) + (1.7724539041519165 * z1);
            	} else {
            		tmp = 1.0 / z0;
            	}
            	return tmp;
            }
            
            def code(z1, z0):
            	tmp = 0
            	if z0 <= -2.8e+152:
            		tmp = 1.0 / z0
            	elif z0 <= 3.4e+120:
            		tmp = ((-1.369138938191455 * z1) * z1) + (1.7724539041519165 * z1)
            	else:
            		tmp = 1.0 / z0
            	return tmp
            
            function code(z1, z0)
            	tmp = 0.0
            	if (z0 <= -2.8e+152)
            		tmp = Float64(1.0 / z0);
            	elseif (z0 <= 3.4e+120)
            		tmp = Float64(Float64(Float64(-1.369138938191455 * z1) * z1) + Float64(1.7724539041519165 * z1));
            	else
            		tmp = Float64(1.0 / z0);
            	end
            	return tmp
            end
            
            function tmp_2 = code(z1, z0)
            	tmp = 0.0;
            	if (z0 <= -2.8e+152)
            		tmp = 1.0 / z0;
            	elseif (z0 <= 3.4e+120)
            		tmp = ((-1.369138938191455 * z1) * z1) + (1.7724539041519165 * z1);
            	else
            		tmp = 1.0 / z0;
            	end
            	tmp_2 = tmp;
            end
            
            code[z1_, z0_] := If[LessEqual[z0, -2.8e+152], N[(1.0 / z0), $MachinePrecision], If[LessEqual[z0, 3.4e+120], N[(N[(N[(-1.369138938191455 * z1), $MachinePrecision] * z1), $MachinePrecision] + N[(1.7724539041519165 * z1), $MachinePrecision]), $MachinePrecision], N[(1.0 / z0), $MachinePrecision]]]
            
            \begin{array}{l}
            \mathbf{if}\;z0 \leq -2.8 \cdot 10^{+152}:\\
            \;\;\;\;\frac{1}{z0}\\
            
            \mathbf{elif}\;z0 \leq 3.4 \cdot 10^{+120}:\\
            \;\;\;\;\left(-1.369138938191455 \cdot z1\right) \cdot z1 + 1.7724539041519165 \cdot z1\\
            
            \mathbf{else}:\\
            \;\;\;\;\frac{1}{z0}\\
            
            
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if z0 < -2.8000000000000002e152 or 3.4e120 < z0

              1. Initial program 91.9%

                \[\frac{z1}{z1 \cdot \left(z0 - -1\right) + \left(\sqrt{\left(1 - z1\right) - z1} \cdot 0.5641895665989011\right) \cdot e^{\left(-z1\right) \cdot z1}} \]
              2. Taylor expanded in z0 around inf

                \[\leadsto \color{blue}{\frac{1}{z0}} \]
              3. Step-by-step derivation
                1. lower-/.f6433.9%

                  \[\leadsto \frac{1}{\color{blue}{z0}} \]
              4. Applied rewrites33.9%

                \[\leadsto \color{blue}{\frac{1}{z0}} \]

              if -2.8000000000000002e152 < z0 < 3.4e120

              1. Initial program 91.9%

                \[\frac{z1}{z1 \cdot \left(z0 - -1\right) + \left(\sqrt{\left(1 - z1\right) - z1} \cdot 0.5641895665989011\right) \cdot e^{\left(-z1\right) \cdot z1}} \]
              2. Taylor expanded in z1 around 0

                \[\leadsto \color{blue}{z1 \cdot \left(\frac{10000000000000000}{5641895665989011} + \frac{-100000000000000000000000000000000}{31830986705905585973052772758121} \cdot \left(z1 \cdot \left(\frac{4358104334010989}{10000000000000000} + z0\right)\right)\right)} \]
              3. Step-by-step derivation
                1. lower-*.f64N/A

                  \[\leadsto z1 \cdot \color{blue}{\left(\frac{10000000000000000}{5641895665989011} + \frac{-100000000000000000000000000000000}{31830986705905585973052772758121} \cdot \left(z1 \cdot \left(\frac{4358104334010989}{10000000000000000} + z0\right)\right)\right)} \]
                2. lower-+.f64N/A

                  \[\leadsto z1 \cdot \left(\frac{10000000000000000}{5641895665989011} + \color{blue}{\frac{-100000000000000000000000000000000}{31830986705905585973052772758121} \cdot \left(z1 \cdot \left(\frac{4358104334010989}{10000000000000000} + z0\right)\right)}\right) \]
                3. lower-*.f64N/A

                  \[\leadsto z1 \cdot \left(\frac{10000000000000000}{5641895665989011} + \frac{-100000000000000000000000000000000}{31830986705905585973052772758121} \cdot \color{blue}{\left(z1 \cdot \left(\frac{4358104334010989}{10000000000000000} + z0\right)\right)}\right) \]
                4. lower-*.f64N/A

                  \[\leadsto z1 \cdot \left(\frac{10000000000000000}{5641895665989011} + \frac{-100000000000000000000000000000000}{31830986705905585973052772758121} \cdot \left(z1 \cdot \color{blue}{\left(\frac{4358104334010989}{10000000000000000} + z0\right)}\right)\right) \]
                5. lower-+.f6450.1%

                  \[\leadsto z1 \cdot \left(1.7724539041519165 + -3.1415928423433717 \cdot \left(z1 \cdot \left(0.4358104334010989 + \color{blue}{z0}\right)\right)\right) \]
              4. Applied rewrites50.1%

                \[\leadsto \color{blue}{z1 \cdot \left(1.7724539041519165 + -3.1415928423433717 \cdot \left(z1 \cdot \left(0.4358104334010989 + z0\right)\right)\right)} \]
              5. Taylor expanded in z0 around inf

                \[\leadsto z1 \cdot \left(1.7724539041519165 + \frac{-100000000000000000000000000000000}{31830986705905585973052772758121} \cdot \color{blue}{\left(z0 \cdot z1\right)}\right) \]
              6. Step-by-step derivation
                1. lower-*.f64N/A

                  \[\leadsto z1 \cdot \left(\frac{10000000000000000}{5641895665989011} + \frac{-100000000000000000000000000000000}{31830986705905585973052772758121} \cdot \left(z0 \cdot \color{blue}{z1}\right)\right) \]
                2. lower-*.f6449.9%

                  \[\leadsto z1 \cdot \left(1.7724539041519165 + -3.1415928423433717 \cdot \left(z0 \cdot z1\right)\right) \]
              7. Applied rewrites49.9%

                \[\leadsto z1 \cdot \left(1.7724539041519165 + -3.1415928423433717 \cdot \color{blue}{\left(z0 \cdot z1\right)}\right) \]
              8. Taylor expanded in z0 around 0

                \[\leadsto z1 \cdot \left(1.7724539041519165 + \frac{-43581043340109890000000000000000}{31830986705905585973052772758121} \cdot \color{blue}{z1}\right) \]
              9. Step-by-step derivation
                1. lower-*.f6450.3%

                  \[\leadsto z1 \cdot \left(1.7724539041519165 + -1.369138938191455 \cdot z1\right) \]
              10. Applied rewrites50.3%

                \[\leadsto z1 \cdot \left(1.7724539041519165 + -1.369138938191455 \cdot \color{blue}{z1}\right) \]
              11. Step-by-step derivation
                1. lift-*.f64N/A

                  \[\leadsto z1 \cdot \color{blue}{\left(\frac{10000000000000000}{5641895665989011} + \frac{-43581043340109890000000000000000}{31830986705905585973052772758121} \cdot z1\right)} \]
                2. lift-+.f64N/A

                  \[\leadsto z1 \cdot \left(\frac{10000000000000000}{5641895665989011} + \color{blue}{\frac{-43581043340109890000000000000000}{31830986705905585973052772758121} \cdot z1}\right) \]
                3. +-commutativeN/A

                  \[\leadsto z1 \cdot \left(\frac{-43581043340109890000000000000000}{31830986705905585973052772758121} \cdot z1 + \color{blue}{\frac{10000000000000000}{5641895665989011}}\right) \]
                4. distribute-rgt-inN/A

                  \[\leadsto \left(\frac{-43581043340109890000000000000000}{31830986705905585973052772758121} \cdot z1\right) \cdot z1 + \color{blue}{\frac{10000000000000000}{5641895665989011} \cdot z1} \]
                5. *-commutativeN/A

                  \[\leadsto \left(\frac{-43581043340109890000000000000000}{31830986705905585973052772758121} \cdot z1\right) \cdot z1 + z1 \cdot \color{blue}{\frac{10000000000000000}{5641895665989011}} \]
                6. lower-+.f64N/A

                  \[\leadsto \left(\frac{-43581043340109890000000000000000}{31830986705905585973052772758121} \cdot z1\right) \cdot z1 + \color{blue}{z1 \cdot \frac{10000000000000000}{5641895665989011}} \]
                7. lower-*.f64N/A

                  \[\leadsto \left(\frac{-43581043340109890000000000000000}{31830986705905585973052772758121} \cdot z1\right) \cdot z1 + \color{blue}{z1} \cdot \frac{10000000000000000}{5641895665989011} \]
                8. *-commutativeN/A

                  \[\leadsto \left(\frac{-43581043340109890000000000000000}{31830986705905585973052772758121} \cdot z1\right) \cdot z1 + \frac{10000000000000000}{5641895665989011} \cdot \color{blue}{z1} \]
                9. lower-*.f6450.3%

                  \[\leadsto \left(-1.369138938191455 \cdot z1\right) \cdot z1 + 1.7724539041519165 \cdot \color{blue}{z1} \]
              12. Applied rewrites50.3%

                \[\leadsto \left(-1.369138938191455 \cdot z1\right) \cdot z1 + \color{blue}{1.7724539041519165 \cdot z1} \]
            3. Recombined 2 regimes into one program.
            4. Add Preprocessing

            Alternative 8: 66.8% accurate, 4.9× speedup?

            \[\begin{array}{l} \mathbf{if}\;z0 - -1 \leq -2 \cdot 10^{+152}:\\ \;\;\;\;\frac{1}{z0}\\ \mathbf{elif}\;z0 - -1 \leq 2 \cdot 10^{+117}:\\ \;\;\;\;z1 \cdot \left(1.7724539041519165 + -1.369138938191455 \cdot z1\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{z0}\\ \end{array} \]
            (FPCore (z1 z0)
              :precision binary64
              (if (<= (- z0 -1.0) -2e+152)
              (/ 1.0 z0)
              (if (<= (- z0 -1.0) 2e+117)
                (* z1 (+ 1.7724539041519165 (* -1.369138938191455 z1)))
                (/ 1.0 z0))))
            double code(double z1, double z0) {
            	double tmp;
            	if ((z0 - -1.0) <= -2e+152) {
            		tmp = 1.0 / z0;
            	} else if ((z0 - -1.0) <= 2e+117) {
            		tmp = z1 * (1.7724539041519165 + (-1.369138938191455 * z1));
            	} else {
            		tmp = 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(z1, z0)
            use fmin_fmax_functions
                real(8), intent (in) :: z1
                real(8), intent (in) :: z0
                real(8) :: tmp
                if ((z0 - (-1.0d0)) <= (-2d+152)) then
                    tmp = 1.0d0 / z0
                else if ((z0 - (-1.0d0)) <= 2d+117) then
                    tmp = z1 * (1.7724539041519165d0 + ((-1.369138938191455d0) * z1))
                else
                    tmp = 1.0d0 / z0
                end if
                code = tmp
            end function
            
            public static double code(double z1, double z0) {
            	double tmp;
            	if ((z0 - -1.0) <= -2e+152) {
            		tmp = 1.0 / z0;
            	} else if ((z0 - -1.0) <= 2e+117) {
            		tmp = z1 * (1.7724539041519165 + (-1.369138938191455 * z1));
            	} else {
            		tmp = 1.0 / z0;
            	}
            	return tmp;
            }
            
            def code(z1, z0):
            	tmp = 0
            	if (z0 - -1.0) <= -2e+152:
            		tmp = 1.0 / z0
            	elif (z0 - -1.0) <= 2e+117:
            		tmp = z1 * (1.7724539041519165 + (-1.369138938191455 * z1))
            	else:
            		tmp = 1.0 / z0
            	return tmp
            
            function code(z1, z0)
            	tmp = 0.0
            	if (Float64(z0 - -1.0) <= -2e+152)
            		tmp = Float64(1.0 / z0);
            	elseif (Float64(z0 - -1.0) <= 2e+117)
            		tmp = Float64(z1 * Float64(1.7724539041519165 + Float64(-1.369138938191455 * z1)));
            	else
            		tmp = Float64(1.0 / z0);
            	end
            	return tmp
            end
            
            function tmp_2 = code(z1, z0)
            	tmp = 0.0;
            	if ((z0 - -1.0) <= -2e+152)
            		tmp = 1.0 / z0;
            	elseif ((z0 - -1.0) <= 2e+117)
            		tmp = z1 * (1.7724539041519165 + (-1.369138938191455 * z1));
            	else
            		tmp = 1.0 / z0;
            	end
            	tmp_2 = tmp;
            end
            
            code[z1_, z0_] := If[LessEqual[N[(z0 - -1.0), $MachinePrecision], -2e+152], N[(1.0 / z0), $MachinePrecision], If[LessEqual[N[(z0 - -1.0), $MachinePrecision], 2e+117], N[(z1 * N[(1.7724539041519165 + N[(-1.369138938191455 * z1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / z0), $MachinePrecision]]]
            
            \begin{array}{l}
            \mathbf{if}\;z0 - -1 \leq -2 \cdot 10^{+152}:\\
            \;\;\;\;\frac{1}{z0}\\
            
            \mathbf{elif}\;z0 - -1 \leq 2 \cdot 10^{+117}:\\
            \;\;\;\;z1 \cdot \left(1.7724539041519165 + -1.369138938191455 \cdot z1\right)\\
            
            \mathbf{else}:\\
            \;\;\;\;\frac{1}{z0}\\
            
            
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if (-.f64 z0 #s(literal -1 binary64)) < -2.0000000000000001e152 or 2.0000000000000001e117 < (-.f64 z0 #s(literal -1 binary64))

              1. Initial program 91.9%

                \[\frac{z1}{z1 \cdot \left(z0 - -1\right) + \left(\sqrt{\left(1 - z1\right) - z1} \cdot 0.5641895665989011\right) \cdot e^{\left(-z1\right) \cdot z1}} \]
              2. Taylor expanded in z0 around inf

                \[\leadsto \color{blue}{\frac{1}{z0}} \]
              3. Step-by-step derivation
                1. lower-/.f6433.9%

                  \[\leadsto \frac{1}{\color{blue}{z0}} \]
              4. Applied rewrites33.9%

                \[\leadsto \color{blue}{\frac{1}{z0}} \]

              if -2.0000000000000001e152 < (-.f64 z0 #s(literal -1 binary64)) < 2.0000000000000001e117

              1. Initial program 91.9%

                \[\frac{z1}{z1 \cdot \left(z0 - -1\right) + \left(\sqrt{\left(1 - z1\right) - z1} \cdot 0.5641895665989011\right) \cdot e^{\left(-z1\right) \cdot z1}} \]
              2. Taylor expanded in z1 around 0

                \[\leadsto \color{blue}{z1 \cdot \left(\frac{10000000000000000}{5641895665989011} + \frac{-100000000000000000000000000000000}{31830986705905585973052772758121} \cdot \left(z1 \cdot \left(\frac{4358104334010989}{10000000000000000} + z0\right)\right)\right)} \]
              3. Step-by-step derivation
                1. lower-*.f64N/A

                  \[\leadsto z1 \cdot \color{blue}{\left(\frac{10000000000000000}{5641895665989011} + \frac{-100000000000000000000000000000000}{31830986705905585973052772758121} \cdot \left(z1 \cdot \left(\frac{4358104334010989}{10000000000000000} + z0\right)\right)\right)} \]
                2. lower-+.f64N/A

                  \[\leadsto z1 \cdot \left(\frac{10000000000000000}{5641895665989011} + \color{blue}{\frac{-100000000000000000000000000000000}{31830986705905585973052772758121} \cdot \left(z1 \cdot \left(\frac{4358104334010989}{10000000000000000} + z0\right)\right)}\right) \]
                3. lower-*.f64N/A

                  \[\leadsto z1 \cdot \left(\frac{10000000000000000}{5641895665989011} + \frac{-100000000000000000000000000000000}{31830986705905585973052772758121} \cdot \color{blue}{\left(z1 \cdot \left(\frac{4358104334010989}{10000000000000000} + z0\right)\right)}\right) \]
                4. lower-*.f64N/A

                  \[\leadsto z1 \cdot \left(\frac{10000000000000000}{5641895665989011} + \frac{-100000000000000000000000000000000}{31830986705905585973052772758121} \cdot \left(z1 \cdot \color{blue}{\left(\frac{4358104334010989}{10000000000000000} + z0\right)}\right)\right) \]
                5. lower-+.f6450.1%

                  \[\leadsto z1 \cdot \left(1.7724539041519165 + -3.1415928423433717 \cdot \left(z1 \cdot \left(0.4358104334010989 + \color{blue}{z0}\right)\right)\right) \]
              4. Applied rewrites50.1%

                \[\leadsto \color{blue}{z1 \cdot \left(1.7724539041519165 + -3.1415928423433717 \cdot \left(z1 \cdot \left(0.4358104334010989 + z0\right)\right)\right)} \]
              5. Taylor expanded in z0 around inf

                \[\leadsto z1 \cdot \left(1.7724539041519165 + \frac{-100000000000000000000000000000000}{31830986705905585973052772758121} \cdot \color{blue}{\left(z0 \cdot z1\right)}\right) \]
              6. Step-by-step derivation
                1. lower-*.f64N/A

                  \[\leadsto z1 \cdot \left(\frac{10000000000000000}{5641895665989011} + \frac{-100000000000000000000000000000000}{31830986705905585973052772758121} \cdot \left(z0 \cdot \color{blue}{z1}\right)\right) \]
                2. lower-*.f6449.9%

                  \[\leadsto z1 \cdot \left(1.7724539041519165 + -3.1415928423433717 \cdot \left(z0 \cdot z1\right)\right) \]
              7. Applied rewrites49.9%

                \[\leadsto z1 \cdot \left(1.7724539041519165 + -3.1415928423433717 \cdot \color{blue}{\left(z0 \cdot z1\right)}\right) \]
              8. Taylor expanded in z0 around 0

                \[\leadsto z1 \cdot \left(1.7724539041519165 + \frac{-43581043340109890000000000000000}{31830986705905585973052772758121} \cdot \color{blue}{z1}\right) \]
              9. Step-by-step derivation
                1. lower-*.f6450.3%

                  \[\leadsto z1 \cdot \left(1.7724539041519165 + -1.369138938191455 \cdot z1\right) \]
              10. Applied rewrites50.3%

                \[\leadsto z1 \cdot \left(1.7724539041519165 + -1.369138938191455 \cdot \color{blue}{z1}\right) \]
            3. Recombined 2 regimes into one program.
            4. Add Preprocessing

            Alternative 9: 66.6% accurate, 5.2× speedup?

            \[\begin{array}{l} \mathbf{if}\;z0 - -1 \leq -2 \cdot 10^{+152}:\\ \;\;\;\;\frac{1}{z0}\\ \mathbf{elif}\;z0 - -1 \leq 2 \cdot 10^{+117}:\\ \;\;\;\;1.7724539041519165 \cdot z1\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{z0}\\ \end{array} \]
            (FPCore (z1 z0)
              :precision binary64
              (if (<= (- z0 -1.0) -2e+152)
              (/ 1.0 z0)
              (if (<= (- z0 -1.0) 2e+117) (* 1.7724539041519165 z1) (/ 1.0 z0))))
            double code(double z1, double z0) {
            	double tmp;
            	if ((z0 - -1.0) <= -2e+152) {
            		tmp = 1.0 / z0;
            	} else if ((z0 - -1.0) <= 2e+117) {
            		tmp = 1.7724539041519165 * z1;
            	} else {
            		tmp = 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(z1, z0)
            use fmin_fmax_functions
                real(8), intent (in) :: z1
                real(8), intent (in) :: z0
                real(8) :: tmp
                if ((z0 - (-1.0d0)) <= (-2d+152)) then
                    tmp = 1.0d0 / z0
                else if ((z0 - (-1.0d0)) <= 2d+117) then
                    tmp = 1.7724539041519165d0 * z1
                else
                    tmp = 1.0d0 / z0
                end if
                code = tmp
            end function
            
            public static double code(double z1, double z0) {
            	double tmp;
            	if ((z0 - -1.0) <= -2e+152) {
            		tmp = 1.0 / z0;
            	} else if ((z0 - -1.0) <= 2e+117) {
            		tmp = 1.7724539041519165 * z1;
            	} else {
            		tmp = 1.0 / z0;
            	}
            	return tmp;
            }
            
            def code(z1, z0):
            	tmp = 0
            	if (z0 - -1.0) <= -2e+152:
            		tmp = 1.0 / z0
            	elif (z0 - -1.0) <= 2e+117:
            		tmp = 1.7724539041519165 * z1
            	else:
            		tmp = 1.0 / z0
            	return tmp
            
            function code(z1, z0)
            	tmp = 0.0
            	if (Float64(z0 - -1.0) <= -2e+152)
            		tmp = Float64(1.0 / z0);
            	elseif (Float64(z0 - -1.0) <= 2e+117)
            		tmp = Float64(1.7724539041519165 * z1);
            	else
            		tmp = Float64(1.0 / z0);
            	end
            	return tmp
            end
            
            function tmp_2 = code(z1, z0)
            	tmp = 0.0;
            	if ((z0 - -1.0) <= -2e+152)
            		tmp = 1.0 / z0;
            	elseif ((z0 - -1.0) <= 2e+117)
            		tmp = 1.7724539041519165 * z1;
            	else
            		tmp = 1.0 / z0;
            	end
            	tmp_2 = tmp;
            end
            
            code[z1_, z0_] := If[LessEqual[N[(z0 - -1.0), $MachinePrecision], -2e+152], N[(1.0 / z0), $MachinePrecision], If[LessEqual[N[(z0 - -1.0), $MachinePrecision], 2e+117], N[(1.7724539041519165 * z1), $MachinePrecision], N[(1.0 / z0), $MachinePrecision]]]
            
            \begin{array}{l}
            \mathbf{if}\;z0 - -1 \leq -2 \cdot 10^{+152}:\\
            \;\;\;\;\frac{1}{z0}\\
            
            \mathbf{elif}\;z0 - -1 \leq 2 \cdot 10^{+117}:\\
            \;\;\;\;1.7724539041519165 \cdot z1\\
            
            \mathbf{else}:\\
            \;\;\;\;\frac{1}{z0}\\
            
            
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if (-.f64 z0 #s(literal -1 binary64)) < -2.0000000000000001e152 or 2.0000000000000001e117 < (-.f64 z0 #s(literal -1 binary64))

              1. Initial program 91.9%

                \[\frac{z1}{z1 \cdot \left(z0 - -1\right) + \left(\sqrt{\left(1 - z1\right) - z1} \cdot 0.5641895665989011\right) \cdot e^{\left(-z1\right) \cdot z1}} \]
              2. Taylor expanded in z0 around inf

                \[\leadsto \color{blue}{\frac{1}{z0}} \]
              3. Step-by-step derivation
                1. lower-/.f6433.9%

                  \[\leadsto \frac{1}{\color{blue}{z0}} \]
              4. Applied rewrites33.9%

                \[\leadsto \color{blue}{\frac{1}{z0}} \]

              if -2.0000000000000001e152 < (-.f64 z0 #s(literal -1 binary64)) < 2.0000000000000001e117

              1. Initial program 91.9%

                \[\frac{z1}{z1 \cdot \left(z0 - -1\right) + \left(\sqrt{\left(1 - z1\right) - z1} \cdot 0.5641895665989011\right) \cdot e^{\left(-z1\right) \cdot z1}} \]
              2. Taylor expanded in z1 around 0

                \[\leadsto \color{blue}{\frac{10000000000000000}{5641895665989011} \cdot z1} \]
              3. Step-by-step derivation
                1. lower-*.f6450.0%

                  \[\leadsto 1.7724539041519165 \cdot \color{blue}{z1} \]
              4. Applied rewrites50.0%

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

            Alternative 10: 50.0% accurate, 26.0× speedup?

            \[1.7724539041519165 \cdot z1 \]
            (FPCore (z1 z0)
              :precision binary64
              (* 1.7724539041519165 z1))
            double code(double z1, double z0) {
            	return 1.7724539041519165 * z1;
            }
            
            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(z1, z0)
            use fmin_fmax_functions
                real(8), intent (in) :: z1
                real(8), intent (in) :: z0
                code = 1.7724539041519165d0 * z1
            end function
            
            public static double code(double z1, double z0) {
            	return 1.7724539041519165 * z1;
            }
            
            def code(z1, z0):
            	return 1.7724539041519165 * z1
            
            function code(z1, z0)
            	return Float64(1.7724539041519165 * z1)
            end
            
            function tmp = code(z1, z0)
            	tmp = 1.7724539041519165 * z1;
            end
            
            code[z1_, z0_] := N[(1.7724539041519165 * z1), $MachinePrecision]
            
            1.7724539041519165 \cdot z1
            
            Derivation
            1. Initial program 91.9%

              \[\frac{z1}{z1 \cdot \left(z0 - -1\right) + \left(\sqrt{\left(1 - z1\right) - z1} \cdot 0.5641895665989011\right) \cdot e^{\left(-z1\right) \cdot z1}} \]
            2. Taylor expanded in z1 around 0

              \[\leadsto \color{blue}{\frac{10000000000000000}{5641895665989011} \cdot z1} \]
            3. Step-by-step derivation
              1. lower-*.f6450.0%

                \[\leadsto 1.7724539041519165 \cdot \color{blue}{z1} \]
            4. Applied rewrites50.0%

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

            Reproduce

            ?
            herbie shell --seed 2025250 
            (FPCore (z1 z0)
              :name "(/ z1 (+ (* z1 (- z0 -1)) (* (* (sqrt (- (- 1 z1) z1)) 5641895665989011/10000000000000000) (exp (* (- z1) z1)))))"
              :precision binary64
              (/ z1 (+ (* z1 (- z0 -1.0)) (* (* (sqrt (- (- 1.0 z1) z1)) 0.5641895665989011) (exp (* (- z1) z1))))))