(log (/ -27/64 (* (* (- 1 z0) (- 1 z0)) (- z0 1))))

Percentage Accurate: 79.1% → 99.8%
Time: 2.0s
Alternatives: 7
Speedup: 1.0×

Specification

?
\[\log \left(\frac{-0.421875}{\left(\left(1 - z0\right) \cdot \left(1 - z0\right)\right) \cdot \left(z0 - 1\right)}\right) \]
(FPCore (z0)
  :precision binary64
  (log (/ -0.421875 (* (* (- 1.0 z0) (- 1.0 z0)) (- z0 1.0)))))
double code(double z0) {
	return log((-0.421875 / (((1.0 - z0) * (1.0 - z0)) * (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 = log(((-0.421875d0) / (((1.0d0 - z0) * (1.0d0 - z0)) * (z0 - 1.0d0))))
end function
public static double code(double z0) {
	return Math.log((-0.421875 / (((1.0 - z0) * (1.0 - z0)) * (z0 - 1.0))));
}
def code(z0):
	return math.log((-0.421875 / (((1.0 - z0) * (1.0 - z0)) * (z0 - 1.0))))
function code(z0)
	return log(Float64(-0.421875 / Float64(Float64(Float64(1.0 - z0) * Float64(1.0 - z0)) * Float64(z0 - 1.0))))
end
function tmp = code(z0)
	tmp = log((-0.421875 / (((1.0 - z0) * (1.0 - z0)) * (z0 - 1.0))));
end
code[z0_] := N[Log[N[(-0.421875 / N[(N[(N[(1.0 - z0), $MachinePrecision] * N[(1.0 - z0), $MachinePrecision]), $MachinePrecision] * N[(z0 - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\log \left(\frac{-0.421875}{\left(\left(1 - z0\right) \cdot \left(1 - z0\right)\right) \cdot \left(z0 - 1\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 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: 79.1% accurate, 1.0× speedup?

\[\log \left(\frac{-0.421875}{\left(\left(1 - z0\right) \cdot \left(1 - z0\right)\right) \cdot \left(z0 - 1\right)}\right) \]
(FPCore (z0)
  :precision binary64
  (log (/ -0.421875 (* (* (- 1.0 z0) (- 1.0 z0)) (- z0 1.0)))))
double code(double z0) {
	return log((-0.421875 / (((1.0 - z0) * (1.0 - z0)) * (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 = log(((-0.421875d0) / (((1.0d0 - z0) * (1.0d0 - z0)) * (z0 - 1.0d0))))
end function
public static double code(double z0) {
	return Math.log((-0.421875 / (((1.0 - z0) * (1.0 - z0)) * (z0 - 1.0))));
}
def code(z0):
	return math.log((-0.421875 / (((1.0 - z0) * (1.0 - z0)) * (z0 - 1.0))))
function code(z0)
	return log(Float64(-0.421875 / Float64(Float64(Float64(1.0 - z0) * Float64(1.0 - z0)) * Float64(z0 - 1.0))))
end
function tmp = code(z0)
	tmp = log((-0.421875 / (((1.0 - z0) * (1.0 - z0)) * (z0 - 1.0))));
end
code[z0_] := N[Log[N[(-0.421875 / N[(N[(N[(1.0 - z0), $MachinePrecision] * N[(1.0 - z0), $MachinePrecision]), $MachinePrecision] * N[(z0 - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\log \left(\frac{-0.421875}{\left(\left(1 - z0\right) \cdot \left(1 - z0\right)\right) \cdot \left(z0 - 1\right)}\right)

Alternative 1: 99.8% accurate, 0.6× speedup?

\[\begin{array}{l} \mathbf{if}\;z0 \leq -4 \cdot 10^{+102}:\\ \;\;\;\;\log \left(-z0\right) \cdot -2 - \log \left(-2.3703703703703702 \cdot z0\right)\\ \mathbf{else}:\\ \;\;\;\;\log \left(\frac{1}{2.3703703703703702 + z0 \cdot \left(z0 \cdot \left(7.111111111111111 + -2.3703703703703702 \cdot z0\right) - 7.111111111111111\right)}\right)\\ \end{array} \]
(FPCore (z0)
  :precision binary64
  (if (<= z0 -4e+102)
  (- (* (log (- z0)) -2.0) (log (* -2.3703703703703702 z0)))
  (log
   (/
    1.0
    (+
     2.3703703703703702
     (*
      z0
      (-
       (* z0 (+ 7.111111111111111 (* -2.3703703703703702 z0)))
       7.111111111111111)))))))
double code(double z0) {
	double tmp;
	if (z0 <= -4e+102) {
		tmp = (log(-z0) * -2.0) - log((-2.3703703703703702 * z0));
	} else {
		tmp = log((1.0 / (2.3703703703703702 + (z0 * ((z0 * (7.111111111111111 + (-2.3703703703703702 * z0))) - 7.111111111111111)))));
	}
	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) :: tmp
    if (z0 <= (-4d+102)) then
        tmp = (log(-z0) * (-2.0d0)) - log(((-2.3703703703703702d0) * z0))
    else
        tmp = log((1.0d0 / (2.3703703703703702d0 + (z0 * ((z0 * (7.111111111111111d0 + ((-2.3703703703703702d0) * z0))) - 7.111111111111111d0)))))
    end if
    code = tmp
end function
public static double code(double z0) {
	double tmp;
	if (z0 <= -4e+102) {
		tmp = (Math.log(-z0) * -2.0) - Math.log((-2.3703703703703702 * z0));
	} else {
		tmp = Math.log((1.0 / (2.3703703703703702 + (z0 * ((z0 * (7.111111111111111 + (-2.3703703703703702 * z0))) - 7.111111111111111)))));
	}
	return tmp;
}
def code(z0):
	tmp = 0
	if z0 <= -4e+102:
		tmp = (math.log(-z0) * -2.0) - math.log((-2.3703703703703702 * z0))
	else:
		tmp = math.log((1.0 / (2.3703703703703702 + (z0 * ((z0 * (7.111111111111111 + (-2.3703703703703702 * z0))) - 7.111111111111111)))))
	return tmp
function code(z0)
	tmp = 0.0
	if (z0 <= -4e+102)
		tmp = Float64(Float64(log(Float64(-z0)) * -2.0) - log(Float64(-2.3703703703703702 * z0)));
	else
		tmp = log(Float64(1.0 / Float64(2.3703703703703702 + Float64(z0 * Float64(Float64(z0 * Float64(7.111111111111111 + Float64(-2.3703703703703702 * z0))) - 7.111111111111111)))));
	end
	return tmp
end
function tmp_2 = code(z0)
	tmp = 0.0;
	if (z0 <= -4e+102)
		tmp = (log(-z0) * -2.0) - log((-2.3703703703703702 * z0));
	else
		tmp = log((1.0 / (2.3703703703703702 + (z0 * ((z0 * (7.111111111111111 + (-2.3703703703703702 * z0))) - 7.111111111111111)))));
	end
	tmp_2 = tmp;
end
code[z0_] := If[LessEqual[z0, -4e+102], N[(N[(N[Log[(-z0)], $MachinePrecision] * -2.0), $MachinePrecision] - N[Log[N[(-2.3703703703703702 * z0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Log[N[(1.0 / N[(2.3703703703703702 + N[(z0 * N[(N[(z0 * N[(7.111111111111111 + N[(-2.3703703703703702 * z0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 7.111111111111111), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;z0 \leq -4 \cdot 10^{+102}:\\
\;\;\;\;\log \left(-z0\right) \cdot -2 - \log \left(-2.3703703703703702 \cdot z0\right)\\

\mathbf{else}:\\
\;\;\;\;\log \left(\frac{1}{2.3703703703703702 + z0 \cdot \left(z0 \cdot \left(7.111111111111111 + -2.3703703703703702 \cdot z0\right) - 7.111111111111111\right)}\right)\\


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z0 < -3.9999999999999999e102

    1. Initial program 79.1%

      \[\log \left(\frac{-0.421875}{\left(\left(1 - z0\right) \cdot \left(1 - z0\right)\right) \cdot \left(z0 - 1\right)}\right) \]
    2. Taylor expanded in z0 around -inf

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

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

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

        \[\leadsto \log \frac{27}{64} + 3 \cdot \color{blue}{\log \left(\frac{-1}{z0}\right)} \]
      4. lower-log.f64N/A

        \[\leadsto \log \frac{27}{64} + 3 \cdot \log \left(\frac{-1}{z0}\right) \]
      5. lower-/.f6432.3%

        \[\leadsto \log 0.421875 + 3 \cdot \log \left(\frac{-1}{z0}\right) \]
    4. Applied rewrites32.3%

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

        \[\leadsto \log \frac{27}{64} + \color{blue}{3 \cdot \log \left(\frac{-1}{z0}\right)} \]
      2. +-commutativeN/A

        \[\leadsto 3 \cdot \log \left(\frac{-1}{z0}\right) + \color{blue}{\log \frac{27}{64}} \]
      3. lift-*.f64N/A

        \[\leadsto 3 \cdot \log \left(\frac{-1}{z0}\right) + \log \color{blue}{\frac{27}{64}} \]
      4. lift-log.f64N/A

        \[\leadsto 3 \cdot \log \left(\frac{-1}{z0}\right) + \log \frac{27}{64} \]
      5. log-pow-revN/A

        \[\leadsto \log \left({\left(\frac{-1}{z0}\right)}^{3}\right) + \log \color{blue}{\frac{27}{64}} \]
      6. lift-log.f64N/A

        \[\leadsto \log \left({\left(\frac{-1}{z0}\right)}^{3}\right) + \log \frac{27}{64} \]
      7. sum-logN/A

        \[\leadsto \log \left({\left(\frac{-1}{z0}\right)}^{3} \cdot \frac{27}{64}\right) \]
      8. unpow3N/A

        \[\leadsto \log \left(\left(\left(\frac{-1}{z0} \cdot \frac{-1}{z0}\right) \cdot \frac{-1}{z0}\right) \cdot \frac{27}{64}\right) \]
      9. associate-*l*N/A

        \[\leadsto \log \left(\left(\frac{-1}{z0} \cdot \frac{-1}{z0}\right) \cdot \left(\frac{-1}{z0} \cdot \frac{27}{64}\right)\right) \]
      10. log-prodN/A

        \[\leadsto \log \left(\frac{-1}{z0} \cdot \frac{-1}{z0}\right) + \color{blue}{\log \left(\frac{-1}{z0} \cdot \frac{27}{64}\right)} \]
      11. lower-unsound-+.f64N/A

        \[\leadsto \log \left(\frac{-1}{z0} \cdot \frac{-1}{z0}\right) + \color{blue}{\log \left(\frac{-1}{z0} \cdot \frac{27}{64}\right)} \]
    6. Applied rewrites32.3%

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

        \[\leadsto 2 \cdot \left(-\log \left(-z0\right)\right) + \color{blue}{\log \left(\frac{-1}{z0} \cdot \frac{27}{64}\right)} \]
      2. add-flipN/A

        \[\leadsto 2 \cdot \left(-\log \left(-z0\right)\right) - \color{blue}{\left(\mathsf{neg}\left(\log \left(\frac{-1}{z0} \cdot \frac{27}{64}\right)\right)\right)} \]
      3. lower--.f64N/A

        \[\leadsto 2 \cdot \left(-\log \left(-z0\right)\right) - \color{blue}{\left(\mathsf{neg}\left(\log \left(\frac{-1}{z0} \cdot \frac{27}{64}\right)\right)\right)} \]
      4. lift-*.f64N/A

        \[\leadsto 2 \cdot \left(-\log \left(-z0\right)\right) - \left(\mathsf{neg}\left(\color{blue}{\log \left(\frac{-1}{z0} \cdot \frac{27}{64}\right)}\right)\right) \]
      5. lift-neg.f64N/A

        \[\leadsto 2 \cdot \left(\mathsf{neg}\left(\log \left(-z0\right)\right)\right) - \left(\mathsf{neg}\left(\log \left(\frac{-1}{z0} \cdot \frac{27}{64}\right)\right)\right) \]
      6. distribute-rgt-neg-outN/A

        \[\leadsto \left(\mathsf{neg}\left(2 \cdot \log \left(-z0\right)\right)\right) - \left(\mathsf{neg}\left(\color{blue}{\log \left(\frac{-1}{z0} \cdot \frac{27}{64}\right)}\right)\right) \]
      7. distribute-lft-neg-inN/A

        \[\leadsto \left(\mathsf{neg}\left(2\right)\right) \cdot \log \left(-z0\right) - \left(\mathsf{neg}\left(\color{blue}{\log \left(\frac{-1}{z0} \cdot \frac{27}{64}\right)}\right)\right) \]
      8. lower-*.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(2\right)\right) \cdot \log \left(-z0\right) - \left(\mathsf{neg}\left(\color{blue}{\log \left(\frac{-1}{z0} \cdot \frac{27}{64}\right)}\right)\right) \]
      9. metadata-evalN/A

        \[\leadsto -2 \cdot \log \left(-z0\right) - \left(\mathsf{neg}\left(\log \color{blue}{\left(\frac{-1}{z0} \cdot \frac{27}{64}\right)}\right)\right) \]
      10. lift-log.f64N/A

        \[\leadsto -2 \cdot \log \left(-z0\right) - \left(\mathsf{neg}\left(\log \left(\frac{-1}{z0} \cdot \frac{27}{64}\right)\right)\right) \]
      11. neg-logN/A

        \[\leadsto -2 \cdot \log \left(-z0\right) - \log \left(\frac{1}{\frac{-1}{z0} \cdot \frac{27}{64}}\right) \]
      12. lower-log.f64N/A

        \[\leadsto -2 \cdot \log \left(-z0\right) - \log \left(\frac{1}{\frac{-1}{z0} \cdot \frac{27}{64}}\right) \]
      13. lift-*.f64N/A

        \[\leadsto -2 \cdot \log \left(-z0\right) - \log \left(\frac{1}{\frac{-1}{z0} \cdot \frac{27}{64}}\right) \]
      14. lift-/.f64N/A

        \[\leadsto -2 \cdot \log \left(-z0\right) - \log \left(\frac{1}{\frac{-1}{z0} \cdot \frac{27}{64}}\right) \]
      15. associate-*l/N/A

        \[\leadsto -2 \cdot \log \left(-z0\right) - \log \left(\frac{1}{\frac{-1 \cdot \frac{27}{64}}{z0}}\right) \]
      16. metadata-evalN/A

        \[\leadsto -2 \cdot \log \left(-z0\right) - \log \left(\frac{1}{\frac{\frac{-27}{64}}{z0}}\right) \]
      17. div-flip-revN/A

        \[\leadsto -2 \cdot \log \left(-z0\right) - \log \left(\frac{z0}{\frac{-27}{64}}\right) \]
      18. lower-/.f6432.3%

        \[\leadsto -2 \cdot \log \left(-z0\right) - \log \left(\frac{z0}{-0.421875}\right) \]
    8. Applied rewrites32.3%

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

        \[\leadsto -2 \cdot \log \left(-z0\right) - \log \color{blue}{\left(\frac{z0}{\frac{-27}{64}}\right)} \]
      2. *-commutativeN/A

        \[\leadsto \log \left(-z0\right) \cdot -2 - \log \color{blue}{\left(\frac{z0}{\frac{-27}{64}}\right)} \]
      3. lower-unsound-log.f64N/A

        \[\leadsto \log \left(-z0\right) \cdot -2 - \log \left(\frac{\color{blue}{z0}}{\frac{-27}{64}}\right) \]
      4. lower-*.f64N/A

        \[\leadsto \log \left(-z0\right) \cdot -2 - \log \color{blue}{\left(\frac{z0}{\frac{-27}{64}}\right)} \]
      5. lower-unsound-log.f6432.3%

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

        \[\leadsto \log \left(-z0\right) \cdot -2 - \log \left(\frac{z0}{\frac{-27}{64}}\right) \]
      7. mult-flipN/A

        \[\leadsto \log \left(-z0\right) \cdot -2 - \log \left(z0 \cdot \frac{1}{\frac{-27}{64}}\right) \]
      8. metadata-evalN/A

        \[\leadsto \log \left(-z0\right) \cdot -2 - \log \left(z0 \cdot \frac{-64}{27}\right) \]
      9. *-commutativeN/A

        \[\leadsto \log \left(-z0\right) \cdot -2 - \log \left(\frac{-64}{27} \cdot z0\right) \]
      10. lift-*.f6432.3%

        \[\leadsto \log \left(-z0\right) \cdot -2 - \log \left(-2.3703703703703702 \cdot z0\right) \]
    10. Applied rewrites32.3%

      \[\leadsto \log \left(-z0\right) \cdot -2 - \color{blue}{\log \left(-2.3703703703703702 \cdot z0\right)} \]

    if -3.9999999999999999e102 < z0

    1. Initial program 79.1%

      \[\log \left(\frac{-0.421875}{\left(\left(1 - z0\right) \cdot \left(1 - z0\right)\right) \cdot \left(z0 - 1\right)}\right) \]
    2. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \log \color{blue}{\left(\frac{\frac{-27}{64}}{\left(\left(1 - z0\right) \cdot \left(1 - z0\right)\right) \cdot \left(z0 - 1\right)}\right)} \]
      2. div-flipN/A

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

        \[\leadsto \log \color{blue}{\left(\frac{1}{\frac{\left(\left(1 - z0\right) \cdot \left(1 - z0\right)\right) \cdot \left(z0 - 1\right)}{\frac{-27}{64}}}\right)} \]
      4. lower-unsound-/.f6479.1%

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

        \[\leadsto \log \left(\frac{1}{\frac{\color{blue}{\left(\left(1 - z0\right) \cdot \left(1 - z0\right)\right) \cdot \left(z0 - 1\right)}}{\frac{-27}{64}}}\right) \]
      6. *-commutativeN/A

        \[\leadsto \log \left(\frac{1}{\frac{\color{blue}{\left(z0 - 1\right) \cdot \left(\left(1 - z0\right) \cdot \left(1 - z0\right)\right)}}{\frac{-27}{64}}}\right) \]
      7. lower-*.f6479.1%

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

        \[\leadsto \log \left(\frac{1}{\frac{\left(z0 - 1\right) \cdot \color{blue}{\left(\left(1 - z0\right) \cdot \left(1 - z0\right)\right)}}{\frac{-27}{64}}}\right) \]
      9. sqr-neg-revN/A

        \[\leadsto \log \left(\frac{1}{\frac{\left(z0 - 1\right) \cdot \color{blue}{\left(\left(\mathsf{neg}\left(\left(1 - z0\right)\right)\right) \cdot \left(\mathsf{neg}\left(\left(1 - z0\right)\right)\right)\right)}}{\frac{-27}{64}}}\right) \]
      10. lift--.f64N/A

        \[\leadsto \log \left(\frac{1}{\frac{\left(z0 - 1\right) \cdot \left(\left(\mathsf{neg}\left(\color{blue}{\left(1 - z0\right)}\right)\right) \cdot \left(\mathsf{neg}\left(\left(1 - z0\right)\right)\right)\right)}{\frac{-27}{64}}}\right) \]
      11. sub-negate-revN/A

        \[\leadsto \log \left(\frac{1}{\frac{\left(z0 - 1\right) \cdot \left(\color{blue}{\left(z0 - 1\right)} \cdot \left(\mathsf{neg}\left(\left(1 - z0\right)\right)\right)\right)}{\frac{-27}{64}}}\right) \]
      12. lift--.f64N/A

        \[\leadsto \log \left(\frac{1}{\frac{\left(z0 - 1\right) \cdot \left(\color{blue}{\left(z0 - 1\right)} \cdot \left(\mathsf{neg}\left(\left(1 - z0\right)\right)\right)\right)}{\frac{-27}{64}}}\right) \]
      13. lift--.f64N/A

        \[\leadsto \log \left(\frac{1}{\frac{\left(z0 - 1\right) \cdot \left(\left(z0 - 1\right) \cdot \left(\mathsf{neg}\left(\color{blue}{\left(1 - z0\right)}\right)\right)\right)}{\frac{-27}{64}}}\right) \]
      14. sub-negate-revN/A

        \[\leadsto \log \left(\frac{1}{\frac{\left(z0 - 1\right) \cdot \left(\left(z0 - 1\right) \cdot \color{blue}{\left(z0 - 1\right)}\right)}{\frac{-27}{64}}}\right) \]
      15. lift--.f64N/A

        \[\leadsto \log \left(\frac{1}{\frac{\left(z0 - 1\right) \cdot \left(\left(z0 - 1\right) \cdot \color{blue}{\left(z0 - 1\right)}\right)}{\frac{-27}{64}}}\right) \]
      16. lower-*.f6479.1%

        \[\leadsto \log \left(\frac{1}{\frac{\left(z0 - 1\right) \cdot \color{blue}{\left(\left(z0 - 1\right) \cdot \left(z0 - 1\right)\right)}}{-0.421875}}\right) \]
    3. Applied rewrites79.1%

      \[\leadsto \log \color{blue}{\left(\frac{1}{\frac{\left(z0 - 1\right) \cdot \left(\left(z0 - 1\right) \cdot \left(z0 - 1\right)\right)}{-0.421875}}\right)} \]
    4. Taylor expanded in z0 around 0

      \[\leadsto \log \left(\frac{1}{\color{blue}{\frac{64}{27} + z0 \cdot \left(z0 \cdot \left(\frac{64}{9} + \frac{-64}{27} \cdot z0\right) - \frac{64}{9}\right)}}\right) \]
    5. Step-by-step derivation
      1. lower-+.f64N/A

        \[\leadsto \log \left(\frac{1}{\frac{64}{27} + \color{blue}{z0 \cdot \left(z0 \cdot \left(\frac{64}{9} + \frac{-64}{27} \cdot z0\right) - \frac{64}{9}\right)}}\right) \]
      2. lower-*.f64N/A

        \[\leadsto \log \left(\frac{1}{\frac{64}{27} + z0 \cdot \color{blue}{\left(z0 \cdot \left(\frac{64}{9} + \frac{-64}{27} \cdot z0\right) - \frac{64}{9}\right)}}\right) \]
      3. lower--.f64N/A

        \[\leadsto \log \left(\frac{1}{\frac{64}{27} + z0 \cdot \left(z0 \cdot \left(\frac{64}{9} + \frac{-64}{27} \cdot z0\right) - \color{blue}{\frac{64}{9}}\right)}\right) \]
      4. lower-*.f64N/A

        \[\leadsto \log \left(\frac{1}{\frac{64}{27} + z0 \cdot \left(z0 \cdot \left(\frac{64}{9} + \frac{-64}{27} \cdot z0\right) - \frac{64}{9}\right)}\right) \]
      5. lower-+.f64N/A

        \[\leadsto \log \left(\frac{1}{\frac{64}{27} + z0 \cdot \left(z0 \cdot \left(\frac{64}{9} + \frac{-64}{27} \cdot z0\right) - \frac{64}{9}\right)}\right) \]
      6. lower-*.f6479.1%

        \[\leadsto \log \left(\frac{1}{2.3703703703703702 + z0 \cdot \left(z0 \cdot \left(7.111111111111111 + -2.3703703703703702 \cdot z0\right) - 7.111111111111111\right)}\right) \]
    6. Applied rewrites79.1%

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

Alternative 2: 99.8% accurate, 0.9× speedup?

\[\begin{array}{l} \mathbf{if}\;z0 \leq -4 \cdot 10^{+102}:\\ \;\;\;\;-0.8630462173553428 + 3 \cdot \log \left(\frac{-1}{z0}\right)\\ \mathbf{else}:\\ \;\;\;\;\log \left(\frac{1}{2.3703703703703702 + z0 \cdot \left(z0 \cdot \left(7.111111111111111 + -2.3703703703703702 \cdot z0\right) - 7.111111111111111\right)}\right)\\ \end{array} \]
(FPCore (z0)
  :precision binary64
  (if (<= z0 -4e+102)
  (+ -0.8630462173553428 (* 3.0 (log (/ -1.0 z0))))
  (log
   (/
    1.0
    (+
     2.3703703703703702
     (*
      z0
      (-
       (* z0 (+ 7.111111111111111 (* -2.3703703703703702 z0)))
       7.111111111111111)))))))
double code(double z0) {
	double tmp;
	if (z0 <= -4e+102) {
		tmp = -0.8630462173553428 + (3.0 * log((-1.0 / z0)));
	} else {
		tmp = log((1.0 / (2.3703703703703702 + (z0 * ((z0 * (7.111111111111111 + (-2.3703703703703702 * z0))) - 7.111111111111111)))));
	}
	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) :: tmp
    if (z0 <= (-4d+102)) then
        tmp = (-0.8630462173553428d0) + (3.0d0 * log(((-1.0d0) / z0)))
    else
        tmp = log((1.0d0 / (2.3703703703703702d0 + (z0 * ((z0 * (7.111111111111111d0 + ((-2.3703703703703702d0) * z0))) - 7.111111111111111d0)))))
    end if
    code = tmp
end function
public static double code(double z0) {
	double tmp;
	if (z0 <= -4e+102) {
		tmp = -0.8630462173553428 + (3.0 * Math.log((-1.0 / z0)));
	} else {
		tmp = Math.log((1.0 / (2.3703703703703702 + (z0 * ((z0 * (7.111111111111111 + (-2.3703703703703702 * z0))) - 7.111111111111111)))));
	}
	return tmp;
}
def code(z0):
	tmp = 0
	if z0 <= -4e+102:
		tmp = -0.8630462173553428 + (3.0 * math.log((-1.0 / z0)))
	else:
		tmp = math.log((1.0 / (2.3703703703703702 + (z0 * ((z0 * (7.111111111111111 + (-2.3703703703703702 * z0))) - 7.111111111111111)))))
	return tmp
function code(z0)
	tmp = 0.0
	if (z0 <= -4e+102)
		tmp = Float64(-0.8630462173553428 + Float64(3.0 * log(Float64(-1.0 / z0))));
	else
		tmp = log(Float64(1.0 / Float64(2.3703703703703702 + Float64(z0 * Float64(Float64(z0 * Float64(7.111111111111111 + Float64(-2.3703703703703702 * z0))) - 7.111111111111111)))));
	end
	return tmp
end
function tmp_2 = code(z0)
	tmp = 0.0;
	if (z0 <= -4e+102)
		tmp = -0.8630462173553428 + (3.0 * log((-1.0 / z0)));
	else
		tmp = log((1.0 / (2.3703703703703702 + (z0 * ((z0 * (7.111111111111111 + (-2.3703703703703702 * z0))) - 7.111111111111111)))));
	end
	tmp_2 = tmp;
end
code[z0_] := If[LessEqual[z0, -4e+102], N[(-0.8630462173553428 + N[(3.0 * N[Log[N[(-1.0 / z0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Log[N[(1.0 / N[(2.3703703703703702 + N[(z0 * N[(N[(z0 * N[(7.111111111111111 + N[(-2.3703703703703702 * z0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 7.111111111111111), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;z0 \leq -4 \cdot 10^{+102}:\\
\;\;\;\;-0.8630462173553428 + 3 \cdot \log \left(\frac{-1}{z0}\right)\\

\mathbf{else}:\\
\;\;\;\;\log \left(\frac{1}{2.3703703703703702 + z0 \cdot \left(z0 \cdot \left(7.111111111111111 + -2.3703703703703702 \cdot z0\right) - 7.111111111111111\right)}\right)\\


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z0 < -3.9999999999999999e102

    1. Initial program 79.1%

      \[\log \left(\frac{-0.421875}{\left(\left(1 - z0\right) \cdot \left(1 - z0\right)\right) \cdot \left(z0 - 1\right)}\right) \]
    2. Taylor expanded in z0 around -inf

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

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

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

        \[\leadsto \log \frac{27}{64} + 3 \cdot \color{blue}{\log \left(\frac{-1}{z0}\right)} \]
      4. lower-log.f64N/A

        \[\leadsto \log \frac{27}{64} + 3 \cdot \log \left(\frac{-1}{z0}\right) \]
      5. lower-/.f6432.3%

        \[\leadsto \log 0.421875 + 3 \cdot \log \left(\frac{-1}{z0}\right) \]
    4. Applied rewrites32.3%

      \[\leadsto \color{blue}{\log 0.421875 + 3 \cdot \log \left(\frac{-1}{z0}\right)} \]
    5. Evaluated real constant32.3%

      \[\leadsto -0.8630462173553428 + \color{blue}{3} \cdot \log \left(\frac{-1}{z0}\right) \]

    if -3.9999999999999999e102 < z0

    1. Initial program 79.1%

      \[\log \left(\frac{-0.421875}{\left(\left(1 - z0\right) \cdot \left(1 - z0\right)\right) \cdot \left(z0 - 1\right)}\right) \]
    2. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \log \color{blue}{\left(\frac{\frac{-27}{64}}{\left(\left(1 - z0\right) \cdot \left(1 - z0\right)\right) \cdot \left(z0 - 1\right)}\right)} \]
      2. div-flipN/A

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

        \[\leadsto \log \color{blue}{\left(\frac{1}{\frac{\left(\left(1 - z0\right) \cdot \left(1 - z0\right)\right) \cdot \left(z0 - 1\right)}{\frac{-27}{64}}}\right)} \]
      4. lower-unsound-/.f6479.1%

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

        \[\leadsto \log \left(\frac{1}{\frac{\color{blue}{\left(\left(1 - z0\right) \cdot \left(1 - z0\right)\right) \cdot \left(z0 - 1\right)}}{\frac{-27}{64}}}\right) \]
      6. *-commutativeN/A

        \[\leadsto \log \left(\frac{1}{\frac{\color{blue}{\left(z0 - 1\right) \cdot \left(\left(1 - z0\right) \cdot \left(1 - z0\right)\right)}}{\frac{-27}{64}}}\right) \]
      7. lower-*.f6479.1%

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

        \[\leadsto \log \left(\frac{1}{\frac{\left(z0 - 1\right) \cdot \color{blue}{\left(\left(1 - z0\right) \cdot \left(1 - z0\right)\right)}}{\frac{-27}{64}}}\right) \]
      9. sqr-neg-revN/A

        \[\leadsto \log \left(\frac{1}{\frac{\left(z0 - 1\right) \cdot \color{blue}{\left(\left(\mathsf{neg}\left(\left(1 - z0\right)\right)\right) \cdot \left(\mathsf{neg}\left(\left(1 - z0\right)\right)\right)\right)}}{\frac{-27}{64}}}\right) \]
      10. lift--.f64N/A

        \[\leadsto \log \left(\frac{1}{\frac{\left(z0 - 1\right) \cdot \left(\left(\mathsf{neg}\left(\color{blue}{\left(1 - z0\right)}\right)\right) \cdot \left(\mathsf{neg}\left(\left(1 - z0\right)\right)\right)\right)}{\frac{-27}{64}}}\right) \]
      11. sub-negate-revN/A

        \[\leadsto \log \left(\frac{1}{\frac{\left(z0 - 1\right) \cdot \left(\color{blue}{\left(z0 - 1\right)} \cdot \left(\mathsf{neg}\left(\left(1 - z0\right)\right)\right)\right)}{\frac{-27}{64}}}\right) \]
      12. lift--.f64N/A

        \[\leadsto \log \left(\frac{1}{\frac{\left(z0 - 1\right) \cdot \left(\color{blue}{\left(z0 - 1\right)} \cdot \left(\mathsf{neg}\left(\left(1 - z0\right)\right)\right)\right)}{\frac{-27}{64}}}\right) \]
      13. lift--.f64N/A

        \[\leadsto \log \left(\frac{1}{\frac{\left(z0 - 1\right) \cdot \left(\left(z0 - 1\right) \cdot \left(\mathsf{neg}\left(\color{blue}{\left(1 - z0\right)}\right)\right)\right)}{\frac{-27}{64}}}\right) \]
      14. sub-negate-revN/A

        \[\leadsto \log \left(\frac{1}{\frac{\left(z0 - 1\right) \cdot \left(\left(z0 - 1\right) \cdot \color{blue}{\left(z0 - 1\right)}\right)}{\frac{-27}{64}}}\right) \]
      15. lift--.f64N/A

        \[\leadsto \log \left(\frac{1}{\frac{\left(z0 - 1\right) \cdot \left(\left(z0 - 1\right) \cdot \color{blue}{\left(z0 - 1\right)}\right)}{\frac{-27}{64}}}\right) \]
      16. lower-*.f6479.1%

        \[\leadsto \log \left(\frac{1}{\frac{\left(z0 - 1\right) \cdot \color{blue}{\left(\left(z0 - 1\right) \cdot \left(z0 - 1\right)\right)}}{-0.421875}}\right) \]
    3. Applied rewrites79.1%

      \[\leadsto \log \color{blue}{\left(\frac{1}{\frac{\left(z0 - 1\right) \cdot \left(\left(z0 - 1\right) \cdot \left(z0 - 1\right)\right)}{-0.421875}}\right)} \]
    4. Taylor expanded in z0 around 0

      \[\leadsto \log \left(\frac{1}{\color{blue}{\frac{64}{27} + z0 \cdot \left(z0 \cdot \left(\frac{64}{9} + \frac{-64}{27} \cdot z0\right) - \frac{64}{9}\right)}}\right) \]
    5. Step-by-step derivation
      1. lower-+.f64N/A

        \[\leadsto \log \left(\frac{1}{\frac{64}{27} + \color{blue}{z0 \cdot \left(z0 \cdot \left(\frac{64}{9} + \frac{-64}{27} \cdot z0\right) - \frac{64}{9}\right)}}\right) \]
      2. lower-*.f64N/A

        \[\leadsto \log \left(\frac{1}{\frac{64}{27} + z0 \cdot \color{blue}{\left(z0 \cdot \left(\frac{64}{9} + \frac{-64}{27} \cdot z0\right) - \frac{64}{9}\right)}}\right) \]
      3. lower--.f64N/A

        \[\leadsto \log \left(\frac{1}{\frac{64}{27} + z0 \cdot \left(z0 \cdot \left(\frac{64}{9} + \frac{-64}{27} \cdot z0\right) - \color{blue}{\frac{64}{9}}\right)}\right) \]
      4. lower-*.f64N/A

        \[\leadsto \log \left(\frac{1}{\frac{64}{27} + z0 \cdot \left(z0 \cdot \left(\frac{64}{9} + \frac{-64}{27} \cdot z0\right) - \frac{64}{9}\right)}\right) \]
      5. lower-+.f64N/A

        \[\leadsto \log \left(\frac{1}{\frac{64}{27} + z0 \cdot \left(z0 \cdot \left(\frac{64}{9} + \frac{-64}{27} \cdot z0\right) - \frac{64}{9}\right)}\right) \]
      6. lower-*.f6479.1%

        \[\leadsto \log \left(\frac{1}{2.3703703703703702 + z0 \cdot \left(z0 \cdot \left(7.111111111111111 + -2.3703703703703702 \cdot z0\right) - 7.111111111111111\right)}\right) \]
    6. Applied rewrites79.1%

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

Alternative 3: 99.7% accurate, 1.0× speedup?

\[\begin{array}{l} \mathbf{if}\;z0 \leq -4 \cdot 10^{+103}:\\ \;\;\;\;-0.8630462173553428 + 3 \cdot \log \left(\frac{-1}{z0}\right)\\ \mathbf{else}:\\ \;\;\;\;\log \left(\frac{-0.421875}{\left(\left(1 - z0\right) \cdot \left(1 - z0\right)\right) \cdot \left(z0 - 1\right)}\right)\\ \end{array} \]
(FPCore (z0)
  :precision binary64
  (if (<= z0 -4e+103)
  (+ -0.8630462173553428 (* 3.0 (log (/ -1.0 z0))))
  (log (/ -0.421875 (* (* (- 1.0 z0) (- 1.0 z0)) (- z0 1.0))))))
double code(double z0) {
	double tmp;
	if (z0 <= -4e+103) {
		tmp = -0.8630462173553428 + (3.0 * log((-1.0 / z0)));
	} else {
		tmp = log((-0.421875 / (((1.0 - z0) * (1.0 - z0)) * (z0 - 1.0))));
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(z0)
use fmin_fmax_functions
    real(8), intent (in) :: z0
    real(8) :: tmp
    if (z0 <= (-4d+103)) then
        tmp = (-0.8630462173553428d0) + (3.0d0 * log(((-1.0d0) / z0)))
    else
        tmp = log(((-0.421875d0) / (((1.0d0 - z0) * (1.0d0 - z0)) * (z0 - 1.0d0))))
    end if
    code = tmp
end function
public static double code(double z0) {
	double tmp;
	if (z0 <= -4e+103) {
		tmp = -0.8630462173553428 + (3.0 * Math.log((-1.0 / z0)));
	} else {
		tmp = Math.log((-0.421875 / (((1.0 - z0) * (1.0 - z0)) * (z0 - 1.0))));
	}
	return tmp;
}
def code(z0):
	tmp = 0
	if z0 <= -4e+103:
		tmp = -0.8630462173553428 + (3.0 * math.log((-1.0 / z0)))
	else:
		tmp = math.log((-0.421875 / (((1.0 - z0) * (1.0 - z0)) * (z0 - 1.0))))
	return tmp
function code(z0)
	tmp = 0.0
	if (z0 <= -4e+103)
		tmp = Float64(-0.8630462173553428 + Float64(3.0 * log(Float64(-1.0 / z0))));
	else
		tmp = log(Float64(-0.421875 / Float64(Float64(Float64(1.0 - z0) * Float64(1.0 - z0)) * Float64(z0 - 1.0))));
	end
	return tmp
end
function tmp_2 = code(z0)
	tmp = 0.0;
	if (z0 <= -4e+103)
		tmp = -0.8630462173553428 + (3.0 * log((-1.0 / z0)));
	else
		tmp = log((-0.421875 / (((1.0 - z0) * (1.0 - z0)) * (z0 - 1.0))));
	end
	tmp_2 = tmp;
end
code[z0_] := If[LessEqual[z0, -4e+103], N[(-0.8630462173553428 + N[(3.0 * N[Log[N[(-1.0 / z0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Log[N[(-0.421875 / N[(N[(N[(1.0 - z0), $MachinePrecision] * N[(1.0 - z0), $MachinePrecision]), $MachinePrecision] * N[(z0 - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;z0 \leq -4 \cdot 10^{+103}:\\
\;\;\;\;-0.8630462173553428 + 3 \cdot \log \left(\frac{-1}{z0}\right)\\

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


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z0 < -4e103

    1. Initial program 79.1%

      \[\log \left(\frac{-0.421875}{\left(\left(1 - z0\right) \cdot \left(1 - z0\right)\right) \cdot \left(z0 - 1\right)}\right) \]
    2. Taylor expanded in z0 around -inf

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

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

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

        \[\leadsto \log \frac{27}{64} + 3 \cdot \color{blue}{\log \left(\frac{-1}{z0}\right)} \]
      4. lower-log.f64N/A

        \[\leadsto \log \frac{27}{64} + 3 \cdot \log \left(\frac{-1}{z0}\right) \]
      5. lower-/.f6432.3%

        \[\leadsto \log 0.421875 + 3 \cdot \log \left(\frac{-1}{z0}\right) \]
    4. Applied rewrites32.3%

      \[\leadsto \color{blue}{\log 0.421875 + 3 \cdot \log \left(\frac{-1}{z0}\right)} \]
    5. Evaluated real constant32.3%

      \[\leadsto -0.8630462173553428 + \color{blue}{3} \cdot \log \left(\frac{-1}{z0}\right) \]

    if -4e103 < z0

    1. Initial program 79.1%

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

Alternative 4: 98.9% accurate, 1.0× speedup?

\[\begin{array}{l} \mathbf{if}\;z0 \leq -4 \cdot 10^{+102}:\\ \;\;\;\;-0.8630462173553428 + 3 \cdot \log \left(\frac{-1}{z0}\right)\\ \mathbf{else}:\\ \;\;\;\;-\log \left(\left(\left(-2.3703703703703702 \cdot z0 - -7.111111111111111\right) \cdot z0 - 7.111111111111111\right) \cdot z0 - -2.3703703703703702\right)\\ \end{array} \]
(FPCore (z0)
  :precision binary64
  (if (<= z0 -4e+102)
  (+ -0.8630462173553428 (* 3.0 (log (/ -1.0 z0))))
  (-
   (log
    (-
     (*
      (-
       (* (- (* -2.3703703703703702 z0) -7.111111111111111) z0)
       7.111111111111111)
      z0)
     -2.3703703703703702)))))
double code(double z0) {
	double tmp;
	if (z0 <= -4e+102) {
		tmp = -0.8630462173553428 + (3.0 * log((-1.0 / z0)));
	} else {
		tmp = -log(((((((-2.3703703703703702 * z0) - -7.111111111111111) * z0) - 7.111111111111111) * z0) - -2.3703703703703702));
	}
	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) :: tmp
    if (z0 <= (-4d+102)) then
        tmp = (-0.8630462173553428d0) + (3.0d0 * log(((-1.0d0) / z0)))
    else
        tmp = -log((((((((-2.3703703703703702d0) * z0) - (-7.111111111111111d0)) * z0) - 7.111111111111111d0) * z0) - (-2.3703703703703702d0)))
    end if
    code = tmp
end function
public static double code(double z0) {
	double tmp;
	if (z0 <= -4e+102) {
		tmp = -0.8630462173553428 + (3.0 * Math.log((-1.0 / z0)));
	} else {
		tmp = -Math.log(((((((-2.3703703703703702 * z0) - -7.111111111111111) * z0) - 7.111111111111111) * z0) - -2.3703703703703702));
	}
	return tmp;
}
def code(z0):
	tmp = 0
	if z0 <= -4e+102:
		tmp = -0.8630462173553428 + (3.0 * math.log((-1.0 / z0)))
	else:
		tmp = -math.log(((((((-2.3703703703703702 * z0) - -7.111111111111111) * z0) - 7.111111111111111) * z0) - -2.3703703703703702))
	return tmp
function code(z0)
	tmp = 0.0
	if (z0 <= -4e+102)
		tmp = Float64(-0.8630462173553428 + Float64(3.0 * log(Float64(-1.0 / z0))));
	else
		tmp = Float64(-log(Float64(Float64(Float64(Float64(Float64(Float64(-2.3703703703703702 * z0) - -7.111111111111111) * z0) - 7.111111111111111) * z0) - -2.3703703703703702)));
	end
	return tmp
end
function tmp_2 = code(z0)
	tmp = 0.0;
	if (z0 <= -4e+102)
		tmp = -0.8630462173553428 + (3.0 * log((-1.0 / z0)));
	else
		tmp = -log(((((((-2.3703703703703702 * z0) - -7.111111111111111) * z0) - 7.111111111111111) * z0) - -2.3703703703703702));
	end
	tmp_2 = tmp;
end
code[z0_] := If[LessEqual[z0, -4e+102], N[(-0.8630462173553428 + N[(3.0 * N[Log[N[(-1.0 / z0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], (-N[Log[N[(N[(N[(N[(N[(N[(-2.3703703703703702 * z0), $MachinePrecision] - -7.111111111111111), $MachinePrecision] * z0), $MachinePrecision] - 7.111111111111111), $MachinePrecision] * z0), $MachinePrecision] - -2.3703703703703702), $MachinePrecision]], $MachinePrecision])]
\begin{array}{l}
\mathbf{if}\;z0 \leq -4 \cdot 10^{+102}:\\
\;\;\;\;-0.8630462173553428 + 3 \cdot \log \left(\frac{-1}{z0}\right)\\

\mathbf{else}:\\
\;\;\;\;-\log \left(\left(\left(-2.3703703703703702 \cdot z0 - -7.111111111111111\right) \cdot z0 - 7.111111111111111\right) \cdot z0 - -2.3703703703703702\right)\\


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z0 < -3.9999999999999999e102

    1. Initial program 79.1%

      \[\log \left(\frac{-0.421875}{\left(\left(1 - z0\right) \cdot \left(1 - z0\right)\right) \cdot \left(z0 - 1\right)}\right) \]
    2. Taylor expanded in z0 around -inf

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

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

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

        \[\leadsto \log \frac{27}{64} + 3 \cdot \color{blue}{\log \left(\frac{-1}{z0}\right)} \]
      4. lower-log.f64N/A

        \[\leadsto \log \frac{27}{64} + 3 \cdot \log \left(\frac{-1}{z0}\right) \]
      5. lower-/.f6432.3%

        \[\leadsto \log 0.421875 + 3 \cdot \log \left(\frac{-1}{z0}\right) \]
    4. Applied rewrites32.3%

      \[\leadsto \color{blue}{\log 0.421875 + 3 \cdot \log \left(\frac{-1}{z0}\right)} \]
    5. Evaluated real constant32.3%

      \[\leadsto -0.8630462173553428 + \color{blue}{3} \cdot \log \left(\frac{-1}{z0}\right) \]

    if -3.9999999999999999e102 < z0

    1. Initial program 79.1%

      \[\log \left(\frac{-0.421875}{\left(\left(1 - z0\right) \cdot \left(1 - z0\right)\right) \cdot \left(z0 - 1\right)}\right) \]
    2. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \log \color{blue}{\left(\frac{\frac{-27}{64}}{\left(\left(1 - z0\right) \cdot \left(1 - z0\right)\right) \cdot \left(z0 - 1\right)}\right)} \]
      2. div-flipN/A

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

        \[\leadsto \log \color{blue}{\left(\frac{1}{\frac{\left(\left(1 - z0\right) \cdot \left(1 - z0\right)\right) \cdot \left(z0 - 1\right)}{\frac{-27}{64}}}\right)} \]
      4. lower-unsound-/.f6479.1%

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

        \[\leadsto \log \left(\frac{1}{\frac{\color{blue}{\left(\left(1 - z0\right) \cdot \left(1 - z0\right)\right) \cdot \left(z0 - 1\right)}}{\frac{-27}{64}}}\right) \]
      6. *-commutativeN/A

        \[\leadsto \log \left(\frac{1}{\frac{\color{blue}{\left(z0 - 1\right) \cdot \left(\left(1 - z0\right) \cdot \left(1 - z0\right)\right)}}{\frac{-27}{64}}}\right) \]
      7. lower-*.f6479.1%

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

        \[\leadsto \log \left(\frac{1}{\frac{\left(z0 - 1\right) \cdot \color{blue}{\left(\left(1 - z0\right) \cdot \left(1 - z0\right)\right)}}{\frac{-27}{64}}}\right) \]
      9. sqr-neg-revN/A

        \[\leadsto \log \left(\frac{1}{\frac{\left(z0 - 1\right) \cdot \color{blue}{\left(\left(\mathsf{neg}\left(\left(1 - z0\right)\right)\right) \cdot \left(\mathsf{neg}\left(\left(1 - z0\right)\right)\right)\right)}}{\frac{-27}{64}}}\right) \]
      10. lift--.f64N/A

        \[\leadsto \log \left(\frac{1}{\frac{\left(z0 - 1\right) \cdot \left(\left(\mathsf{neg}\left(\color{blue}{\left(1 - z0\right)}\right)\right) \cdot \left(\mathsf{neg}\left(\left(1 - z0\right)\right)\right)\right)}{\frac{-27}{64}}}\right) \]
      11. sub-negate-revN/A

        \[\leadsto \log \left(\frac{1}{\frac{\left(z0 - 1\right) \cdot \left(\color{blue}{\left(z0 - 1\right)} \cdot \left(\mathsf{neg}\left(\left(1 - z0\right)\right)\right)\right)}{\frac{-27}{64}}}\right) \]
      12. lift--.f64N/A

        \[\leadsto \log \left(\frac{1}{\frac{\left(z0 - 1\right) \cdot \left(\color{blue}{\left(z0 - 1\right)} \cdot \left(\mathsf{neg}\left(\left(1 - z0\right)\right)\right)\right)}{\frac{-27}{64}}}\right) \]
      13. lift--.f64N/A

        \[\leadsto \log \left(\frac{1}{\frac{\left(z0 - 1\right) \cdot \left(\left(z0 - 1\right) \cdot \left(\mathsf{neg}\left(\color{blue}{\left(1 - z0\right)}\right)\right)\right)}{\frac{-27}{64}}}\right) \]
      14. sub-negate-revN/A

        \[\leadsto \log \left(\frac{1}{\frac{\left(z0 - 1\right) \cdot \left(\left(z0 - 1\right) \cdot \color{blue}{\left(z0 - 1\right)}\right)}{\frac{-27}{64}}}\right) \]
      15. lift--.f64N/A

        \[\leadsto \log \left(\frac{1}{\frac{\left(z0 - 1\right) \cdot \left(\left(z0 - 1\right) \cdot \color{blue}{\left(z0 - 1\right)}\right)}{\frac{-27}{64}}}\right) \]
      16. lower-*.f6479.1%

        \[\leadsto \log \left(\frac{1}{\frac{\left(z0 - 1\right) \cdot \color{blue}{\left(\left(z0 - 1\right) \cdot \left(z0 - 1\right)\right)}}{-0.421875}}\right) \]
    3. Applied rewrites79.1%

      \[\leadsto \log \color{blue}{\left(\frac{1}{\frac{\left(z0 - 1\right) \cdot \left(\left(z0 - 1\right) \cdot \left(z0 - 1\right)\right)}{-0.421875}}\right)} \]
    4. Taylor expanded in z0 around 0

      \[\leadsto \log \left(\frac{1}{\color{blue}{\frac{64}{27} + z0 \cdot \left(z0 \cdot \left(\frac{64}{9} + \frac{-64}{27} \cdot z0\right) - \frac{64}{9}\right)}}\right) \]
    5. Step-by-step derivation
      1. lower-+.f64N/A

        \[\leadsto \log \left(\frac{1}{\frac{64}{27} + \color{blue}{z0 \cdot \left(z0 \cdot \left(\frac{64}{9} + \frac{-64}{27} \cdot z0\right) - \frac{64}{9}\right)}}\right) \]
      2. lower-*.f64N/A

        \[\leadsto \log \left(\frac{1}{\frac{64}{27} + z0 \cdot \color{blue}{\left(z0 \cdot \left(\frac{64}{9} + \frac{-64}{27} \cdot z0\right) - \frac{64}{9}\right)}}\right) \]
      3. lower--.f64N/A

        \[\leadsto \log \left(\frac{1}{\frac{64}{27} + z0 \cdot \left(z0 \cdot \left(\frac{64}{9} + \frac{-64}{27} \cdot z0\right) - \color{blue}{\frac{64}{9}}\right)}\right) \]
      4. lower-*.f64N/A

        \[\leadsto \log \left(\frac{1}{\frac{64}{27} + z0 \cdot \left(z0 \cdot \left(\frac{64}{9} + \frac{-64}{27} \cdot z0\right) - \frac{64}{9}\right)}\right) \]
      5. lower-+.f64N/A

        \[\leadsto \log \left(\frac{1}{\frac{64}{27} + z0 \cdot \left(z0 \cdot \left(\frac{64}{9} + \frac{-64}{27} \cdot z0\right) - \frac{64}{9}\right)}\right) \]
      6. lower-*.f6479.1%

        \[\leadsto \log \left(\frac{1}{2.3703703703703702 + z0 \cdot \left(z0 \cdot \left(7.111111111111111 + -2.3703703703703702 \cdot z0\right) - 7.111111111111111\right)}\right) \]
    6. Applied rewrites79.1%

      \[\leadsto \log \left(\frac{1}{\color{blue}{2.3703703703703702 + z0 \cdot \left(z0 \cdot \left(7.111111111111111 + -2.3703703703703702 \cdot z0\right) - 7.111111111111111\right)}}\right) \]
    7. Step-by-step derivation
      1. lift-log.f64N/A

        \[\leadsto \color{blue}{\log \left(\frac{1}{\frac{64}{27} + z0 \cdot \left(z0 \cdot \left(\frac{64}{9} + \frac{-64}{27} \cdot z0\right) - \frac{64}{9}\right)}\right)} \]
      2. lift-/.f64N/A

        \[\leadsto \log \color{blue}{\left(\frac{1}{\frac{64}{27} + z0 \cdot \left(z0 \cdot \left(\frac{64}{9} + \frac{-64}{27} \cdot z0\right) - \frac{64}{9}\right)}\right)} \]
      3. log-recN/A

        \[\leadsto \color{blue}{\mathsf{neg}\left(\log \left(\frac{64}{27} + z0 \cdot \left(z0 \cdot \left(\frac{64}{9} + \frac{-64}{27} \cdot z0\right) - \frac{64}{9}\right)\right)\right)} \]
      4. lower-log.f64N/A

        \[\leadsto \mathsf{neg}\left(\color{blue}{\log \left(\frac{64}{27} + z0 \cdot \left(z0 \cdot \left(\frac{64}{9} + \frac{-64}{27} \cdot z0\right) - \frac{64}{9}\right)\right)}\right) \]
      5. lower-unsound-log.f64N/A

        \[\leadsto \mathsf{neg}\left(\color{blue}{\log \left(\frac{64}{27} + z0 \cdot \left(z0 \cdot \left(\frac{64}{9} + \frac{-64}{27} \cdot z0\right) - \frac{64}{9}\right)\right)}\right) \]
      6. lower-neg.f64N/A

        \[\leadsto \color{blue}{-\log \left(\frac{64}{27} + z0 \cdot \left(z0 \cdot \left(\frac{64}{9} + \frac{-64}{27} \cdot z0\right) - \frac{64}{9}\right)\right)} \]
      7. lower-unsound-log.f6478.1%

        \[\leadsto -\color{blue}{\log \left(2.3703703703703702 + z0 \cdot \left(z0 \cdot \left(7.111111111111111 + -2.3703703703703702 \cdot z0\right) - 7.111111111111111\right)\right)} \]
    8. Applied rewrites78.1%

      \[\leadsto \color{blue}{-\log \left(\left(\left(-2.3703703703703702 \cdot z0 - -7.111111111111111\right) \cdot z0 - 7.111111111111111\right) \cdot z0 - -2.3703703703703702\right)} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 5: 98.8% accurate, 1.0× speedup?

\[\begin{array}{l} \mathbf{if}\;z0 \leq -0.84:\\ \;\;\;\;-0.8630462173553428 + 3 \cdot \log \left(\frac{-1}{z0}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(z0 - -1.5\right) \cdot z0 - -3\right) \cdot z0 - 0.8630462173553428\\ \end{array} \]
(FPCore (z0)
  :precision binary64
  (if (<= z0 -0.84)
  (+ -0.8630462173553428 (* 3.0 (log (/ -1.0 z0))))
  (- (* (- (* (- z0 -1.5) z0) -3.0) z0) 0.8630462173553428)))
double code(double z0) {
	double tmp;
	if (z0 <= -0.84) {
		tmp = -0.8630462173553428 + (3.0 * log((-1.0 / z0)));
	} else {
		tmp = ((((z0 - -1.5) * z0) - -3.0) * z0) - 0.8630462173553428;
	}
	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) :: tmp
    if (z0 <= (-0.84d0)) then
        tmp = (-0.8630462173553428d0) + (3.0d0 * log(((-1.0d0) / z0)))
    else
        tmp = ((((z0 - (-1.5d0)) * z0) - (-3.0d0)) * z0) - 0.8630462173553428d0
    end if
    code = tmp
end function
public static double code(double z0) {
	double tmp;
	if (z0 <= -0.84) {
		tmp = -0.8630462173553428 + (3.0 * Math.log((-1.0 / z0)));
	} else {
		tmp = ((((z0 - -1.5) * z0) - -3.0) * z0) - 0.8630462173553428;
	}
	return tmp;
}
def code(z0):
	tmp = 0
	if z0 <= -0.84:
		tmp = -0.8630462173553428 + (3.0 * math.log((-1.0 / z0)))
	else:
		tmp = ((((z0 - -1.5) * z0) - -3.0) * z0) - 0.8630462173553428
	return tmp
function code(z0)
	tmp = 0.0
	if (z0 <= -0.84)
		tmp = Float64(-0.8630462173553428 + Float64(3.0 * log(Float64(-1.0 / z0))));
	else
		tmp = Float64(Float64(Float64(Float64(Float64(z0 - -1.5) * z0) - -3.0) * z0) - 0.8630462173553428);
	end
	return tmp
end
function tmp_2 = code(z0)
	tmp = 0.0;
	if (z0 <= -0.84)
		tmp = -0.8630462173553428 + (3.0 * log((-1.0 / z0)));
	else
		tmp = ((((z0 - -1.5) * z0) - -3.0) * z0) - 0.8630462173553428;
	end
	tmp_2 = tmp;
end
code[z0_] := If[LessEqual[z0, -0.84], N[(-0.8630462173553428 + N[(3.0 * N[Log[N[(-1.0 / z0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(z0 - -1.5), $MachinePrecision] * z0), $MachinePrecision] - -3.0), $MachinePrecision] * z0), $MachinePrecision] - 0.8630462173553428), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;z0 \leq -0.84:\\
\;\;\;\;-0.8630462173553428 + 3 \cdot \log \left(\frac{-1}{z0}\right)\\

\mathbf{else}:\\
\;\;\;\;\left(\left(z0 - -1.5\right) \cdot z0 - -3\right) \cdot z0 - 0.8630462173553428\\


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z0 < -0.83999999999999997

    1. Initial program 79.1%

      \[\log \left(\frac{-0.421875}{\left(\left(1 - z0\right) \cdot \left(1 - z0\right)\right) \cdot \left(z0 - 1\right)}\right) \]
    2. Taylor expanded in z0 around -inf

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

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

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

        \[\leadsto \log \frac{27}{64} + 3 \cdot \color{blue}{\log \left(\frac{-1}{z0}\right)} \]
      4. lower-log.f64N/A

        \[\leadsto \log \frac{27}{64} + 3 \cdot \log \left(\frac{-1}{z0}\right) \]
      5. lower-/.f6432.3%

        \[\leadsto \log 0.421875 + 3 \cdot \log \left(\frac{-1}{z0}\right) \]
    4. Applied rewrites32.3%

      \[\leadsto \color{blue}{\log 0.421875 + 3 \cdot \log \left(\frac{-1}{z0}\right)} \]
    5. Evaluated real constant32.3%

      \[\leadsto -0.8630462173553428 + \color{blue}{3} \cdot \log \left(\frac{-1}{z0}\right) \]

    if -0.83999999999999997 < z0

    1. Initial program 79.1%

      \[\log \left(\frac{-0.421875}{\left(\left(1 - z0\right) \cdot \left(1 - z0\right)\right) \cdot \left(z0 - 1\right)}\right) \]
    2. Step-by-step derivation
      1. lift-log.f64N/A

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

        \[\leadsto \log \color{blue}{\left(\frac{\frac{-27}{64}}{\left(\left(1 - z0\right) \cdot \left(1 - z0\right)\right) \cdot \left(z0 - 1\right)}\right)} \]
      3. lift-*.f64N/A

        \[\leadsto \log \left(\frac{\frac{-27}{64}}{\color{blue}{\left(\left(1 - z0\right) \cdot \left(1 - z0\right)\right) \cdot \left(z0 - 1\right)}}\right) \]
      4. associate-/r*N/A

        \[\leadsto \log \color{blue}{\left(\frac{\frac{\frac{-27}{64}}{\left(1 - z0\right) \cdot \left(1 - z0\right)}}{z0 - 1}\right)} \]
      5. frac-2negN/A

        \[\leadsto \log \color{blue}{\left(\frac{\mathsf{neg}\left(\frac{\frac{-27}{64}}{\left(1 - z0\right) \cdot \left(1 - z0\right)}\right)}{\mathsf{neg}\left(\left(z0 - 1\right)\right)}\right)} \]
      6. lift--.f64N/A

        \[\leadsto \log \left(\frac{\mathsf{neg}\left(\frac{\frac{-27}{64}}{\left(1 - z0\right) \cdot \left(1 - z0\right)}\right)}{\mathsf{neg}\left(\color{blue}{\left(z0 - 1\right)}\right)}\right) \]
      7. sub-negate-revN/A

        \[\leadsto \log \left(\frac{\mathsf{neg}\left(\frac{\frac{-27}{64}}{\left(1 - z0\right) \cdot \left(1 - z0\right)}\right)}{\color{blue}{1 - z0}}\right) \]
      8. lift--.f64N/A

        \[\leadsto \log \left(\frac{\mathsf{neg}\left(\frac{\frac{-27}{64}}{\left(1 - z0\right) \cdot \left(1 - z0\right)}\right)}{\color{blue}{1 - z0}}\right) \]
      9. log-divN/A

        \[\leadsto \color{blue}{\log \left(\mathsf{neg}\left(\frac{\frac{-27}{64}}{\left(1 - z0\right) \cdot \left(1 - z0\right)}\right)\right) - \log \left(1 - z0\right)} \]
      10. lower-unsound--.f64N/A

        \[\leadsto \color{blue}{\log \left(\mathsf{neg}\left(\frac{\frac{-27}{64}}{\left(1 - z0\right) \cdot \left(1 - z0\right)}\right)\right) - \log \left(1 - z0\right)} \]
    3. Applied rewrites84.6%

      \[\leadsto \color{blue}{\log \left(\frac{0.421875}{\left(z0 - 1\right) \cdot \left(z0 - 1\right)}\right) - \log \left(1 - z0\right)} \]
    4. Taylor expanded in z0 around 0

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

        \[\leadsto \log \frac{27}{64} + \color{blue}{z0 \cdot \left(3 + z0 \cdot \left(\frac{3}{2} + z0\right)\right)} \]
      2. lower-log.f64N/A

        \[\leadsto \log \frac{27}{64} + \color{blue}{z0} \cdot \left(3 + z0 \cdot \left(\frac{3}{2} + z0\right)\right) \]
      3. lower-*.f64N/A

        \[\leadsto \log \frac{27}{64} + z0 \cdot \color{blue}{\left(3 + z0 \cdot \left(\frac{3}{2} + z0\right)\right)} \]
      4. lower-+.f64N/A

        \[\leadsto \log \frac{27}{64} + z0 \cdot \left(3 + \color{blue}{z0 \cdot \left(\frac{3}{2} + z0\right)}\right) \]
      5. lower-*.f64N/A

        \[\leadsto \log \frac{27}{64} + z0 \cdot \left(3 + z0 \cdot \color{blue}{\left(\frac{3}{2} + z0\right)}\right) \]
      6. lower-+.f6468.4%

        \[\leadsto \log 0.421875 + z0 \cdot \left(3 + z0 \cdot \left(1.5 + \color{blue}{z0}\right)\right) \]
    6. Applied rewrites68.4%

      \[\leadsto \color{blue}{\log 0.421875 + z0 \cdot \left(3 + z0 \cdot \left(1.5 + z0\right)\right)} \]
    7. Step-by-step derivation
      1. lift-+.f64N/A

        \[\leadsto \log \frac{27}{64} + \color{blue}{z0 \cdot \left(3 + z0 \cdot \left(\frac{3}{2} + z0\right)\right)} \]
      2. +-commutativeN/A

        \[\leadsto z0 \cdot \left(3 + z0 \cdot \left(\frac{3}{2} + z0\right)\right) + \color{blue}{\log \frac{27}{64}} \]
      3. add-flipN/A

        \[\leadsto z0 \cdot \left(3 + z0 \cdot \left(\frac{3}{2} + z0\right)\right) - \color{blue}{\left(\mathsf{neg}\left(\log \frac{27}{64}\right)\right)} \]
      4. lift-log.f64N/A

        \[\leadsto z0 \cdot \left(3 + z0 \cdot \left(\frac{3}{2} + z0\right)\right) - \left(\mathsf{neg}\left(\log \frac{27}{64}\right)\right) \]
      5. neg-logN/A

        \[\leadsto z0 \cdot \left(3 + z0 \cdot \left(\frac{3}{2} + z0\right)\right) - \log \left(\frac{1}{\frac{27}{64}}\right) \]
      6. metadata-evalN/A

        \[\leadsto z0 \cdot \left(3 + z0 \cdot \left(\frac{3}{2} + z0\right)\right) - \log \frac{64}{27} \]
      7. lift-log.f64N/A

        \[\leadsto z0 \cdot \left(3 + z0 \cdot \left(\frac{3}{2} + z0\right)\right) - \log \frac{64}{27} \]
      8. lower--.f6467.4%

        \[\leadsto z0 \cdot \left(3 + z0 \cdot \left(1.5 + z0\right)\right) - \color{blue}{\log 2.3703703703703702} \]
      9. lift-*.f64N/A

        \[\leadsto z0 \cdot \left(3 + z0 \cdot \left(\frac{3}{2} + z0\right)\right) - \log \color{blue}{\frac{64}{27}} \]
      10. *-commutativeN/A

        \[\leadsto \left(3 + z0 \cdot \left(\frac{3}{2} + z0\right)\right) \cdot z0 - \log \color{blue}{\frac{64}{27}} \]
      11. lower-*.f6467.4%

        \[\leadsto \left(3 + z0 \cdot \left(1.5 + z0\right)\right) \cdot z0 - \log \color{blue}{2.3703703703703702} \]
      12. lift-+.f64N/A

        \[\leadsto \left(3 + z0 \cdot \left(\frac{3}{2} + z0\right)\right) \cdot z0 - \log \frac{64}{27} \]
      13. +-commutativeN/A

        \[\leadsto \left(z0 \cdot \left(\frac{3}{2} + z0\right) + 3\right) \cdot z0 - \log \frac{64}{27} \]
      14. add-flipN/A

        \[\leadsto \left(z0 \cdot \left(\frac{3}{2} + z0\right) - \left(\mathsf{neg}\left(3\right)\right)\right) \cdot z0 - \log \frac{64}{27} \]
      15. metadata-evalN/A

        \[\leadsto \left(z0 \cdot \left(\frac{3}{2} + z0\right) - -3\right) \cdot z0 - \log \frac{64}{27} \]
      16. lower--.f6467.4%

        \[\leadsto \left(z0 \cdot \left(1.5 + z0\right) - -3\right) \cdot z0 - \log 2.3703703703703702 \]
      17. lift-*.f64N/A

        \[\leadsto \left(z0 \cdot \left(\frac{3}{2} + z0\right) - -3\right) \cdot z0 - \log \frac{64}{27} \]
      18. *-commutativeN/A

        \[\leadsto \left(\left(\frac{3}{2} + z0\right) \cdot z0 - -3\right) \cdot z0 - \log \frac{64}{27} \]
      19. lower-*.f6467.4%

        \[\leadsto \left(\left(1.5 + z0\right) \cdot z0 - -3\right) \cdot z0 - \log 2.3703703703703702 \]
      20. lift-+.f64N/A

        \[\leadsto \left(\left(\frac{3}{2} + z0\right) \cdot z0 - -3\right) \cdot z0 - \log \frac{64}{27} \]
      21. +-commutativeN/A

        \[\leadsto \left(\left(z0 + \frac{3}{2}\right) \cdot z0 - -3\right) \cdot z0 - \log \frac{64}{27} \]
      22. add-flipN/A

        \[\leadsto \left(\left(z0 - \left(\mathsf{neg}\left(\frac{3}{2}\right)\right)\right) \cdot z0 - -3\right) \cdot z0 - \log \frac{64}{27} \]
      23. lower--.f64N/A

        \[\leadsto \left(\left(z0 - \left(\mathsf{neg}\left(\frac{3}{2}\right)\right)\right) \cdot z0 - -3\right) \cdot z0 - \log \frac{64}{27} \]
      24. metadata-eval67.4%

        \[\leadsto \left(\left(z0 - -1.5\right) \cdot z0 - -3\right) \cdot z0 - \log 2.3703703703703702 \]
    8. Applied rewrites67.4%

      \[\leadsto \left(\left(z0 - -1.5\right) \cdot z0 - -3\right) \cdot z0 - \color{blue}{\log 2.3703703703703702} \]
    9. Evaluated real constant68.4%

      \[\leadsto \left(\left(z0 - -1.5\right) \cdot z0 - -3\right) \cdot z0 - 0.8630462173553428 \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 6: 80.3% accurate, 1.0× speedup?

\[\begin{array}{l} \mathbf{if}\;z0 \leq -5.4 \cdot 10^{+101}:\\ \;\;\;\;-0.8630462173553428\\ \mathbf{elif}\;z0 \leq -0.84:\\ \;\;\;\;-\log \left(\left(\left(z0 \cdot z0\right) \cdot \left(-z0\right)\right) \cdot 2.3703703703703702\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(z0 - -1.5\right) \cdot z0 - -3\right) \cdot z0 - 0.8630462173553428\\ \end{array} \]
(FPCore (z0)
  :precision binary64
  (if (<= z0 -5.4e+101)
  -0.8630462173553428
  (if (<= z0 -0.84)
    (- (log (* (* (* z0 z0) (- z0)) 2.3703703703703702)))
    (- (* (- (* (- z0 -1.5) z0) -3.0) z0) 0.8630462173553428))))
double code(double z0) {
	double tmp;
	if (z0 <= -5.4e+101) {
		tmp = -0.8630462173553428;
	} else if (z0 <= -0.84) {
		tmp = -log((((z0 * z0) * -z0) * 2.3703703703703702));
	} else {
		tmp = ((((z0 - -1.5) * z0) - -3.0) * z0) - 0.8630462173553428;
	}
	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) :: tmp
    if (z0 <= (-5.4d+101)) then
        tmp = -0.8630462173553428d0
    else if (z0 <= (-0.84d0)) then
        tmp = -log((((z0 * z0) * -z0) * 2.3703703703703702d0))
    else
        tmp = ((((z0 - (-1.5d0)) * z0) - (-3.0d0)) * z0) - 0.8630462173553428d0
    end if
    code = tmp
end function
public static double code(double z0) {
	double tmp;
	if (z0 <= -5.4e+101) {
		tmp = -0.8630462173553428;
	} else if (z0 <= -0.84) {
		tmp = -Math.log((((z0 * z0) * -z0) * 2.3703703703703702));
	} else {
		tmp = ((((z0 - -1.5) * z0) - -3.0) * z0) - 0.8630462173553428;
	}
	return tmp;
}
def code(z0):
	tmp = 0
	if z0 <= -5.4e+101:
		tmp = -0.8630462173553428
	elif z0 <= -0.84:
		tmp = -math.log((((z0 * z0) * -z0) * 2.3703703703703702))
	else:
		tmp = ((((z0 - -1.5) * z0) - -3.0) * z0) - 0.8630462173553428
	return tmp
function code(z0)
	tmp = 0.0
	if (z0 <= -5.4e+101)
		tmp = -0.8630462173553428;
	elseif (z0 <= -0.84)
		tmp = Float64(-log(Float64(Float64(Float64(z0 * z0) * Float64(-z0)) * 2.3703703703703702)));
	else
		tmp = Float64(Float64(Float64(Float64(Float64(z0 - -1.5) * z0) - -3.0) * z0) - 0.8630462173553428);
	end
	return tmp
end
function tmp_2 = code(z0)
	tmp = 0.0;
	if (z0 <= -5.4e+101)
		tmp = -0.8630462173553428;
	elseif (z0 <= -0.84)
		tmp = -log((((z0 * z0) * -z0) * 2.3703703703703702));
	else
		tmp = ((((z0 - -1.5) * z0) - -3.0) * z0) - 0.8630462173553428;
	end
	tmp_2 = tmp;
end
code[z0_] := If[LessEqual[z0, -5.4e+101], -0.8630462173553428, If[LessEqual[z0, -0.84], (-N[Log[N[(N[(N[(z0 * z0), $MachinePrecision] * (-z0)), $MachinePrecision] * 2.3703703703703702), $MachinePrecision]], $MachinePrecision]), N[(N[(N[(N[(N[(z0 - -1.5), $MachinePrecision] * z0), $MachinePrecision] - -3.0), $MachinePrecision] * z0), $MachinePrecision] - 0.8630462173553428), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;z0 \leq -5.4 \cdot 10^{+101}:\\
\;\;\;\;-0.8630462173553428\\

\mathbf{elif}\;z0 \leq -0.84:\\
\;\;\;\;-\log \left(\left(\left(z0 \cdot z0\right) \cdot \left(-z0\right)\right) \cdot 2.3703703703703702\right)\\

\mathbf{else}:\\
\;\;\;\;\left(\left(z0 - -1.5\right) \cdot z0 - -3\right) \cdot z0 - 0.8630462173553428\\


\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z0 < -5.4000000000000001e101

    1. Initial program 79.1%

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

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

        \[\leadsto \log \frac{27}{64} + \color{blue}{z0 \cdot \left(3 + \frac{3}{2} \cdot z0\right)} \]
      2. lower-log.f64N/A

        \[\leadsto \log \frac{27}{64} + \color{blue}{z0} \cdot \left(3 + \frac{3}{2} \cdot z0\right) \]
      3. lower-*.f64N/A

        \[\leadsto \log \frac{27}{64} + z0 \cdot \color{blue}{\left(3 + \frac{3}{2} \cdot z0\right)} \]
      4. lower-+.f64N/A

        \[\leadsto \log \frac{27}{64} + z0 \cdot \left(3 + \color{blue}{\frac{3}{2} \cdot z0}\right) \]
      5. lower-*.f6467.3%

        \[\leadsto \log 0.421875 + z0 \cdot \left(3 + 1.5 \cdot \color{blue}{z0}\right) \]
    4. Applied rewrites67.3%

      \[\leadsto \color{blue}{\log 0.421875 + z0 \cdot \left(3 + 1.5 \cdot z0\right)} \]
    5. Evaluated real constant67.3%

      \[\leadsto -0.8630462173553428 + \color{blue}{z0} \cdot \left(3 + 1.5 \cdot z0\right) \]
    6. Taylor expanded in z0 around 0

      \[\leadsto \frac{-1943407311442519}{2251799813685248} \]
    7. Step-by-step derivation
      1. Applied rewrites70.4%

        \[\leadsto -0.8630462173553428 \]

      if -5.4000000000000001e101 < z0 < -0.83999999999999997

      1. Initial program 79.1%

        \[\log \left(\frac{-0.421875}{\left(\left(1 - z0\right) \cdot \left(1 - z0\right)\right) \cdot \left(z0 - 1\right)}\right) \]
      2. Taylor expanded in z0 around -inf

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

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

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

          \[\leadsto \log \frac{27}{64} + 3 \cdot \color{blue}{\log \left(\frac{-1}{z0}\right)} \]
        4. lower-log.f64N/A

          \[\leadsto \log \frac{27}{64} + 3 \cdot \log \left(\frac{-1}{z0}\right) \]
        5. lower-/.f6432.3%

          \[\leadsto \log 0.421875 + 3 \cdot \log \left(\frac{-1}{z0}\right) \]
      4. Applied rewrites32.3%

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

          \[\leadsto \log \frac{27}{64} + \color{blue}{3 \cdot \log \left(\frac{-1}{z0}\right)} \]
        2. lift-*.f64N/A

          \[\leadsto \log \frac{27}{64} + 3 \cdot \color{blue}{\log \left(\frac{-1}{z0}\right)} \]
        3. fp-cancel-sign-sub-invN/A

          \[\leadsto \log \frac{27}{64} - \color{blue}{\left(\mathsf{neg}\left(3\right)\right) \cdot \log \left(\frac{-1}{z0}\right)} \]
        4. sub-negate-revN/A

          \[\leadsto \mathsf{neg}\left(\left(\left(\mathsf{neg}\left(3\right)\right) \cdot \log \left(\frac{-1}{z0}\right) - \log \frac{27}{64}\right)\right) \]
        5. lower-neg.f64N/A

          \[\leadsto -\left(\left(\mathsf{neg}\left(3\right)\right) \cdot \log \left(\frac{-1}{z0}\right) - \log \frac{27}{64}\right) \]
        6. sub-flipN/A

          \[\leadsto -\left(\left(\mathsf{neg}\left(3\right)\right) \cdot \log \left(\frac{-1}{z0}\right) + \left(\mathsf{neg}\left(\log \frac{27}{64}\right)\right)\right) \]
        7. distribute-lft-neg-outN/A

          \[\leadsto -\left(\left(\mathsf{neg}\left(3 \cdot \log \left(\frac{-1}{z0}\right)\right)\right) + \left(\mathsf{neg}\left(\log \frac{27}{64}\right)\right)\right) \]
        8. lift-log.f64N/A

          \[\leadsto -\left(\left(\mathsf{neg}\left(3 \cdot \log \left(\frac{-1}{z0}\right)\right)\right) + \left(\mathsf{neg}\left(\log \frac{27}{64}\right)\right)\right) \]
        9. log-pow-revN/A

          \[\leadsto -\left(\left(\mathsf{neg}\left(\log \left({\left(\frac{-1}{z0}\right)}^{3}\right)\right)\right) + \left(\mathsf{neg}\left(\log \frac{27}{64}\right)\right)\right) \]
        10. neg-logN/A

          \[\leadsto -\left(\log \left(\frac{1}{{\left(\frac{-1}{z0}\right)}^{3}}\right) + \left(\mathsf{neg}\left(\log \frac{27}{64}\right)\right)\right) \]
        11. lift-log.f64N/A

          \[\leadsto -\left(\log \left(\frac{1}{{\left(\frac{-1}{z0}\right)}^{3}}\right) + \left(\mathsf{neg}\left(\log \frac{27}{64}\right)\right)\right) \]
        12. neg-logN/A

          \[\leadsto -\left(\log \left(\frac{1}{{\left(\frac{-1}{z0}\right)}^{3}}\right) + \log \left(\frac{1}{\frac{27}{64}}\right)\right) \]
        13. sum-logN/A

          \[\leadsto -\log \left(\frac{1}{{\left(\frac{-1}{z0}\right)}^{3}} \cdot \frac{1}{\frac{27}{64}}\right) \]
        14. lower-log.f64N/A

          \[\leadsto -\log \left(\frac{1}{{\left(\frac{-1}{z0}\right)}^{3}} \cdot \frac{1}{\frac{27}{64}}\right) \]
        15. lower-*.f64N/A

          \[\leadsto -\log \left(\frac{1}{{\left(\frac{-1}{z0}\right)}^{3}} \cdot \frac{1}{\frac{27}{64}}\right) \]
      6. Applied rewrites11.5%

        \[\leadsto -\log \left(\left(\left(z0 \cdot z0\right) \cdot \left(-z0\right)\right) \cdot 2.3703703703703702\right) \]

      if -0.83999999999999997 < z0

      1. Initial program 79.1%

        \[\log \left(\frac{-0.421875}{\left(\left(1 - z0\right) \cdot \left(1 - z0\right)\right) \cdot \left(z0 - 1\right)}\right) \]
      2. Step-by-step derivation
        1. lift-log.f64N/A

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

          \[\leadsto \log \color{blue}{\left(\frac{\frac{-27}{64}}{\left(\left(1 - z0\right) \cdot \left(1 - z0\right)\right) \cdot \left(z0 - 1\right)}\right)} \]
        3. lift-*.f64N/A

          \[\leadsto \log \left(\frac{\frac{-27}{64}}{\color{blue}{\left(\left(1 - z0\right) \cdot \left(1 - z0\right)\right) \cdot \left(z0 - 1\right)}}\right) \]
        4. associate-/r*N/A

          \[\leadsto \log \color{blue}{\left(\frac{\frac{\frac{-27}{64}}{\left(1 - z0\right) \cdot \left(1 - z0\right)}}{z0 - 1}\right)} \]
        5. frac-2negN/A

          \[\leadsto \log \color{blue}{\left(\frac{\mathsf{neg}\left(\frac{\frac{-27}{64}}{\left(1 - z0\right) \cdot \left(1 - z0\right)}\right)}{\mathsf{neg}\left(\left(z0 - 1\right)\right)}\right)} \]
        6. lift--.f64N/A

          \[\leadsto \log \left(\frac{\mathsf{neg}\left(\frac{\frac{-27}{64}}{\left(1 - z0\right) \cdot \left(1 - z0\right)}\right)}{\mathsf{neg}\left(\color{blue}{\left(z0 - 1\right)}\right)}\right) \]
        7. sub-negate-revN/A

          \[\leadsto \log \left(\frac{\mathsf{neg}\left(\frac{\frac{-27}{64}}{\left(1 - z0\right) \cdot \left(1 - z0\right)}\right)}{\color{blue}{1 - z0}}\right) \]
        8. lift--.f64N/A

          \[\leadsto \log \left(\frac{\mathsf{neg}\left(\frac{\frac{-27}{64}}{\left(1 - z0\right) \cdot \left(1 - z0\right)}\right)}{\color{blue}{1 - z0}}\right) \]
        9. log-divN/A

          \[\leadsto \color{blue}{\log \left(\mathsf{neg}\left(\frac{\frac{-27}{64}}{\left(1 - z0\right) \cdot \left(1 - z0\right)}\right)\right) - \log \left(1 - z0\right)} \]
        10. lower-unsound--.f64N/A

          \[\leadsto \color{blue}{\log \left(\mathsf{neg}\left(\frac{\frac{-27}{64}}{\left(1 - z0\right) \cdot \left(1 - z0\right)}\right)\right) - \log \left(1 - z0\right)} \]
      3. Applied rewrites84.6%

        \[\leadsto \color{blue}{\log \left(\frac{0.421875}{\left(z0 - 1\right) \cdot \left(z0 - 1\right)}\right) - \log \left(1 - z0\right)} \]
      4. Taylor expanded in z0 around 0

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

          \[\leadsto \log \frac{27}{64} + \color{blue}{z0 \cdot \left(3 + z0 \cdot \left(\frac{3}{2} + z0\right)\right)} \]
        2. lower-log.f64N/A

          \[\leadsto \log \frac{27}{64} + \color{blue}{z0} \cdot \left(3 + z0 \cdot \left(\frac{3}{2} + z0\right)\right) \]
        3. lower-*.f64N/A

          \[\leadsto \log \frac{27}{64} + z0 \cdot \color{blue}{\left(3 + z0 \cdot \left(\frac{3}{2} + z0\right)\right)} \]
        4. lower-+.f64N/A

          \[\leadsto \log \frac{27}{64} + z0 \cdot \left(3 + \color{blue}{z0 \cdot \left(\frac{3}{2} + z0\right)}\right) \]
        5. lower-*.f64N/A

          \[\leadsto \log \frac{27}{64} + z0 \cdot \left(3 + z0 \cdot \color{blue}{\left(\frac{3}{2} + z0\right)}\right) \]
        6. lower-+.f6468.4%

          \[\leadsto \log 0.421875 + z0 \cdot \left(3 + z0 \cdot \left(1.5 + \color{blue}{z0}\right)\right) \]
      6. Applied rewrites68.4%

        \[\leadsto \color{blue}{\log 0.421875 + z0 \cdot \left(3 + z0 \cdot \left(1.5 + z0\right)\right)} \]
      7. Step-by-step derivation
        1. lift-+.f64N/A

          \[\leadsto \log \frac{27}{64} + \color{blue}{z0 \cdot \left(3 + z0 \cdot \left(\frac{3}{2} + z0\right)\right)} \]
        2. +-commutativeN/A

          \[\leadsto z0 \cdot \left(3 + z0 \cdot \left(\frac{3}{2} + z0\right)\right) + \color{blue}{\log \frac{27}{64}} \]
        3. add-flipN/A

          \[\leadsto z0 \cdot \left(3 + z0 \cdot \left(\frac{3}{2} + z0\right)\right) - \color{blue}{\left(\mathsf{neg}\left(\log \frac{27}{64}\right)\right)} \]
        4. lift-log.f64N/A

          \[\leadsto z0 \cdot \left(3 + z0 \cdot \left(\frac{3}{2} + z0\right)\right) - \left(\mathsf{neg}\left(\log \frac{27}{64}\right)\right) \]
        5. neg-logN/A

          \[\leadsto z0 \cdot \left(3 + z0 \cdot \left(\frac{3}{2} + z0\right)\right) - \log \left(\frac{1}{\frac{27}{64}}\right) \]
        6. metadata-evalN/A

          \[\leadsto z0 \cdot \left(3 + z0 \cdot \left(\frac{3}{2} + z0\right)\right) - \log \frac{64}{27} \]
        7. lift-log.f64N/A

          \[\leadsto z0 \cdot \left(3 + z0 \cdot \left(\frac{3}{2} + z0\right)\right) - \log \frac{64}{27} \]
        8. lower--.f6467.4%

          \[\leadsto z0 \cdot \left(3 + z0 \cdot \left(1.5 + z0\right)\right) - \color{blue}{\log 2.3703703703703702} \]
        9. lift-*.f64N/A

          \[\leadsto z0 \cdot \left(3 + z0 \cdot \left(\frac{3}{2} + z0\right)\right) - \log \color{blue}{\frac{64}{27}} \]
        10. *-commutativeN/A

          \[\leadsto \left(3 + z0 \cdot \left(\frac{3}{2} + z0\right)\right) \cdot z0 - \log \color{blue}{\frac{64}{27}} \]
        11. lower-*.f6467.4%

          \[\leadsto \left(3 + z0 \cdot \left(1.5 + z0\right)\right) \cdot z0 - \log \color{blue}{2.3703703703703702} \]
        12. lift-+.f64N/A

          \[\leadsto \left(3 + z0 \cdot \left(\frac{3}{2} + z0\right)\right) \cdot z0 - \log \frac{64}{27} \]
        13. +-commutativeN/A

          \[\leadsto \left(z0 \cdot \left(\frac{3}{2} + z0\right) + 3\right) \cdot z0 - \log \frac{64}{27} \]
        14. add-flipN/A

          \[\leadsto \left(z0 \cdot \left(\frac{3}{2} + z0\right) - \left(\mathsf{neg}\left(3\right)\right)\right) \cdot z0 - \log \frac{64}{27} \]
        15. metadata-evalN/A

          \[\leadsto \left(z0 \cdot \left(\frac{3}{2} + z0\right) - -3\right) \cdot z0 - \log \frac{64}{27} \]
        16. lower--.f6467.4%

          \[\leadsto \left(z0 \cdot \left(1.5 + z0\right) - -3\right) \cdot z0 - \log 2.3703703703703702 \]
        17. lift-*.f64N/A

          \[\leadsto \left(z0 \cdot \left(\frac{3}{2} + z0\right) - -3\right) \cdot z0 - \log \frac{64}{27} \]
        18. *-commutativeN/A

          \[\leadsto \left(\left(\frac{3}{2} + z0\right) \cdot z0 - -3\right) \cdot z0 - \log \frac{64}{27} \]
        19. lower-*.f6467.4%

          \[\leadsto \left(\left(1.5 + z0\right) \cdot z0 - -3\right) \cdot z0 - \log 2.3703703703703702 \]
        20. lift-+.f64N/A

          \[\leadsto \left(\left(\frac{3}{2} + z0\right) \cdot z0 - -3\right) \cdot z0 - \log \frac{64}{27} \]
        21. +-commutativeN/A

          \[\leadsto \left(\left(z0 + \frac{3}{2}\right) \cdot z0 - -3\right) \cdot z0 - \log \frac{64}{27} \]
        22. add-flipN/A

          \[\leadsto \left(\left(z0 - \left(\mathsf{neg}\left(\frac{3}{2}\right)\right)\right) \cdot z0 - -3\right) \cdot z0 - \log \frac{64}{27} \]
        23. lower--.f64N/A

          \[\leadsto \left(\left(z0 - \left(\mathsf{neg}\left(\frac{3}{2}\right)\right)\right) \cdot z0 - -3\right) \cdot z0 - \log \frac{64}{27} \]
        24. metadata-eval67.4%

          \[\leadsto \left(\left(z0 - -1.5\right) \cdot z0 - -3\right) \cdot z0 - \log 2.3703703703703702 \]
      8. Applied rewrites67.4%

        \[\leadsto \left(\left(z0 - -1.5\right) \cdot z0 - -3\right) \cdot z0 - \color{blue}{\log 2.3703703703703702} \]
      9. Evaluated real constant68.4%

        \[\leadsto \left(\left(z0 - -1.5\right) \cdot z0 - -3\right) \cdot z0 - 0.8630462173553428 \]
    8. Recombined 3 regimes into one program.
    9. Add Preprocessing

    Alternative 7: 70.4% accurate, 131.0× speedup?

    \[-0.8630462173553428 \]
    (FPCore (z0)
      :precision binary64
      -0.8630462173553428)
    double code(double z0) {
    	return -0.8630462173553428;
    }
    
    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 = -0.8630462173553428d0
    end function
    
    public static double code(double z0) {
    	return -0.8630462173553428;
    }
    
    def code(z0):
    	return -0.8630462173553428
    
    function code(z0)
    	return -0.8630462173553428
    end
    
    function tmp = code(z0)
    	tmp = -0.8630462173553428;
    end
    
    code[z0_] := -0.8630462173553428
    
    -0.8630462173553428
    
    Derivation
    1. Initial program 79.1%

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

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

        \[\leadsto \log \frac{27}{64} + \color{blue}{z0 \cdot \left(3 + \frac{3}{2} \cdot z0\right)} \]
      2. lower-log.f64N/A

        \[\leadsto \log \frac{27}{64} + \color{blue}{z0} \cdot \left(3 + \frac{3}{2} \cdot z0\right) \]
      3. lower-*.f64N/A

        \[\leadsto \log \frac{27}{64} + z0 \cdot \color{blue}{\left(3 + \frac{3}{2} \cdot z0\right)} \]
      4. lower-+.f64N/A

        \[\leadsto \log \frac{27}{64} + z0 \cdot \left(3 + \color{blue}{\frac{3}{2} \cdot z0}\right) \]
      5. lower-*.f6467.3%

        \[\leadsto \log 0.421875 + z0 \cdot \left(3 + 1.5 \cdot \color{blue}{z0}\right) \]
    4. Applied rewrites67.3%

      \[\leadsto \color{blue}{\log 0.421875 + z0 \cdot \left(3 + 1.5 \cdot z0\right)} \]
    5. Evaluated real constant67.3%

      \[\leadsto -0.8630462173553428 + \color{blue}{z0} \cdot \left(3 + 1.5 \cdot z0\right) \]
    6. Taylor expanded in z0 around 0

      \[\leadsto \frac{-1943407311442519}{2251799813685248} \]
    7. Step-by-step derivation
      1. Applied rewrites70.4%

        \[\leadsto -0.8630462173553428 \]
      2. Add Preprocessing

      Reproduce

      ?
      herbie shell --seed 2025250 
      (FPCore (z0)
        :name "(log (/ -27/64 (* (* (- 1 z0) (- 1 z0)) (- z0 1))))"
        :precision binary64
        (log (/ -0.421875 (* (* (- 1.0 z0) (- 1.0 z0)) (- z0 1.0)))))