
(FPCore (d h l M D) :precision binary64 (* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
double code(double d, double h, double l, double M, double D) {
return (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
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(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
end function
public static double code(double d, double h, double l, double M, double D) {
return (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
def code(d, h, l, M, D): return (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))
function code(d, h, l, M, D) return Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) end
function tmp = code(d, h, l, M, D) tmp = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); end
code[d_, h_, l_, M_, D_] := N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)
\end{array}
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (d h l M D) :precision binary64 (* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
double code(double d, double h, double l, double M, double D) {
return (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
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(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
end function
public static double code(double d, double h, double l, double M, double D) {
return (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
def code(d, h, l, M, D): return (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))
function code(d, h, l, M, D) return Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) end
function tmp = code(d, h, l, M, D) tmp = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); end
code[d_, h_, l_, M_, D_] := N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)
\end{array}
d_m = (fabs.f64 d)
(FPCore (d_m h l M D)
:precision binary64
(let* ((t_0
(-
1.0
(* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d_m)) 2.0)) (/ h l)))))
(if (<= h -1e+241)
(* (* (* (/ 1.0 (sqrt (* (* (* d_m d_m) h) l))) d_m) d_m) t_0)
(if (<= h -1e-298)
(* (/ d_m (sqrt (* l h))) t_0)
(* (/ d_m (* (sqrt l) (sqrt h))) t_0)))))d_m = fabs(d);
double code(double d_m, double h, double l, double M, double D) {
double t_0 = 1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l));
double tmp;
if (h <= -1e+241) {
tmp = (((1.0 / sqrt((((d_m * d_m) * h) * l))) * d_m) * d_m) * t_0;
} else if (h <= -1e-298) {
tmp = (d_m / sqrt((l * h))) * t_0;
} else {
tmp = (d_m / (sqrt(l) * sqrt(h))) * t_0;
}
return tmp;
}
d_m = private
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(d_m, h, l, m, d)
use fmin_fmax_functions
real(8), intent (in) :: d_m
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 - (((1.0d0 / 2.0d0) * (((m * d) / (2.0d0 * d_m)) ** 2.0d0)) * (h / l))
if (h <= (-1d+241)) then
tmp = (((1.0d0 / sqrt((((d_m * d_m) * h) * l))) * d_m) * d_m) * t_0
else if (h <= (-1d-298)) then
tmp = (d_m / sqrt((l * h))) * t_0
else
tmp = (d_m / (sqrt(l) * sqrt(h))) * t_0
end if
code = tmp
end function
d_m = Math.abs(d);
public static double code(double d_m, double h, double l, double M, double D) {
double t_0 = 1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l));
double tmp;
if (h <= -1e+241) {
tmp = (((1.0 / Math.sqrt((((d_m * d_m) * h) * l))) * d_m) * d_m) * t_0;
} else if (h <= -1e-298) {
tmp = (d_m / Math.sqrt((l * h))) * t_0;
} else {
tmp = (d_m / (Math.sqrt(l) * Math.sqrt(h))) * t_0;
}
return tmp;
}
d_m = math.fabs(d) def code(d_m, h, l, M, D): t_0 = 1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l)) tmp = 0 if h <= -1e+241: tmp = (((1.0 / math.sqrt((((d_m * d_m) * h) * l))) * d_m) * d_m) * t_0 elif h <= -1e-298: tmp = (d_m / math.sqrt((l * h))) * t_0 else: tmp = (d_m / (math.sqrt(l) * math.sqrt(h))) * t_0 return tmp
d_m = abs(d) function code(d_m, h, l, M, D) t_0 = Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d_m)) ^ 2.0)) * Float64(h / l))) tmp = 0.0 if (h <= -1e+241) tmp = Float64(Float64(Float64(Float64(1.0 / sqrt(Float64(Float64(Float64(d_m * d_m) * h) * l))) * d_m) * d_m) * t_0); elseif (h <= -1e-298) tmp = Float64(Float64(d_m / sqrt(Float64(l * h))) * t_0); else tmp = Float64(Float64(d_m / Float64(sqrt(l) * sqrt(h))) * t_0); end return tmp end
d_m = abs(d); function tmp_2 = code(d_m, h, l, M, D) t_0 = 1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d_m)) ^ 2.0)) * (h / l)); tmp = 0.0; if (h <= -1e+241) tmp = (((1.0 / sqrt((((d_m * d_m) * h) * l))) * d_m) * d_m) * t_0; elseif (h <= -1e-298) tmp = (d_m / sqrt((l * h))) * t_0; else tmp = (d_m / (sqrt(l) * sqrt(h))) * t_0; end tmp_2 = tmp; end
d_m = N[Abs[d], $MachinePrecision]
code[d$95$m_, h_, l_, M_, D_] := Block[{t$95$0 = N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -1e+241], N[(N[(N[(N[(1.0 / N[Sqrt[N[(N[(N[(d$95$m * d$95$m), $MachinePrecision] * h), $MachinePrecision] * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * d$95$m), $MachinePrecision] * d$95$m), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[h, -1e-298], N[(N[(d$95$m / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[(d$95$m / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]]]]
\begin{array}{l}
d_m = \left|d\right|
\\
\begin{array}{l}
t_0 := 1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d\_m}\right)}^{2}\right) \cdot \frac{h}{\ell}\\
\mathbf{if}\;h \leq -1 \cdot 10^{+241}:\\
\;\;\;\;\left(\left(\frac{1}{\sqrt{\left(\left(d\_m \cdot d\_m\right) \cdot h\right) \cdot \ell}} \cdot d\_m\right) \cdot d\_m\right) \cdot t\_0\\
\mathbf{elif}\;h \leq -1 \cdot 10^{-298}:\\
\;\;\;\;\frac{d\_m}{\sqrt{\ell \cdot h}} \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{d\_m}{\sqrt{\ell} \cdot \sqrt{h}} \cdot t\_0\\
\end{array}
\end{array}
if h < -1.0000000000000001e241Initial program 34.4%
Taylor expanded in d around inf
*-commutativeN/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites47.9%
lift-sqrt.f64N/A
lift-/.f64N/A
inv-powN/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
unpow-prod-downN/A
inv-powN/A
associate-/r*N/A
inv-powN/A
inv-powN/A
associate-/r*N/A
inv-powN/A
frac-timesN/A
inv-powN/A
inv-powN/A
times-fracN/A
metadata-evalN/A
unpow2N/A
associate-/r*N/A
Applied rewrites40.9%
if -1.0000000000000001e241 < h < -9.99999999999999912e-299Initial program 34.4%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f6432.5
Applied rewrites32.5%
lift-*.f64N/A
lift-/.f64N/A
lift-sqrt.f64N/A
sqrt-divN/A
lift-/.f64N/A
lift-sqrt.f64N/A
sqrt-divN/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f64N/A
*-commutativeN/A
sqrt-unprodN/A
lower-sqrt.f64N/A
*-commutativeN/A
lower-*.f6469.4
Applied rewrites69.4%
Taylor expanded in d around 0
pow2N/A
rem-square-sqrt69.5
Applied rewrites69.5%
if -9.99999999999999912e-299 < h Initial program 34.4%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
*-commutativeN/A
sqrt-unprodN/A
sqrt-divN/A
sqrt-divN/A
frac-timesN/A
pow1/2N/A
metadata-evalN/A
pow1/2N/A
metadata-evalN/A
sqr-powN/A
unpow1N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6439.0
Applied rewrites39.0%
d_m = (fabs.f64 d)
(FPCore (d_m h l M D)
:precision binary64
(let* ((t_0
(-
1.0
(* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d_m)) 2.0)) (/ h l)))))
(if (<= h -1e-298)
(* (/ d_m (sqrt (* l h))) t_0)
(* (/ d_m (* (sqrt l) (sqrt h))) t_0))))d_m = fabs(d);
double code(double d_m, double h, double l, double M, double D) {
double t_0 = 1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l));
double tmp;
if (h <= -1e-298) {
tmp = (d_m / sqrt((l * h))) * t_0;
} else {
tmp = (d_m / (sqrt(l) * sqrt(h))) * t_0;
}
return tmp;
}
d_m = private
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(d_m, h, l, m, d)
use fmin_fmax_functions
real(8), intent (in) :: d_m
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 - (((1.0d0 / 2.0d0) * (((m * d) / (2.0d0 * d_m)) ** 2.0d0)) * (h / l))
if (h <= (-1d-298)) then
tmp = (d_m / sqrt((l * h))) * t_0
else
tmp = (d_m / (sqrt(l) * sqrt(h))) * t_0
end if
code = tmp
end function
d_m = Math.abs(d);
public static double code(double d_m, double h, double l, double M, double D) {
double t_0 = 1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l));
double tmp;
if (h <= -1e-298) {
tmp = (d_m / Math.sqrt((l * h))) * t_0;
} else {
tmp = (d_m / (Math.sqrt(l) * Math.sqrt(h))) * t_0;
}
return tmp;
}
d_m = math.fabs(d) def code(d_m, h, l, M, D): t_0 = 1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l)) tmp = 0 if h <= -1e-298: tmp = (d_m / math.sqrt((l * h))) * t_0 else: tmp = (d_m / (math.sqrt(l) * math.sqrt(h))) * t_0 return tmp
d_m = abs(d) function code(d_m, h, l, M, D) t_0 = Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d_m)) ^ 2.0)) * Float64(h / l))) tmp = 0.0 if (h <= -1e-298) tmp = Float64(Float64(d_m / sqrt(Float64(l * h))) * t_0); else tmp = Float64(Float64(d_m / Float64(sqrt(l) * sqrt(h))) * t_0); end return tmp end
d_m = abs(d); function tmp_2 = code(d_m, h, l, M, D) t_0 = 1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d_m)) ^ 2.0)) * (h / l)); tmp = 0.0; if (h <= -1e-298) tmp = (d_m / sqrt((l * h))) * t_0; else tmp = (d_m / (sqrt(l) * sqrt(h))) * t_0; end tmp_2 = tmp; end
d_m = N[Abs[d], $MachinePrecision]
code[d$95$m_, h_, l_, M_, D_] := Block[{t$95$0 = N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -1e-298], N[(N[(d$95$m / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[(d$95$m / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]]]
\begin{array}{l}
d_m = \left|d\right|
\\
\begin{array}{l}
t_0 := 1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d\_m}\right)}^{2}\right) \cdot \frac{h}{\ell}\\
\mathbf{if}\;h \leq -1 \cdot 10^{-298}:\\
\;\;\;\;\frac{d\_m}{\sqrt{\ell \cdot h}} \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{d\_m}{\sqrt{\ell} \cdot \sqrt{h}} \cdot t\_0\\
\end{array}
\end{array}
if h < -9.99999999999999912e-299Initial program 34.4%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f6432.5
Applied rewrites32.5%
lift-*.f64N/A
lift-/.f64N/A
lift-sqrt.f64N/A
sqrt-divN/A
lift-/.f64N/A
lift-sqrt.f64N/A
sqrt-divN/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f64N/A
*-commutativeN/A
sqrt-unprodN/A
lower-sqrt.f64N/A
*-commutativeN/A
lower-*.f6469.4
Applied rewrites69.4%
Taylor expanded in d around 0
pow2N/A
rem-square-sqrt69.5
Applied rewrites69.5%
if -9.99999999999999912e-299 < h Initial program 34.4%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
*-commutativeN/A
sqrt-unprodN/A
sqrt-divN/A
sqrt-divN/A
frac-timesN/A
pow1/2N/A
metadata-evalN/A
pow1/2N/A
metadata-evalN/A
sqr-powN/A
unpow1N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6439.0
Applied rewrites39.0%
d_m = (fabs.f64 d)
(FPCore (d_m h l M D)
:precision binary64
(let* ((t_0
(- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d_m)) 2.0)) (/ h l))))
(t_1
(* (* (pow (/ d_m h) (/ 1.0 2.0)) (pow (/ d_m l) (/ 1.0 2.0))) t_0)))
(if (<= t_1 -2e-169)
(* (/ (* -0.125 (* M (* D M))) (* (* l d_m) (sqrt (* (/ 1.0 h) l)))) D)
(if (<= t_1 2e+222)
(/ (/ d_m (sqrt h)) (sqrt l))
(* (/ d_m (sqrt (* l h))) t_0)))))d_m = fabs(d);
double code(double d_m, double h, double l, double M, double D) {
double t_0 = 1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l));
double t_1 = (pow((d_m / h), (1.0 / 2.0)) * pow((d_m / l), (1.0 / 2.0))) * t_0;
double tmp;
if (t_1 <= -2e-169) {
tmp = ((-0.125 * (M * (D * M))) / ((l * d_m) * sqrt(((1.0 / h) * l)))) * D;
} else if (t_1 <= 2e+222) {
tmp = (d_m / sqrt(h)) / sqrt(l);
} else {
tmp = (d_m / sqrt((l * h))) * t_0;
}
return tmp;
}
d_m = private
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(d_m, h, l, m, d)
use fmin_fmax_functions
real(8), intent (in) :: d_m
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 1.0d0 - (((1.0d0 / 2.0d0) * (((m * d) / (2.0d0 * d_m)) ** 2.0d0)) * (h / l))
t_1 = (((d_m / h) ** (1.0d0 / 2.0d0)) * ((d_m / l) ** (1.0d0 / 2.0d0))) * t_0
if (t_1 <= (-2d-169)) then
tmp = (((-0.125d0) * (m * (d * m))) / ((l * d_m) * sqrt(((1.0d0 / h) * l)))) * d
else if (t_1 <= 2d+222) then
tmp = (d_m / sqrt(h)) / sqrt(l)
else
tmp = (d_m / sqrt((l * h))) * t_0
end if
code = tmp
end function
d_m = Math.abs(d);
public static double code(double d_m, double h, double l, double M, double D) {
double t_0 = 1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l));
double t_1 = (Math.pow((d_m / h), (1.0 / 2.0)) * Math.pow((d_m / l), (1.0 / 2.0))) * t_0;
double tmp;
if (t_1 <= -2e-169) {
tmp = ((-0.125 * (M * (D * M))) / ((l * d_m) * Math.sqrt(((1.0 / h) * l)))) * D;
} else if (t_1 <= 2e+222) {
tmp = (d_m / Math.sqrt(h)) / Math.sqrt(l);
} else {
tmp = (d_m / Math.sqrt((l * h))) * t_0;
}
return tmp;
}
d_m = math.fabs(d) def code(d_m, h, l, M, D): t_0 = 1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l)) t_1 = (math.pow((d_m / h), (1.0 / 2.0)) * math.pow((d_m / l), (1.0 / 2.0))) * t_0 tmp = 0 if t_1 <= -2e-169: tmp = ((-0.125 * (M * (D * M))) / ((l * d_m) * math.sqrt(((1.0 / h) * l)))) * D elif t_1 <= 2e+222: tmp = (d_m / math.sqrt(h)) / math.sqrt(l) else: tmp = (d_m / math.sqrt((l * h))) * t_0 return tmp
d_m = abs(d) function code(d_m, h, l, M, D) t_0 = Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d_m)) ^ 2.0)) * Float64(h / l))) t_1 = Float64(Float64((Float64(d_m / h) ^ Float64(1.0 / 2.0)) * (Float64(d_m / l) ^ Float64(1.0 / 2.0))) * t_0) tmp = 0.0 if (t_1 <= -2e-169) tmp = Float64(Float64(Float64(-0.125 * Float64(M * Float64(D * M))) / Float64(Float64(l * d_m) * sqrt(Float64(Float64(1.0 / h) * l)))) * D); elseif (t_1 <= 2e+222) tmp = Float64(Float64(d_m / sqrt(h)) / sqrt(l)); else tmp = Float64(Float64(d_m / sqrt(Float64(l * h))) * t_0); end return tmp end
d_m = abs(d); function tmp_2 = code(d_m, h, l, M, D) t_0 = 1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d_m)) ^ 2.0)) * (h / l)); t_1 = (((d_m / h) ^ (1.0 / 2.0)) * ((d_m / l) ^ (1.0 / 2.0))) * t_0; tmp = 0.0; if (t_1 <= -2e-169) tmp = ((-0.125 * (M * (D * M))) / ((l * d_m) * sqrt(((1.0 / h) * l)))) * D; elseif (t_1 <= 2e+222) tmp = (d_m / sqrt(h)) / sqrt(l); else tmp = (d_m / sqrt((l * h))) * t_0; end tmp_2 = tmp; end
d_m = N[Abs[d], $MachinePrecision]
code[d$95$m_, h_, l_, M_, D_] := Block[{t$95$0 = N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Power[N[(d$95$m / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d$95$m / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]}, If[LessEqual[t$95$1, -2e-169], N[(N[(N[(-0.125 * N[(M * N[(D * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(l * d$95$m), $MachinePrecision] * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * D), $MachinePrecision], If[LessEqual[t$95$1, 2e+222], N[(N[(d$95$m / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision], N[(N[(d$95$m / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]]]]]
\begin{array}{l}
d_m = \left|d\right|
\\
\begin{array}{l}
t_0 := 1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d\_m}\right)}^{2}\right) \cdot \frac{h}{\ell}\\
t_1 := \left({\left(\frac{d\_m}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d\_m}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot t\_0\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{-169}:\\
\;\;\;\;\frac{-0.125 \cdot \left(M \cdot \left(D \cdot M\right)\right)}{\left(\ell \cdot d\_m\right) \cdot \sqrt{\frac{1}{h} \cdot \ell}} \cdot D\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+222}:\\
\;\;\;\;\frac{\frac{d\_m}{\sqrt{h}}}{\sqrt{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d\_m}{\sqrt{\ell \cdot h}} \cdot t\_0\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -2.00000000000000004e-169Initial program 34.4%
Taylor expanded in d around 0
Applied rewrites12.1%
Taylor expanded in h around inf
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
pow2N/A
lower-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-/.f6421.7
Applied rewrites21.7%
if -2.00000000000000004e-169 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2.0000000000000001e222Initial program 34.4%
Taylor expanded in l around inf
sqrt-unprodN/A
*-commutativeN/A
sqrt-unprodN/A
sqrt-divN/A
sqrt-divN/A
frac-timesN/A
pow1/2N/A
metadata-evalN/A
pow1/2N/A
metadata-evalN/A
sqr-powN/A
unpow1N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6424.8
Applied rewrites24.8%
lift-/.f64N/A
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f6424.0
Applied rewrites24.0%
if 2.0000000000000001e222 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 34.4%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f6432.5
Applied rewrites32.5%
lift-*.f64N/A
lift-/.f64N/A
lift-sqrt.f64N/A
sqrt-divN/A
lift-/.f64N/A
lift-sqrt.f64N/A
sqrt-divN/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f64N/A
*-commutativeN/A
sqrt-unprodN/A
lower-sqrt.f64N/A
*-commutativeN/A
lower-*.f6469.4
Applied rewrites69.4%
Taylor expanded in d around 0
pow2N/A
rem-square-sqrt69.5
Applied rewrites69.5%
d_m = (fabs.f64 d)
(FPCore (d_m h l M D)
:precision binary64
(let* ((t_0
(*
(* (pow (/ d_m h) (/ 1.0 2.0)) (pow (/ d_m l) (/ 1.0 2.0)))
(-
1.0
(* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d_m)) 2.0)) (/ h l)))))
(t_1 (* M (/ D (+ d_m d_m)))))
(if (<= t_0 -2e-169)
(* (/ (* -0.125 (* M (* D M))) (* (* l d_m) (sqrt (* (/ 1.0 h) l)))) D)
(if (<= t_0 2e+222)
(/ (/ d_m (sqrt h)) (sqrt l))
(*
(/ d_m (sqrt (* l h)))
(- 1.0 (* (* (/ 1.0 2.0) (* t_1 t_1)) (/ h l))))))))d_m = fabs(d);
double code(double d_m, double h, double l, double M, double D) {
double t_0 = (pow((d_m / h), (1.0 / 2.0)) * pow((d_m / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l)));
double t_1 = M * (D / (d_m + d_m));
double tmp;
if (t_0 <= -2e-169) {
tmp = ((-0.125 * (M * (D * M))) / ((l * d_m) * sqrt(((1.0 / h) * l)))) * D;
} else if (t_0 <= 2e+222) {
tmp = (d_m / sqrt(h)) / sqrt(l);
} else {
tmp = (d_m / sqrt((l * h))) * (1.0 - (((1.0 / 2.0) * (t_1 * t_1)) * (h / l)));
}
return tmp;
}
d_m = private
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(d_m, h, l, m, d)
use fmin_fmax_functions
real(8), intent (in) :: d_m
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (((d_m / h) ** (1.0d0 / 2.0d0)) * ((d_m / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d) / (2.0d0 * d_m)) ** 2.0d0)) * (h / l)))
t_1 = m * (d / (d_m + d_m))
if (t_0 <= (-2d-169)) then
tmp = (((-0.125d0) * (m * (d * m))) / ((l * d_m) * sqrt(((1.0d0 / h) * l)))) * d
else if (t_0 <= 2d+222) then
tmp = (d_m / sqrt(h)) / sqrt(l)
else
tmp = (d_m / sqrt((l * h))) * (1.0d0 - (((1.0d0 / 2.0d0) * (t_1 * t_1)) * (h / l)))
end if
code = tmp
end function
d_m = Math.abs(d);
public static double code(double d_m, double h, double l, double M, double D) {
double t_0 = (Math.pow((d_m / h), (1.0 / 2.0)) * Math.pow((d_m / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l)));
double t_1 = M * (D / (d_m + d_m));
double tmp;
if (t_0 <= -2e-169) {
tmp = ((-0.125 * (M * (D * M))) / ((l * d_m) * Math.sqrt(((1.0 / h) * l)))) * D;
} else if (t_0 <= 2e+222) {
tmp = (d_m / Math.sqrt(h)) / Math.sqrt(l);
} else {
tmp = (d_m / Math.sqrt((l * h))) * (1.0 - (((1.0 / 2.0) * (t_1 * t_1)) * (h / l)));
}
return tmp;
}
d_m = math.fabs(d) def code(d_m, h, l, M, D): t_0 = (math.pow((d_m / h), (1.0 / 2.0)) * math.pow((d_m / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l))) t_1 = M * (D / (d_m + d_m)) tmp = 0 if t_0 <= -2e-169: tmp = ((-0.125 * (M * (D * M))) / ((l * d_m) * math.sqrt(((1.0 / h) * l)))) * D elif t_0 <= 2e+222: tmp = (d_m / math.sqrt(h)) / math.sqrt(l) else: tmp = (d_m / math.sqrt((l * h))) * (1.0 - (((1.0 / 2.0) * (t_1 * t_1)) * (h / l))) return tmp
d_m = abs(d) function code(d_m, h, l, M, D) t_0 = Float64(Float64((Float64(d_m / h) ^ Float64(1.0 / 2.0)) * (Float64(d_m / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d_m)) ^ 2.0)) * Float64(h / l)))) t_1 = Float64(M * Float64(D / Float64(d_m + d_m))) tmp = 0.0 if (t_0 <= -2e-169) tmp = Float64(Float64(Float64(-0.125 * Float64(M * Float64(D * M))) / Float64(Float64(l * d_m) * sqrt(Float64(Float64(1.0 / h) * l)))) * D); elseif (t_0 <= 2e+222) tmp = Float64(Float64(d_m / sqrt(h)) / sqrt(l)); else tmp = Float64(Float64(d_m / sqrt(Float64(l * h))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * Float64(t_1 * t_1)) * Float64(h / l)))); end return tmp end
d_m = abs(d); function tmp_2 = code(d_m, h, l, M, D) t_0 = (((d_m / h) ^ (1.0 / 2.0)) * ((d_m / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d_m)) ^ 2.0)) * (h / l))); t_1 = M * (D / (d_m + d_m)); tmp = 0.0; if (t_0 <= -2e-169) tmp = ((-0.125 * (M * (D * M))) / ((l * d_m) * sqrt(((1.0 / h) * l)))) * D; elseif (t_0 <= 2e+222) tmp = (d_m / sqrt(h)) / sqrt(l); else tmp = (d_m / sqrt((l * h))) * (1.0 - (((1.0 / 2.0) * (t_1 * t_1)) * (h / l))); end tmp_2 = tmp; end
d_m = N[Abs[d], $MachinePrecision]
code[d$95$m_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(N[Power[N[(d$95$m / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d$95$m / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(M * N[(D / N[(d$95$m + d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -2e-169], N[(N[(N[(-0.125 * N[(M * N[(D * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(l * d$95$m), $MachinePrecision] * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * D), $MachinePrecision], If[LessEqual[t$95$0, 2e+222], N[(N[(d$95$m / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision], N[(N[(d$95$m / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
d_m = \left|d\right|
\\
\begin{array}{l}
t_0 := \left({\left(\frac{d\_m}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d\_m}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d\_m}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_1 := M \cdot \frac{D}{d\_m + d\_m}\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{-169}:\\
\;\;\;\;\frac{-0.125 \cdot \left(M \cdot \left(D \cdot M\right)\right)}{\left(\ell \cdot d\_m\right) \cdot \sqrt{\frac{1}{h} \cdot \ell}} \cdot D\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+222}:\\
\;\;\;\;\frac{\frac{d\_m}{\sqrt{h}}}{\sqrt{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d\_m}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\frac{1}{2} \cdot \left(t\_1 \cdot t\_1\right)\right) \cdot \frac{h}{\ell}\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -2.00000000000000004e-169Initial program 34.4%
Taylor expanded in d around 0
Applied rewrites12.1%
Taylor expanded in h around inf
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
pow2N/A
lower-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-/.f6421.7
Applied rewrites21.7%
if -2.00000000000000004e-169 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2.0000000000000001e222Initial program 34.4%
Taylor expanded in l around inf
sqrt-unprodN/A
*-commutativeN/A
sqrt-unprodN/A
sqrt-divN/A
sqrt-divN/A
frac-timesN/A
pow1/2N/A
metadata-evalN/A
pow1/2N/A
metadata-evalN/A
sqr-powN/A
unpow1N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6424.8
Applied rewrites24.8%
lift-/.f64N/A
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f6424.0
Applied rewrites24.0%
if 2.0000000000000001e222 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 34.4%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f6432.5
Applied rewrites32.5%
lift-*.f64N/A
lift-/.f64N/A
lift-sqrt.f64N/A
sqrt-divN/A
lift-/.f64N/A
lift-sqrt.f64N/A
sqrt-divN/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f64N/A
*-commutativeN/A
sqrt-unprodN/A
lower-sqrt.f64N/A
*-commutativeN/A
lower-*.f6469.4
Applied rewrites69.4%
Taylor expanded in d around 0
pow2N/A
rem-square-sqrt69.5
Applied rewrites69.5%
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
unpow2N/A
lower-*.f64N/A
count-2-revN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f64N/A
count-2-revN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6469.1
Applied rewrites69.1%
d_m = (fabs.f64 d)
(FPCore (d_m h l M D)
:precision binary64
(let* ((t_0 (* M (* D M)))
(t_1
(*
(* (pow (/ d_m h) (/ 1.0 2.0)) (pow (/ d_m l) (/ 1.0 2.0)))
(-
1.0
(* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d_m)) 2.0)) (/ h l))))))
(if (<= t_1 -2e-169)
(* (/ (* -0.125 t_0) (* (* l d_m) (sqrt (* (/ 1.0 h) l)))) D)
(if (<= t_1 2e+222)
(/ (/ d_m (sqrt h)) (sqrt l))
(*
(/ d_m (sqrt (* h l)))
(fma (/ (* -0.125 (* t_0 D)) (* (* d_m d_m) l)) h 1.0))))))d_m = fabs(d);
double code(double d_m, double h, double l, double M, double D) {
double t_0 = M * (D * M);
double t_1 = (pow((d_m / h), (1.0 / 2.0)) * pow((d_m / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l)));
double tmp;
if (t_1 <= -2e-169) {
tmp = ((-0.125 * t_0) / ((l * d_m) * sqrt(((1.0 / h) * l)))) * D;
} else if (t_1 <= 2e+222) {
tmp = (d_m / sqrt(h)) / sqrt(l);
} else {
tmp = (d_m / sqrt((h * l))) * fma(((-0.125 * (t_0 * D)) / ((d_m * d_m) * l)), h, 1.0);
}
return tmp;
}
d_m = abs(d) function code(d_m, h, l, M, D) t_0 = Float64(M * Float64(D * M)) t_1 = Float64(Float64((Float64(d_m / h) ^ Float64(1.0 / 2.0)) * (Float64(d_m / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d_m)) ^ 2.0)) * Float64(h / l)))) tmp = 0.0 if (t_1 <= -2e-169) tmp = Float64(Float64(Float64(-0.125 * t_0) / Float64(Float64(l * d_m) * sqrt(Float64(Float64(1.0 / h) * l)))) * D); elseif (t_1 <= 2e+222) tmp = Float64(Float64(d_m / sqrt(h)) / sqrt(l)); else tmp = Float64(Float64(d_m / sqrt(Float64(h * l))) * fma(Float64(Float64(-0.125 * Float64(t_0 * D)) / Float64(Float64(d_m * d_m) * l)), h, 1.0)); end return tmp end
d_m = N[Abs[d], $MachinePrecision]
code[d$95$m_, h_, l_, M_, D_] := Block[{t$95$0 = N[(M * N[(D * M), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Power[N[(d$95$m / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d$95$m / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e-169], N[(N[(N[(-0.125 * t$95$0), $MachinePrecision] / N[(N[(l * d$95$m), $MachinePrecision] * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * D), $MachinePrecision], If[LessEqual[t$95$1, 2e+222], N[(N[(d$95$m / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision], N[(N[(d$95$m / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(-0.125 * N[(t$95$0 * D), $MachinePrecision]), $MachinePrecision] / N[(N[(d$95$m * d$95$m), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] * h + 1.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
d_m = \left|d\right|
\\
\begin{array}{l}
t_0 := M \cdot \left(D \cdot M\right)\\
t_1 := \left({\left(\frac{d\_m}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d\_m}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d\_m}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{-169}:\\
\;\;\;\;\frac{-0.125 \cdot t\_0}{\left(\ell \cdot d\_m\right) \cdot \sqrt{\frac{1}{h} \cdot \ell}} \cdot D\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+222}:\\
\;\;\;\;\frac{\frac{d\_m}{\sqrt{h}}}{\sqrt{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d\_m}{\sqrt{h \cdot \ell}} \cdot \mathsf{fma}\left(\frac{-0.125 \cdot \left(t\_0 \cdot D\right)}{\left(d\_m \cdot d\_m\right) \cdot \ell}, h, 1\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -2.00000000000000004e-169Initial program 34.4%
Taylor expanded in d around 0
Applied rewrites12.1%
Taylor expanded in h around inf
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
pow2N/A
lower-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-/.f6421.7
Applied rewrites21.7%
if -2.00000000000000004e-169 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2.0000000000000001e222Initial program 34.4%
Taylor expanded in l around inf
sqrt-unprodN/A
*-commutativeN/A
sqrt-unprodN/A
sqrt-divN/A
sqrt-divN/A
frac-timesN/A
pow1/2N/A
metadata-evalN/A
pow1/2N/A
metadata-evalN/A
sqr-powN/A
unpow1N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6424.8
Applied rewrites24.8%
lift-/.f64N/A
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f6424.0
Applied rewrites24.0%
if 2.0000000000000001e222 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 34.4%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f6432.5
Applied rewrites32.5%
Taylor expanded in h around inf
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
distribute-rgt-inN/A
inv-powN/A
pow-plusN/A
metadata-evalN/A
metadata-evalN/A
lower-fma.f64N/A
Applied rewrites23.8%
Applied rewrites59.3%
d_m = (fabs.f64 d) (FPCore (d_m h l M D) :precision binary64 (if (<= M 1.26e-109) (/ d_m (sqrt (* l h))) (* (/ (* (* (* M (* D M)) D) h) (* (* l d_m) (sqrt (* h l)))) -0.125)))
d_m = fabs(d);
double code(double d_m, double h, double l, double M, double D) {
double tmp;
if (M <= 1.26e-109) {
tmp = d_m / sqrt((l * h));
} else {
tmp = ((((M * (D * M)) * D) * h) / ((l * d_m) * sqrt((h * l)))) * -0.125;
}
return tmp;
}
d_m = private
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(d_m, h, l, m, d)
use fmin_fmax_functions
real(8), intent (in) :: d_m
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8) :: tmp
if (m <= 1.26d-109) then
tmp = d_m / sqrt((l * h))
else
tmp = ((((m * (d * m)) * d) * h) / ((l * d_m) * sqrt((h * l)))) * (-0.125d0)
end if
code = tmp
end function
d_m = Math.abs(d);
public static double code(double d_m, double h, double l, double M, double D) {
double tmp;
if (M <= 1.26e-109) {
tmp = d_m / Math.sqrt((l * h));
} else {
tmp = ((((M * (D * M)) * D) * h) / ((l * d_m) * Math.sqrt((h * l)))) * -0.125;
}
return tmp;
}
d_m = math.fabs(d) def code(d_m, h, l, M, D): tmp = 0 if M <= 1.26e-109: tmp = d_m / math.sqrt((l * h)) else: tmp = ((((M * (D * M)) * D) * h) / ((l * d_m) * math.sqrt((h * l)))) * -0.125 return tmp
d_m = abs(d) function code(d_m, h, l, M, D) tmp = 0.0 if (M <= 1.26e-109) tmp = Float64(d_m / sqrt(Float64(l * h))); else tmp = Float64(Float64(Float64(Float64(Float64(M * Float64(D * M)) * D) * h) / Float64(Float64(l * d_m) * sqrt(Float64(h * l)))) * -0.125); end return tmp end
d_m = abs(d); function tmp_2 = code(d_m, h, l, M, D) tmp = 0.0; if (M <= 1.26e-109) tmp = d_m / sqrt((l * h)); else tmp = ((((M * (D * M)) * D) * h) / ((l * d_m) * sqrt((h * l)))) * -0.125; end tmp_2 = tmp; end
d_m = N[Abs[d], $MachinePrecision] code[d$95$m_, h_, l_, M_, D_] := If[LessEqual[M, 1.26e-109], N[(d$95$m / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(M * N[(D * M), $MachinePrecision]), $MachinePrecision] * D), $MachinePrecision] * h), $MachinePrecision] / N[(N[(l * d$95$m), $MachinePrecision] * N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision]]
\begin{array}{l}
d_m = \left|d\right|
\\
\begin{array}{l}
\mathbf{if}\;M \leq 1.26 \cdot 10^{-109}:\\
\;\;\;\;\frac{d\_m}{\sqrt{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(\left(M \cdot \left(D \cdot M\right)\right) \cdot D\right) \cdot h}{\left(\ell \cdot d\_m\right) \cdot \sqrt{h \cdot \ell}} \cdot -0.125\\
\end{array}
\end{array}
if M < 1.26000000000000007e-109Initial program 34.4%
Taylor expanded in l around inf
sqrt-unprodN/A
*-commutativeN/A
sqrt-unprodN/A
sqrt-divN/A
sqrt-divN/A
frac-timesN/A
pow1/2N/A
metadata-evalN/A
pow1/2N/A
metadata-evalN/A
sqr-powN/A
unpow1N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6424.8
Applied rewrites24.8%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
*-commutativeN/A
sqrt-unprodN/A
lower-sqrt.f64N/A
*-commutativeN/A
lower-*.f6443.1
Applied rewrites43.1%
if 1.26000000000000007e-109 < M Initial program 34.4%
Taylor expanded in d around 0
Applied rewrites12.1%
Taylor expanded in d around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites36.1%
d_m = (fabs.f64 d) (FPCore (d_m h l M D) :precision binary64 (if (<= M 2.6e-99) (/ d_m (sqrt (* l h))) (* (* (* (/ (* (* M M) h) (* (* l d_m) (sqrt (* h l)))) -0.125) D) D)))
d_m = fabs(d);
double code(double d_m, double h, double l, double M, double D) {
double tmp;
if (M <= 2.6e-99) {
tmp = d_m / sqrt((l * h));
} else {
tmp = (((((M * M) * h) / ((l * d_m) * sqrt((h * l)))) * -0.125) * D) * D;
}
return tmp;
}
d_m = private
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(d_m, h, l, m, d)
use fmin_fmax_functions
real(8), intent (in) :: d_m
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8) :: tmp
if (m <= 2.6d-99) then
tmp = d_m / sqrt((l * h))
else
tmp = (((((m * m) * h) / ((l * d_m) * sqrt((h * l)))) * (-0.125d0)) * d) * d
end if
code = tmp
end function
d_m = Math.abs(d);
public static double code(double d_m, double h, double l, double M, double D) {
double tmp;
if (M <= 2.6e-99) {
tmp = d_m / Math.sqrt((l * h));
} else {
tmp = (((((M * M) * h) / ((l * d_m) * Math.sqrt((h * l)))) * -0.125) * D) * D;
}
return tmp;
}
d_m = math.fabs(d) def code(d_m, h, l, M, D): tmp = 0 if M <= 2.6e-99: tmp = d_m / math.sqrt((l * h)) else: tmp = (((((M * M) * h) / ((l * d_m) * math.sqrt((h * l)))) * -0.125) * D) * D return tmp
d_m = abs(d) function code(d_m, h, l, M, D) tmp = 0.0 if (M <= 2.6e-99) tmp = Float64(d_m / sqrt(Float64(l * h))); else tmp = Float64(Float64(Float64(Float64(Float64(Float64(M * M) * h) / Float64(Float64(l * d_m) * sqrt(Float64(h * l)))) * -0.125) * D) * D); end return tmp end
d_m = abs(d); function tmp_2 = code(d_m, h, l, M, D) tmp = 0.0; if (M <= 2.6e-99) tmp = d_m / sqrt((l * h)); else tmp = (((((M * M) * h) / ((l * d_m) * sqrt((h * l)))) * -0.125) * D) * D; end tmp_2 = tmp; end
d_m = N[Abs[d], $MachinePrecision] code[d$95$m_, h_, l_, M_, D_] := If[LessEqual[M, 2.6e-99], N[(d$95$m / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(N[(M * M), $MachinePrecision] * h), $MachinePrecision] / N[(N[(l * d$95$m), $MachinePrecision] * N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision] * D), $MachinePrecision] * D), $MachinePrecision]]
\begin{array}{l}
d_m = \left|d\right|
\\
\begin{array}{l}
\mathbf{if}\;M \leq 2.6 \cdot 10^{-99}:\\
\;\;\;\;\frac{d\_m}{\sqrt{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\frac{\left(M \cdot M\right) \cdot h}{\left(\ell \cdot d\_m\right) \cdot \sqrt{h \cdot \ell}} \cdot -0.125\right) \cdot D\right) \cdot D\\
\end{array}
\end{array}
if M < 2.60000000000000005e-99Initial program 34.4%
Taylor expanded in l around inf
sqrt-unprodN/A
*-commutativeN/A
sqrt-unprodN/A
sqrt-divN/A
sqrt-divN/A
frac-timesN/A
pow1/2N/A
metadata-evalN/A
pow1/2N/A
metadata-evalN/A
sqr-powN/A
unpow1N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6424.8
Applied rewrites24.8%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
*-commutativeN/A
sqrt-unprodN/A
lower-sqrt.f64N/A
*-commutativeN/A
lower-*.f6443.1
Applied rewrites43.1%
if 2.60000000000000005e-99 < M Initial program 34.4%
Taylor expanded in d around 0
Applied rewrites12.1%
Taylor expanded in d around 0
lower-/.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
sqrt-prodN/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
*-commutativeN/A
lower-*.f6432.5
Applied rewrites32.5%
d_m = (fabs.f64 d)
(FPCore (d_m h l M D)
:precision binary64
(let* ((t_0
(*
(* (pow (/ d_m h) (/ 1.0 2.0)) (pow (/ d_m l) (/ 1.0 2.0)))
(-
1.0
(* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d_m)) 2.0)) (/ h l))))))
(if (<= t_0 -2e-169)
(* (* (sqrt (/ 1.0 (* l d_m))) d_m) (- (* (sqrt (/ 1.0 (* h d_m))) d_m)))
(if (<= t_0 2e+222)
(/ (/ d_m (sqrt h)) (sqrt l))
(/ d_m (sqrt (* l h)))))))d_m = fabs(d);
double code(double d_m, double h, double l, double M, double D) {
double t_0 = (pow((d_m / h), (1.0 / 2.0)) * pow((d_m / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l)));
double tmp;
if (t_0 <= -2e-169) {
tmp = (sqrt((1.0 / (l * d_m))) * d_m) * -(sqrt((1.0 / (h * d_m))) * d_m);
} else if (t_0 <= 2e+222) {
tmp = (d_m / sqrt(h)) / sqrt(l);
} else {
tmp = d_m / sqrt((l * h));
}
return tmp;
}
d_m = private
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(d_m, h, l, m, d)
use fmin_fmax_functions
real(8), intent (in) :: d_m
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8) :: t_0
real(8) :: tmp
t_0 = (((d_m / h) ** (1.0d0 / 2.0d0)) * ((d_m / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d) / (2.0d0 * d_m)) ** 2.0d0)) * (h / l)))
if (t_0 <= (-2d-169)) then
tmp = (sqrt((1.0d0 / (l * d_m))) * d_m) * -(sqrt((1.0d0 / (h * d_m))) * d_m)
else if (t_0 <= 2d+222) then
tmp = (d_m / sqrt(h)) / sqrt(l)
else
tmp = d_m / sqrt((l * h))
end if
code = tmp
end function
d_m = Math.abs(d);
public static double code(double d_m, double h, double l, double M, double D) {
double t_0 = (Math.pow((d_m / h), (1.0 / 2.0)) * Math.pow((d_m / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l)));
double tmp;
if (t_0 <= -2e-169) {
tmp = (Math.sqrt((1.0 / (l * d_m))) * d_m) * -(Math.sqrt((1.0 / (h * d_m))) * d_m);
} else if (t_0 <= 2e+222) {
tmp = (d_m / Math.sqrt(h)) / Math.sqrt(l);
} else {
tmp = d_m / Math.sqrt((l * h));
}
return tmp;
}
d_m = math.fabs(d) def code(d_m, h, l, M, D): t_0 = (math.pow((d_m / h), (1.0 / 2.0)) * math.pow((d_m / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l))) tmp = 0 if t_0 <= -2e-169: tmp = (math.sqrt((1.0 / (l * d_m))) * d_m) * -(math.sqrt((1.0 / (h * d_m))) * d_m) elif t_0 <= 2e+222: tmp = (d_m / math.sqrt(h)) / math.sqrt(l) else: tmp = d_m / math.sqrt((l * h)) return tmp
d_m = abs(d) function code(d_m, h, l, M, D) t_0 = Float64(Float64((Float64(d_m / h) ^ Float64(1.0 / 2.0)) * (Float64(d_m / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d_m)) ^ 2.0)) * Float64(h / l)))) tmp = 0.0 if (t_0 <= -2e-169) tmp = Float64(Float64(sqrt(Float64(1.0 / Float64(l * d_m))) * d_m) * Float64(-Float64(sqrt(Float64(1.0 / Float64(h * d_m))) * d_m))); elseif (t_0 <= 2e+222) tmp = Float64(Float64(d_m / sqrt(h)) / sqrt(l)); else tmp = Float64(d_m / sqrt(Float64(l * h))); end return tmp end
d_m = abs(d); function tmp_2 = code(d_m, h, l, M, D) t_0 = (((d_m / h) ^ (1.0 / 2.0)) * ((d_m / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d_m)) ^ 2.0)) * (h / l))); tmp = 0.0; if (t_0 <= -2e-169) tmp = (sqrt((1.0 / (l * d_m))) * d_m) * -(sqrt((1.0 / (h * d_m))) * d_m); elseif (t_0 <= 2e+222) tmp = (d_m / sqrt(h)) / sqrt(l); else tmp = d_m / sqrt((l * h)); end tmp_2 = tmp; end
d_m = N[Abs[d], $MachinePrecision]
code[d$95$m_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(N[Power[N[(d$95$m / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d$95$m / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -2e-169], N[(N[(N[Sqrt[N[(1.0 / N[(l * d$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * d$95$m), $MachinePrecision] * (-N[(N[Sqrt[N[(1.0 / N[(h * d$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * d$95$m), $MachinePrecision])), $MachinePrecision], If[LessEqual[t$95$0, 2e+222], N[(N[(d$95$m / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision], N[(d$95$m / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
d_m = \left|d\right|
\\
\begin{array}{l}
t_0 := \left({\left(\frac{d\_m}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d\_m}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d\_m}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{-169}:\\
\;\;\;\;\left(\sqrt{\frac{1}{\ell \cdot d\_m}} \cdot d\_m\right) \cdot \left(-\sqrt{\frac{1}{h \cdot d\_m}} \cdot d\_m\right)\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+222}:\\
\;\;\;\;\frac{\frac{d\_m}{\sqrt{h}}}{\sqrt{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d\_m}{\sqrt{\ell \cdot h}}\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -2.00000000000000004e-169Initial program 34.4%
Applied rewrites23.7%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lift-*.f6417.4
Applied rewrites17.4%
Taylor expanded in d around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f647.5
Applied rewrites7.5%
if -2.00000000000000004e-169 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2.0000000000000001e222Initial program 34.4%
Taylor expanded in l around inf
sqrt-unprodN/A
*-commutativeN/A
sqrt-unprodN/A
sqrt-divN/A
sqrt-divN/A
frac-timesN/A
pow1/2N/A
metadata-evalN/A
pow1/2N/A
metadata-evalN/A
sqr-powN/A
unpow1N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6424.8
Applied rewrites24.8%
lift-/.f64N/A
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f6424.0
Applied rewrites24.0%
if 2.0000000000000001e222 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 34.4%
Taylor expanded in l around inf
sqrt-unprodN/A
*-commutativeN/A
sqrt-unprodN/A
sqrt-divN/A
sqrt-divN/A
frac-timesN/A
pow1/2N/A
metadata-evalN/A
pow1/2N/A
metadata-evalN/A
sqr-powN/A
unpow1N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6424.8
Applied rewrites24.8%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
*-commutativeN/A
sqrt-unprodN/A
lower-sqrt.f64N/A
*-commutativeN/A
lower-*.f6443.1
Applied rewrites43.1%
d_m = (fabs.f64 d)
(FPCore (d_m h l M D)
:precision binary64
(let* ((t_0
(*
(* (pow (/ d_m h) (/ 1.0 2.0)) (pow (/ d_m l) (/ 1.0 2.0)))
(-
1.0
(* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d_m)) 2.0)) (/ h l))))))
(if (<= t_0 -2e-169)
(/ d_m (- (* (sqrt (/ l h)) h)))
(if (<= t_0 2e+222)
(/ (/ d_m (sqrt h)) (sqrt l))
(/ d_m (sqrt (* l h)))))))d_m = fabs(d);
double code(double d_m, double h, double l, double M, double D) {
double t_0 = (pow((d_m / h), (1.0 / 2.0)) * pow((d_m / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l)));
double tmp;
if (t_0 <= -2e-169) {
tmp = d_m / -(sqrt((l / h)) * h);
} else if (t_0 <= 2e+222) {
tmp = (d_m / sqrt(h)) / sqrt(l);
} else {
tmp = d_m / sqrt((l * h));
}
return tmp;
}
d_m = private
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(d_m, h, l, m, d)
use fmin_fmax_functions
real(8), intent (in) :: d_m
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8) :: t_0
real(8) :: tmp
t_0 = (((d_m / h) ** (1.0d0 / 2.0d0)) * ((d_m / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d) / (2.0d0 * d_m)) ** 2.0d0)) * (h / l)))
if (t_0 <= (-2d-169)) then
tmp = d_m / -(sqrt((l / h)) * h)
else if (t_0 <= 2d+222) then
tmp = (d_m / sqrt(h)) / sqrt(l)
else
tmp = d_m / sqrt((l * h))
end if
code = tmp
end function
d_m = Math.abs(d);
public static double code(double d_m, double h, double l, double M, double D) {
double t_0 = (Math.pow((d_m / h), (1.0 / 2.0)) * Math.pow((d_m / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l)));
double tmp;
if (t_0 <= -2e-169) {
tmp = d_m / -(Math.sqrt((l / h)) * h);
} else if (t_0 <= 2e+222) {
tmp = (d_m / Math.sqrt(h)) / Math.sqrt(l);
} else {
tmp = d_m / Math.sqrt((l * h));
}
return tmp;
}
d_m = math.fabs(d) def code(d_m, h, l, M, D): t_0 = (math.pow((d_m / h), (1.0 / 2.0)) * math.pow((d_m / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l))) tmp = 0 if t_0 <= -2e-169: tmp = d_m / -(math.sqrt((l / h)) * h) elif t_0 <= 2e+222: tmp = (d_m / math.sqrt(h)) / math.sqrt(l) else: tmp = d_m / math.sqrt((l * h)) return tmp
d_m = abs(d) function code(d_m, h, l, M, D) t_0 = Float64(Float64((Float64(d_m / h) ^ Float64(1.0 / 2.0)) * (Float64(d_m / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d_m)) ^ 2.0)) * Float64(h / l)))) tmp = 0.0 if (t_0 <= -2e-169) tmp = Float64(d_m / Float64(-Float64(sqrt(Float64(l / h)) * h))); elseif (t_0 <= 2e+222) tmp = Float64(Float64(d_m / sqrt(h)) / sqrt(l)); else tmp = Float64(d_m / sqrt(Float64(l * h))); end return tmp end
d_m = abs(d); function tmp_2 = code(d_m, h, l, M, D) t_0 = (((d_m / h) ^ (1.0 / 2.0)) * ((d_m / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d_m)) ^ 2.0)) * (h / l))); tmp = 0.0; if (t_0 <= -2e-169) tmp = d_m / -(sqrt((l / h)) * h); elseif (t_0 <= 2e+222) tmp = (d_m / sqrt(h)) / sqrt(l); else tmp = d_m / sqrt((l * h)); end tmp_2 = tmp; end
d_m = N[Abs[d], $MachinePrecision]
code[d$95$m_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(N[Power[N[(d$95$m / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d$95$m / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -2e-169], N[(d$95$m / (-N[(N[Sqrt[N[(l / h), $MachinePrecision]], $MachinePrecision] * h), $MachinePrecision])), $MachinePrecision], If[LessEqual[t$95$0, 2e+222], N[(N[(d$95$m / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision], N[(d$95$m / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
d_m = \left|d\right|
\\
\begin{array}{l}
t_0 := \left({\left(\frac{d\_m}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d\_m}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d\_m}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{-169}:\\
\;\;\;\;\frac{d\_m}{-\sqrt{\frac{\ell}{h}} \cdot h}\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+222}:\\
\;\;\;\;\frac{\frac{d\_m}{\sqrt{h}}}{\sqrt{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d\_m}{\sqrt{\ell \cdot h}}\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -2.00000000000000004e-169Initial program 34.4%
Taylor expanded in l around inf
sqrt-unprodN/A
*-commutativeN/A
sqrt-unprodN/A
sqrt-divN/A
sqrt-divN/A
frac-timesN/A
pow1/2N/A
metadata-evalN/A
pow1/2N/A
metadata-evalN/A
sqr-powN/A
unpow1N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6424.8
Applied rewrites24.8%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
*-commutativeN/A
sqrt-unprodN/A
lower-sqrt.f64N/A
*-commutativeN/A
lower-*.f6443.1
Applied rewrites43.1%
Taylor expanded in h around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6425.7
Applied rewrites25.7%
if -2.00000000000000004e-169 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2.0000000000000001e222Initial program 34.4%
Taylor expanded in l around inf
sqrt-unprodN/A
*-commutativeN/A
sqrt-unprodN/A
sqrt-divN/A
sqrt-divN/A
frac-timesN/A
pow1/2N/A
metadata-evalN/A
pow1/2N/A
metadata-evalN/A
sqr-powN/A
unpow1N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6424.8
Applied rewrites24.8%
lift-/.f64N/A
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f6424.0
Applied rewrites24.0%
if 2.0000000000000001e222 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 34.4%
Taylor expanded in l around inf
sqrt-unprodN/A
*-commutativeN/A
sqrt-unprodN/A
sqrt-divN/A
sqrt-divN/A
frac-timesN/A
pow1/2N/A
metadata-evalN/A
pow1/2N/A
metadata-evalN/A
sqr-powN/A
unpow1N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6424.8
Applied rewrites24.8%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
*-commutativeN/A
sqrt-unprodN/A
lower-sqrt.f64N/A
*-commutativeN/A
lower-*.f6443.1
Applied rewrites43.1%
d_m = (fabs.f64 d)
(FPCore (d_m h l M D)
:precision binary64
(if (<= l -1e-189)
(/ d_m (sqrt (* l h)))
(if (<= l -2e-307)
(/ d_m (* (sqrt (/ l h)) h))
(/ d_m (* (sqrt l) (sqrt h))))))d_m = fabs(d);
double code(double d_m, double h, double l, double M, double D) {
double tmp;
if (l <= -1e-189) {
tmp = d_m / sqrt((l * h));
} else if (l <= -2e-307) {
tmp = d_m / (sqrt((l / h)) * h);
} else {
tmp = d_m / (sqrt(l) * sqrt(h));
}
return tmp;
}
d_m = private
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(d_m, h, l, m, d)
use fmin_fmax_functions
real(8), intent (in) :: d_m
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8) :: tmp
if (l <= (-1d-189)) then
tmp = d_m / sqrt((l * h))
else if (l <= (-2d-307)) then
tmp = d_m / (sqrt((l / h)) * h)
else
tmp = d_m / (sqrt(l) * sqrt(h))
end if
code = tmp
end function
d_m = Math.abs(d);
public static double code(double d_m, double h, double l, double M, double D) {
double tmp;
if (l <= -1e-189) {
tmp = d_m / Math.sqrt((l * h));
} else if (l <= -2e-307) {
tmp = d_m / (Math.sqrt((l / h)) * h);
} else {
tmp = d_m / (Math.sqrt(l) * Math.sqrt(h));
}
return tmp;
}
d_m = math.fabs(d) def code(d_m, h, l, M, D): tmp = 0 if l <= -1e-189: tmp = d_m / math.sqrt((l * h)) elif l <= -2e-307: tmp = d_m / (math.sqrt((l / h)) * h) else: tmp = d_m / (math.sqrt(l) * math.sqrt(h)) return tmp
d_m = abs(d) function code(d_m, h, l, M, D) tmp = 0.0 if (l <= -1e-189) tmp = Float64(d_m / sqrt(Float64(l * h))); elseif (l <= -2e-307) tmp = Float64(d_m / Float64(sqrt(Float64(l / h)) * h)); else tmp = Float64(d_m / Float64(sqrt(l) * sqrt(h))); end return tmp end
d_m = abs(d); function tmp_2 = code(d_m, h, l, M, D) tmp = 0.0; if (l <= -1e-189) tmp = d_m / sqrt((l * h)); elseif (l <= -2e-307) tmp = d_m / (sqrt((l / h)) * h); else tmp = d_m / (sqrt(l) * sqrt(h)); end tmp_2 = tmp; end
d_m = N[Abs[d], $MachinePrecision] code[d$95$m_, h_, l_, M_, D_] := If[LessEqual[l, -1e-189], N[(d$95$m / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -2e-307], N[(d$95$m / N[(N[Sqrt[N[(l / h), $MachinePrecision]], $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision], N[(d$95$m / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
d_m = \left|d\right|
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1 \cdot 10^{-189}:\\
\;\;\;\;\frac{d\_m}{\sqrt{\ell \cdot h}}\\
\mathbf{elif}\;\ell \leq -2 \cdot 10^{-307}:\\
\;\;\;\;\frac{d\_m}{\sqrt{\frac{\ell}{h}} \cdot h}\\
\mathbf{else}:\\
\;\;\;\;\frac{d\_m}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < -1.00000000000000007e-189Initial program 34.4%
Taylor expanded in l around inf
sqrt-unprodN/A
*-commutativeN/A
sqrt-unprodN/A
sqrt-divN/A
sqrt-divN/A
frac-timesN/A
pow1/2N/A
metadata-evalN/A
pow1/2N/A
metadata-evalN/A
sqr-powN/A
unpow1N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6424.8
Applied rewrites24.8%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
*-commutativeN/A
sqrt-unprodN/A
lower-sqrt.f64N/A
*-commutativeN/A
lower-*.f6443.1
Applied rewrites43.1%
if -1.00000000000000007e-189 < l < -1.99999999999999982e-307Initial program 34.4%
Taylor expanded in l around inf
sqrt-unprodN/A
*-commutativeN/A
sqrt-unprodN/A
sqrt-divN/A
sqrt-divN/A
frac-timesN/A
pow1/2N/A
metadata-evalN/A
pow1/2N/A
metadata-evalN/A
sqr-powN/A
unpow1N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6424.8
Applied rewrites24.8%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
*-commutativeN/A
sqrt-unprodN/A
lower-sqrt.f64N/A
*-commutativeN/A
lower-*.f6443.1
Applied rewrites43.1%
Taylor expanded in h around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6424.9
Applied rewrites24.9%
if -1.99999999999999982e-307 < l Initial program 34.4%
Taylor expanded in l around inf
sqrt-unprodN/A
*-commutativeN/A
sqrt-unprodN/A
sqrt-divN/A
sqrt-divN/A
frac-timesN/A
pow1/2N/A
metadata-evalN/A
pow1/2N/A
metadata-evalN/A
sqr-powN/A
unpow1N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6424.8
Applied rewrites24.8%
d_m = (fabs.f64 d) (FPCore (d_m h l M D) :precision binary64 (if (<= l -2e-307) (/ d_m (sqrt (* l h))) (/ d_m (* (sqrt l) (sqrt h)))))
d_m = fabs(d);
double code(double d_m, double h, double l, double M, double D) {
double tmp;
if (l <= -2e-307) {
tmp = d_m / sqrt((l * h));
} else {
tmp = d_m / (sqrt(l) * sqrt(h));
}
return tmp;
}
d_m = private
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(d_m, h, l, m, d)
use fmin_fmax_functions
real(8), intent (in) :: d_m
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8) :: tmp
if (l <= (-2d-307)) then
tmp = d_m / sqrt((l * h))
else
tmp = d_m / (sqrt(l) * sqrt(h))
end if
code = tmp
end function
d_m = Math.abs(d);
public static double code(double d_m, double h, double l, double M, double D) {
double tmp;
if (l <= -2e-307) {
tmp = d_m / Math.sqrt((l * h));
} else {
tmp = d_m / (Math.sqrt(l) * Math.sqrt(h));
}
return tmp;
}
d_m = math.fabs(d) def code(d_m, h, l, M, D): tmp = 0 if l <= -2e-307: tmp = d_m / math.sqrt((l * h)) else: tmp = d_m / (math.sqrt(l) * math.sqrt(h)) return tmp
d_m = abs(d) function code(d_m, h, l, M, D) tmp = 0.0 if (l <= -2e-307) tmp = Float64(d_m / sqrt(Float64(l * h))); else tmp = Float64(d_m / Float64(sqrt(l) * sqrt(h))); end return tmp end
d_m = abs(d); function tmp_2 = code(d_m, h, l, M, D) tmp = 0.0; if (l <= -2e-307) tmp = d_m / sqrt((l * h)); else tmp = d_m / (sqrt(l) * sqrt(h)); end tmp_2 = tmp; end
d_m = N[Abs[d], $MachinePrecision] code[d$95$m_, h_, l_, M_, D_] := If[LessEqual[l, -2e-307], N[(d$95$m / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d$95$m / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
d_m = \left|d\right|
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2 \cdot 10^{-307}:\\
\;\;\;\;\frac{d\_m}{\sqrt{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d\_m}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < -1.99999999999999982e-307Initial program 34.4%
Taylor expanded in l around inf
sqrt-unprodN/A
*-commutativeN/A
sqrt-unprodN/A
sqrt-divN/A
sqrt-divN/A
frac-timesN/A
pow1/2N/A
metadata-evalN/A
pow1/2N/A
metadata-evalN/A
sqr-powN/A
unpow1N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6424.8
Applied rewrites24.8%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
*-commutativeN/A
sqrt-unprodN/A
lower-sqrt.f64N/A
*-commutativeN/A
lower-*.f6443.1
Applied rewrites43.1%
if -1.99999999999999982e-307 < l Initial program 34.4%
Taylor expanded in l around inf
sqrt-unprodN/A
*-commutativeN/A
sqrt-unprodN/A
sqrt-divN/A
sqrt-divN/A
frac-timesN/A
pow1/2N/A
metadata-evalN/A
pow1/2N/A
metadata-evalN/A
sqr-powN/A
unpow1N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6424.8
Applied rewrites24.8%
d_m = (fabs.f64 d) (FPCore (d_m h l M D) :precision binary64 (/ d_m (sqrt (* l h))))
d_m = fabs(d);
double code(double d_m, double h, double l, double M, double D) {
return d_m / sqrt((l * h));
}
d_m = private
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(d_m, h, l, m, d)
use fmin_fmax_functions
real(8), intent (in) :: d_m
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d
code = d_m / sqrt((l * h))
end function
d_m = Math.abs(d);
public static double code(double d_m, double h, double l, double M, double D) {
return d_m / Math.sqrt((l * h));
}
d_m = math.fabs(d) def code(d_m, h, l, M, D): return d_m / math.sqrt((l * h))
d_m = abs(d) function code(d_m, h, l, M, D) return Float64(d_m / sqrt(Float64(l * h))) end
d_m = abs(d); function tmp = code(d_m, h, l, M, D) tmp = d_m / sqrt((l * h)); end
d_m = N[Abs[d], $MachinePrecision] code[d$95$m_, h_, l_, M_, D_] := N[(d$95$m / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
d_m = \left|d\right|
\\
\frac{d\_m}{\sqrt{\ell \cdot h}}
\end{array}
Initial program 34.4%
Taylor expanded in l around inf
sqrt-unprodN/A
*-commutativeN/A
sqrt-unprodN/A
sqrt-divN/A
sqrt-divN/A
frac-timesN/A
pow1/2N/A
metadata-evalN/A
pow1/2N/A
metadata-evalN/A
sqr-powN/A
unpow1N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6424.8
Applied rewrites24.8%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
*-commutativeN/A
sqrt-unprodN/A
lower-sqrt.f64N/A
*-commutativeN/A
lower-*.f6443.1
Applied rewrites43.1%
herbie shell --seed 2025127
(FPCore (d h l M D)
:name "Henrywood and Agarwal, Equation (12)"
:precision binary64
(* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))