
(FPCore (z1 z0) :precision binary64 (/ z1 (+ (* z1 (- z0 -1.0)) (* (* (sqrt (- (- 1.0 z1) z1)) 0.5641895665989011) (exp (* (- z1) z1))))))
double code(double z1, double z0) {
return z1 / ((z1 * (z0 - -1.0)) + ((sqrt(((1.0 - z1) - z1)) * 0.5641895665989011) * exp((-z1 * 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 = z1 / ((z1 * (z0 - (-1.0d0))) + ((sqrt(((1.0d0 - z1) - z1)) * 0.5641895665989011d0) * exp((-z1 * z1))))
end function
public static double code(double z1, double z0) {
return z1 / ((z1 * (z0 - -1.0)) + ((Math.sqrt(((1.0 - z1) - z1)) * 0.5641895665989011) * Math.exp((-z1 * z1))));
}
def code(z1, z0): return z1 / ((z1 * (z0 - -1.0)) + ((math.sqrt(((1.0 - z1) - z1)) * 0.5641895665989011) * math.exp((-z1 * z1))))
function code(z1, z0) return Float64(z1 / Float64(Float64(z1 * Float64(z0 - -1.0)) + Float64(Float64(sqrt(Float64(Float64(1.0 - z1) - z1)) * 0.5641895665989011) * exp(Float64(Float64(-z1) * z1))))) end
function tmp = code(z1, z0) tmp = z1 / ((z1 * (z0 - -1.0)) + ((sqrt(((1.0 - z1) - z1)) * 0.5641895665989011) * exp((-z1 * z1)))); end
code[z1_, z0_] := N[(z1 / N[(N[(z1 * N[(z0 - -1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(N[(1.0 - z1), $MachinePrecision] - z1), $MachinePrecision]], $MachinePrecision] * 0.5641895665989011), $MachinePrecision] * N[Exp[N[((-z1) * z1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{z1}{z1 \cdot \left(z0 - -1\right) + \left(\sqrt{\left(1 - z1\right) - z1} \cdot 0.5641895665989011\right) \cdot e^{\left(-z1\right) \cdot z1}}
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (z1 z0) :precision binary64 (/ z1 (+ (* z1 (- z0 -1.0)) (* (* (sqrt (- (- 1.0 z1) z1)) 0.5641895665989011) (exp (* (- z1) z1))))))
double code(double z1, double z0) {
return z1 / ((z1 * (z0 - -1.0)) + ((sqrt(((1.0 - z1) - z1)) * 0.5641895665989011) * exp((-z1 * 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 = z1 / ((z1 * (z0 - (-1.0d0))) + ((sqrt(((1.0d0 - z1) - z1)) * 0.5641895665989011d0) * exp((-z1 * z1))))
end function
public static double code(double z1, double z0) {
return z1 / ((z1 * (z0 - -1.0)) + ((Math.sqrt(((1.0 - z1) - z1)) * 0.5641895665989011) * Math.exp((-z1 * z1))));
}
def code(z1, z0): return z1 / ((z1 * (z0 - -1.0)) + ((math.sqrt(((1.0 - z1) - z1)) * 0.5641895665989011) * math.exp((-z1 * z1))))
function code(z1, z0) return Float64(z1 / Float64(Float64(z1 * Float64(z0 - -1.0)) + Float64(Float64(sqrt(Float64(Float64(1.0 - z1) - z1)) * 0.5641895665989011) * exp(Float64(Float64(-z1) * z1))))) end
function tmp = code(z1, z0) tmp = z1 / ((z1 * (z0 - -1.0)) + ((sqrt(((1.0 - z1) - z1)) * 0.5641895665989011) * exp((-z1 * z1)))); end
code[z1_, z0_] := N[(z1 / N[(N[(z1 * N[(z0 - -1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(N[(1.0 - z1), $MachinePrecision] - z1), $MachinePrecision]], $MachinePrecision] * 0.5641895665989011), $MachinePrecision] * N[Exp[N[((-z1) * z1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{z1}{z1 \cdot \left(z0 - -1\right) + \left(\sqrt{\left(1 - z1\right) - z1} \cdot 0.5641895665989011\right) \cdot e^{\left(-z1\right) \cdot z1}}
(FPCore (z1 z0)
:precision binary64
(let* ((t_0 (exp (* (- z1) z1)))
(t_1 (sqrt (- (- 1.0 z1) z1)))
(t_2
(/
z1
(+ (* z1 (- z0 -1.0)) (* (* t_1 0.5641895665989011) t_0))))
(t_3
(/
1.0
(/
(- (* t_0 (* 0.5641895665989011 t_1)) (* (- -1.0 z0) z1))
z1))))
(if (<= t_2 -1e-304) t_3 (if (<= t_2 0.0) (/ 1.0 z0) t_3))))double code(double z1, double z0) {
double t_0 = exp((-z1 * z1));
double t_1 = sqrt(((1.0 - z1) - z1));
double t_2 = z1 / ((z1 * (z0 - -1.0)) + ((t_1 * 0.5641895665989011) * t_0));
double t_3 = 1.0 / (((t_0 * (0.5641895665989011 * t_1)) - ((-1.0 - z0) * z1)) / z1);
double tmp;
if (t_2 <= -1e-304) {
tmp = t_3;
} else if (t_2 <= 0.0) {
tmp = 1.0 / z0;
} else {
tmp = t_3;
}
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) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = exp((-z1 * z1))
t_1 = sqrt(((1.0d0 - z1) - z1))
t_2 = z1 / ((z1 * (z0 - (-1.0d0))) + ((t_1 * 0.5641895665989011d0) * t_0))
t_3 = 1.0d0 / (((t_0 * (0.5641895665989011d0 * t_1)) - (((-1.0d0) - z0) * z1)) / z1)
if (t_2 <= (-1d-304)) then
tmp = t_3
else if (t_2 <= 0.0d0) then
tmp = 1.0d0 / z0
else
tmp = t_3
end if
code = tmp
end function
public static double code(double z1, double z0) {
double t_0 = Math.exp((-z1 * z1));
double t_1 = Math.sqrt(((1.0 - z1) - z1));
double t_2 = z1 / ((z1 * (z0 - -1.0)) + ((t_1 * 0.5641895665989011) * t_0));
double t_3 = 1.0 / (((t_0 * (0.5641895665989011 * t_1)) - ((-1.0 - z0) * z1)) / z1);
double tmp;
if (t_2 <= -1e-304) {
tmp = t_3;
} else if (t_2 <= 0.0) {
tmp = 1.0 / z0;
} else {
tmp = t_3;
}
return tmp;
}
def code(z1, z0): t_0 = math.exp((-z1 * z1)) t_1 = math.sqrt(((1.0 - z1) - z1)) t_2 = z1 / ((z1 * (z0 - -1.0)) + ((t_1 * 0.5641895665989011) * t_0)) t_3 = 1.0 / (((t_0 * (0.5641895665989011 * t_1)) - ((-1.0 - z0) * z1)) / z1) tmp = 0 if t_2 <= -1e-304: tmp = t_3 elif t_2 <= 0.0: tmp = 1.0 / z0 else: tmp = t_3 return tmp
function code(z1, z0) t_0 = exp(Float64(Float64(-z1) * z1)) t_1 = sqrt(Float64(Float64(1.0 - z1) - z1)) t_2 = Float64(z1 / Float64(Float64(z1 * Float64(z0 - -1.0)) + Float64(Float64(t_1 * 0.5641895665989011) * t_0))) t_3 = Float64(1.0 / Float64(Float64(Float64(t_0 * Float64(0.5641895665989011 * t_1)) - Float64(Float64(-1.0 - z0) * z1)) / z1)) tmp = 0.0 if (t_2 <= -1e-304) tmp = t_3; elseif (t_2 <= 0.0) tmp = Float64(1.0 / z0); else tmp = t_3; end return tmp end
function tmp_2 = code(z1, z0) t_0 = exp((-z1 * z1)); t_1 = sqrt(((1.0 - z1) - z1)); t_2 = z1 / ((z1 * (z0 - -1.0)) + ((t_1 * 0.5641895665989011) * t_0)); t_3 = 1.0 / (((t_0 * (0.5641895665989011 * t_1)) - ((-1.0 - z0) * z1)) / z1); tmp = 0.0; if (t_2 <= -1e-304) tmp = t_3; elseif (t_2 <= 0.0) tmp = 1.0 / z0; else tmp = t_3; end tmp_2 = tmp; end
code[z1_, z0_] := Block[{t$95$0 = N[Exp[N[((-z1) * z1), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(N[(1.0 - z1), $MachinePrecision] - z1), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(z1 / N[(N[(z1 * N[(z0 - -1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$1 * 0.5641895665989011), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(1.0 / N[(N[(N[(t$95$0 * N[(0.5641895665989011 * t$95$1), $MachinePrecision]), $MachinePrecision] - N[(N[(-1.0 - z0), $MachinePrecision] * z1), $MachinePrecision]), $MachinePrecision] / z1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1e-304], t$95$3, If[LessEqual[t$95$2, 0.0], N[(1.0 / z0), $MachinePrecision], t$95$3]]]]]]
\begin{array}{l}
t_0 := e^{\left(-z1\right) \cdot z1}\\
t_1 := \sqrt{\left(1 - z1\right) - z1}\\
t_2 := \frac{z1}{z1 \cdot \left(z0 - -1\right) + \left(t\_1 \cdot 0.5641895665989011\right) \cdot t\_0}\\
t_3 := \frac{1}{\frac{t\_0 \cdot \left(0.5641895665989011 \cdot t\_1\right) - \left(-1 - z0\right) \cdot z1}{z1}}\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{-304}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;\frac{1}{z0}\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
if (/.f64 z1 (+.f64 (*.f64 z1 (-.f64 z0 #s(literal -1 binary64))) (*.f64 (*.f64 (sqrt.f64 (-.f64 (-.f64 #s(literal 1 binary64) z1) z1)) #s(literal 5641895665989011/10000000000000000 binary64)) (exp.f64 (*.f64 (neg.f64 z1) z1))))) < -9.9999999999999997e-305 or 0.0 < (/.f64 z1 (+.f64 (*.f64 z1 (-.f64 z0 #s(literal -1 binary64))) (*.f64 (*.f64 (sqrt.f64 (-.f64 (-.f64 #s(literal 1 binary64) z1) z1)) #s(literal 5641895665989011/10000000000000000 binary64)) (exp.f64 (*.f64 (neg.f64 z1) z1))))) Initial program 91.9%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6491.9%
Applied rewrites91.9%
if -9.9999999999999997e-305 < (/.f64 z1 (+.f64 (*.f64 z1 (-.f64 z0 #s(literal -1 binary64))) (*.f64 (*.f64 (sqrt.f64 (-.f64 (-.f64 #s(literal 1 binary64) z1) z1)) #s(literal 5641895665989011/10000000000000000 binary64)) (exp.f64 (*.f64 (neg.f64 z1) z1))))) < 0.0Initial program 91.9%
Taylor expanded in z0 around inf
lower-/.f6433.9%
Applied rewrites33.9%
(FPCore (z1 z0)
:precision binary64
(let* ((t_0
(/
z1
(+
(* z1 (- z0 -1.0))
(*
(* (sqrt (- (- 1.0 z1) z1)) 0.5641895665989011)
(exp (* (- z1) z1)))))))
(if (<= t_0 -1e-304) t_0 (if (<= t_0 0.0) (/ 1.0 z0) t_0))))double code(double z1, double z0) {
double t_0 = z1 / ((z1 * (z0 - -1.0)) + ((sqrt(((1.0 - z1) - z1)) * 0.5641895665989011) * exp((-z1 * z1))));
double tmp;
if (t_0 <= -1e-304) {
tmp = t_0;
} else if (t_0 <= 0.0) {
tmp = 1.0 / z0;
} else {
tmp = t_0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(z1, z0)
use fmin_fmax_functions
real(8), intent (in) :: z1
real(8), intent (in) :: z0
real(8) :: t_0
real(8) :: tmp
t_0 = z1 / ((z1 * (z0 - (-1.0d0))) + ((sqrt(((1.0d0 - z1) - z1)) * 0.5641895665989011d0) * exp((-z1 * z1))))
if (t_0 <= (-1d-304)) then
tmp = t_0
else if (t_0 <= 0.0d0) then
tmp = 1.0d0 / z0
else
tmp = t_0
end if
code = tmp
end function
public static double code(double z1, double z0) {
double t_0 = z1 / ((z1 * (z0 - -1.0)) + ((Math.sqrt(((1.0 - z1) - z1)) * 0.5641895665989011) * Math.exp((-z1 * z1))));
double tmp;
if (t_0 <= -1e-304) {
tmp = t_0;
} else if (t_0 <= 0.0) {
tmp = 1.0 / z0;
} else {
tmp = t_0;
}
return tmp;
}
def code(z1, z0): t_0 = z1 / ((z1 * (z0 - -1.0)) + ((math.sqrt(((1.0 - z1) - z1)) * 0.5641895665989011) * math.exp((-z1 * z1)))) tmp = 0 if t_0 <= -1e-304: tmp = t_0 elif t_0 <= 0.0: tmp = 1.0 / z0 else: tmp = t_0 return tmp
function code(z1, z0) t_0 = Float64(z1 / Float64(Float64(z1 * Float64(z0 - -1.0)) + Float64(Float64(sqrt(Float64(Float64(1.0 - z1) - z1)) * 0.5641895665989011) * exp(Float64(Float64(-z1) * z1))))) tmp = 0.0 if (t_0 <= -1e-304) tmp = t_0; elseif (t_0 <= 0.0) tmp = Float64(1.0 / z0); else tmp = t_0; end return tmp end
function tmp_2 = code(z1, z0) t_0 = z1 / ((z1 * (z0 - -1.0)) + ((sqrt(((1.0 - z1) - z1)) * 0.5641895665989011) * exp((-z1 * z1)))); tmp = 0.0; if (t_0 <= -1e-304) tmp = t_0; elseif (t_0 <= 0.0) tmp = 1.0 / z0; else tmp = t_0; end tmp_2 = tmp; end
code[z1_, z0_] := Block[{t$95$0 = N[(z1 / N[(N[(z1 * N[(z0 - -1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(N[(1.0 - z1), $MachinePrecision] - z1), $MachinePrecision]], $MachinePrecision] * 0.5641895665989011), $MachinePrecision] * N[Exp[N[((-z1) * z1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -1e-304], t$95$0, If[LessEqual[t$95$0, 0.0], N[(1.0 / z0), $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := \frac{z1}{z1 \cdot \left(z0 - -1\right) + \left(\sqrt{\left(1 - z1\right) - z1} \cdot 0.5641895665989011\right) \cdot e^{\left(-z1\right) \cdot z1}}\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{-304}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\frac{1}{z0}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if (/.f64 z1 (+.f64 (*.f64 z1 (-.f64 z0 #s(literal -1 binary64))) (*.f64 (*.f64 (sqrt.f64 (-.f64 (-.f64 #s(literal 1 binary64) z1) z1)) #s(literal 5641895665989011/10000000000000000 binary64)) (exp.f64 (*.f64 (neg.f64 z1) z1))))) < -9.9999999999999997e-305 or 0.0 < (/.f64 z1 (+.f64 (*.f64 z1 (-.f64 z0 #s(literal -1 binary64))) (*.f64 (*.f64 (sqrt.f64 (-.f64 (-.f64 #s(literal 1 binary64) z1) z1)) #s(literal 5641895665989011/10000000000000000 binary64)) (exp.f64 (*.f64 (neg.f64 z1) z1))))) Initial program 91.9%
if -9.9999999999999997e-305 < (/.f64 z1 (+.f64 (*.f64 z1 (-.f64 z0 #s(literal -1 binary64))) (*.f64 (*.f64 (sqrt.f64 (-.f64 (-.f64 #s(literal 1 binary64) z1) z1)) #s(literal 5641895665989011/10000000000000000 binary64)) (exp.f64 (*.f64 (neg.f64 z1) z1))))) < 0.0Initial program 91.9%
Taylor expanded in z0 around inf
lower-/.f6433.9%
Applied rewrites33.9%
(FPCore (z1 z0)
:precision binary64
(let* ((t_0
(/
z1
(+
(* z1 (- z0 -1.0))
(*
(* (sqrt (- (- 1.0 z1) z1)) 0.5641895665989011)
(exp (* (- z1) z1)))))))
(if (<= t_0 -1e-304)
(/ z1 (+ 0.5641895665989011 (* z1 (+ 0.4358104334010989 z0))))
(if (<= t_0 0.0)
(/ 1.0 z0)
(/
1.0
(/ (- (* 1.0 0.5641895665989011) (* (- -1.0 z0) z1)) z1))))))double code(double z1, double z0) {
double t_0 = z1 / ((z1 * (z0 - -1.0)) + ((sqrt(((1.0 - z1) - z1)) * 0.5641895665989011) * exp((-z1 * z1))));
double tmp;
if (t_0 <= -1e-304) {
tmp = z1 / (0.5641895665989011 + (z1 * (0.4358104334010989 + z0)));
} else if (t_0 <= 0.0) {
tmp = 1.0 / z0;
} else {
tmp = 1.0 / (((1.0 * 0.5641895665989011) - ((-1.0 - z0) * z1)) / z1);
}
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) :: t_0
real(8) :: tmp
t_0 = z1 / ((z1 * (z0 - (-1.0d0))) + ((sqrt(((1.0d0 - z1) - z1)) * 0.5641895665989011d0) * exp((-z1 * z1))))
if (t_0 <= (-1d-304)) then
tmp = z1 / (0.5641895665989011d0 + (z1 * (0.4358104334010989d0 + z0)))
else if (t_0 <= 0.0d0) then
tmp = 1.0d0 / z0
else
tmp = 1.0d0 / (((1.0d0 * 0.5641895665989011d0) - (((-1.0d0) - z0) * z1)) / z1)
end if
code = tmp
end function
public static double code(double z1, double z0) {
double t_0 = z1 / ((z1 * (z0 - -1.0)) + ((Math.sqrt(((1.0 - z1) - z1)) * 0.5641895665989011) * Math.exp((-z1 * z1))));
double tmp;
if (t_0 <= -1e-304) {
tmp = z1 / (0.5641895665989011 + (z1 * (0.4358104334010989 + z0)));
} else if (t_0 <= 0.0) {
tmp = 1.0 / z0;
} else {
tmp = 1.0 / (((1.0 * 0.5641895665989011) - ((-1.0 - z0) * z1)) / z1);
}
return tmp;
}
def code(z1, z0): t_0 = z1 / ((z1 * (z0 - -1.0)) + ((math.sqrt(((1.0 - z1) - z1)) * 0.5641895665989011) * math.exp((-z1 * z1)))) tmp = 0 if t_0 <= -1e-304: tmp = z1 / (0.5641895665989011 + (z1 * (0.4358104334010989 + z0))) elif t_0 <= 0.0: tmp = 1.0 / z0 else: tmp = 1.0 / (((1.0 * 0.5641895665989011) - ((-1.0 - z0) * z1)) / z1) return tmp
function code(z1, z0) t_0 = Float64(z1 / Float64(Float64(z1 * Float64(z0 - -1.0)) + Float64(Float64(sqrt(Float64(Float64(1.0 - z1) - z1)) * 0.5641895665989011) * exp(Float64(Float64(-z1) * z1))))) tmp = 0.0 if (t_0 <= -1e-304) tmp = Float64(z1 / Float64(0.5641895665989011 + Float64(z1 * Float64(0.4358104334010989 + z0)))); elseif (t_0 <= 0.0) tmp = Float64(1.0 / z0); else tmp = Float64(1.0 / Float64(Float64(Float64(1.0 * 0.5641895665989011) - Float64(Float64(-1.0 - z0) * z1)) / z1)); end return tmp end
function tmp_2 = code(z1, z0) t_0 = z1 / ((z1 * (z0 - -1.0)) + ((sqrt(((1.0 - z1) - z1)) * 0.5641895665989011) * exp((-z1 * z1)))); tmp = 0.0; if (t_0 <= -1e-304) tmp = z1 / (0.5641895665989011 + (z1 * (0.4358104334010989 + z0))); elseif (t_0 <= 0.0) tmp = 1.0 / z0; else tmp = 1.0 / (((1.0 * 0.5641895665989011) - ((-1.0 - z0) * z1)) / z1); end tmp_2 = tmp; end
code[z1_, z0_] := Block[{t$95$0 = N[(z1 / N[(N[(z1 * N[(z0 - -1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(N[(1.0 - z1), $MachinePrecision] - z1), $MachinePrecision]], $MachinePrecision] * 0.5641895665989011), $MachinePrecision] * N[Exp[N[((-z1) * z1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -1e-304], N[(z1 / N[(0.5641895665989011 + N[(z1 * N[(0.4358104334010989 + z0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(1.0 / z0), $MachinePrecision], N[(1.0 / N[(N[(N[(1.0 * 0.5641895665989011), $MachinePrecision] - N[(N[(-1.0 - z0), $MachinePrecision] * z1), $MachinePrecision]), $MachinePrecision] / z1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \frac{z1}{z1 \cdot \left(z0 - -1\right) + \left(\sqrt{\left(1 - z1\right) - z1} \cdot 0.5641895665989011\right) \cdot e^{\left(-z1\right) \cdot z1}}\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{-304}:\\
\;\;\;\;\frac{z1}{0.5641895665989011 + z1 \cdot \left(0.4358104334010989 + z0\right)}\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\frac{1}{z0}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{1 \cdot 0.5641895665989011 - \left(-1 - z0\right) \cdot z1}{z1}}\\
\end{array}
if (/.f64 z1 (+.f64 (*.f64 z1 (-.f64 z0 #s(literal -1 binary64))) (*.f64 (*.f64 (sqrt.f64 (-.f64 (-.f64 #s(literal 1 binary64) z1) z1)) #s(literal 5641895665989011/10000000000000000 binary64)) (exp.f64 (*.f64 (neg.f64 z1) z1))))) < -9.9999999999999997e-305Initial program 91.9%
Taylor expanded in z1 around 0
lower-+.f64N/A
lower-*.f64N/A
lower-+.f6477.2%
Applied rewrites77.2%
if -9.9999999999999997e-305 < (/.f64 z1 (+.f64 (*.f64 z1 (-.f64 z0 #s(literal -1 binary64))) (*.f64 (*.f64 (sqrt.f64 (-.f64 (-.f64 #s(literal 1 binary64) z1) z1)) #s(literal 5641895665989011/10000000000000000 binary64)) (exp.f64 (*.f64 (neg.f64 z1) z1))))) < 0.0Initial program 91.9%
Taylor expanded in z0 around inf
lower-/.f6433.9%
Applied rewrites33.9%
if 0.0 < (/.f64 z1 (+.f64 (*.f64 z1 (-.f64 z0 #s(literal -1 binary64))) (*.f64 (*.f64 (sqrt.f64 (-.f64 (-.f64 #s(literal 1 binary64) z1) z1)) #s(literal 5641895665989011/10000000000000000 binary64)) (exp.f64 (*.f64 (neg.f64 z1) z1))))) Initial program 91.9%
Taylor expanded in z1 around 0
Applied rewrites91.2%
Taylor expanded in z1 around 0
Applied rewrites90.8%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6490.9%
Applied rewrites90.9%
(FPCore (z1 z0)
:precision binary64
(let* ((t_0 (* z1 (- z0 -1.0)))
(t_1
(/
z1
(+
t_0
(*
(* (sqrt (- (- 1.0 z1) z1)) 0.5641895665989011)
(exp (* (- z1) z1)))))))
(if (<= t_1 -1e-304)
(/ z1 (+ 0.5641895665989011 (* z1 (+ 0.4358104334010989 z0))))
(if (<= t_1 0.0)
(/ 1.0 z0)
(/ z1 (+ t_0 (* 0.5641895665989011 1.0)))))))double code(double z1, double z0) {
double t_0 = z1 * (z0 - -1.0);
double t_1 = z1 / (t_0 + ((sqrt(((1.0 - z1) - z1)) * 0.5641895665989011) * exp((-z1 * z1))));
double tmp;
if (t_1 <= -1e-304) {
tmp = z1 / (0.5641895665989011 + (z1 * (0.4358104334010989 + z0)));
} else if (t_1 <= 0.0) {
tmp = 1.0 / z0;
} else {
tmp = z1 / (t_0 + (0.5641895665989011 * 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(z1, z0)
use fmin_fmax_functions
real(8), intent (in) :: z1
real(8), intent (in) :: z0
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = z1 * (z0 - (-1.0d0))
t_1 = z1 / (t_0 + ((sqrt(((1.0d0 - z1) - z1)) * 0.5641895665989011d0) * exp((-z1 * z1))))
if (t_1 <= (-1d-304)) then
tmp = z1 / (0.5641895665989011d0 + (z1 * (0.4358104334010989d0 + z0)))
else if (t_1 <= 0.0d0) then
tmp = 1.0d0 / z0
else
tmp = z1 / (t_0 + (0.5641895665989011d0 * 1.0d0))
end if
code = tmp
end function
public static double code(double z1, double z0) {
double t_0 = z1 * (z0 - -1.0);
double t_1 = z1 / (t_0 + ((Math.sqrt(((1.0 - z1) - z1)) * 0.5641895665989011) * Math.exp((-z1 * z1))));
double tmp;
if (t_1 <= -1e-304) {
tmp = z1 / (0.5641895665989011 + (z1 * (0.4358104334010989 + z0)));
} else if (t_1 <= 0.0) {
tmp = 1.0 / z0;
} else {
tmp = z1 / (t_0 + (0.5641895665989011 * 1.0));
}
return tmp;
}
def code(z1, z0): t_0 = z1 * (z0 - -1.0) t_1 = z1 / (t_0 + ((math.sqrt(((1.0 - z1) - z1)) * 0.5641895665989011) * math.exp((-z1 * z1)))) tmp = 0 if t_1 <= -1e-304: tmp = z1 / (0.5641895665989011 + (z1 * (0.4358104334010989 + z0))) elif t_1 <= 0.0: tmp = 1.0 / z0 else: tmp = z1 / (t_0 + (0.5641895665989011 * 1.0)) return tmp
function code(z1, z0) t_0 = Float64(z1 * Float64(z0 - -1.0)) t_1 = Float64(z1 / Float64(t_0 + Float64(Float64(sqrt(Float64(Float64(1.0 - z1) - z1)) * 0.5641895665989011) * exp(Float64(Float64(-z1) * z1))))) tmp = 0.0 if (t_1 <= -1e-304) tmp = Float64(z1 / Float64(0.5641895665989011 + Float64(z1 * Float64(0.4358104334010989 + z0)))); elseif (t_1 <= 0.0) tmp = Float64(1.0 / z0); else tmp = Float64(z1 / Float64(t_0 + Float64(0.5641895665989011 * 1.0))); end return tmp end
function tmp_2 = code(z1, z0) t_0 = z1 * (z0 - -1.0); t_1 = z1 / (t_0 + ((sqrt(((1.0 - z1) - z1)) * 0.5641895665989011) * exp((-z1 * z1)))); tmp = 0.0; if (t_1 <= -1e-304) tmp = z1 / (0.5641895665989011 + (z1 * (0.4358104334010989 + z0))); elseif (t_1 <= 0.0) tmp = 1.0 / z0; else tmp = z1 / (t_0 + (0.5641895665989011 * 1.0)); end tmp_2 = tmp; end
code[z1_, z0_] := Block[{t$95$0 = N[(z1 * N[(z0 - -1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(z1 / N[(t$95$0 + N[(N[(N[Sqrt[N[(N[(1.0 - z1), $MachinePrecision] - z1), $MachinePrecision]], $MachinePrecision] * 0.5641895665989011), $MachinePrecision] * N[Exp[N[((-z1) * z1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e-304], N[(z1 / N[(0.5641895665989011 + N[(z1 * N[(0.4358104334010989 + z0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(1.0 / z0), $MachinePrecision], N[(z1 / N[(t$95$0 + N[(0.5641895665989011 * 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := z1 \cdot \left(z0 - -1\right)\\
t_1 := \frac{z1}{t\_0 + \left(\sqrt{\left(1 - z1\right) - z1} \cdot 0.5641895665989011\right) \cdot e^{\left(-z1\right) \cdot z1}}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{-304}:\\
\;\;\;\;\frac{z1}{0.5641895665989011 + z1 \cdot \left(0.4358104334010989 + z0\right)}\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;\frac{1}{z0}\\
\mathbf{else}:\\
\;\;\;\;\frac{z1}{t\_0 + 0.5641895665989011 \cdot 1}\\
\end{array}
if (/.f64 z1 (+.f64 (*.f64 z1 (-.f64 z0 #s(literal -1 binary64))) (*.f64 (*.f64 (sqrt.f64 (-.f64 (-.f64 #s(literal 1 binary64) z1) z1)) #s(literal 5641895665989011/10000000000000000 binary64)) (exp.f64 (*.f64 (neg.f64 z1) z1))))) < -9.9999999999999997e-305Initial program 91.9%
Taylor expanded in z1 around 0
lower-+.f64N/A
lower-*.f64N/A
lower-+.f6477.2%
Applied rewrites77.2%
if -9.9999999999999997e-305 < (/.f64 z1 (+.f64 (*.f64 z1 (-.f64 z0 #s(literal -1 binary64))) (*.f64 (*.f64 (sqrt.f64 (-.f64 (-.f64 #s(literal 1 binary64) z1) z1)) #s(literal 5641895665989011/10000000000000000 binary64)) (exp.f64 (*.f64 (neg.f64 z1) z1))))) < 0.0Initial program 91.9%
Taylor expanded in z0 around inf
lower-/.f6433.9%
Applied rewrites33.9%
if 0.0 < (/.f64 z1 (+.f64 (*.f64 z1 (-.f64 z0 #s(literal -1 binary64))) (*.f64 (*.f64 (sqrt.f64 (-.f64 (-.f64 #s(literal 1 binary64) z1) z1)) #s(literal 5641895665989011/10000000000000000 binary64)) (exp.f64 (*.f64 (neg.f64 z1) z1))))) Initial program 91.9%
Taylor expanded in z1 around 0
Applied rewrites91.2%
Taylor expanded in z1 around 0
Applied rewrites90.8%
(FPCore (z1 z0)
:precision binary64
(let* ((t_0
(/
z1
(+
(* z1 (- z0 -1.0))
(*
(* (sqrt (- (- 1.0 z1) z1)) 0.5641895665989011)
(exp (* (- z1) z1))))))
(t_1
(/
z1
(+ 0.5641895665989011 (* z1 (+ 0.4358104334010989 z0))))))
(if (<= t_0 -1e-304) t_1 (if (<= t_0 0.0) (/ 1.0 z0) t_1))))double code(double z1, double z0) {
double t_0 = z1 / ((z1 * (z0 - -1.0)) + ((sqrt(((1.0 - z1) - z1)) * 0.5641895665989011) * exp((-z1 * z1))));
double t_1 = z1 / (0.5641895665989011 + (z1 * (0.4358104334010989 + z0)));
double tmp;
if (t_0 <= -1e-304) {
tmp = t_1;
} else if (t_0 <= 0.0) {
tmp = 1.0 / z0;
} else {
tmp = t_1;
}
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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = z1 / ((z1 * (z0 - (-1.0d0))) + ((sqrt(((1.0d0 - z1) - z1)) * 0.5641895665989011d0) * exp((-z1 * z1))))
t_1 = z1 / (0.5641895665989011d0 + (z1 * (0.4358104334010989d0 + z0)))
if (t_0 <= (-1d-304)) then
tmp = t_1
else if (t_0 <= 0.0d0) then
tmp = 1.0d0 / z0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double z1, double z0) {
double t_0 = z1 / ((z1 * (z0 - -1.0)) + ((Math.sqrt(((1.0 - z1) - z1)) * 0.5641895665989011) * Math.exp((-z1 * z1))));
double t_1 = z1 / (0.5641895665989011 + (z1 * (0.4358104334010989 + z0)));
double tmp;
if (t_0 <= -1e-304) {
tmp = t_1;
} else if (t_0 <= 0.0) {
tmp = 1.0 / z0;
} else {
tmp = t_1;
}
return tmp;
}
def code(z1, z0): t_0 = z1 / ((z1 * (z0 - -1.0)) + ((math.sqrt(((1.0 - z1) - z1)) * 0.5641895665989011) * math.exp((-z1 * z1)))) t_1 = z1 / (0.5641895665989011 + (z1 * (0.4358104334010989 + z0))) tmp = 0 if t_0 <= -1e-304: tmp = t_1 elif t_0 <= 0.0: tmp = 1.0 / z0 else: tmp = t_1 return tmp
function code(z1, z0) t_0 = Float64(z1 / Float64(Float64(z1 * Float64(z0 - -1.0)) + Float64(Float64(sqrt(Float64(Float64(1.0 - z1) - z1)) * 0.5641895665989011) * exp(Float64(Float64(-z1) * z1))))) t_1 = Float64(z1 / Float64(0.5641895665989011 + Float64(z1 * Float64(0.4358104334010989 + z0)))) tmp = 0.0 if (t_0 <= -1e-304) tmp = t_1; elseif (t_0 <= 0.0) tmp = Float64(1.0 / z0); else tmp = t_1; end return tmp end
function tmp_2 = code(z1, z0) t_0 = z1 / ((z1 * (z0 - -1.0)) + ((sqrt(((1.0 - z1) - z1)) * 0.5641895665989011) * exp((-z1 * z1)))); t_1 = z1 / (0.5641895665989011 + (z1 * (0.4358104334010989 + z0))); tmp = 0.0; if (t_0 <= -1e-304) tmp = t_1; elseif (t_0 <= 0.0) tmp = 1.0 / z0; else tmp = t_1; end tmp_2 = tmp; end
code[z1_, z0_] := Block[{t$95$0 = N[(z1 / N[(N[(z1 * N[(z0 - -1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(N[(1.0 - z1), $MachinePrecision] - z1), $MachinePrecision]], $MachinePrecision] * 0.5641895665989011), $MachinePrecision] * N[Exp[N[((-z1) * z1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(z1 / N[(0.5641895665989011 + N[(z1 * N[(0.4358104334010989 + z0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -1e-304], t$95$1, If[LessEqual[t$95$0, 0.0], N[(1.0 / z0), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
t_0 := \frac{z1}{z1 \cdot \left(z0 - -1\right) + \left(\sqrt{\left(1 - z1\right) - z1} \cdot 0.5641895665989011\right) \cdot e^{\left(-z1\right) \cdot z1}}\\
t_1 := \frac{z1}{0.5641895665989011 + z1 \cdot \left(0.4358104334010989 + z0\right)}\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{-304}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\frac{1}{z0}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (/.f64 z1 (+.f64 (*.f64 z1 (-.f64 z0 #s(literal -1 binary64))) (*.f64 (*.f64 (sqrt.f64 (-.f64 (-.f64 #s(literal 1 binary64) z1) z1)) #s(literal 5641895665989011/10000000000000000 binary64)) (exp.f64 (*.f64 (neg.f64 z1) z1))))) < -9.9999999999999997e-305 or 0.0 < (/.f64 z1 (+.f64 (*.f64 z1 (-.f64 z0 #s(literal -1 binary64))) (*.f64 (*.f64 (sqrt.f64 (-.f64 (-.f64 #s(literal 1 binary64) z1) z1)) #s(literal 5641895665989011/10000000000000000 binary64)) (exp.f64 (*.f64 (neg.f64 z1) z1))))) Initial program 91.9%
Taylor expanded in z1 around 0
lower-+.f64N/A
lower-*.f64N/A
lower-+.f6477.2%
Applied rewrites77.2%
if -9.9999999999999997e-305 < (/.f64 z1 (+.f64 (*.f64 z1 (-.f64 z0 #s(literal -1 binary64))) (*.f64 (*.f64 (sqrt.f64 (-.f64 (-.f64 #s(literal 1 binary64) z1) z1)) #s(literal 5641895665989011/10000000000000000 binary64)) (exp.f64 (*.f64 (neg.f64 z1) z1))))) < 0.0Initial program 91.9%
Taylor expanded in z0 around inf
lower-/.f6433.9%
Applied rewrites33.9%
(FPCore (z1 z0)
:precision binary64
(if (<= z0 -2.8e+152)
(/ 1.0 z0)
(if (<= z0 3.4e+120)
(/ z1 (+ 0.5641895665989011 (* z1 0.4358104334010989)))
(/ 1.0 z0))))double code(double z1, double z0) {
double tmp;
if (z0 <= -2.8e+152) {
tmp = 1.0 / z0;
} else if (z0 <= 3.4e+120) {
tmp = z1 / (0.5641895665989011 + (z1 * 0.4358104334010989));
} 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 <= (-2.8d+152)) then
tmp = 1.0d0 / z0
else if (z0 <= 3.4d+120) then
tmp = z1 / (0.5641895665989011d0 + (z1 * 0.4358104334010989d0))
else
tmp = 1.0d0 / z0
end if
code = tmp
end function
public static double code(double z1, double z0) {
double tmp;
if (z0 <= -2.8e+152) {
tmp = 1.0 / z0;
} else if (z0 <= 3.4e+120) {
tmp = z1 / (0.5641895665989011 + (z1 * 0.4358104334010989));
} else {
tmp = 1.0 / z0;
}
return tmp;
}
def code(z1, z0): tmp = 0 if z0 <= -2.8e+152: tmp = 1.0 / z0 elif z0 <= 3.4e+120: tmp = z1 / (0.5641895665989011 + (z1 * 0.4358104334010989)) else: tmp = 1.0 / z0 return tmp
function code(z1, z0) tmp = 0.0 if (z0 <= -2.8e+152) tmp = Float64(1.0 / z0); elseif (z0 <= 3.4e+120) tmp = Float64(z1 / Float64(0.5641895665989011 + Float64(z1 * 0.4358104334010989))); else tmp = Float64(1.0 / z0); end return tmp end
function tmp_2 = code(z1, z0) tmp = 0.0; if (z0 <= -2.8e+152) tmp = 1.0 / z0; elseif (z0 <= 3.4e+120) tmp = z1 / (0.5641895665989011 + (z1 * 0.4358104334010989)); else tmp = 1.0 / z0; end tmp_2 = tmp; end
code[z1_, z0_] := If[LessEqual[z0, -2.8e+152], N[(1.0 / z0), $MachinePrecision], If[LessEqual[z0, 3.4e+120], N[(z1 / N[(0.5641895665989011 + N[(z1 * 0.4358104334010989), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / z0), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;z0 \leq -2.8 \cdot 10^{+152}:\\
\;\;\;\;\frac{1}{z0}\\
\mathbf{elif}\;z0 \leq 3.4 \cdot 10^{+120}:\\
\;\;\;\;\frac{z1}{0.5641895665989011 + z1 \cdot 0.4358104334010989}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{z0}\\
\end{array}
if z0 < -2.8000000000000002e152 or 3.4e120 < z0 Initial program 91.9%
Taylor expanded in z0 around inf
lower-/.f6433.9%
Applied rewrites33.9%
if -2.8000000000000002e152 < z0 < 3.4e120Initial program 91.9%
Taylor expanded in z1 around 0
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-*.f6471.4%
Applied rewrites71.4%
Taylor expanded in z0 around 0
lower-+.f64N/A
lower-*.f6451.5%
Applied rewrites51.5%
Taylor expanded in z1 around 0
Applied rewrites53.5%
(FPCore (z1 z0)
:precision binary64
(if (<= z0 -2.8e+152)
(/ 1.0 z0)
(if (<= z0 3.4e+120)
(+ (* (* -1.369138938191455 z1) z1) (* 1.7724539041519165 z1))
(/ 1.0 z0))))double code(double z1, double z0) {
double tmp;
if (z0 <= -2.8e+152) {
tmp = 1.0 / z0;
} else if (z0 <= 3.4e+120) {
tmp = ((-1.369138938191455 * z1) * z1) + (1.7724539041519165 * 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 <= (-2.8d+152)) then
tmp = 1.0d0 / z0
else if (z0 <= 3.4d+120) then
tmp = (((-1.369138938191455d0) * z1) * z1) + (1.7724539041519165d0 * z1)
else
tmp = 1.0d0 / z0
end if
code = tmp
end function
public static double code(double z1, double z0) {
double tmp;
if (z0 <= -2.8e+152) {
tmp = 1.0 / z0;
} else if (z0 <= 3.4e+120) {
tmp = ((-1.369138938191455 * z1) * z1) + (1.7724539041519165 * z1);
} else {
tmp = 1.0 / z0;
}
return tmp;
}
def code(z1, z0): tmp = 0 if z0 <= -2.8e+152: tmp = 1.0 / z0 elif z0 <= 3.4e+120: tmp = ((-1.369138938191455 * z1) * z1) + (1.7724539041519165 * z1) else: tmp = 1.0 / z0 return tmp
function code(z1, z0) tmp = 0.0 if (z0 <= -2.8e+152) tmp = Float64(1.0 / z0); elseif (z0 <= 3.4e+120) tmp = Float64(Float64(Float64(-1.369138938191455 * z1) * z1) + Float64(1.7724539041519165 * z1)); else tmp = Float64(1.0 / z0); end return tmp end
function tmp_2 = code(z1, z0) tmp = 0.0; if (z0 <= -2.8e+152) tmp = 1.0 / z0; elseif (z0 <= 3.4e+120) tmp = ((-1.369138938191455 * z1) * z1) + (1.7724539041519165 * z1); else tmp = 1.0 / z0; end tmp_2 = tmp; end
code[z1_, z0_] := If[LessEqual[z0, -2.8e+152], N[(1.0 / z0), $MachinePrecision], If[LessEqual[z0, 3.4e+120], N[(N[(N[(-1.369138938191455 * z1), $MachinePrecision] * z1), $MachinePrecision] + N[(1.7724539041519165 * z1), $MachinePrecision]), $MachinePrecision], N[(1.0 / z0), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;z0 \leq -2.8 \cdot 10^{+152}:\\
\;\;\;\;\frac{1}{z0}\\
\mathbf{elif}\;z0 \leq 3.4 \cdot 10^{+120}:\\
\;\;\;\;\left(-1.369138938191455 \cdot z1\right) \cdot z1 + 1.7724539041519165 \cdot z1\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{z0}\\
\end{array}
if z0 < -2.8000000000000002e152 or 3.4e120 < z0 Initial program 91.9%
Taylor expanded in z0 around inf
lower-/.f6433.9%
Applied rewrites33.9%
if -2.8000000000000002e152 < z0 < 3.4e120Initial program 91.9%
Taylor expanded in z1 around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-+.f6450.1%
Applied rewrites50.1%
Taylor expanded in z0 around inf
lower-*.f64N/A
lower-*.f6449.9%
Applied rewrites49.9%
Taylor expanded in z0 around 0
lower-*.f6450.3%
Applied rewrites50.3%
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
distribute-rgt-inN/A
*-commutativeN/A
lower-+.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6450.3%
Applied rewrites50.3%
(FPCore (z1 z0)
:precision binary64
(if (<= (- z0 -1.0) -2e+152)
(/ 1.0 z0)
(if (<= (- z0 -1.0) 2e+117)
(* z1 (+ 1.7724539041519165 (* -1.369138938191455 z1)))
(/ 1.0 z0))))double code(double z1, double z0) {
double tmp;
if ((z0 - -1.0) <= -2e+152) {
tmp = 1.0 / z0;
} else if ((z0 - -1.0) <= 2e+117) {
tmp = z1 * (1.7724539041519165 + (-1.369138938191455 * 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 - (-1.0d0)) <= (-2d+152)) then
tmp = 1.0d0 / z0
else if ((z0 - (-1.0d0)) <= 2d+117) then
tmp = z1 * (1.7724539041519165d0 + ((-1.369138938191455d0) * z1))
else
tmp = 1.0d0 / z0
end if
code = tmp
end function
public static double code(double z1, double z0) {
double tmp;
if ((z0 - -1.0) <= -2e+152) {
tmp = 1.0 / z0;
} else if ((z0 - -1.0) <= 2e+117) {
tmp = z1 * (1.7724539041519165 + (-1.369138938191455 * z1));
} else {
tmp = 1.0 / z0;
}
return tmp;
}
def code(z1, z0): tmp = 0 if (z0 - -1.0) <= -2e+152: tmp = 1.0 / z0 elif (z0 - -1.0) <= 2e+117: tmp = z1 * (1.7724539041519165 + (-1.369138938191455 * z1)) else: tmp = 1.0 / z0 return tmp
function code(z1, z0) tmp = 0.0 if (Float64(z0 - -1.0) <= -2e+152) tmp = Float64(1.0 / z0); elseif (Float64(z0 - -1.0) <= 2e+117) tmp = Float64(z1 * Float64(1.7724539041519165 + Float64(-1.369138938191455 * z1))); else tmp = Float64(1.0 / z0); end return tmp end
function tmp_2 = code(z1, z0) tmp = 0.0; if ((z0 - -1.0) <= -2e+152) tmp = 1.0 / z0; elseif ((z0 - -1.0) <= 2e+117) tmp = z1 * (1.7724539041519165 + (-1.369138938191455 * z1)); else tmp = 1.0 / z0; end tmp_2 = tmp; end
code[z1_, z0_] := If[LessEqual[N[(z0 - -1.0), $MachinePrecision], -2e+152], N[(1.0 / z0), $MachinePrecision], If[LessEqual[N[(z0 - -1.0), $MachinePrecision], 2e+117], N[(z1 * N[(1.7724539041519165 + N[(-1.369138938191455 * z1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / z0), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;z0 - -1 \leq -2 \cdot 10^{+152}:\\
\;\;\;\;\frac{1}{z0}\\
\mathbf{elif}\;z0 - -1 \leq 2 \cdot 10^{+117}:\\
\;\;\;\;z1 \cdot \left(1.7724539041519165 + -1.369138938191455 \cdot z1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{z0}\\
\end{array}
if (-.f64 z0 #s(literal -1 binary64)) < -2.0000000000000001e152 or 2.0000000000000001e117 < (-.f64 z0 #s(literal -1 binary64)) Initial program 91.9%
Taylor expanded in z0 around inf
lower-/.f6433.9%
Applied rewrites33.9%
if -2.0000000000000001e152 < (-.f64 z0 #s(literal -1 binary64)) < 2.0000000000000001e117Initial program 91.9%
Taylor expanded in z1 around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-+.f6450.1%
Applied rewrites50.1%
Taylor expanded in z0 around inf
lower-*.f64N/A
lower-*.f6449.9%
Applied rewrites49.9%
Taylor expanded in z0 around 0
lower-*.f6450.3%
Applied rewrites50.3%
(FPCore (z1 z0) :precision binary64 (if (<= (- z0 -1.0) -2e+152) (/ 1.0 z0) (if (<= (- z0 -1.0) 2e+117) (* 1.7724539041519165 z1) (/ 1.0 z0))))
double code(double z1, double z0) {
double tmp;
if ((z0 - -1.0) <= -2e+152) {
tmp = 1.0 / z0;
} else if ((z0 - -1.0) <= 2e+117) {
tmp = 1.7724539041519165 * 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 - (-1.0d0)) <= (-2d+152)) then
tmp = 1.0d0 / z0
else if ((z0 - (-1.0d0)) <= 2d+117) then
tmp = 1.7724539041519165d0 * z1
else
tmp = 1.0d0 / z0
end if
code = tmp
end function
public static double code(double z1, double z0) {
double tmp;
if ((z0 - -1.0) <= -2e+152) {
tmp = 1.0 / z0;
} else if ((z0 - -1.0) <= 2e+117) {
tmp = 1.7724539041519165 * z1;
} else {
tmp = 1.0 / z0;
}
return tmp;
}
def code(z1, z0): tmp = 0 if (z0 - -1.0) <= -2e+152: tmp = 1.0 / z0 elif (z0 - -1.0) <= 2e+117: tmp = 1.7724539041519165 * z1 else: tmp = 1.0 / z0 return tmp
function code(z1, z0) tmp = 0.0 if (Float64(z0 - -1.0) <= -2e+152) tmp = Float64(1.0 / z0); elseif (Float64(z0 - -1.0) <= 2e+117) tmp = Float64(1.7724539041519165 * z1); else tmp = Float64(1.0 / z0); end return tmp end
function tmp_2 = code(z1, z0) tmp = 0.0; if ((z0 - -1.0) <= -2e+152) tmp = 1.0 / z0; elseif ((z0 - -1.0) <= 2e+117) tmp = 1.7724539041519165 * z1; else tmp = 1.0 / z0; end tmp_2 = tmp; end
code[z1_, z0_] := If[LessEqual[N[(z0 - -1.0), $MachinePrecision], -2e+152], N[(1.0 / z0), $MachinePrecision], If[LessEqual[N[(z0 - -1.0), $MachinePrecision], 2e+117], N[(1.7724539041519165 * z1), $MachinePrecision], N[(1.0 / z0), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;z0 - -1 \leq -2 \cdot 10^{+152}:\\
\;\;\;\;\frac{1}{z0}\\
\mathbf{elif}\;z0 - -1 \leq 2 \cdot 10^{+117}:\\
\;\;\;\;1.7724539041519165 \cdot z1\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{z0}\\
\end{array}
if (-.f64 z0 #s(literal -1 binary64)) < -2.0000000000000001e152 or 2.0000000000000001e117 < (-.f64 z0 #s(literal -1 binary64)) Initial program 91.9%
Taylor expanded in z0 around inf
lower-/.f6433.9%
Applied rewrites33.9%
if -2.0000000000000001e152 < (-.f64 z0 #s(literal -1 binary64)) < 2.0000000000000001e117Initial program 91.9%
Taylor expanded in z1 around 0
lower-*.f6450.0%
Applied rewrites50.0%
(FPCore (z1 z0) :precision binary64 (* 1.7724539041519165 z1))
double code(double z1, double z0) {
return 1.7724539041519165 * 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.7724539041519165d0 * z1
end function
public static double code(double z1, double z0) {
return 1.7724539041519165 * z1;
}
def code(z1, z0): return 1.7724539041519165 * z1
function code(z1, z0) return Float64(1.7724539041519165 * z1) end
function tmp = code(z1, z0) tmp = 1.7724539041519165 * z1; end
code[z1_, z0_] := N[(1.7724539041519165 * z1), $MachinePrecision]
1.7724539041519165 \cdot z1
Initial program 91.9%
Taylor expanded in z1 around 0
lower-*.f6450.0%
Applied rewrites50.0%
herbie shell --seed 2025250
(FPCore (z1 z0)
:name "(/ z1 (+ (* z1 (- z0 -1)) (* (* (sqrt (- (- 1 z1) z1)) 5641895665989011/10000000000000000) (exp (* (- z1) z1)))))"
:precision binary64
(/ z1 (+ (* z1 (- z0 -1.0)) (* (* (sqrt (- (- 1.0 z1) z1)) 0.5641895665989011) (exp (* (- z1) z1))))))