
(FPCore (z1 z0) :precision binary64 (/ (sqrt PI) (- (/ (sqrt (- (- 1.0 z1) z1)) (* (exp (* z1 z1)) z1)) (* (- -1.0 z0) (sqrt PI)))))
double code(double z1, double z0) {
return sqrt(((double) M_PI)) / ((sqrt(((1.0 - z1) - z1)) / (exp((z1 * z1)) * z1)) - ((-1.0 - z0) * sqrt(((double) M_PI))));
}
public static double code(double z1, double z0) {
return Math.sqrt(Math.PI) / ((Math.sqrt(((1.0 - z1) - z1)) / (Math.exp((z1 * z1)) * z1)) - ((-1.0 - z0) * Math.sqrt(Math.PI)));
}
def code(z1, z0): return math.sqrt(math.pi) / ((math.sqrt(((1.0 - z1) - z1)) / (math.exp((z1 * z1)) * z1)) - ((-1.0 - z0) * math.sqrt(math.pi)))
function code(z1, z0) return Float64(sqrt(pi) / Float64(Float64(sqrt(Float64(Float64(1.0 - z1) - z1)) / Float64(exp(Float64(z1 * z1)) * z1)) - Float64(Float64(-1.0 - z0) * sqrt(pi)))) end
function tmp = code(z1, z0) tmp = sqrt(pi) / ((sqrt(((1.0 - z1) - z1)) / (exp((z1 * z1)) * z1)) - ((-1.0 - z0) * sqrt(pi))); end
code[z1_, z0_] := N[(N[Sqrt[Pi], $MachinePrecision] / N[(N[(N[Sqrt[N[(N[(1.0 - z1), $MachinePrecision] - z1), $MachinePrecision]], $MachinePrecision] / N[(N[Exp[N[(z1 * z1), $MachinePrecision]], $MachinePrecision] * z1), $MachinePrecision]), $MachinePrecision] - N[(N[(-1.0 - z0), $MachinePrecision] * N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{\sqrt{\pi}}{\frac{\sqrt{\left(1 - z1\right) - z1}}{e^{z1 \cdot z1} \cdot z1} - \left(-1 - z0\right) \cdot \sqrt{\pi}}
Herbie found 7 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (z1 z0) :precision binary64 (/ (sqrt PI) (- (/ (sqrt (- (- 1.0 z1) z1)) (* (exp (* z1 z1)) z1)) (* (- -1.0 z0) (sqrt PI)))))
double code(double z1, double z0) {
return sqrt(((double) M_PI)) / ((sqrt(((1.0 - z1) - z1)) / (exp((z1 * z1)) * z1)) - ((-1.0 - z0) * sqrt(((double) M_PI))));
}
public static double code(double z1, double z0) {
return Math.sqrt(Math.PI) / ((Math.sqrt(((1.0 - z1) - z1)) / (Math.exp((z1 * z1)) * z1)) - ((-1.0 - z0) * Math.sqrt(Math.PI)));
}
def code(z1, z0): return math.sqrt(math.pi) / ((math.sqrt(((1.0 - z1) - z1)) / (math.exp((z1 * z1)) * z1)) - ((-1.0 - z0) * math.sqrt(math.pi)))
function code(z1, z0) return Float64(sqrt(pi) / Float64(Float64(sqrt(Float64(Float64(1.0 - z1) - z1)) / Float64(exp(Float64(z1 * z1)) * z1)) - Float64(Float64(-1.0 - z0) * sqrt(pi)))) end
function tmp = code(z1, z0) tmp = sqrt(pi) / ((sqrt(((1.0 - z1) - z1)) / (exp((z1 * z1)) * z1)) - ((-1.0 - z0) * sqrt(pi))); end
code[z1_, z0_] := N[(N[Sqrt[Pi], $MachinePrecision] / N[(N[(N[Sqrt[N[(N[(1.0 - z1), $MachinePrecision] - z1), $MachinePrecision]], $MachinePrecision] / N[(N[Exp[N[(z1 * z1), $MachinePrecision]], $MachinePrecision] * z1), $MachinePrecision]), $MachinePrecision] - N[(N[(-1.0 - z0), $MachinePrecision] * N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{\sqrt{\pi}}{\frac{\sqrt{\left(1 - z1\right) - z1}}{e^{z1 \cdot z1} \cdot z1} - \left(-1 - z0\right) \cdot \sqrt{\pi}}
(FPCore (z1 z0) :precision binary64 (/ 1.772453850905516 (- (/ (sqrt (- (- 1.0 z1) z1)) (* (exp (* z1 z1)) z1)) (* (- -1.0 z0) 1.772453850905516))))
double code(double z1, double z0) {
return 1.772453850905516 / ((sqrt(((1.0 - z1) - z1)) / (exp((z1 * z1)) * z1)) - ((-1.0 - z0) * 1.772453850905516));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(z1, z0)
use fmin_fmax_functions
real(8), intent (in) :: z1
real(8), intent (in) :: z0
code = 1.772453850905516d0 / ((sqrt(((1.0d0 - z1) - z1)) / (exp((z1 * z1)) * z1)) - (((-1.0d0) - z0) * 1.772453850905516d0))
end function
public static double code(double z1, double z0) {
return 1.772453850905516 / ((Math.sqrt(((1.0 - z1) - z1)) / (Math.exp((z1 * z1)) * z1)) - ((-1.0 - z0) * 1.772453850905516));
}
def code(z1, z0): return 1.772453850905516 / ((math.sqrt(((1.0 - z1) - z1)) / (math.exp((z1 * z1)) * z1)) - ((-1.0 - z0) * 1.772453850905516))
function code(z1, z0) return Float64(1.772453850905516 / Float64(Float64(sqrt(Float64(Float64(1.0 - z1) - z1)) / Float64(exp(Float64(z1 * z1)) * z1)) - Float64(Float64(-1.0 - z0) * 1.772453850905516))) end
function tmp = code(z1, z0) tmp = 1.772453850905516 / ((sqrt(((1.0 - z1) - z1)) / (exp((z1 * z1)) * z1)) - ((-1.0 - z0) * 1.772453850905516)); end
code[z1_, z0_] := N[(1.772453850905516 / N[(N[(N[Sqrt[N[(N[(1.0 - z1), $MachinePrecision] - z1), $MachinePrecision]], $MachinePrecision] / N[(N[Exp[N[(z1 * z1), $MachinePrecision]], $MachinePrecision] * z1), $MachinePrecision]), $MachinePrecision] - N[(N[(-1.0 - z0), $MachinePrecision] * 1.772453850905516), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{1.772453850905516}{\frac{\sqrt{\left(1 - z1\right) - z1}}{e^{z1 \cdot z1} \cdot z1} - \left(-1 - z0\right) \cdot 1.772453850905516}
Initial program 99.3%
Evaluated real constant99.0%
Evaluated real constant99.5%
(FPCore (z1 z0) :precision binary64 (/ 1.0 (- (* (/ 1.0 z1) 0.5641895835477563) (* (- -1.0 z0) 1.0))))
double code(double z1, double z0) {
return 1.0 / (((1.0 / z1) * 0.5641895835477563) - ((-1.0 - z0) * 1.0));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(z1, z0)
use fmin_fmax_functions
real(8), intent (in) :: z1
real(8), intent (in) :: z0
code = 1.0d0 / (((1.0d0 / z1) * 0.5641895835477563d0) - (((-1.0d0) - z0) * 1.0d0))
end function
public static double code(double z1, double z0) {
return 1.0 / (((1.0 / z1) * 0.5641895835477563) - ((-1.0 - z0) * 1.0));
}
def code(z1, z0): return 1.0 / (((1.0 / z1) * 0.5641895835477563) - ((-1.0 - z0) * 1.0))
function code(z1, z0) return Float64(1.0 / Float64(Float64(Float64(1.0 / z1) * 0.5641895835477563) - Float64(Float64(-1.0 - z0) * 1.0))) end
function tmp = code(z1, z0) tmp = 1.0 / (((1.0 / z1) * 0.5641895835477563) - ((-1.0 - z0) * 1.0)); end
code[z1_, z0_] := N[(1.0 / N[(N[(N[(1.0 / z1), $MachinePrecision] * 0.5641895835477563), $MachinePrecision] - N[(N[(-1.0 - z0), $MachinePrecision] * 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{1}{\frac{1}{z1} \cdot 0.5641895835477563 - \left(-1 - z0\right) \cdot 1}
Initial program 99.3%
Taylor expanded in z1 around 0
lower-/.f6498.3%
Applied rewrites98.3%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6498.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6498.4%
Applied rewrites98.4%
Evaluated real constant97.7%
Evaluated real constant98.5%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
mult-flipN/A
lower-*.f64N/A
metadata-evalN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
metadata-evalN/A
lower-*.f6498.6%
Applied rewrites98.6%
(FPCore (z1 z0) :precision binary64 (/ 1.772453850905516 (- (/ 1.0 z1) (* (- -1.0 z0) 1.772453850905516))))
double code(double z1, double z0) {
return 1.772453850905516 / ((1.0 / z1) - ((-1.0 - z0) * 1.772453850905516));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(z1, z0)
use fmin_fmax_functions
real(8), intent (in) :: z1
real(8), intent (in) :: z0
code = 1.772453850905516d0 / ((1.0d0 / z1) - (((-1.0d0) - z0) * 1.772453850905516d0))
end function
public static double code(double z1, double z0) {
return 1.772453850905516 / ((1.0 / z1) - ((-1.0 - z0) * 1.772453850905516));
}
def code(z1, z0): return 1.772453850905516 / ((1.0 / z1) - ((-1.0 - z0) * 1.772453850905516))
function code(z1, z0) return Float64(1.772453850905516 / Float64(Float64(1.0 / z1) - Float64(Float64(-1.0 - z0) * 1.772453850905516))) end
function tmp = code(z1, z0) tmp = 1.772453850905516 / ((1.0 / z1) - ((-1.0 - z0) * 1.772453850905516)); end
code[z1_, z0_] := N[(1.772453850905516 / N[(N[(1.0 / z1), $MachinePrecision] - N[(N[(-1.0 - z0), $MachinePrecision] * 1.772453850905516), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{1.772453850905516}{\frac{1}{z1} - \left(-1 - z0\right) \cdot 1.772453850905516}
Initial program 99.3%
Evaluated real constant99.0%
Evaluated real constant99.5%
Taylor expanded in z1 around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f6473.4%
Applied rewrites73.4%
Taylor expanded in z1 around 0
Applied rewrites85.0%
Taylor expanded in z1 around 0
Applied rewrites98.5%
(FPCore (z1 z0)
:precision binary64
(if (<= z0 -6e+73)
(/ 1.0 z0)
(if (<= z0 1.15e+46)
(*
z1
(+
1.772453850905516
(* 1.772453850905516 (* z1 (+ 1.0 (* -1.772453850905516 z0))))))
(/ 1.0 z0))))double code(double z1, double z0) {
double tmp;
if (z0 <= -6e+73) {
tmp = 1.0 / z0;
} else if (z0 <= 1.15e+46) {
tmp = z1 * (1.772453850905516 + (1.772453850905516 * (z1 * (1.0 + (-1.772453850905516 * z0)))));
} else {
tmp = 1.0 / z0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(z1, z0)
use fmin_fmax_functions
real(8), intent (in) :: z1
real(8), intent (in) :: z0
real(8) :: tmp
if (z0 <= (-6d+73)) then
tmp = 1.0d0 / z0
else if (z0 <= 1.15d+46) then
tmp = z1 * (1.772453850905516d0 + (1.772453850905516d0 * (z1 * (1.0d0 + ((-1.772453850905516d0) * z0)))))
else
tmp = 1.0d0 / z0
end if
code = tmp
end function
public static double code(double z1, double z0) {
double tmp;
if (z0 <= -6e+73) {
tmp = 1.0 / z0;
} else if (z0 <= 1.15e+46) {
tmp = z1 * (1.772453850905516 + (1.772453850905516 * (z1 * (1.0 + (-1.772453850905516 * z0)))));
} else {
tmp = 1.0 / z0;
}
return tmp;
}
def code(z1, z0): tmp = 0 if z0 <= -6e+73: tmp = 1.0 / z0 elif z0 <= 1.15e+46: tmp = z1 * (1.772453850905516 + (1.772453850905516 * (z1 * (1.0 + (-1.772453850905516 * z0))))) else: tmp = 1.0 / z0 return tmp
function code(z1, z0) tmp = 0.0 if (z0 <= -6e+73) tmp = Float64(1.0 / z0); elseif (z0 <= 1.15e+46) tmp = Float64(z1 * Float64(1.772453850905516 + Float64(1.772453850905516 * Float64(z1 * Float64(1.0 + Float64(-1.772453850905516 * z0)))))); else tmp = Float64(1.0 / z0); end return tmp end
function tmp_2 = code(z1, z0) tmp = 0.0; if (z0 <= -6e+73) tmp = 1.0 / z0; elseif (z0 <= 1.15e+46) tmp = z1 * (1.772453850905516 + (1.772453850905516 * (z1 * (1.0 + (-1.772453850905516 * z0))))); else tmp = 1.0 / z0; end tmp_2 = tmp; end
code[z1_, z0_] := If[LessEqual[z0, -6e+73], N[(1.0 / z0), $MachinePrecision], If[LessEqual[z0, 1.15e+46], N[(z1 * N[(1.772453850905516 + N[(1.772453850905516 * N[(z1 * N[(1.0 + N[(-1.772453850905516 * z0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / z0), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;z0 \leq -6 \cdot 10^{+73}:\\
\;\;\;\;\frac{1}{z0}\\
\mathbf{elif}\;z0 \leq 1.15 \cdot 10^{+46}:\\
\;\;\;\;z1 \cdot \left(1.772453850905516 + 1.772453850905516 \cdot \left(z1 \cdot \left(1 + -1.772453850905516 \cdot z0\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{z0}\\
\end{array}
if z0 < -6.0000000000000002e73 or 1.15e46 < z0 Initial program 99.3%
Taylor expanded in z0 around inf
lower-/.f6434.3%
Applied rewrites34.3%
if -6.0000000000000002e73 < z0 < 1.15e46Initial program 99.3%
Evaluated real constant99.0%
Evaluated real constant99.5%
Taylor expanded in z1 around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f6449.8%
Applied rewrites49.8%
Taylor expanded in z0 around inf
lower-*.f6450.0%
Applied rewrites50.0%
(FPCore (z1 z0)
:precision binary64
(if (<= z0 -6e+73)
(/ 1.0 z0)
(if (<= z0 1.15e+46)
(* z1 (+ 1.772453850905516 (* -1.3691388026842775 z1)))
(/ 1.0 z0))))double code(double z1, double z0) {
double tmp;
if (z0 <= -6e+73) {
tmp = 1.0 / z0;
} else if (z0 <= 1.15e+46) {
tmp = z1 * (1.772453850905516 + (-1.3691388026842775 * z1));
} else {
tmp = 1.0 / z0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(z1, z0)
use fmin_fmax_functions
real(8), intent (in) :: z1
real(8), intent (in) :: z0
real(8) :: tmp
if (z0 <= (-6d+73)) then
tmp = 1.0d0 / z0
else if (z0 <= 1.15d+46) then
tmp = z1 * (1.772453850905516d0 + ((-1.3691388026842775d0) * z1))
else
tmp = 1.0d0 / z0
end if
code = tmp
end function
public static double code(double z1, double z0) {
double tmp;
if (z0 <= -6e+73) {
tmp = 1.0 / z0;
} else if (z0 <= 1.15e+46) {
tmp = z1 * (1.772453850905516 + (-1.3691388026842775 * z1));
} else {
tmp = 1.0 / z0;
}
return tmp;
}
def code(z1, z0): tmp = 0 if z0 <= -6e+73: tmp = 1.0 / z0 elif z0 <= 1.15e+46: tmp = z1 * (1.772453850905516 + (-1.3691388026842775 * z1)) else: tmp = 1.0 / z0 return tmp
function code(z1, z0) tmp = 0.0 if (z0 <= -6e+73) tmp = Float64(1.0 / z0); elseif (z0 <= 1.15e+46) tmp = Float64(z1 * Float64(1.772453850905516 + Float64(-1.3691388026842775 * z1))); else tmp = Float64(1.0 / z0); end return tmp end
function tmp_2 = code(z1, z0) tmp = 0.0; if (z0 <= -6e+73) tmp = 1.0 / z0; elseif (z0 <= 1.15e+46) tmp = z1 * (1.772453850905516 + (-1.3691388026842775 * z1)); else tmp = 1.0 / z0; end tmp_2 = tmp; end
code[z1_, z0_] := If[LessEqual[z0, -6e+73], N[(1.0 / z0), $MachinePrecision], If[LessEqual[z0, 1.15e+46], N[(z1 * N[(1.772453850905516 + N[(-1.3691388026842775 * z1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / z0), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;z0 \leq -6 \cdot 10^{+73}:\\
\;\;\;\;\frac{1}{z0}\\
\mathbf{elif}\;z0 \leq 1.15 \cdot 10^{+46}:\\
\;\;\;\;z1 \cdot \left(1.772453850905516 + -1.3691388026842775 \cdot z1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{z0}\\
\end{array}
if z0 < -6.0000000000000002e73 or 1.15e46 < z0 Initial program 99.3%
Taylor expanded in z0 around inf
lower-/.f6434.3%
Applied rewrites34.3%
if -6.0000000000000002e73 < z0 < 1.15e46Initial program 99.3%
Evaluated real constant99.0%
Evaluated real constant99.5%
Taylor expanded in z1 around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f6449.8%
Applied rewrites49.8%
Taylor expanded in z0 around 0
lower-*.f6450.0%
Applied rewrites50.0%
(FPCore (z1 z0) :precision binary64 (if (<= z0 -6e+73) (/ 1.0 z0) (if (<= z0 1.15e+46) (* 1.772453850905516 z1) (/ 1.0 z0))))
double code(double z1, double z0) {
double tmp;
if (z0 <= -6e+73) {
tmp = 1.0 / z0;
} else if (z0 <= 1.15e+46) {
tmp = 1.772453850905516 * z1;
} else {
tmp = 1.0 / z0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(z1, z0)
use fmin_fmax_functions
real(8), intent (in) :: z1
real(8), intent (in) :: z0
real(8) :: tmp
if (z0 <= (-6d+73)) then
tmp = 1.0d0 / z0
else if (z0 <= 1.15d+46) then
tmp = 1.772453850905516d0 * z1
else
tmp = 1.0d0 / z0
end if
code = tmp
end function
public static double code(double z1, double z0) {
double tmp;
if (z0 <= -6e+73) {
tmp = 1.0 / z0;
} else if (z0 <= 1.15e+46) {
tmp = 1.772453850905516 * z1;
} else {
tmp = 1.0 / z0;
}
return tmp;
}
def code(z1, z0): tmp = 0 if z0 <= -6e+73: tmp = 1.0 / z0 elif z0 <= 1.15e+46: tmp = 1.772453850905516 * z1 else: tmp = 1.0 / z0 return tmp
function code(z1, z0) tmp = 0.0 if (z0 <= -6e+73) tmp = Float64(1.0 / z0); elseif (z0 <= 1.15e+46) tmp = Float64(1.772453850905516 * z1); else tmp = Float64(1.0 / z0); end return tmp end
function tmp_2 = code(z1, z0) tmp = 0.0; if (z0 <= -6e+73) tmp = 1.0 / z0; elseif (z0 <= 1.15e+46) tmp = 1.772453850905516 * z1; else tmp = 1.0 / z0; end tmp_2 = tmp; end
code[z1_, z0_] := If[LessEqual[z0, -6e+73], N[(1.0 / z0), $MachinePrecision], If[LessEqual[z0, 1.15e+46], N[(1.772453850905516 * z1), $MachinePrecision], N[(1.0 / z0), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;z0 \leq -6 \cdot 10^{+73}:\\
\;\;\;\;\frac{1}{z0}\\
\mathbf{elif}\;z0 \leq 1.15 \cdot 10^{+46}:\\
\;\;\;\;1.772453850905516 \cdot z1\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{z0}\\
\end{array}
if z0 < -6.0000000000000002e73 or 1.15e46 < z0 Initial program 99.3%
Taylor expanded in z0 around inf
lower-/.f6434.3%
Applied rewrites34.3%
if -6.0000000000000002e73 < z0 < 1.15e46Initial program 99.3%
Evaluated real constant99.0%
Evaluated real constant99.5%
Taylor expanded in z1 around 0
lower-*.f6449.8%
Applied rewrites49.8%
(FPCore (z1 z0) :precision binary64 (* 1.772453850905516 z1))
double code(double z1, double z0) {
return 1.772453850905516 * z1;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(z1, z0)
use fmin_fmax_functions
real(8), intent (in) :: z1
real(8), intent (in) :: z0
code = 1.772453850905516d0 * z1
end function
public static double code(double z1, double z0) {
return 1.772453850905516 * z1;
}
def code(z1, z0): return 1.772453850905516 * z1
function code(z1, z0) return Float64(1.772453850905516 * z1) end
function tmp = code(z1, z0) tmp = 1.772453850905516 * z1; end
code[z1_, z0_] := N[(1.772453850905516 * z1), $MachinePrecision]
1.772453850905516 \cdot z1
Initial program 99.3%
Evaluated real constant99.0%
Evaluated real constant99.5%
Taylor expanded in z1 around 0
lower-*.f6449.8%
Applied rewrites49.8%
herbie shell --seed 2025250
(FPCore (z1 z0)
:name "(/ (sqrt PI) (- (/ (sqrt (- (- 1 z1) z1)) (* (exp (* z1 z1)) z1)) (* (- -1 z0) (sqrt PI))))"
:precision binary64
(/ (sqrt PI) (- (/ (sqrt (- (- 1.0 z1) z1)) (* (exp (* z1 z1)) z1)) (* (- -1.0 z0) (sqrt PI)))))