(sqrt (fabs (log (- 1 z0))))

Percentage Accurate: 37.1% → 99.7%
Time: 2.8s
Alternatives: 8
Speedup: 7.7×

Specification

?
\[\sqrt{\left|\log \left(1 - z0\right)\right|} \]
(FPCore (z0)
  :precision binary64
  (sqrt (fabs (log (- 1.0 z0)))))
double code(double z0) {
	return sqrt(fabs(log((1.0 - z0))));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(z0)
use fmin_fmax_functions
    real(8), intent (in) :: z0
    code = sqrt(abs(log((1.0d0 - z0))))
end function
public static double code(double z0) {
	return Math.sqrt(Math.abs(Math.log((1.0 - z0))));
}
def code(z0):
	return math.sqrt(math.fabs(math.log((1.0 - z0))))
function code(z0)
	return sqrt(abs(log(Float64(1.0 - z0))))
end
function tmp = code(z0)
	tmp = sqrt(abs(log((1.0 - z0))));
end
code[z0_] := N[Sqrt[N[Abs[N[Log[N[(1.0 - z0), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]
\sqrt{\left|\log \left(1 - z0\right)\right|}

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

\[\sqrt{\left|\log \left(1 - z0\right)\right|} \]
(FPCore (z0)
  :precision binary64
  (sqrt (fabs (log (- 1.0 z0)))))
double code(double z0) {
	return sqrt(fabs(log((1.0 - z0))));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(z0)
use fmin_fmax_functions
    real(8), intent (in) :: z0
    code = sqrt(abs(log((1.0d0 - z0))))
end function
public static double code(double z0) {
	return Math.sqrt(Math.abs(Math.log((1.0 - z0))));
}
def code(z0):
	return math.sqrt(math.fabs(math.log((1.0 - z0))))
function code(z0)
	return sqrt(abs(log(Float64(1.0 - z0))))
end
function tmp = code(z0)
	tmp = sqrt(abs(log((1.0 - z0))));
end
code[z0_] := N[Sqrt[N[Abs[N[Log[N[(1.0 - z0), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]
\sqrt{\left|\log \left(1 - z0\right)\right|}

Alternative 1: 99.7% accurate, 0.2× speedup?

\[\begin{array}{l} t_0 := \sqrt{\left|\log \left(1 - z0\right)\right|}\\ t_1 := \frac{1}{t\_0}\\ \mathbf{if}\;t\_0 \leq 0.0002:\\ \;\;\;\;\sqrt{\left|\left(\left(-0.3333333333333333 \cdot z0 - 0.5\right) \cdot z0\right) \cdot z0 - z0\right|}\\ \mathbf{else}:\\ \;\;\;\;\left(t\_0 - t\_1\right) \cdot 0.5 + \left(t\_0 + t\_1\right) \cdot 0.5\\ \end{array} \]
(FPCore (z0)
  :precision binary64
  (let* ((t_0 (sqrt (fabs (log (- 1.0 z0))))) (t_1 (/ 1.0 t_0)))
  (if (<= t_0 0.0002)
    (sqrt
     (fabs (- (* (* (- (* -0.3333333333333333 z0) 0.5) z0) z0) z0)))
    (+ (* (- t_0 t_1) 0.5) (* (+ t_0 t_1) 0.5)))))
double code(double z0) {
	double t_0 = sqrt(fabs(log((1.0 - z0))));
	double t_1 = 1.0 / t_0;
	double tmp;
	if (t_0 <= 0.0002) {
		tmp = sqrt(fabs((((((-0.3333333333333333 * z0) - 0.5) * z0) * z0) - z0)));
	} else {
		tmp = ((t_0 - t_1) * 0.5) + ((t_0 + t_1) * 0.5);
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(z0)
use fmin_fmax_functions
    real(8), intent (in) :: z0
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = sqrt(abs(log((1.0d0 - z0))))
    t_1 = 1.0d0 / t_0
    if (t_0 <= 0.0002d0) then
        tmp = sqrt(abs(((((((-0.3333333333333333d0) * z0) - 0.5d0) * z0) * z0) - z0)))
    else
        tmp = ((t_0 - t_1) * 0.5d0) + ((t_0 + t_1) * 0.5d0)
    end if
    code = tmp
end function
public static double code(double z0) {
	double t_0 = Math.sqrt(Math.abs(Math.log((1.0 - z0))));
	double t_1 = 1.0 / t_0;
	double tmp;
	if (t_0 <= 0.0002) {
		tmp = Math.sqrt(Math.abs((((((-0.3333333333333333 * z0) - 0.5) * z0) * z0) - z0)));
	} else {
		tmp = ((t_0 - t_1) * 0.5) + ((t_0 + t_1) * 0.5);
	}
	return tmp;
}
def code(z0):
	t_0 = math.sqrt(math.fabs(math.log((1.0 - z0))))
	t_1 = 1.0 / t_0
	tmp = 0
	if t_0 <= 0.0002:
		tmp = math.sqrt(math.fabs((((((-0.3333333333333333 * z0) - 0.5) * z0) * z0) - z0)))
	else:
		tmp = ((t_0 - t_1) * 0.5) + ((t_0 + t_1) * 0.5)
	return tmp
function code(z0)
	t_0 = sqrt(abs(log(Float64(1.0 - z0))))
	t_1 = Float64(1.0 / t_0)
	tmp = 0.0
	if (t_0 <= 0.0002)
		tmp = sqrt(abs(Float64(Float64(Float64(Float64(Float64(-0.3333333333333333 * z0) - 0.5) * z0) * z0) - z0)));
	else
		tmp = Float64(Float64(Float64(t_0 - t_1) * 0.5) + Float64(Float64(t_0 + t_1) * 0.5));
	end
	return tmp
end
function tmp_2 = code(z0)
	t_0 = sqrt(abs(log((1.0 - z0))));
	t_1 = 1.0 / t_0;
	tmp = 0.0;
	if (t_0 <= 0.0002)
		tmp = sqrt(abs((((((-0.3333333333333333 * z0) - 0.5) * z0) * z0) - z0)));
	else
		tmp = ((t_0 - t_1) * 0.5) + ((t_0 + t_1) * 0.5);
	end
	tmp_2 = tmp;
end
code[z0_] := Block[{t$95$0 = N[Sqrt[N[Abs[N[Log[N[(1.0 - z0), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(1.0 / t$95$0), $MachinePrecision]}, If[LessEqual[t$95$0, 0.0002], N[Sqrt[N[Abs[N[(N[(N[(N[(N[(-0.3333333333333333 * z0), $MachinePrecision] - 0.5), $MachinePrecision] * z0), $MachinePrecision] * z0), $MachinePrecision] - z0), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], N[(N[(N[(t$95$0 - t$95$1), $MachinePrecision] * 0.5), $MachinePrecision] + N[(N[(t$95$0 + t$95$1), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \sqrt{\left|\log \left(1 - z0\right)\right|}\\
t_1 := \frac{1}{t\_0}\\
\mathbf{if}\;t\_0 \leq 0.0002:\\
\;\;\;\;\sqrt{\left|\left(\left(-0.3333333333333333 \cdot z0 - 0.5\right) \cdot z0\right) \cdot z0 - z0\right|}\\

\mathbf{else}:\\
\;\;\;\;\left(t\_0 - t\_1\right) \cdot 0.5 + \left(t\_0 + t\_1\right) \cdot 0.5\\


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (sqrt.f64 (fabs.f64 (log.f64 (-.f64 #s(literal 1 binary64) z0)))) < 2.0000000000000001e-4

    1. Initial program 37.1%

      \[\sqrt{\left|\log \left(1 - z0\right)\right|} \]
    2. Taylor expanded in z0 around 0

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

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

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

        \[\leadsto \sqrt{\left|z0 \cdot \left(z0 \cdot \left(\frac{-1}{3} \cdot z0 - \frac{1}{2}\right) - 1\right)\right|} \]
      4. lower--.f64N/A

        \[\leadsto \sqrt{\left|z0 \cdot \left(z0 \cdot \left(\frac{-1}{3} \cdot z0 - \frac{1}{2}\right) - 1\right)\right|} \]
      5. lower-*.f6468.5%

        \[\leadsto \sqrt{\left|z0 \cdot \left(z0 \cdot \left(-0.3333333333333333 \cdot z0 - 0.5\right) - 1\right)\right|} \]
    4. Applied rewrites68.5%

      \[\leadsto \sqrt{\left|\color{blue}{z0 \cdot \left(z0 \cdot \left(-0.3333333333333333 \cdot z0 - 0.5\right) - 1\right)}\right|} \]
    5. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \sqrt{\left|z0 \cdot \color{blue}{\left(z0 \cdot \left(\frac{-1}{3} \cdot z0 - \frac{1}{2}\right) - 1\right)}\right|} \]
      2. lift--.f64N/A

        \[\leadsto \sqrt{\left|z0 \cdot \left(z0 \cdot \left(\frac{-1}{3} \cdot z0 - \frac{1}{2}\right) - \color{blue}{1}\right)\right|} \]
      3. sub-flipN/A

        \[\leadsto \sqrt{\left|z0 \cdot \left(z0 \cdot \left(\frac{-1}{3} \cdot z0 - \frac{1}{2}\right) + \color{blue}{\left(\mathsf{neg}\left(1\right)\right)}\right)\right|} \]
      4. metadata-evalN/A

        \[\leadsto \sqrt{\left|z0 \cdot \left(z0 \cdot \left(\frac{-1}{3} \cdot z0 - \frac{1}{2}\right) + -1\right)\right|} \]
      5. distribute-rgt-inN/A

        \[\leadsto \sqrt{\left|\left(z0 \cdot \left(\frac{-1}{3} \cdot z0 - \frac{1}{2}\right)\right) \cdot z0 + \color{blue}{-1 \cdot z0}\right|} \]
      6. mul-1-negN/A

        \[\leadsto \sqrt{\left|\left(z0 \cdot \left(\frac{-1}{3} \cdot z0 - \frac{1}{2}\right)\right) \cdot z0 + \left(\mathsf{neg}\left(z0\right)\right)\right|} \]
      7. sub-flip-reverseN/A

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

        \[\leadsto \sqrt{\left|\left(z0 \cdot \left(\frac{-1}{3} \cdot z0 - \frac{1}{2}\right)\right) \cdot z0 - \color{blue}{z0}\right|} \]
      9. lower-*.f6468.5%

        \[\leadsto \sqrt{\left|\left(z0 \cdot \left(-0.3333333333333333 \cdot z0 - 0.5\right)\right) \cdot z0 - z0\right|} \]
      10. lift-*.f64N/A

        \[\leadsto \sqrt{\left|\left(z0 \cdot \left(\frac{-1}{3} \cdot z0 - \frac{1}{2}\right)\right) \cdot z0 - z0\right|} \]
      11. *-commutativeN/A

        \[\leadsto \sqrt{\left|\left(\left(\frac{-1}{3} \cdot z0 - \frac{1}{2}\right) \cdot z0\right) \cdot z0 - z0\right|} \]
      12. lower-*.f6468.5%

        \[\leadsto \sqrt{\left|\left(\left(-0.3333333333333333 \cdot z0 - 0.5\right) \cdot z0\right) \cdot z0 - z0\right|} \]
    6. Applied rewrites68.5%

      \[\leadsto \sqrt{\left|\left(\left(-0.3333333333333333 \cdot z0 - 0.5\right) \cdot z0\right) \cdot z0 - \color{blue}{z0}\right|} \]

    if 2.0000000000000001e-4 < (sqrt.f64 (fabs.f64 (log.f64 (-.f64 #s(literal 1 binary64) z0))))

    1. Initial program 37.1%

      \[\sqrt{\left|\log \left(1 - z0\right)\right|} \]
    2. Step-by-step derivation
      1. remove-double-negN/A

        \[\leadsto \sqrt{\left|\color{blue}{\mathsf{neg}\left(\left(\mathsf{neg}\left(\log \left(1 - z0\right)\right)\right)\right)}\right|} \]
      2. lift-log.f64N/A

        \[\leadsto \sqrt{\left|\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\log \left(1 - z0\right)}\right)\right)\right)\right|} \]
      3. neg-logN/A

        \[\leadsto \sqrt{\left|\mathsf{neg}\left(\color{blue}{\log \left(\frac{1}{1 - z0}\right)}\right)\right|} \]
      4. neg-logN/A

        \[\leadsto \sqrt{\left|\color{blue}{\log \left(\frac{1}{\frac{1}{1 - z0}}\right)}\right|} \]
      5. *-inversesN/A

        \[\leadsto \sqrt{\left|\log \left(\frac{1}{\frac{\color{blue}{\frac{e^{0} + e^{\mathsf{neg}\left(0\right)}}{e^{0} + e^{\mathsf{neg}\left(0\right)}}}}{1 - z0}}\right)\right|} \]
      6. associate-/l/N/A

        \[\leadsto \sqrt{\left|\log \left(\frac{1}{\color{blue}{\frac{e^{0} + e^{\mathsf{neg}\left(0\right)}}{\left(e^{0} + e^{\mathsf{neg}\left(0\right)}\right) \cdot \left(1 - z0\right)}}}\right)\right|} \]
      7. div-flip-revN/A

        \[\leadsto \sqrt{\left|\log \color{blue}{\left(\frac{\left(e^{0} + e^{\mathsf{neg}\left(0\right)}\right) \cdot \left(1 - z0\right)}{e^{0} + e^{\mathsf{neg}\left(0\right)}}\right)}\right|} \]
      8. log-divN/A

        \[\leadsto \sqrt{\left|\color{blue}{\log \left(\left(e^{0} + e^{\mathsf{neg}\left(0\right)}\right) \cdot \left(1 - z0\right)\right) - \log \left(e^{0} + e^{\mathsf{neg}\left(0\right)}\right)}\right|} \]
      9. lower-unsound--.f64N/A

        \[\leadsto \sqrt{\left|\color{blue}{\log \left(\left(e^{0} + e^{\mathsf{neg}\left(0\right)}\right) \cdot \left(1 - z0\right)\right) - \log \left(e^{0} + e^{\mathsf{neg}\left(0\right)}\right)}\right|} \]
      10. lower-unsound-log.f64N/A

        \[\leadsto \sqrt{\left|\color{blue}{\log \left(\left(e^{0} + e^{\mathsf{neg}\left(0\right)}\right) \cdot \left(1 - z0\right)\right)} - \log \left(e^{0} + e^{\mathsf{neg}\left(0\right)}\right)\right|} \]
      11. lower-*.f64N/A

        \[\leadsto \sqrt{\left|\log \color{blue}{\left(\left(e^{0} + e^{\mathsf{neg}\left(0\right)}\right) \cdot \left(1 - z0\right)\right)} - \log \left(e^{0} + e^{\mathsf{neg}\left(0\right)}\right)\right|} \]
      12. cosh-undefN/A

        \[\leadsto \sqrt{\left|\log \left(\color{blue}{\left(2 \cdot \cosh 0\right)} \cdot \left(1 - z0\right)\right) - \log \left(e^{0} + e^{\mathsf{neg}\left(0\right)}\right)\right|} \]
      13. cosh-0-revN/A

        \[\leadsto \sqrt{\left|\log \left(\left(2 \cdot \color{blue}{1}\right) \cdot \left(1 - z0\right)\right) - \log \left(e^{0} + e^{\mathsf{neg}\left(0\right)}\right)\right|} \]
      14. metadata-evalN/A

        \[\leadsto \sqrt{\left|\log \left(\color{blue}{2} \cdot \left(1 - z0\right)\right) - \log \left(e^{0} + e^{\mathsf{neg}\left(0\right)}\right)\right|} \]
      15. lower-unsound-log.f64N/A

        \[\leadsto \sqrt{\left|\log \left(2 \cdot \left(1 - z0\right)\right) - \color{blue}{\log \left(e^{0} + e^{\mathsf{neg}\left(0\right)}\right)}\right|} \]
      16. cosh-undefN/A

        \[\leadsto \sqrt{\left|\log \left(2 \cdot \left(1 - z0\right)\right) - \log \color{blue}{\left(2 \cdot \cosh 0\right)}\right|} \]
    3. Applied rewrites37.1%

      \[\leadsto \sqrt{\left|\color{blue}{\log \left(2 \cdot \left(1 - z0\right)\right) - \log 2}\right|} \]
    4. Step-by-step derivation
      1. lift-sqrt.f64N/A

        \[\leadsto \color{blue}{\sqrt{\left|\log \left(2 \cdot \left(1 - z0\right)\right) - \log 2\right|}} \]
      2. pow1/2N/A

        \[\leadsto \color{blue}{{\left(\left|\log \left(2 \cdot \left(1 - z0\right)\right) - \log 2\right|\right)}^{\frac{1}{2}}} \]
      3. remove-double-negN/A

        \[\leadsto {\left(\left|\log \left(2 \cdot \left(1 - z0\right)\right) - \log 2\right|\right)}^{\color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)\right)\right)}} \]
      4. pow-negN/A

        \[\leadsto \color{blue}{\frac{1}{{\left(\left|\log \left(2 \cdot \left(1 - z0\right)\right) - \log 2\right|\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}}} \]
    5. Applied rewrites37.1%

      \[\leadsto \color{blue}{\frac{1}{{\left(\left|\log \left(1 - z0\right)\right|\right)}^{-0.5}}} \]
    6. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{1}{{\left(\left|\log \left(1 - z0\right)\right|\right)}^{\frac{-1}{2}}}} \]
      2. lift-pow.f64N/A

        \[\leadsto \frac{1}{\color{blue}{{\left(\left|\log \left(1 - z0\right)\right|\right)}^{\frac{-1}{2}}}} \]
      3. pow-flipN/A

        \[\leadsto \color{blue}{{\left(\left|\log \left(1 - z0\right)\right|\right)}^{\left(\mathsf{neg}\left(\frac{-1}{2}\right)\right)}} \]
      4. metadata-evalN/A

        \[\leadsto {\left(\left|\log \left(1 - z0\right)\right|\right)}^{\color{blue}{\frac{1}{2}}} \]
      5. exp-to-powN/A

        \[\leadsto \color{blue}{e^{\log \left(\left|\log \left(1 - z0\right)\right|\right) \cdot \frac{1}{2}}} \]
      6. lift-log.f64N/A

        \[\leadsto e^{\color{blue}{\log \left(\left|\log \left(1 - z0\right)\right|\right)} \cdot \frac{1}{2}} \]
      7. lift-*.f64N/A

        \[\leadsto e^{\color{blue}{\log \left(\left|\log \left(1 - z0\right)\right|\right) \cdot \frac{1}{2}}} \]
      8. sinh-+-cosh-revN/A

        \[\leadsto \color{blue}{\cosh \left(\log \left(\left|\log \left(1 - z0\right)\right|\right) \cdot \frac{1}{2}\right) + \sinh \left(\log \left(\left|\log \left(1 - z0\right)\right|\right) \cdot \frac{1}{2}\right)} \]
      9. +-commutativeN/A

        \[\leadsto \color{blue}{\sinh \left(\log \left(\left|\log \left(1 - z0\right)\right|\right) \cdot \frac{1}{2}\right) + \cosh \left(\log \left(\left|\log \left(1 - z0\right)\right|\right) \cdot \frac{1}{2}\right)} \]
      10. lower-+.f64N/A

        \[\leadsto \color{blue}{\sinh \left(\log \left(\left|\log \left(1 - z0\right)\right|\right) \cdot \frac{1}{2}\right) + \cosh \left(\log \left(\left|\log \left(1 - z0\right)\right|\right) \cdot \frac{1}{2}\right)} \]
    7. Applied rewrites34.6%

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

Alternative 2: 99.7% accurate, 0.5× speedup?

\[\begin{array}{l} t_0 := \sqrt{\left|\log \left(1 - z0\right)\right|}\\ \mathbf{if}\;t\_0 \leq 0.0002:\\ \;\;\;\;\sqrt{\left|\left(\left(-0.3333333333333333 \cdot z0 - 0.5\right) \cdot z0\right) \cdot z0 - z0\right|}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \]
(FPCore (z0)
  :precision binary64
  (let* ((t_0 (sqrt (fabs (log (- 1.0 z0))))))
  (if (<= t_0 0.0002)
    (sqrt
     (fabs (- (* (* (- (* -0.3333333333333333 z0) 0.5) z0) z0) z0)))
    t_0)))
double code(double z0) {
	double t_0 = sqrt(fabs(log((1.0 - z0))));
	double tmp;
	if (t_0 <= 0.0002) {
		tmp = sqrt(fabs((((((-0.3333333333333333 * z0) - 0.5) * z0) * z0) - 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(z0)
use fmin_fmax_functions
    real(8), intent (in) :: z0
    real(8) :: t_0
    real(8) :: tmp
    t_0 = sqrt(abs(log((1.0d0 - z0))))
    if (t_0 <= 0.0002d0) then
        tmp = sqrt(abs(((((((-0.3333333333333333d0) * z0) - 0.5d0) * z0) * z0) - z0)))
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double z0) {
	double t_0 = Math.sqrt(Math.abs(Math.log((1.0 - z0))));
	double tmp;
	if (t_0 <= 0.0002) {
		tmp = Math.sqrt(Math.abs((((((-0.3333333333333333 * z0) - 0.5) * z0) * z0) - z0)));
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(z0):
	t_0 = math.sqrt(math.fabs(math.log((1.0 - z0))))
	tmp = 0
	if t_0 <= 0.0002:
		tmp = math.sqrt(math.fabs((((((-0.3333333333333333 * z0) - 0.5) * z0) * z0) - z0)))
	else:
		tmp = t_0
	return tmp
function code(z0)
	t_0 = sqrt(abs(log(Float64(1.0 - z0))))
	tmp = 0.0
	if (t_0 <= 0.0002)
		tmp = sqrt(abs(Float64(Float64(Float64(Float64(Float64(-0.3333333333333333 * z0) - 0.5) * z0) * z0) - z0)));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(z0)
	t_0 = sqrt(abs(log((1.0 - z0))));
	tmp = 0.0;
	if (t_0 <= 0.0002)
		tmp = sqrt(abs((((((-0.3333333333333333 * z0) - 0.5) * z0) * z0) - z0)));
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[z0_] := Block[{t$95$0 = N[Sqrt[N[Abs[N[Log[N[(1.0 - z0), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, 0.0002], N[Sqrt[N[Abs[N[(N[(N[(N[(N[(-0.3333333333333333 * z0), $MachinePrecision] - 0.5), $MachinePrecision] * z0), $MachinePrecision] * z0), $MachinePrecision] - z0), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], t$95$0]]
\begin{array}{l}
t_0 := \sqrt{\left|\log \left(1 - z0\right)\right|}\\
\mathbf{if}\;t\_0 \leq 0.0002:\\
\;\;\;\;\sqrt{\left|\left(\left(-0.3333333333333333 \cdot z0 - 0.5\right) \cdot z0\right) \cdot z0 - z0\right|}\\

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


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (sqrt.f64 (fabs.f64 (log.f64 (-.f64 #s(literal 1 binary64) z0)))) < 2.0000000000000001e-4

    1. Initial program 37.1%

      \[\sqrt{\left|\log \left(1 - z0\right)\right|} \]
    2. Taylor expanded in z0 around 0

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

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

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

        \[\leadsto \sqrt{\left|z0 \cdot \left(z0 \cdot \left(\frac{-1}{3} \cdot z0 - \frac{1}{2}\right) - 1\right)\right|} \]
      4. lower--.f64N/A

        \[\leadsto \sqrt{\left|z0 \cdot \left(z0 \cdot \left(\frac{-1}{3} \cdot z0 - \frac{1}{2}\right) - 1\right)\right|} \]
      5. lower-*.f6468.5%

        \[\leadsto \sqrt{\left|z0 \cdot \left(z0 \cdot \left(-0.3333333333333333 \cdot z0 - 0.5\right) - 1\right)\right|} \]
    4. Applied rewrites68.5%

      \[\leadsto \sqrt{\left|\color{blue}{z0 \cdot \left(z0 \cdot \left(-0.3333333333333333 \cdot z0 - 0.5\right) - 1\right)}\right|} \]
    5. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \sqrt{\left|z0 \cdot \color{blue}{\left(z0 \cdot \left(\frac{-1}{3} \cdot z0 - \frac{1}{2}\right) - 1\right)}\right|} \]
      2. lift--.f64N/A

        \[\leadsto \sqrt{\left|z0 \cdot \left(z0 \cdot \left(\frac{-1}{3} \cdot z0 - \frac{1}{2}\right) - \color{blue}{1}\right)\right|} \]
      3. sub-flipN/A

        \[\leadsto \sqrt{\left|z0 \cdot \left(z0 \cdot \left(\frac{-1}{3} \cdot z0 - \frac{1}{2}\right) + \color{blue}{\left(\mathsf{neg}\left(1\right)\right)}\right)\right|} \]
      4. metadata-evalN/A

        \[\leadsto \sqrt{\left|z0 \cdot \left(z0 \cdot \left(\frac{-1}{3} \cdot z0 - \frac{1}{2}\right) + -1\right)\right|} \]
      5. distribute-rgt-inN/A

        \[\leadsto \sqrt{\left|\left(z0 \cdot \left(\frac{-1}{3} \cdot z0 - \frac{1}{2}\right)\right) \cdot z0 + \color{blue}{-1 \cdot z0}\right|} \]
      6. mul-1-negN/A

        \[\leadsto \sqrt{\left|\left(z0 \cdot \left(\frac{-1}{3} \cdot z0 - \frac{1}{2}\right)\right) \cdot z0 + \left(\mathsf{neg}\left(z0\right)\right)\right|} \]
      7. sub-flip-reverseN/A

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

        \[\leadsto \sqrt{\left|\left(z0 \cdot \left(\frac{-1}{3} \cdot z0 - \frac{1}{2}\right)\right) \cdot z0 - \color{blue}{z0}\right|} \]
      9. lower-*.f6468.5%

        \[\leadsto \sqrt{\left|\left(z0 \cdot \left(-0.3333333333333333 \cdot z0 - 0.5\right)\right) \cdot z0 - z0\right|} \]
      10. lift-*.f64N/A

        \[\leadsto \sqrt{\left|\left(z0 \cdot \left(\frac{-1}{3} \cdot z0 - \frac{1}{2}\right)\right) \cdot z0 - z0\right|} \]
      11. *-commutativeN/A

        \[\leadsto \sqrt{\left|\left(\left(\frac{-1}{3} \cdot z0 - \frac{1}{2}\right) \cdot z0\right) \cdot z0 - z0\right|} \]
      12. lower-*.f6468.5%

        \[\leadsto \sqrt{\left|\left(\left(-0.3333333333333333 \cdot z0 - 0.5\right) \cdot z0\right) \cdot z0 - z0\right|} \]
    6. Applied rewrites68.5%

      \[\leadsto \sqrt{\left|\left(\left(-0.3333333333333333 \cdot z0 - 0.5\right) \cdot z0\right) \cdot z0 - \color{blue}{z0}\right|} \]

    if 2.0000000000000001e-4 < (sqrt.f64 (fabs.f64 (log.f64 (-.f64 #s(literal 1 binary64) z0))))

    1. Initial program 37.1%

      \[\sqrt{\left|\log \left(1 - z0\right)\right|} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 3: 68.5% accurate, 2.8× speedup?

\[\sqrt{\left|\left(\left(\left(-0.25 \cdot z0 - 0.3333333333333333\right) \cdot z0 - 0.5\right) \cdot z0\right) \cdot z0 - z0\right|} \]
(FPCore (z0)
  :precision binary64
  (sqrt
 (fabs
  (-
   (* (* (- (* (- (* -0.25 z0) 0.3333333333333333) z0) 0.5) z0) z0)
   z0))))
double code(double z0) {
	return sqrt(fabs((((((((-0.25 * z0) - 0.3333333333333333) * z0) - 0.5) * z0) * z0) - z0)));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(z0)
use fmin_fmax_functions
    real(8), intent (in) :: z0
    code = sqrt(abs(((((((((-0.25d0) * z0) - 0.3333333333333333d0) * z0) - 0.5d0) * z0) * z0) - z0)))
end function
public static double code(double z0) {
	return Math.sqrt(Math.abs((((((((-0.25 * z0) - 0.3333333333333333) * z0) - 0.5) * z0) * z0) - z0)));
}
def code(z0):
	return math.sqrt(math.fabs((((((((-0.25 * z0) - 0.3333333333333333) * z0) - 0.5) * z0) * z0) - z0)))
function code(z0)
	return sqrt(abs(Float64(Float64(Float64(Float64(Float64(Float64(Float64(-0.25 * z0) - 0.3333333333333333) * z0) - 0.5) * z0) * z0) - z0)))
end
function tmp = code(z0)
	tmp = sqrt(abs((((((((-0.25 * z0) - 0.3333333333333333) * z0) - 0.5) * z0) * z0) - z0)));
end
code[z0_] := N[Sqrt[N[Abs[N[(N[(N[(N[(N[(N[(N[(-0.25 * z0), $MachinePrecision] - 0.3333333333333333), $MachinePrecision] * z0), $MachinePrecision] - 0.5), $MachinePrecision] * z0), $MachinePrecision] * z0), $MachinePrecision] - z0), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]
\sqrt{\left|\left(\left(\left(-0.25 \cdot z0 - 0.3333333333333333\right) \cdot z0 - 0.5\right) \cdot z0\right) \cdot z0 - z0\right|}
Derivation
  1. Initial program 37.1%

    \[\sqrt{\left|\log \left(1 - z0\right)\right|} \]
  2. Taylor expanded in z0 around 0

    \[\leadsto \sqrt{\left|\color{blue}{z0 \cdot \left(z0 \cdot \left(z0 \cdot \left(\frac{-1}{4} \cdot z0 - \frac{1}{3}\right) - \frac{1}{2}\right) - 1\right)}\right|} \]
  3. Step-by-step derivation
    1. lower-*.f64N/A

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

      \[\leadsto \sqrt{\left|z0 \cdot \left(z0 \cdot \left(z0 \cdot \left(\frac{-1}{4} \cdot z0 - \frac{1}{3}\right) - \frac{1}{2}\right) - \color{blue}{1}\right)\right|} \]
    3. lower-*.f64N/A

      \[\leadsto \sqrt{\left|z0 \cdot \left(z0 \cdot \left(z0 \cdot \left(\frac{-1}{4} \cdot z0 - \frac{1}{3}\right) - \frac{1}{2}\right) - 1\right)\right|} \]
    4. lower--.f64N/A

      \[\leadsto \sqrt{\left|z0 \cdot \left(z0 \cdot \left(z0 \cdot \left(\frac{-1}{4} \cdot z0 - \frac{1}{3}\right) - \frac{1}{2}\right) - 1\right)\right|} \]
    5. lower-*.f64N/A

      \[\leadsto \sqrt{\left|z0 \cdot \left(z0 \cdot \left(z0 \cdot \left(\frac{-1}{4} \cdot z0 - \frac{1}{3}\right) - \frac{1}{2}\right) - 1\right)\right|} \]
    6. lower--.f64N/A

      \[\leadsto \sqrt{\left|z0 \cdot \left(z0 \cdot \left(z0 \cdot \left(\frac{-1}{4} \cdot z0 - \frac{1}{3}\right) - \frac{1}{2}\right) - 1\right)\right|} \]
    7. lower-*.f6468.5%

      \[\leadsto \sqrt{\left|z0 \cdot \left(z0 \cdot \left(z0 \cdot \left(-0.25 \cdot z0 - 0.3333333333333333\right) - 0.5\right) - 1\right)\right|} \]
  4. Applied rewrites68.5%

    \[\leadsto \sqrt{\left|\color{blue}{z0 \cdot \left(z0 \cdot \left(z0 \cdot \left(-0.25 \cdot z0 - 0.3333333333333333\right) - 0.5\right) - 1\right)}\right|} \]
  5. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto \sqrt{\left|z0 \cdot \color{blue}{\left(z0 \cdot \left(z0 \cdot \left(\frac{-1}{4} \cdot z0 - \frac{1}{3}\right) - \frac{1}{2}\right) - 1\right)}\right|} \]
    2. lift--.f64N/A

      \[\leadsto \sqrt{\left|z0 \cdot \left(z0 \cdot \left(z0 \cdot \left(\frac{-1}{4} \cdot z0 - \frac{1}{3}\right) - \frac{1}{2}\right) - \color{blue}{1}\right)\right|} \]
    3. sub-flipN/A

      \[\leadsto \sqrt{\left|z0 \cdot \left(z0 \cdot \left(z0 \cdot \left(\frac{-1}{4} \cdot z0 - \frac{1}{3}\right) - \frac{1}{2}\right) + \color{blue}{\left(\mathsf{neg}\left(1\right)\right)}\right)\right|} \]
    4. metadata-evalN/A

      \[\leadsto \sqrt{\left|z0 \cdot \left(z0 \cdot \left(z0 \cdot \left(\frac{-1}{4} \cdot z0 - \frac{1}{3}\right) - \frac{1}{2}\right) + -1\right)\right|} \]
    5. distribute-rgt-inN/A

      \[\leadsto \sqrt{\left|\left(z0 \cdot \left(z0 \cdot \left(\frac{-1}{4} \cdot z0 - \frac{1}{3}\right) - \frac{1}{2}\right)\right) \cdot z0 + \color{blue}{-1 \cdot z0}\right|} \]
    6. mul-1-negN/A

      \[\leadsto \sqrt{\left|\left(z0 \cdot \left(z0 \cdot \left(\frac{-1}{4} \cdot z0 - \frac{1}{3}\right) - \frac{1}{2}\right)\right) \cdot z0 + \left(\mathsf{neg}\left(z0\right)\right)\right|} \]
    7. sub-flip-reverseN/A

      \[\leadsto \sqrt{\left|\left(z0 \cdot \left(z0 \cdot \left(\frac{-1}{4} \cdot z0 - \frac{1}{3}\right) - \frac{1}{2}\right)\right) \cdot z0 - \color{blue}{z0}\right|} \]
    8. lower--.f64N/A

      \[\leadsto \sqrt{\left|\left(z0 \cdot \left(z0 \cdot \left(\frac{-1}{4} \cdot z0 - \frac{1}{3}\right) - \frac{1}{2}\right)\right) \cdot z0 - \color{blue}{z0}\right|} \]
    9. lower-*.f6468.5%

      \[\leadsto \sqrt{\left|\left(z0 \cdot \left(z0 \cdot \left(-0.25 \cdot z0 - 0.3333333333333333\right) - 0.5\right)\right) \cdot z0 - z0\right|} \]
    10. lift-*.f64N/A

      \[\leadsto \sqrt{\left|\left(z0 \cdot \left(z0 \cdot \left(\frac{-1}{4} \cdot z0 - \frac{1}{3}\right) - \frac{1}{2}\right)\right) \cdot z0 - z0\right|} \]
    11. *-commutativeN/A

      \[\leadsto \sqrt{\left|\left(\left(z0 \cdot \left(\frac{-1}{4} \cdot z0 - \frac{1}{3}\right) - \frac{1}{2}\right) \cdot z0\right) \cdot z0 - z0\right|} \]
    12. lower-*.f6468.5%

      \[\leadsto \sqrt{\left|\left(\left(z0 \cdot \left(-0.25 \cdot z0 - 0.3333333333333333\right) - 0.5\right) \cdot z0\right) \cdot z0 - z0\right|} \]
    13. lift-*.f64N/A

      \[\leadsto \sqrt{\left|\left(\left(z0 \cdot \left(\frac{-1}{4} \cdot z0 - \frac{1}{3}\right) - \frac{1}{2}\right) \cdot z0\right) \cdot z0 - z0\right|} \]
    14. *-commutativeN/A

      \[\leadsto \sqrt{\left|\left(\left(\left(\frac{-1}{4} \cdot z0 - \frac{1}{3}\right) \cdot z0 - \frac{1}{2}\right) \cdot z0\right) \cdot z0 - z0\right|} \]
    15. lower-*.f6468.5%

      \[\leadsto \sqrt{\left|\left(\left(\left(-0.25 \cdot z0 - 0.3333333333333333\right) \cdot z0 - 0.5\right) \cdot z0\right) \cdot z0 - z0\right|} \]
  6. Applied rewrites68.5%

    \[\leadsto \sqrt{\left|\left(\left(\left(-0.25 \cdot z0 - 0.3333333333333333\right) \cdot z0 - 0.5\right) \cdot z0\right) \cdot z0 - \color{blue}{z0}\right|} \]
  7. Add Preprocessing

Alternative 4: 68.5% accurate, 2.8× speedup?

\[\sqrt{\left|z0 \cdot \left(z0 \cdot \left(z0 \cdot \left(-0.25 \cdot z0 - 0.3333333333333333\right) - 0.5\right) - 1\right)\right|} \]
(FPCore (z0)
  :precision binary64
  (sqrt
 (fabs
  (*
   z0
   (-
    (* z0 (- (* z0 (- (* -0.25 z0) 0.3333333333333333)) 0.5))
    1.0)))))
double code(double z0) {
	return sqrt(fabs((z0 * ((z0 * ((z0 * ((-0.25 * z0) - 0.3333333333333333)) - 0.5)) - 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(z0)
use fmin_fmax_functions
    real(8), intent (in) :: z0
    code = sqrt(abs((z0 * ((z0 * ((z0 * (((-0.25d0) * z0) - 0.3333333333333333d0)) - 0.5d0)) - 1.0d0))))
end function
public static double code(double z0) {
	return Math.sqrt(Math.abs((z0 * ((z0 * ((z0 * ((-0.25 * z0) - 0.3333333333333333)) - 0.5)) - 1.0))));
}
def code(z0):
	return math.sqrt(math.fabs((z0 * ((z0 * ((z0 * ((-0.25 * z0) - 0.3333333333333333)) - 0.5)) - 1.0))))
function code(z0)
	return sqrt(abs(Float64(z0 * Float64(Float64(z0 * Float64(Float64(z0 * Float64(Float64(-0.25 * z0) - 0.3333333333333333)) - 0.5)) - 1.0))))
end
function tmp = code(z0)
	tmp = sqrt(abs((z0 * ((z0 * ((z0 * ((-0.25 * z0) - 0.3333333333333333)) - 0.5)) - 1.0))));
end
code[z0_] := N[Sqrt[N[Abs[N[(z0 * N[(N[(z0 * N[(N[(z0 * N[(N[(-0.25 * z0), $MachinePrecision] - 0.3333333333333333), $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]
\sqrt{\left|z0 \cdot \left(z0 \cdot \left(z0 \cdot \left(-0.25 \cdot z0 - 0.3333333333333333\right) - 0.5\right) - 1\right)\right|}
Derivation
  1. Initial program 37.1%

    \[\sqrt{\left|\log \left(1 - z0\right)\right|} \]
  2. Taylor expanded in z0 around 0

    \[\leadsto \sqrt{\left|\color{blue}{z0 \cdot \left(z0 \cdot \left(z0 \cdot \left(\frac{-1}{4} \cdot z0 - \frac{1}{3}\right) - \frac{1}{2}\right) - 1\right)}\right|} \]
  3. Step-by-step derivation
    1. lower-*.f64N/A

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

      \[\leadsto \sqrt{\left|z0 \cdot \left(z0 \cdot \left(z0 \cdot \left(\frac{-1}{4} \cdot z0 - \frac{1}{3}\right) - \frac{1}{2}\right) - \color{blue}{1}\right)\right|} \]
    3. lower-*.f64N/A

      \[\leadsto \sqrt{\left|z0 \cdot \left(z0 \cdot \left(z0 \cdot \left(\frac{-1}{4} \cdot z0 - \frac{1}{3}\right) - \frac{1}{2}\right) - 1\right)\right|} \]
    4. lower--.f64N/A

      \[\leadsto \sqrt{\left|z0 \cdot \left(z0 \cdot \left(z0 \cdot \left(\frac{-1}{4} \cdot z0 - \frac{1}{3}\right) - \frac{1}{2}\right) - 1\right)\right|} \]
    5. lower-*.f64N/A

      \[\leadsto \sqrt{\left|z0 \cdot \left(z0 \cdot \left(z0 \cdot \left(\frac{-1}{4} \cdot z0 - \frac{1}{3}\right) - \frac{1}{2}\right) - 1\right)\right|} \]
    6. lower--.f64N/A

      \[\leadsto \sqrt{\left|z0 \cdot \left(z0 \cdot \left(z0 \cdot \left(\frac{-1}{4} \cdot z0 - \frac{1}{3}\right) - \frac{1}{2}\right) - 1\right)\right|} \]
    7. lower-*.f6468.5%

      \[\leadsto \sqrt{\left|z0 \cdot \left(z0 \cdot \left(z0 \cdot \left(-0.25 \cdot z0 - 0.3333333333333333\right) - 0.5\right) - 1\right)\right|} \]
  4. Applied rewrites68.5%

    \[\leadsto \sqrt{\left|\color{blue}{z0 \cdot \left(z0 \cdot \left(z0 \cdot \left(-0.25 \cdot z0 - 0.3333333333333333\right) - 0.5\right) - 1\right)}\right|} \]
  5. Add Preprocessing

Alternative 5: 68.5% accurate, 4.0× speedup?

\[\sqrt{\left|z0 \cdot \left(\left(-0.5 \cdot z0 - 0.5\right) - 0.5\right)\right|} \]
(FPCore (z0)
  :precision binary64
  (sqrt (fabs (* z0 (- (- (* -0.5 z0) 0.5) 0.5)))))
double code(double z0) {
	return sqrt(fabs((z0 * (((-0.5 * z0) - 0.5) - 0.5))));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(z0)
use fmin_fmax_functions
    real(8), intent (in) :: z0
    code = sqrt(abs((z0 * ((((-0.5d0) * z0) - 0.5d0) - 0.5d0))))
end function
public static double code(double z0) {
	return Math.sqrt(Math.abs((z0 * (((-0.5 * z0) - 0.5) - 0.5))));
}
def code(z0):
	return math.sqrt(math.fabs((z0 * (((-0.5 * z0) - 0.5) - 0.5))))
function code(z0)
	return sqrt(abs(Float64(z0 * Float64(Float64(Float64(-0.5 * z0) - 0.5) - 0.5))))
end
function tmp = code(z0)
	tmp = sqrt(abs((z0 * (((-0.5 * z0) - 0.5) - 0.5))));
end
code[z0_] := N[Sqrt[N[Abs[N[(z0 * N[(N[(N[(-0.5 * z0), $MachinePrecision] - 0.5), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]
\sqrt{\left|z0 \cdot \left(\left(-0.5 \cdot z0 - 0.5\right) - 0.5\right)\right|}
Derivation
  1. Initial program 37.1%

    \[\sqrt{\left|\log \left(1 - z0\right)\right|} \]
  2. Taylor expanded in z0 around 0

    \[\leadsto \sqrt{\left|\color{blue}{z0 \cdot \left(z0 \cdot \left(z0 \cdot \left(\frac{-1}{4} \cdot z0 - \frac{1}{3}\right) - \frac{1}{2}\right) - 1\right)}\right|} \]
  3. Step-by-step derivation
    1. lower-*.f64N/A

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

      \[\leadsto \sqrt{\left|z0 \cdot \left(z0 \cdot \left(z0 \cdot \left(\frac{-1}{4} \cdot z0 - \frac{1}{3}\right) - \frac{1}{2}\right) - \color{blue}{1}\right)\right|} \]
    3. lower-*.f64N/A

      \[\leadsto \sqrt{\left|z0 \cdot \left(z0 \cdot \left(z0 \cdot \left(\frac{-1}{4} \cdot z0 - \frac{1}{3}\right) - \frac{1}{2}\right) - 1\right)\right|} \]
    4. lower--.f64N/A

      \[\leadsto \sqrt{\left|z0 \cdot \left(z0 \cdot \left(z0 \cdot \left(\frac{-1}{4} \cdot z0 - \frac{1}{3}\right) - \frac{1}{2}\right) - 1\right)\right|} \]
    5. lower-*.f64N/A

      \[\leadsto \sqrt{\left|z0 \cdot \left(z0 \cdot \left(z0 \cdot \left(\frac{-1}{4} \cdot z0 - \frac{1}{3}\right) - \frac{1}{2}\right) - 1\right)\right|} \]
    6. lower--.f64N/A

      \[\leadsto \sqrt{\left|z0 \cdot \left(z0 \cdot \left(z0 \cdot \left(\frac{-1}{4} \cdot z0 - \frac{1}{3}\right) - \frac{1}{2}\right) - 1\right)\right|} \]
    7. lower-*.f6468.5%

      \[\leadsto \sqrt{\left|z0 \cdot \left(z0 \cdot \left(z0 \cdot \left(-0.25 \cdot z0 - 0.3333333333333333\right) - 0.5\right) - 1\right)\right|} \]
  4. Applied rewrites68.5%

    \[\leadsto \sqrt{\left|\color{blue}{z0 \cdot \left(z0 \cdot \left(z0 \cdot \left(-0.25 \cdot z0 - 0.3333333333333333\right) - 0.5\right) - 1\right)}\right|} \]
  5. Taylor expanded in z0 around 0

    \[\leadsto \sqrt{\left|z0 \cdot \left(z0 \cdot \frac{-1}{2} - 1\right)\right|} \]
  6. Step-by-step derivation
    1. Applied rewrites68.5%

      \[\leadsto \sqrt{\left|z0 \cdot \left(z0 \cdot -0.5 - 1\right)\right|} \]
    2. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto \sqrt{\left|z0 \cdot \left(z0 \cdot \frac{-1}{2} - \color{blue}{1}\right)\right|} \]
      2. metadata-evalN/A

        \[\leadsto \sqrt{\left|z0 \cdot \left(z0 \cdot \frac{-1}{2} - \left(\frac{1}{2} + \color{blue}{\frac{1}{2}}\right)\right)\right|} \]
      3. associate--r+N/A

        \[\leadsto \sqrt{\left|z0 \cdot \left(\left(z0 \cdot \frac{-1}{2} - \frac{1}{2}\right) - \color{blue}{\frac{1}{2}}\right)\right|} \]
      4. lower--.f64N/A

        \[\leadsto \sqrt{\left|z0 \cdot \left(\left(z0 \cdot \frac{-1}{2} - \frac{1}{2}\right) - \color{blue}{\frac{1}{2}}\right)\right|} \]
      5. lower--.f6468.5%

        \[\leadsto \sqrt{\left|z0 \cdot \left(\left(z0 \cdot -0.5 - 0.5\right) - 0.5\right)\right|} \]
      6. lift-*.f64N/A

        \[\leadsto \sqrt{\left|z0 \cdot \left(\left(z0 \cdot \frac{-1}{2} - \frac{1}{2}\right) - \frac{1}{2}\right)\right|} \]
      7. *-commutativeN/A

        \[\leadsto \sqrt{\left|z0 \cdot \left(\left(\frac{-1}{2} \cdot z0 - \frac{1}{2}\right) - \frac{1}{2}\right)\right|} \]
      8. *-commutativeN/A

        \[\leadsto \sqrt{\left|z0 \cdot \left(\left(\frac{-1}{2} \cdot z0 - \frac{1}{2}\right) - \frac{1}{2}\right)\right|} \]
      9. lift-*.f6468.5%

        \[\leadsto \sqrt{\left|z0 \cdot \left(\left(-0.5 \cdot z0 - 0.5\right) - 0.5\right)\right|} \]
      10. *-commutative68.5%

        \[\leadsto \sqrt{\left|z0 \cdot \left(\left(-0.5 \cdot z0 - 0.5\right) - 0.5\right)\right|} \]
    3. Applied rewrites68.5%

      \[\leadsto \sqrt{\left|z0 \cdot \left(\left(-0.5 \cdot z0 - 0.5\right) - \color{blue}{0.5}\right)\right|} \]
    4. Add Preprocessing

    Alternative 6: 68.5% accurate, 4.5× speedup?

    \[\sqrt{\left|\left(-0.5 \cdot z0\right) \cdot z0 - z0\right|} \]
    (FPCore (z0)
      :precision binary64
      (sqrt (fabs (- (* (* -0.5 z0) z0) z0))))
    double code(double z0) {
    	return sqrt(fabs((((-0.5 * z0) * z0) - z0)));
    }
    
    module fmin_fmax_functions
        implicit none
        private
        public fmax
        public fmin
    
        interface fmax
            module procedure fmax88
            module procedure fmax44
            module procedure fmax84
            module procedure fmax48
        end interface
        interface fmin
            module procedure fmin88
            module procedure fmin44
            module procedure fmin84
            module procedure fmin48
        end interface
    contains
        real(8) function fmax88(x, y) result (res)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
        end function
        real(4) function fmax44(x, y) result (res)
            real(4), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
        end function
        real(8) function fmax84(x, y) result(res)
            real(8), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
        end function
        real(8) function fmax48(x, y) result(res)
            real(4), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
        end function
        real(8) function fmin88(x, y) result (res)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
        end function
        real(4) function fmin44(x, y) result (res)
            real(4), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
        end function
        real(8) function fmin84(x, y) result(res)
            real(8), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
        end function
        real(8) function fmin48(x, y) result(res)
            real(4), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
        end function
    end module
    
    real(8) function code(z0)
    use fmin_fmax_functions
        real(8), intent (in) :: z0
        code = sqrt(abs(((((-0.5d0) * z0) * z0) - z0)))
    end function
    
    public static double code(double z0) {
    	return Math.sqrt(Math.abs((((-0.5 * z0) * z0) - z0)));
    }
    
    def code(z0):
    	return math.sqrt(math.fabs((((-0.5 * z0) * z0) - z0)))
    
    function code(z0)
    	return sqrt(abs(Float64(Float64(Float64(-0.5 * z0) * z0) - z0)))
    end
    
    function tmp = code(z0)
    	tmp = sqrt(abs((((-0.5 * z0) * z0) - z0)));
    end
    
    code[z0_] := N[Sqrt[N[Abs[N[(N[(N[(-0.5 * z0), $MachinePrecision] * z0), $MachinePrecision] - z0), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]
    
    \sqrt{\left|\left(-0.5 \cdot z0\right) \cdot z0 - z0\right|}
    
    Derivation
    1. Initial program 37.1%

      \[\sqrt{\left|\log \left(1 - z0\right)\right|} \]
    2. Taylor expanded in z0 around 0

      \[\leadsto \sqrt{\left|\color{blue}{z0 \cdot \left(z0 \cdot \left(z0 \cdot \left(\frac{-1}{4} \cdot z0 - \frac{1}{3}\right) - \frac{1}{2}\right) - 1\right)}\right|} \]
    3. Step-by-step derivation
      1. lower-*.f64N/A

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

        \[\leadsto \sqrt{\left|z0 \cdot \left(z0 \cdot \left(z0 \cdot \left(\frac{-1}{4} \cdot z0 - \frac{1}{3}\right) - \frac{1}{2}\right) - \color{blue}{1}\right)\right|} \]
      3. lower-*.f64N/A

        \[\leadsto \sqrt{\left|z0 \cdot \left(z0 \cdot \left(z0 \cdot \left(\frac{-1}{4} \cdot z0 - \frac{1}{3}\right) - \frac{1}{2}\right) - 1\right)\right|} \]
      4. lower--.f64N/A

        \[\leadsto \sqrt{\left|z0 \cdot \left(z0 \cdot \left(z0 \cdot \left(\frac{-1}{4} \cdot z0 - \frac{1}{3}\right) - \frac{1}{2}\right) - 1\right)\right|} \]
      5. lower-*.f64N/A

        \[\leadsto \sqrt{\left|z0 \cdot \left(z0 \cdot \left(z0 \cdot \left(\frac{-1}{4} \cdot z0 - \frac{1}{3}\right) - \frac{1}{2}\right) - 1\right)\right|} \]
      6. lower--.f64N/A

        \[\leadsto \sqrt{\left|z0 \cdot \left(z0 \cdot \left(z0 \cdot \left(\frac{-1}{4} \cdot z0 - \frac{1}{3}\right) - \frac{1}{2}\right) - 1\right)\right|} \]
      7. lower-*.f6468.5%

        \[\leadsto \sqrt{\left|z0 \cdot \left(z0 \cdot \left(z0 \cdot \left(-0.25 \cdot z0 - 0.3333333333333333\right) - 0.5\right) - 1\right)\right|} \]
    4. Applied rewrites68.5%

      \[\leadsto \sqrt{\left|\color{blue}{z0 \cdot \left(z0 \cdot \left(z0 \cdot \left(-0.25 \cdot z0 - 0.3333333333333333\right) - 0.5\right) - 1\right)}\right|} \]
    5. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \sqrt{\left|z0 \cdot \color{blue}{\left(z0 \cdot \left(z0 \cdot \left(\frac{-1}{4} \cdot z0 - \frac{1}{3}\right) - \frac{1}{2}\right) - 1\right)}\right|} \]
      2. lift--.f64N/A

        \[\leadsto \sqrt{\left|z0 \cdot \left(z0 \cdot \left(z0 \cdot \left(\frac{-1}{4} \cdot z0 - \frac{1}{3}\right) - \frac{1}{2}\right) - \color{blue}{1}\right)\right|} \]
      3. sub-flipN/A

        \[\leadsto \sqrt{\left|z0 \cdot \left(z0 \cdot \left(z0 \cdot \left(\frac{-1}{4} \cdot z0 - \frac{1}{3}\right) - \frac{1}{2}\right) + \color{blue}{\left(\mathsf{neg}\left(1\right)\right)}\right)\right|} \]
      4. metadata-evalN/A

        \[\leadsto \sqrt{\left|z0 \cdot \left(z0 \cdot \left(z0 \cdot \left(\frac{-1}{4} \cdot z0 - \frac{1}{3}\right) - \frac{1}{2}\right) + -1\right)\right|} \]
      5. distribute-rgt-inN/A

        \[\leadsto \sqrt{\left|\left(z0 \cdot \left(z0 \cdot \left(\frac{-1}{4} \cdot z0 - \frac{1}{3}\right) - \frac{1}{2}\right)\right) \cdot z0 + \color{blue}{-1 \cdot z0}\right|} \]
      6. mul-1-negN/A

        \[\leadsto \sqrt{\left|\left(z0 \cdot \left(z0 \cdot \left(\frac{-1}{4} \cdot z0 - \frac{1}{3}\right) - \frac{1}{2}\right)\right) \cdot z0 + \left(\mathsf{neg}\left(z0\right)\right)\right|} \]
      7. sub-flip-reverseN/A

        \[\leadsto \sqrt{\left|\left(z0 \cdot \left(z0 \cdot \left(\frac{-1}{4} \cdot z0 - \frac{1}{3}\right) - \frac{1}{2}\right)\right) \cdot z0 - \color{blue}{z0}\right|} \]
      8. lower--.f64N/A

        \[\leadsto \sqrt{\left|\left(z0 \cdot \left(z0 \cdot \left(\frac{-1}{4} \cdot z0 - \frac{1}{3}\right) - \frac{1}{2}\right)\right) \cdot z0 - \color{blue}{z0}\right|} \]
      9. lower-*.f6468.5%

        \[\leadsto \sqrt{\left|\left(z0 \cdot \left(z0 \cdot \left(-0.25 \cdot z0 - 0.3333333333333333\right) - 0.5\right)\right) \cdot z0 - z0\right|} \]
      10. lift-*.f64N/A

        \[\leadsto \sqrt{\left|\left(z0 \cdot \left(z0 \cdot \left(\frac{-1}{4} \cdot z0 - \frac{1}{3}\right) - \frac{1}{2}\right)\right) \cdot z0 - z0\right|} \]
      11. *-commutativeN/A

        \[\leadsto \sqrt{\left|\left(\left(z0 \cdot \left(\frac{-1}{4} \cdot z0 - \frac{1}{3}\right) - \frac{1}{2}\right) \cdot z0\right) \cdot z0 - z0\right|} \]
      12. lower-*.f6468.5%

        \[\leadsto \sqrt{\left|\left(\left(z0 \cdot \left(-0.25 \cdot z0 - 0.3333333333333333\right) - 0.5\right) \cdot z0\right) \cdot z0 - z0\right|} \]
      13. lift-*.f64N/A

        \[\leadsto \sqrt{\left|\left(\left(z0 \cdot \left(\frac{-1}{4} \cdot z0 - \frac{1}{3}\right) - \frac{1}{2}\right) \cdot z0\right) \cdot z0 - z0\right|} \]
      14. *-commutativeN/A

        \[\leadsto \sqrt{\left|\left(\left(\left(\frac{-1}{4} \cdot z0 - \frac{1}{3}\right) \cdot z0 - \frac{1}{2}\right) \cdot z0\right) \cdot z0 - z0\right|} \]
      15. lower-*.f6468.5%

        \[\leadsto \sqrt{\left|\left(\left(\left(-0.25 \cdot z0 - 0.3333333333333333\right) \cdot z0 - 0.5\right) \cdot z0\right) \cdot z0 - z0\right|} \]
    6. Applied rewrites68.5%

      \[\leadsto \sqrt{\left|\left(\left(\left(-0.25 \cdot z0 - 0.3333333333333333\right) \cdot z0 - 0.5\right) \cdot z0\right) \cdot z0 - \color{blue}{z0}\right|} \]
    7. Taylor expanded in z0 around 0

      \[\leadsto \sqrt{\left|\left(\frac{-1}{2} \cdot z0\right) \cdot z0 - z0\right|} \]
    8. Step-by-step derivation
      1. Applied rewrites68.5%

        \[\leadsto \sqrt{\left|\left(-0.5 \cdot z0\right) \cdot z0 - z0\right|} \]
      2. Add Preprocessing

      Alternative 7: 68.5% accurate, 4.5× speedup?

      \[\sqrt{\left|z0 \cdot \left(-0.5 \cdot z0 - 1\right)\right|} \]
      (FPCore (z0)
        :precision binary64
        (sqrt (fabs (* z0 (- (* -0.5 z0) 1.0)))))
      double code(double z0) {
      	return sqrt(fabs((z0 * ((-0.5 * 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(z0)
      use fmin_fmax_functions
          real(8), intent (in) :: z0
          code = sqrt(abs((z0 * (((-0.5d0) * z0) - 1.0d0))))
      end function
      
      public static double code(double z0) {
      	return Math.sqrt(Math.abs((z0 * ((-0.5 * z0) - 1.0))));
      }
      
      def code(z0):
      	return math.sqrt(math.fabs((z0 * ((-0.5 * z0) - 1.0))))
      
      function code(z0)
      	return sqrt(abs(Float64(z0 * Float64(Float64(-0.5 * z0) - 1.0))))
      end
      
      function tmp = code(z0)
      	tmp = sqrt(abs((z0 * ((-0.5 * z0) - 1.0))));
      end
      
      code[z0_] := N[Sqrt[N[Abs[N[(z0 * N[(N[(-0.5 * z0), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]
      
      \sqrt{\left|z0 \cdot \left(-0.5 \cdot z0 - 1\right)\right|}
      
      Derivation
      1. Initial program 37.1%

        \[\sqrt{\left|\log \left(1 - z0\right)\right|} \]
      2. Taylor expanded in z0 around 0

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

          \[\leadsto \sqrt{\left|z0 \cdot \color{blue}{\left(\frac{-1}{2} \cdot z0 - 1\right)}\right|} \]
        2. lower--.f64N/A

          \[\leadsto \sqrt{\left|z0 \cdot \left(\frac{-1}{2} \cdot z0 - \color{blue}{1}\right)\right|} \]
        3. lower-*.f6468.5%

          \[\leadsto \sqrt{\left|z0 \cdot \left(-0.5 \cdot z0 - 1\right)\right|} \]
      4. Applied rewrites68.5%

        \[\leadsto \sqrt{\left|\color{blue}{z0 \cdot \left(-0.5 \cdot z0 - 1\right)}\right|} \]
      5. Add Preprocessing

      Alternative 8: 68.5% accurate, 7.7× speedup?

      \[\sqrt{\left|-z0\right|} \]
      (FPCore (z0)
        :precision binary64
        (sqrt (fabs (- z0))))
      double code(double z0) {
      	return sqrt(fabs(-z0));
      }
      
      module fmin_fmax_functions
          implicit none
          private
          public fmax
          public fmin
      
          interface fmax
              module procedure fmax88
              module procedure fmax44
              module procedure fmax84
              module procedure fmax48
          end interface
          interface fmin
              module procedure fmin88
              module procedure fmin44
              module procedure fmin84
              module procedure fmin48
          end interface
      contains
          real(8) function fmax88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(4) function fmax44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(8) function fmax84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmax48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
          end function
          real(8) function fmin88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(4) function fmin44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(8) function fmin84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmin48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
          end function
      end module
      
      real(8) function code(z0)
      use fmin_fmax_functions
          real(8), intent (in) :: z0
          code = sqrt(abs(-z0))
      end function
      
      public static double code(double z0) {
      	return Math.sqrt(Math.abs(-z0));
      }
      
      def code(z0):
      	return math.sqrt(math.fabs(-z0))
      
      function code(z0)
      	return sqrt(abs(Float64(-z0)))
      end
      
      function tmp = code(z0)
      	tmp = sqrt(abs(-z0));
      end
      
      code[z0_] := N[Sqrt[N[Abs[(-z0)], $MachinePrecision]], $MachinePrecision]
      
      \sqrt{\left|-z0\right|}
      
      Derivation
      1. Initial program 37.1%

        \[\sqrt{\left|\log \left(1 - z0\right)\right|} \]
      2. Taylor expanded in z0 around 0

        \[\leadsto \sqrt{\left|\color{blue}{-1 \cdot z0}\right|} \]
      3. Step-by-step derivation
        1. lower-*.f6468.5%

          \[\leadsto \sqrt{\left|-1 \cdot \color{blue}{z0}\right|} \]
      4. Applied rewrites68.5%

        \[\leadsto \sqrt{\left|\color{blue}{-1 \cdot z0}\right|} \]
      5. Step-by-step derivation
        1. lift-*.f64N/A

          \[\leadsto \sqrt{\left|-1 \cdot \color{blue}{z0}\right|} \]
        2. mul-1-negN/A

          \[\leadsto \sqrt{\left|\mathsf{neg}\left(z0\right)\right|} \]
        3. lower-neg.f6468.5%

          \[\leadsto \sqrt{\left|-z0\right|} \]
      6. Applied rewrites68.5%

        \[\leadsto \sqrt{\left|-z0\right|} \]
      7. Add Preprocessing

      Reproduce

      ?
      herbie shell --seed 2025250 
      (FPCore (z0)
        :name "(sqrt (fabs (log (- 1 z0))))"
        :precision binary64
        (sqrt (fabs (log (- 1.0 z0)))))