(- (sqrt PI) (* (- 3/2 (* 1/2 z0)) z0))

Percentage Accurate: 99.2% → 100.0%
Time: 1.1s
Alternatives: 5
Speedup: 1.6×

Specification

?
\[\sqrt{\pi} - \left(1.5 - 0.5 \cdot z0\right) \cdot z0 \]
(FPCore (z0)
  :precision binary64
  (- (sqrt PI) (* (- 1.5 (* 0.5 z0)) z0)))
double code(double z0) {
	return sqrt(((double) M_PI)) - ((1.5 - (0.5 * z0)) * z0);
}
public static double code(double z0) {
	return Math.sqrt(Math.PI) - ((1.5 - (0.5 * z0)) * z0);
}
def code(z0):
	return math.sqrt(math.pi) - ((1.5 - (0.5 * z0)) * z0)
function code(z0)
	return Float64(sqrt(pi) - Float64(Float64(1.5 - Float64(0.5 * z0)) * z0))
end
function tmp = code(z0)
	tmp = sqrt(pi) - ((1.5 - (0.5 * z0)) * z0);
end
code[z0_] := N[(N[Sqrt[Pi], $MachinePrecision] - N[(N[(1.5 - N[(0.5 * z0), $MachinePrecision]), $MachinePrecision] * z0), $MachinePrecision]), $MachinePrecision]
\sqrt{\pi} - \left(1.5 - 0.5 \cdot z0\right) \cdot z0

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

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

Initial Program: 99.2% accurate, 1.0× speedup?

\[\sqrt{\pi} - \left(1.5 - 0.5 \cdot z0\right) \cdot z0 \]
(FPCore (z0)
  :precision binary64
  (- (sqrt PI) (* (- 1.5 (* 0.5 z0)) z0)))
double code(double z0) {
	return sqrt(((double) M_PI)) - ((1.5 - (0.5 * z0)) * z0);
}
public static double code(double z0) {
	return Math.sqrt(Math.PI) - ((1.5 - (0.5 * z0)) * z0);
}
def code(z0):
	return math.sqrt(math.pi) - ((1.5 - (0.5 * z0)) * z0)
function code(z0)
	return Float64(sqrt(pi) - Float64(Float64(1.5 - Float64(0.5 * z0)) * z0))
end
function tmp = code(z0)
	tmp = sqrt(pi) - ((1.5 - (0.5 * z0)) * z0);
end
code[z0_] := N[(N[Sqrt[Pi], $MachinePrecision] - N[(N[(1.5 - N[(0.5 * z0), $MachinePrecision]), $MachinePrecision] * z0), $MachinePrecision]), $MachinePrecision]
\sqrt{\pi} - \left(1.5 - 0.5 \cdot z0\right) \cdot z0

Alternative 1: 100.0% accurate, 1.2× speedup?

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

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

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

    \[\sqrt{\pi} - \left(1.5 - 0.5 \cdot z0\right) \cdot z0 \]
  2. Evaluated real constant100.0%

    \[\leadsto \color{blue}{1.772453850905516} - \left(1.5 - 0.5 \cdot z0\right) \cdot z0 \]
  3. Step-by-step derivation
    1. lift-*.f64N/A

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

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

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

      \[\leadsto \frac{7982422502469483}{4503599627370496} - z0 \cdot \left(\frac{3}{2} - \color{blue}{\frac{1}{2} \cdot z0}\right) \]
    5. fp-cancel-sub-sign-invN/A

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

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

      \[\leadsto \frac{7982422502469483}{4503599627370496} - z0 \cdot \left(\frac{3}{2} + \color{blue}{\frac{-1}{2} \cdot z0}\right) \]
    8. distribute-rgt-outN/A

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

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

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

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

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

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

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

      \[\leadsto \frac{7982422502469483}{4503599627370496} - \left(\left(\frac{-1}{2} \cdot z0\right) \cdot z0 - \left(\mathsf{neg}\left(\color{blue}{z0 \cdot \frac{3}{2}}\right)\right)\right) \]
    16. *-commutativeN/A

      \[\leadsto \frac{7982422502469483}{4503599627370496} - \left(\left(\frac{-1}{2} \cdot z0\right) \cdot z0 - \left(\mathsf{neg}\left(\color{blue}{\frac{3}{2} \cdot z0}\right)\right)\right) \]
    17. distribute-lft-neg-inN/A

      \[\leadsto \frac{7982422502469483}{4503599627370496} - \left(\left(\frac{-1}{2} \cdot z0\right) \cdot z0 - \color{blue}{\left(\mathsf{neg}\left(\frac{3}{2}\right)\right) \cdot z0}\right) \]
    18. metadata-evalN/A

      \[\leadsto \frac{7982422502469483}{4503599627370496} - \left(\left(\frac{-1}{2} \cdot z0\right) \cdot z0 - \color{blue}{\frac{-3}{2}} \cdot z0\right) \]
    19. lower-*.f64100.0%

      \[\leadsto 1.772453850905516 - \left(\left(-0.5 \cdot z0\right) \cdot z0 - \color{blue}{-1.5 \cdot z0}\right) \]
  4. Applied rewrites100.0%

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

Alternative 2: 100.0% accurate, 1.6× speedup?

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

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

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

    \[\sqrt{\pi} - \left(1.5 - 0.5 \cdot z0\right) \cdot z0 \]
  2. Evaluated real constant100.0%

    \[\leadsto \color{blue}{1.772453850905516} - \left(1.5 - 0.5 \cdot z0\right) \cdot z0 \]
  3. Add Preprocessing

Alternative 3: 97.9% accurate, 1.9× speedup?

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

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

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

    \[\sqrt{\pi} - \left(1.5 - 0.5 \cdot z0\right) \cdot z0 \]
  2. Evaluated real constant100.0%

    \[\leadsto \color{blue}{1.772453850905516} - \left(1.5 - 0.5 \cdot z0\right) \cdot z0 \]
  3. Step-by-step derivation
    1. lift-*.f64N/A

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

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

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

      \[\leadsto \frac{7982422502469483}{4503599627370496} - z0 \cdot \left(\frac{3}{2} - \color{blue}{\frac{1}{2} \cdot z0}\right) \]
    5. fp-cancel-sub-sign-invN/A

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

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

      \[\leadsto \frac{7982422502469483}{4503599627370496} - z0 \cdot \left(\frac{3}{2} + \color{blue}{\frac{-1}{2} \cdot z0}\right) \]
    8. distribute-rgt-outN/A

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

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

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

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

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

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

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

      \[\leadsto \frac{7982422502469483}{4503599627370496} - \left(\left(\frac{-1}{2} \cdot z0\right) \cdot z0 - \left(\mathsf{neg}\left(\color{blue}{z0 \cdot \frac{3}{2}}\right)\right)\right) \]
    16. *-commutativeN/A

      \[\leadsto \frac{7982422502469483}{4503599627370496} - \left(\left(\frac{-1}{2} \cdot z0\right) \cdot z0 - \left(\mathsf{neg}\left(\color{blue}{\frac{3}{2} \cdot z0}\right)\right)\right) \]
    17. distribute-lft-neg-inN/A

      \[\leadsto \frac{7982422502469483}{4503599627370496} - \left(\left(\frac{-1}{2} \cdot z0\right) \cdot z0 - \color{blue}{\left(\mathsf{neg}\left(\frac{3}{2}\right)\right) \cdot z0}\right) \]
    18. metadata-evalN/A

      \[\leadsto \frac{7982422502469483}{4503599627370496} - \left(\left(\frac{-1}{2} \cdot z0\right) \cdot z0 - \color{blue}{\frac{-3}{2}} \cdot z0\right) \]
    19. lower-*.f64100.0%

      \[\leadsto 1.772453850905516 - \left(\left(-0.5 \cdot z0\right) \cdot z0 - \color{blue}{-1.5 \cdot z0}\right) \]
  4. Applied rewrites100.0%

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

      \[\leadsto \color{blue}{\frac{7982422502469483}{4503599627370496} - \left(\left(\frac{-1}{2} \cdot z0\right) \cdot z0 - \frac{-3}{2} \cdot z0\right)} \]
    2. sub-negate-revN/A

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

      \[\leadsto \mathsf{neg}\left(\left(\color{blue}{\left(\left(\frac{-1}{2} \cdot z0\right) \cdot z0 - \frac{-3}{2} \cdot z0\right)} - \frac{7982422502469483}{4503599627370496}\right)\right) \]
    4. associate--l-N/A

      \[\leadsto \mathsf{neg}\left(\color{blue}{\left(\left(\frac{-1}{2} \cdot z0\right) \cdot z0 - \left(\frac{-3}{2} \cdot z0 + \frac{7982422502469483}{4503599627370496}\right)\right)}\right) \]
    5. sub-negateN/A

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

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

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

      \[\leadsto \color{blue}{\left(\frac{-3}{2} \cdot z0 - \left(\mathsf{neg}\left(\frac{7982422502469483}{4503599627370496}\right)\right)\right)} - \left(\frac{-1}{2} \cdot z0\right) \cdot z0 \]
    9. metadata-eval100.0%

      \[\leadsto \left(-1.5 \cdot z0 - \color{blue}{-1.772453850905516}\right) - \left(-0.5 \cdot z0\right) \cdot z0 \]
  6. Applied rewrites100.0%

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

    \[\leadsto \color{blue}{\frac{7982422502469483}{4503599627370496}} - \left(-0.5 \cdot z0\right) \cdot z0 \]
  8. Step-by-step derivation
    1. Applied rewrites97.9%

      \[\leadsto \color{blue}{1.772453850905516} - \left(-0.5 \cdot z0\right) \cdot z0 \]
    2. Add Preprocessing

    Alternative 4: 52.1% accurate, 3.0× speedup?

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

      \[\sqrt{\pi} - \left(1.5 - 0.5 \cdot z0\right) \cdot z0 \]
    2. Evaluated real constant100.0%

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

      \[\leadsto 1.772453850905516 - \color{blue}{\frac{3}{2}} \cdot z0 \]
    4. Step-by-step derivation
      1. Applied rewrites52.1%

        \[\leadsto 1.772453850905516 - \color{blue}{1.5} \cdot z0 \]
      2. Add Preprocessing

      Alternative 5: 51.8% accurate, 27.0× speedup?

      \[1.772453850905516 \]
      (FPCore (z0)
        :precision binary64
        1.772453850905516)
      double code(double z0) {
      	return 1.772453850905516;
      }
      
      module fmin_fmax_functions
          implicit none
          private
          public fmax
          public fmin
      
          interface fmax
              module procedure fmax88
              module procedure fmax44
              module procedure fmax84
              module procedure fmax48
          end interface
          interface fmin
              module procedure fmin88
              module procedure fmin44
              module procedure fmin84
              module procedure fmin48
          end interface
      contains
          real(8) function fmax88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(4) function fmax44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(8) function fmax84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmax48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
          end function
          real(8) function fmin88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(4) function fmin44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(8) function fmin84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmin48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
          end function
      end module
      
      real(8) function code(z0)
      use fmin_fmax_functions
          real(8), intent (in) :: z0
          code = 1.772453850905516d0
      end function
      
      public static double code(double z0) {
      	return 1.772453850905516;
      }
      
      def code(z0):
      	return 1.772453850905516
      
      function code(z0)
      	return 1.772453850905516
      end
      
      function tmp = code(z0)
      	tmp = 1.772453850905516;
      end
      
      code[z0_] := 1.772453850905516
      
      1.772453850905516
      
      Derivation
      1. Initial program 99.2%

        \[\sqrt{\pi} - \left(1.5 - 0.5 \cdot z0\right) \cdot z0 \]
      2. Evaluated real constant100.0%

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

        \[\leadsto \color{blue}{\frac{7982422502469483}{4503599627370496}} \]
      4. Step-by-step derivation
        1. Applied rewrites51.8%

          \[\leadsto \color{blue}{1.772453850905516} \]
        2. Add Preprocessing

        Reproduce

        ?
        herbie shell --seed 2025250 
        (FPCore (z0)
          :name "(- (sqrt PI) (* (- 3/2 (* 1/2 z0)) z0))"
          :precision binary64
          (- (sqrt PI) (* (- 1.5 (* 0.5 z0)) z0)))