(/ (sqrt PI) (- (/ (sqrt (- (- 1 z1) z1)) (* (exp (* z1 z1)) z1)) (* (- -1 z0) (sqrt PI))))

Percentage Accurate: 99.3% → 99.5%
Time: 2.5s
Alternatives: 7
Speedup: 1.1×

Specification

?
\[\frac{\sqrt{\pi}}{\frac{\sqrt{\left(1 - z1\right) - z1}}{e^{z1 \cdot z1} \cdot z1} - \left(-1 - z0\right) \cdot \sqrt{\pi}} \]
(FPCore (z1 z0)
  :precision binary64
  (/
 (sqrt PI)
 (-
  (/ (sqrt (- (- 1.0 z1) z1)) (* (exp (* z1 z1)) z1))
  (* (- -1.0 z0) (sqrt PI)))))
double code(double z1, double z0) {
	return sqrt(((double) M_PI)) / ((sqrt(((1.0 - z1) - z1)) / (exp((z1 * z1)) * z1)) - ((-1.0 - z0) * sqrt(((double) M_PI))));
}
public static double code(double z1, double z0) {
	return Math.sqrt(Math.PI) / ((Math.sqrt(((1.0 - z1) - z1)) / (Math.exp((z1 * z1)) * z1)) - ((-1.0 - z0) * Math.sqrt(Math.PI)));
}
def code(z1, z0):
	return math.sqrt(math.pi) / ((math.sqrt(((1.0 - z1) - z1)) / (math.exp((z1 * z1)) * z1)) - ((-1.0 - z0) * math.sqrt(math.pi)))
function code(z1, z0)
	return Float64(sqrt(pi) / Float64(Float64(sqrt(Float64(Float64(1.0 - z1) - z1)) / Float64(exp(Float64(z1 * z1)) * z1)) - Float64(Float64(-1.0 - z0) * sqrt(pi))))
end
function tmp = code(z1, z0)
	tmp = sqrt(pi) / ((sqrt(((1.0 - z1) - z1)) / (exp((z1 * z1)) * z1)) - ((-1.0 - z0) * sqrt(pi)));
end
code[z1_, z0_] := N[(N[Sqrt[Pi], $MachinePrecision] / N[(N[(N[Sqrt[N[(N[(1.0 - z1), $MachinePrecision] - z1), $MachinePrecision]], $MachinePrecision] / N[(N[Exp[N[(z1 * z1), $MachinePrecision]], $MachinePrecision] * z1), $MachinePrecision]), $MachinePrecision] - N[(N[(-1.0 - z0), $MachinePrecision] * N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{\sqrt{\pi}}{\frac{\sqrt{\left(1 - z1\right) - z1}}{e^{z1 \cdot z1} \cdot z1} - \left(-1 - z0\right) \cdot \sqrt{\pi}}

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 7 alternatives:

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

Initial Program: 99.3% accurate, 1.0× speedup?

\[\frac{\sqrt{\pi}}{\frac{\sqrt{\left(1 - z1\right) - z1}}{e^{z1 \cdot z1} \cdot z1} - \left(-1 - z0\right) \cdot \sqrt{\pi}} \]
(FPCore (z1 z0)
  :precision binary64
  (/
 (sqrt PI)
 (-
  (/ (sqrt (- (- 1.0 z1) z1)) (* (exp (* z1 z1)) z1))
  (* (- -1.0 z0) (sqrt PI)))))
double code(double z1, double z0) {
	return sqrt(((double) M_PI)) / ((sqrt(((1.0 - z1) - z1)) / (exp((z1 * z1)) * z1)) - ((-1.0 - z0) * sqrt(((double) M_PI))));
}
public static double code(double z1, double z0) {
	return Math.sqrt(Math.PI) / ((Math.sqrt(((1.0 - z1) - z1)) / (Math.exp((z1 * z1)) * z1)) - ((-1.0 - z0) * Math.sqrt(Math.PI)));
}
def code(z1, z0):
	return math.sqrt(math.pi) / ((math.sqrt(((1.0 - z1) - z1)) / (math.exp((z1 * z1)) * z1)) - ((-1.0 - z0) * math.sqrt(math.pi)))
function code(z1, z0)
	return Float64(sqrt(pi) / Float64(Float64(sqrt(Float64(Float64(1.0 - z1) - z1)) / Float64(exp(Float64(z1 * z1)) * z1)) - Float64(Float64(-1.0 - z0) * sqrt(pi))))
end
function tmp = code(z1, z0)
	tmp = sqrt(pi) / ((sqrt(((1.0 - z1) - z1)) / (exp((z1 * z1)) * z1)) - ((-1.0 - z0) * sqrt(pi)));
end
code[z1_, z0_] := N[(N[Sqrt[Pi], $MachinePrecision] / N[(N[(N[Sqrt[N[(N[(1.0 - z1), $MachinePrecision] - z1), $MachinePrecision]], $MachinePrecision] / N[(N[Exp[N[(z1 * z1), $MachinePrecision]], $MachinePrecision] * z1), $MachinePrecision]), $MachinePrecision] - N[(N[(-1.0 - z0), $MachinePrecision] * N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{\sqrt{\pi}}{\frac{\sqrt{\left(1 - z1\right) - z1}}{e^{z1 \cdot z1} \cdot z1} - \left(-1 - z0\right) \cdot \sqrt{\pi}}

Alternative 1: 99.5% accurate, 1.1× speedup?

\[\frac{1.772453850905516}{\frac{\sqrt{\left(1 - z1\right) - z1}}{e^{z1 \cdot z1} \cdot z1} - \left(-1 - z0\right) \cdot 1.772453850905516} \]
(FPCore (z1 z0)
  :precision binary64
  (/
 1.772453850905516
 (-
  (/ (sqrt (- (- 1.0 z1) z1)) (* (exp (* z1 z1)) z1))
  (* (- -1.0 z0) 1.772453850905516))))
double code(double z1, double z0) {
	return 1.772453850905516 / ((sqrt(((1.0 - z1) - z1)) / (exp((z1 * z1)) * z1)) - ((-1.0 - z0) * 1.772453850905516));
}
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.772453850905516d0 / ((sqrt(((1.0d0 - z1) - z1)) / (exp((z1 * z1)) * z1)) - (((-1.0d0) - z0) * 1.772453850905516d0))
end function
public static double code(double z1, double z0) {
	return 1.772453850905516 / ((Math.sqrt(((1.0 - z1) - z1)) / (Math.exp((z1 * z1)) * z1)) - ((-1.0 - z0) * 1.772453850905516));
}
def code(z1, z0):
	return 1.772453850905516 / ((math.sqrt(((1.0 - z1) - z1)) / (math.exp((z1 * z1)) * z1)) - ((-1.0 - z0) * 1.772453850905516))
function code(z1, z0)
	return Float64(1.772453850905516 / Float64(Float64(sqrt(Float64(Float64(1.0 - z1) - z1)) / Float64(exp(Float64(z1 * z1)) * z1)) - Float64(Float64(-1.0 - z0) * 1.772453850905516)))
end
function tmp = code(z1, z0)
	tmp = 1.772453850905516 / ((sqrt(((1.0 - z1) - z1)) / (exp((z1 * z1)) * z1)) - ((-1.0 - z0) * 1.772453850905516));
end
code[z1_, z0_] := N[(1.772453850905516 / N[(N[(N[Sqrt[N[(N[(1.0 - z1), $MachinePrecision] - z1), $MachinePrecision]], $MachinePrecision] / N[(N[Exp[N[(z1 * z1), $MachinePrecision]], $MachinePrecision] * z1), $MachinePrecision]), $MachinePrecision] - N[(N[(-1.0 - z0), $MachinePrecision] * 1.772453850905516), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{1.772453850905516}{\frac{\sqrt{\left(1 - z1\right) - z1}}{e^{z1 \cdot z1} \cdot z1} - \left(-1 - z0\right) \cdot 1.772453850905516}
Derivation
  1. Initial program 99.3%

    \[\frac{\sqrt{\pi}}{\frac{\sqrt{\left(1 - z1\right) - z1}}{e^{z1 \cdot z1} \cdot z1} - \left(-1 - z0\right) \cdot \sqrt{\pi}} \]
  2. Evaluated real constant99.0%

    \[\leadsto \frac{\color{blue}{1.772453850905516}}{\frac{\sqrt{\left(1 - z1\right) - z1}}{e^{z1 \cdot z1} \cdot z1} - \left(-1 - z0\right) \cdot \sqrt{\pi}} \]
  3. Evaluated real constant99.5%

    \[\leadsto \frac{1.772453850905516}{\frac{\sqrt{\left(1 - z1\right) - z1}}{e^{z1 \cdot z1} \cdot z1} - \left(-1 - z0\right) \cdot \color{blue}{1.772453850905516}} \]
  4. Add Preprocessing

Alternative 2: 98.6% accurate, 4.6× speedup?

\[\frac{1}{\frac{1}{z1} \cdot 0.5641895835477563 - \left(-1 - z0\right) \cdot 1} \]
(FPCore (z1 z0)
  :precision binary64
  (/ 1.0 (- (* (/ 1.0 z1) 0.5641895835477563) (* (- -1.0 z0) 1.0))))
double code(double z1, double z0) {
	return 1.0 / (((1.0 / z1) * 0.5641895835477563) - ((-1.0 - z0) * 1.0));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(z1, z0)
use fmin_fmax_functions
    real(8), intent (in) :: z1
    real(8), intent (in) :: z0
    code = 1.0d0 / (((1.0d0 / z1) * 0.5641895835477563d0) - (((-1.0d0) - z0) * 1.0d0))
end function
public static double code(double z1, double z0) {
	return 1.0 / (((1.0 / z1) * 0.5641895835477563) - ((-1.0 - z0) * 1.0));
}
def code(z1, z0):
	return 1.0 / (((1.0 / z1) * 0.5641895835477563) - ((-1.0 - z0) * 1.0))
function code(z1, z0)
	return Float64(1.0 / Float64(Float64(Float64(1.0 / z1) * 0.5641895835477563) - Float64(Float64(-1.0 - z0) * 1.0)))
end
function tmp = code(z1, z0)
	tmp = 1.0 / (((1.0 / z1) * 0.5641895835477563) - ((-1.0 - z0) * 1.0));
end
code[z1_, z0_] := N[(1.0 / N[(N[(N[(1.0 / z1), $MachinePrecision] * 0.5641895835477563), $MachinePrecision] - N[(N[(-1.0 - z0), $MachinePrecision] * 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{1}{\frac{1}{z1} \cdot 0.5641895835477563 - \left(-1 - z0\right) \cdot 1}
Derivation
  1. Initial program 99.3%

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

    \[\leadsto \frac{\sqrt{\pi}}{\color{blue}{\frac{1}{z1}} - \left(-1 - z0\right) \cdot \sqrt{\pi}} \]
  3. Step-by-step derivation
    1. lower-/.f6498.3%

      \[\leadsto \frac{\sqrt{\pi}}{\frac{1}{\color{blue}{z1}} - \left(-1 - z0\right) \cdot \sqrt{\pi}} \]
  4. Applied rewrites98.3%

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

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

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

      \[\leadsto \color{blue}{\frac{1}{\frac{\frac{1}{z1} - \left(-1 - z0\right) \cdot \sqrt{\pi}}{\sqrt{\pi}}}} \]
    4. lower-unsound-/.f6498.4%

      \[\leadsto \frac{1}{\color{blue}{\frac{\frac{1}{z1} - \left(-1 - z0\right) \cdot \sqrt{\pi}}{\sqrt{\pi}}}} \]
    5. lift-*.f64N/A

      \[\leadsto \frac{1}{\frac{\frac{1}{z1} - \color{blue}{\left(-1 - z0\right) \cdot \sqrt{\pi}}}{\sqrt{\pi}}} \]
    6. *-commutativeN/A

      \[\leadsto \frac{1}{\frac{\frac{1}{z1} - \color{blue}{\sqrt{\pi} \cdot \left(-1 - z0\right)}}{\sqrt{\pi}}} \]
    7. lower-*.f6498.4%

      \[\leadsto \frac{1}{\frac{\frac{1}{z1} - \color{blue}{\sqrt{\pi} \cdot \left(-1 - z0\right)}}{\sqrt{\pi}}} \]
  6. Applied rewrites98.4%

    \[\leadsto \color{blue}{\frac{1}{\frac{\frac{1}{z1} - \sqrt{\pi} \cdot \left(-1 - z0\right)}{\sqrt{\pi}}}} \]
  7. Evaluated real constant97.7%

    \[\leadsto \frac{1}{\frac{\frac{1}{z1} - \color{blue}{1.772453850905516} \cdot \left(-1 - z0\right)}{\sqrt{\pi}}} \]
  8. Evaluated real constant98.5%

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

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

      \[\leadsto \frac{1}{\frac{\color{blue}{\frac{1}{z1} - \frac{7982422502469483}{4503599627370496} \cdot \left(-1 - z0\right)}}{\frac{7982422502469483}{4503599627370496}}} \]
    3. div-subN/A

      \[\leadsto \frac{1}{\color{blue}{\frac{\frac{1}{z1}}{\frac{7982422502469483}{4503599627370496}} - \frac{\frac{7982422502469483}{4503599627370496} \cdot \left(-1 - z0\right)}{\frac{7982422502469483}{4503599627370496}}}} \]
    4. lower--.f64N/A

      \[\leadsto \frac{1}{\color{blue}{\frac{\frac{1}{z1}}{\frac{7982422502469483}{4503599627370496}} - \frac{\frac{7982422502469483}{4503599627370496} \cdot \left(-1 - z0\right)}{\frac{7982422502469483}{4503599627370496}}}} \]
    5. mult-flipN/A

      \[\leadsto \frac{1}{\color{blue}{\frac{1}{z1} \cdot \frac{1}{\frac{7982422502469483}{4503599627370496}}} - \frac{\frac{7982422502469483}{4503599627370496} \cdot \left(-1 - z0\right)}{\frac{7982422502469483}{4503599627370496}}} \]
    6. lower-*.f64N/A

      \[\leadsto \frac{1}{\color{blue}{\frac{1}{z1} \cdot \frac{1}{\frac{7982422502469483}{4503599627370496}}} - \frac{\frac{7982422502469483}{4503599627370496} \cdot \left(-1 - z0\right)}{\frac{7982422502469483}{4503599627370496}}} \]
    7. metadata-evalN/A

      \[\leadsto \frac{1}{\frac{1}{z1} \cdot \color{blue}{\frac{4503599627370496}{7982422502469483}} - \frac{\frac{7982422502469483}{4503599627370496} \cdot \left(-1 - z0\right)}{\frac{7982422502469483}{4503599627370496}}} \]
    8. lift-*.f64N/A

      \[\leadsto \frac{1}{\frac{1}{z1} \cdot \frac{4503599627370496}{7982422502469483} - \frac{\color{blue}{\frac{7982422502469483}{4503599627370496} \cdot \left(-1 - z0\right)}}{\frac{7982422502469483}{4503599627370496}}} \]
    9. *-commutativeN/A

      \[\leadsto \frac{1}{\frac{1}{z1} \cdot \frac{4503599627370496}{7982422502469483} - \frac{\color{blue}{\left(-1 - z0\right) \cdot \frac{7982422502469483}{4503599627370496}}}{\frac{7982422502469483}{4503599627370496}}} \]
    10. associate-/l*N/A

      \[\leadsto \frac{1}{\frac{1}{z1} \cdot \frac{4503599627370496}{7982422502469483} - \color{blue}{\left(-1 - z0\right) \cdot \frac{\frac{7982422502469483}{4503599627370496}}{\frac{7982422502469483}{4503599627370496}}}} \]
    11. metadata-evalN/A

      \[\leadsto \frac{1}{\frac{1}{z1} \cdot \frac{4503599627370496}{7982422502469483} - \left(-1 - z0\right) \cdot \color{blue}{1}} \]
    12. lower-*.f6498.6%

      \[\leadsto \frac{1}{\frac{1}{z1} \cdot 0.5641895835477563 - \color{blue}{\left(-1 - z0\right) \cdot 1}} \]
  10. Applied rewrites98.6%

    \[\leadsto \frac{1}{\color{blue}{\frac{1}{z1} \cdot 0.5641895835477563 - \left(-1 - z0\right) \cdot 1}} \]
  11. Add Preprocessing

Alternative 3: 98.5% accurate, 5.3× speedup?

\[\frac{1.772453850905516}{\frac{1}{z1} - \left(-1 - z0\right) \cdot 1.772453850905516} \]
(FPCore (z1 z0)
  :precision binary64
  (/ 1.772453850905516 (- (/ 1.0 z1) (* (- -1.0 z0) 1.772453850905516))))
double code(double z1, double z0) {
	return 1.772453850905516 / ((1.0 / z1) - ((-1.0 - z0) * 1.772453850905516));
}
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.772453850905516d0 / ((1.0d0 / z1) - (((-1.0d0) - z0) * 1.772453850905516d0))
end function
public static double code(double z1, double z0) {
	return 1.772453850905516 / ((1.0 / z1) - ((-1.0 - z0) * 1.772453850905516));
}
def code(z1, z0):
	return 1.772453850905516 / ((1.0 / z1) - ((-1.0 - z0) * 1.772453850905516))
function code(z1, z0)
	return Float64(1.772453850905516 / Float64(Float64(1.0 / z1) - Float64(Float64(-1.0 - z0) * 1.772453850905516)))
end
function tmp = code(z1, z0)
	tmp = 1.772453850905516 / ((1.0 / z1) - ((-1.0 - z0) * 1.772453850905516));
end
code[z1_, z0_] := N[(1.772453850905516 / N[(N[(1.0 / z1), $MachinePrecision] - N[(N[(-1.0 - z0), $MachinePrecision] * 1.772453850905516), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{1.772453850905516}{\frac{1}{z1} - \left(-1 - z0\right) \cdot 1.772453850905516}
Derivation
  1. Initial program 99.3%

    \[\frac{\sqrt{\pi}}{\frac{\sqrt{\left(1 - z1\right) - z1}}{e^{z1 \cdot z1} \cdot z1} - \left(-1 - z0\right) \cdot \sqrt{\pi}} \]
  2. Evaluated real constant99.0%

    \[\leadsto \frac{\color{blue}{1.772453850905516}}{\frac{\sqrt{\left(1 - z1\right) - z1}}{e^{z1 \cdot z1} \cdot z1} - \left(-1 - z0\right) \cdot \sqrt{\pi}} \]
  3. Evaluated real constant99.5%

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

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

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

      \[\leadsto \frac{\frac{7982422502469483}{4503599627370496}}{\frac{1 + z1 \cdot \left(\frac{-3}{2} \cdot z1 - 1\right)}{z1} - \left(-1 - z0\right) \cdot \frac{7982422502469483}{4503599627370496}} \]
    3. lower-*.f64N/A

      \[\leadsto \frac{\frac{7982422502469483}{4503599627370496}}{\frac{1 + z1 \cdot \left(\frac{-3}{2} \cdot z1 - 1\right)}{z1} - \left(-1 - z0\right) \cdot \frac{7982422502469483}{4503599627370496}} \]
    4. lower--.f64N/A

      \[\leadsto \frac{\frac{7982422502469483}{4503599627370496}}{\frac{1 + z1 \cdot \left(\frac{-3}{2} \cdot z1 - 1\right)}{z1} - \left(-1 - z0\right) \cdot \frac{7982422502469483}{4503599627370496}} \]
    5. lower-*.f6473.4%

      \[\leadsto \frac{1.772453850905516}{\frac{1 + z1 \cdot \left(-1.5 \cdot z1 - 1\right)}{z1} - \left(-1 - z0\right) \cdot 1.772453850905516} \]
  6. Applied rewrites73.4%

    \[\leadsto \frac{1.772453850905516}{\color{blue}{\frac{1 + z1 \cdot \left(-1.5 \cdot z1 - 1\right)}{z1}} - \left(-1 - z0\right) \cdot 1.772453850905516} \]
  7. Taylor expanded in z1 around 0

    \[\leadsto \frac{1.772453850905516}{\frac{1 + z1 \cdot -1}{z1} - \left(-1 - z0\right) \cdot 1.772453850905516} \]
  8. Step-by-step derivation
    1. Applied rewrites85.0%

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

      \[\leadsto \frac{1.772453850905516}{\frac{1}{z1} - \left(-1 - z0\right) \cdot 1.772453850905516} \]
    3. Step-by-step derivation
      1. Applied rewrites98.5%

        \[\leadsto \frac{1.772453850905516}{\frac{1}{z1} - \left(-1 - z0\right) \cdot 1.772453850905516} \]
      2. Add Preprocessing

      Alternative 4: 68.0% accurate, 4.6× speedup?

      \[\begin{array}{l} \mathbf{if}\;z0 \leq -6 \cdot 10^{+73}:\\ \;\;\;\;\frac{1}{z0}\\ \mathbf{elif}\;z0 \leq 1.15 \cdot 10^{+46}:\\ \;\;\;\;z1 \cdot \left(1.772453850905516 + 1.772453850905516 \cdot \left(z1 \cdot \left(1 + -1.772453850905516 \cdot z0\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{z0}\\ \end{array} \]
      (FPCore (z1 z0)
        :precision binary64
        (if (<= z0 -6e+73)
        (/ 1.0 z0)
        (if (<= z0 1.15e+46)
          (*
           z1
           (+
            1.772453850905516
            (* 1.772453850905516 (* z1 (+ 1.0 (* -1.772453850905516 z0))))))
          (/ 1.0 z0))))
      double code(double z1, double z0) {
      	double tmp;
      	if (z0 <= -6e+73) {
      		tmp = 1.0 / z0;
      	} else if (z0 <= 1.15e+46) {
      		tmp = z1 * (1.772453850905516 + (1.772453850905516 * (z1 * (1.0 + (-1.772453850905516 * z0)))));
      	} 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 <= (-6d+73)) then
              tmp = 1.0d0 / z0
          else if (z0 <= 1.15d+46) then
              tmp = z1 * (1.772453850905516d0 + (1.772453850905516d0 * (z1 * (1.0d0 + ((-1.772453850905516d0) * z0)))))
          else
              tmp = 1.0d0 / z0
          end if
          code = tmp
      end function
      
      public static double code(double z1, double z0) {
      	double tmp;
      	if (z0 <= -6e+73) {
      		tmp = 1.0 / z0;
      	} else if (z0 <= 1.15e+46) {
      		tmp = z1 * (1.772453850905516 + (1.772453850905516 * (z1 * (1.0 + (-1.772453850905516 * z0)))));
      	} else {
      		tmp = 1.0 / z0;
      	}
      	return tmp;
      }
      
      def code(z1, z0):
      	tmp = 0
      	if z0 <= -6e+73:
      		tmp = 1.0 / z0
      	elif z0 <= 1.15e+46:
      		tmp = z1 * (1.772453850905516 + (1.772453850905516 * (z1 * (1.0 + (-1.772453850905516 * z0)))))
      	else:
      		tmp = 1.0 / z0
      	return tmp
      
      function code(z1, z0)
      	tmp = 0.0
      	if (z0 <= -6e+73)
      		tmp = Float64(1.0 / z0);
      	elseif (z0 <= 1.15e+46)
      		tmp = Float64(z1 * Float64(1.772453850905516 + Float64(1.772453850905516 * Float64(z1 * Float64(1.0 + Float64(-1.772453850905516 * z0))))));
      	else
      		tmp = Float64(1.0 / z0);
      	end
      	return tmp
      end
      
      function tmp_2 = code(z1, z0)
      	tmp = 0.0;
      	if (z0 <= -6e+73)
      		tmp = 1.0 / z0;
      	elseif (z0 <= 1.15e+46)
      		tmp = z1 * (1.772453850905516 + (1.772453850905516 * (z1 * (1.0 + (-1.772453850905516 * z0)))));
      	else
      		tmp = 1.0 / z0;
      	end
      	tmp_2 = tmp;
      end
      
      code[z1_, z0_] := If[LessEqual[z0, -6e+73], N[(1.0 / z0), $MachinePrecision], If[LessEqual[z0, 1.15e+46], N[(z1 * N[(1.772453850905516 + N[(1.772453850905516 * N[(z1 * N[(1.0 + N[(-1.772453850905516 * z0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / z0), $MachinePrecision]]]
      
      \begin{array}{l}
      \mathbf{if}\;z0 \leq -6 \cdot 10^{+73}:\\
      \;\;\;\;\frac{1}{z0}\\
      
      \mathbf{elif}\;z0 \leq 1.15 \cdot 10^{+46}:\\
      \;\;\;\;z1 \cdot \left(1.772453850905516 + 1.772453850905516 \cdot \left(z1 \cdot \left(1 + -1.772453850905516 \cdot z0\right)\right)\right)\\
      
      \mathbf{else}:\\
      \;\;\;\;\frac{1}{z0}\\
      
      
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if z0 < -6.0000000000000002e73 or 1.15e46 < z0

        1. Initial program 99.3%

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

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

            \[\leadsto \frac{1}{\color{blue}{z0}} \]
        4. Applied rewrites34.3%

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

        if -6.0000000000000002e73 < z0 < 1.15e46

        1. Initial program 99.3%

          \[\frac{\sqrt{\pi}}{\frac{\sqrt{\left(1 - z1\right) - z1}}{e^{z1 \cdot z1} \cdot z1} - \left(-1 - z0\right) \cdot \sqrt{\pi}} \]
        2. Evaluated real constant99.0%

          \[\leadsto \frac{\color{blue}{1.772453850905516}}{\frac{\sqrt{\left(1 - z1\right) - z1}}{e^{z1 \cdot z1} \cdot z1} - \left(-1 - z0\right) \cdot \sqrt{\pi}} \]
        3. Evaluated real constant99.5%

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

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

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

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

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

            \[\leadsto z1 \cdot \left(\frac{7982422502469483}{4503599627370496} + \frac{7982422502469483}{4503599627370496} \cdot \left(z1 \cdot \color{blue}{\left(1 + \frac{-7982422502469483}{4503599627370496} \cdot \left(1 + z0\right)\right)}\right)\right) \]
          5. lower-+.f64N/A

            \[\leadsto z1 \cdot \left(\frac{7982422502469483}{4503599627370496} + \frac{7982422502469483}{4503599627370496} \cdot \left(z1 \cdot \left(1 + \color{blue}{\frac{-7982422502469483}{4503599627370496} \cdot \left(1 + z0\right)}\right)\right)\right) \]
          6. lower-*.f64N/A

            \[\leadsto z1 \cdot \left(\frac{7982422502469483}{4503599627370496} + \frac{7982422502469483}{4503599627370496} \cdot \left(z1 \cdot \left(1 + \frac{-7982422502469483}{4503599627370496} \cdot \color{blue}{\left(1 + z0\right)}\right)\right)\right) \]
          7. lower-+.f6449.8%

            \[\leadsto z1 \cdot \left(1.772453850905516 + 1.772453850905516 \cdot \left(z1 \cdot \left(1 + -1.772453850905516 \cdot \left(1 + \color{blue}{z0}\right)\right)\right)\right) \]
        6. Applied rewrites49.8%

          \[\leadsto \color{blue}{z1 \cdot \left(1.772453850905516 + 1.772453850905516 \cdot \left(z1 \cdot \left(1 + -1.772453850905516 \cdot \left(1 + z0\right)\right)\right)\right)} \]
        7. Taylor expanded in z0 around inf

          \[\leadsto z1 \cdot \left(1.772453850905516 + 1.772453850905516 \cdot \left(z1 \cdot \left(1 + \frac{-7982422502469483}{4503599627370496} \cdot \color{blue}{z0}\right)\right)\right) \]
        8. Step-by-step derivation
          1. lower-*.f6450.0%

            \[\leadsto z1 \cdot \left(1.772453850905516 + 1.772453850905516 \cdot \left(z1 \cdot \left(1 + -1.772453850905516 \cdot z0\right)\right)\right) \]
        9. Applied rewrites50.0%

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

      Alternative 5: 67.8% accurate, 6.9× speedup?

      \[\begin{array}{l} \mathbf{if}\;z0 \leq -6 \cdot 10^{+73}:\\ \;\;\;\;\frac{1}{z0}\\ \mathbf{elif}\;z0 \leq 1.15 \cdot 10^{+46}:\\ \;\;\;\;z1 \cdot \left(1.772453850905516 + -1.3691388026842775 \cdot z1\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{z0}\\ \end{array} \]
      (FPCore (z1 z0)
        :precision binary64
        (if (<= z0 -6e+73)
        (/ 1.0 z0)
        (if (<= z0 1.15e+46)
          (* z1 (+ 1.772453850905516 (* -1.3691388026842775 z1)))
          (/ 1.0 z0))))
      double code(double z1, double z0) {
      	double tmp;
      	if (z0 <= -6e+73) {
      		tmp = 1.0 / z0;
      	} else if (z0 <= 1.15e+46) {
      		tmp = z1 * (1.772453850905516 + (-1.3691388026842775 * 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 <= (-6d+73)) then
              tmp = 1.0d0 / z0
          else if (z0 <= 1.15d+46) then
              tmp = z1 * (1.772453850905516d0 + ((-1.3691388026842775d0) * z1))
          else
              tmp = 1.0d0 / z0
          end if
          code = tmp
      end function
      
      public static double code(double z1, double z0) {
      	double tmp;
      	if (z0 <= -6e+73) {
      		tmp = 1.0 / z0;
      	} else if (z0 <= 1.15e+46) {
      		tmp = z1 * (1.772453850905516 + (-1.3691388026842775 * z1));
      	} else {
      		tmp = 1.0 / z0;
      	}
      	return tmp;
      }
      
      def code(z1, z0):
      	tmp = 0
      	if z0 <= -6e+73:
      		tmp = 1.0 / z0
      	elif z0 <= 1.15e+46:
      		tmp = z1 * (1.772453850905516 + (-1.3691388026842775 * z1))
      	else:
      		tmp = 1.0 / z0
      	return tmp
      
      function code(z1, z0)
      	tmp = 0.0
      	if (z0 <= -6e+73)
      		tmp = Float64(1.0 / z0);
      	elseif (z0 <= 1.15e+46)
      		tmp = Float64(z1 * Float64(1.772453850905516 + Float64(-1.3691388026842775 * z1)));
      	else
      		tmp = Float64(1.0 / z0);
      	end
      	return tmp
      end
      
      function tmp_2 = code(z1, z0)
      	tmp = 0.0;
      	if (z0 <= -6e+73)
      		tmp = 1.0 / z0;
      	elseif (z0 <= 1.15e+46)
      		tmp = z1 * (1.772453850905516 + (-1.3691388026842775 * z1));
      	else
      		tmp = 1.0 / z0;
      	end
      	tmp_2 = tmp;
      end
      
      code[z1_, z0_] := If[LessEqual[z0, -6e+73], N[(1.0 / z0), $MachinePrecision], If[LessEqual[z0, 1.15e+46], N[(z1 * N[(1.772453850905516 + N[(-1.3691388026842775 * z1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / z0), $MachinePrecision]]]
      
      \begin{array}{l}
      \mathbf{if}\;z0 \leq -6 \cdot 10^{+73}:\\
      \;\;\;\;\frac{1}{z0}\\
      
      \mathbf{elif}\;z0 \leq 1.15 \cdot 10^{+46}:\\
      \;\;\;\;z1 \cdot \left(1.772453850905516 + -1.3691388026842775 \cdot z1\right)\\
      
      \mathbf{else}:\\
      \;\;\;\;\frac{1}{z0}\\
      
      
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if z0 < -6.0000000000000002e73 or 1.15e46 < z0

        1. Initial program 99.3%

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

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

            \[\leadsto \frac{1}{\color{blue}{z0}} \]
        4. Applied rewrites34.3%

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

        if -6.0000000000000002e73 < z0 < 1.15e46

        1. Initial program 99.3%

          \[\frac{\sqrt{\pi}}{\frac{\sqrt{\left(1 - z1\right) - z1}}{e^{z1 \cdot z1} \cdot z1} - \left(-1 - z0\right) \cdot \sqrt{\pi}} \]
        2. Evaluated real constant99.0%

          \[\leadsto \frac{\color{blue}{1.772453850905516}}{\frac{\sqrt{\left(1 - z1\right) - z1}}{e^{z1 \cdot z1} \cdot z1} - \left(-1 - z0\right) \cdot \sqrt{\pi}} \]
        3. Evaluated real constant99.5%

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

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

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

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

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

            \[\leadsto z1 \cdot \left(\frac{7982422502469483}{4503599627370496} + \frac{7982422502469483}{4503599627370496} \cdot \left(z1 \cdot \color{blue}{\left(1 + \frac{-7982422502469483}{4503599627370496} \cdot \left(1 + z0\right)\right)}\right)\right) \]
          5. lower-+.f64N/A

            \[\leadsto z1 \cdot \left(\frac{7982422502469483}{4503599627370496} + \frac{7982422502469483}{4503599627370496} \cdot \left(z1 \cdot \left(1 + \color{blue}{\frac{-7982422502469483}{4503599627370496} \cdot \left(1 + z0\right)}\right)\right)\right) \]
          6. lower-*.f64N/A

            \[\leadsto z1 \cdot \left(\frac{7982422502469483}{4503599627370496} + \frac{7982422502469483}{4503599627370496} \cdot \left(z1 \cdot \left(1 + \frac{-7982422502469483}{4503599627370496} \cdot \color{blue}{\left(1 + z0\right)}\right)\right)\right) \]
          7. lower-+.f6449.8%

            \[\leadsto z1 \cdot \left(1.772453850905516 + 1.772453850905516 \cdot \left(z1 \cdot \left(1 + -1.772453850905516 \cdot \left(1 + \color{blue}{z0}\right)\right)\right)\right) \]
        6. Applied rewrites49.8%

          \[\leadsto \color{blue}{z1 \cdot \left(1.772453850905516 + 1.772453850905516 \cdot \left(z1 \cdot \left(1 + -1.772453850905516 \cdot \left(1 + z0\right)\right)\right)\right)} \]
        7. Taylor expanded in z0 around 0

          \[\leadsto z1 \cdot \left(1.772453850905516 + \frac{-27769434000295737506075571713721}{20282409603651670423947251286016} \cdot \color{blue}{z1}\right) \]
        8. Step-by-step derivation
          1. lower-*.f6450.0%

            \[\leadsto z1 \cdot \left(1.772453850905516 + -1.3691388026842775 \cdot z1\right) \]
        9. Applied rewrites50.0%

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

      Alternative 6: 67.6% accurate, 7.5× speedup?

      \[\begin{array}{l} \mathbf{if}\;z0 \leq -6 \cdot 10^{+73}:\\ \;\;\;\;\frac{1}{z0}\\ \mathbf{elif}\;z0 \leq 1.15 \cdot 10^{+46}:\\ \;\;\;\;1.772453850905516 \cdot z1\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{z0}\\ \end{array} \]
      (FPCore (z1 z0)
        :precision binary64
        (if (<= z0 -6e+73)
        (/ 1.0 z0)
        (if (<= z0 1.15e+46) (* 1.772453850905516 z1) (/ 1.0 z0))))
      double code(double z1, double z0) {
      	double tmp;
      	if (z0 <= -6e+73) {
      		tmp = 1.0 / z0;
      	} else if (z0 <= 1.15e+46) {
      		tmp = 1.772453850905516 * 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 <= (-6d+73)) then
              tmp = 1.0d0 / z0
          else if (z0 <= 1.15d+46) then
              tmp = 1.772453850905516d0 * z1
          else
              tmp = 1.0d0 / z0
          end if
          code = tmp
      end function
      
      public static double code(double z1, double z0) {
      	double tmp;
      	if (z0 <= -6e+73) {
      		tmp = 1.0 / z0;
      	} else if (z0 <= 1.15e+46) {
      		tmp = 1.772453850905516 * z1;
      	} else {
      		tmp = 1.0 / z0;
      	}
      	return tmp;
      }
      
      def code(z1, z0):
      	tmp = 0
      	if z0 <= -6e+73:
      		tmp = 1.0 / z0
      	elif z0 <= 1.15e+46:
      		tmp = 1.772453850905516 * z1
      	else:
      		tmp = 1.0 / z0
      	return tmp
      
      function code(z1, z0)
      	tmp = 0.0
      	if (z0 <= -6e+73)
      		tmp = Float64(1.0 / z0);
      	elseif (z0 <= 1.15e+46)
      		tmp = Float64(1.772453850905516 * z1);
      	else
      		tmp = Float64(1.0 / z0);
      	end
      	return tmp
      end
      
      function tmp_2 = code(z1, z0)
      	tmp = 0.0;
      	if (z0 <= -6e+73)
      		tmp = 1.0 / z0;
      	elseif (z0 <= 1.15e+46)
      		tmp = 1.772453850905516 * z1;
      	else
      		tmp = 1.0 / z0;
      	end
      	tmp_2 = tmp;
      end
      
      code[z1_, z0_] := If[LessEqual[z0, -6e+73], N[(1.0 / z0), $MachinePrecision], If[LessEqual[z0, 1.15e+46], N[(1.772453850905516 * z1), $MachinePrecision], N[(1.0 / z0), $MachinePrecision]]]
      
      \begin{array}{l}
      \mathbf{if}\;z0 \leq -6 \cdot 10^{+73}:\\
      \;\;\;\;\frac{1}{z0}\\
      
      \mathbf{elif}\;z0 \leq 1.15 \cdot 10^{+46}:\\
      \;\;\;\;1.772453850905516 \cdot z1\\
      
      \mathbf{else}:\\
      \;\;\;\;\frac{1}{z0}\\
      
      
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if z0 < -6.0000000000000002e73 or 1.15e46 < z0

        1. Initial program 99.3%

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

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

            \[\leadsto \frac{1}{\color{blue}{z0}} \]
        4. Applied rewrites34.3%

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

        if -6.0000000000000002e73 < z0 < 1.15e46

        1. Initial program 99.3%

          \[\frac{\sqrt{\pi}}{\frac{\sqrt{\left(1 - z1\right) - z1}}{e^{z1 \cdot z1} \cdot z1} - \left(-1 - z0\right) \cdot \sqrt{\pi}} \]
        2. Evaluated real constant99.0%

          \[\leadsto \frac{\color{blue}{1.772453850905516}}{\frac{\sqrt{\left(1 - z1\right) - z1}}{e^{z1 \cdot z1} \cdot z1} - \left(-1 - z0\right) \cdot \sqrt{\pi}} \]
        3. Evaluated real constant99.5%

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

          \[\leadsto \color{blue}{\frac{7982422502469483}{4503599627370496} \cdot z1} \]
        5. Step-by-step derivation
          1. lower-*.f6449.8%

            \[\leadsto 1.772453850905516 \cdot \color{blue}{z1} \]
        6. Applied rewrites49.8%

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

      Alternative 7: 49.8% accurate, 30.0× speedup?

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

        \[\frac{\sqrt{\pi}}{\frac{\sqrt{\left(1 - z1\right) - z1}}{e^{z1 \cdot z1} \cdot z1} - \left(-1 - z0\right) \cdot \sqrt{\pi}} \]
      2. Evaluated real constant99.0%

        \[\leadsto \frac{\color{blue}{1.772453850905516}}{\frac{\sqrt{\left(1 - z1\right) - z1}}{e^{z1 \cdot z1} \cdot z1} - \left(-1 - z0\right) \cdot \sqrt{\pi}} \]
      3. Evaluated real constant99.5%

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

        \[\leadsto \color{blue}{\frac{7982422502469483}{4503599627370496} \cdot z1} \]
      5. Step-by-step derivation
        1. lower-*.f6449.8%

          \[\leadsto 1.772453850905516 \cdot \color{blue}{z1} \]
      6. Applied rewrites49.8%

        \[\leadsto \color{blue}{1.772453850905516 \cdot z1} \]
      7. Add Preprocessing

      Reproduce

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