
(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 14 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 (sqrt (/ 1.0 (* h l)))) (t_1 (* d_m t_0)))
(if (<= d_m 3.8e-162)
(/ (* -0.125 (/ (* (* M D) (* (* M D) (* t_0 h))) d_m)) l)
(if (<= d_m 1.25e+149)
(*
t_1
(-
1.0
(/
(* (/ (* (* M D) h) l) (* M D))
(* (* (+ d_m d_m) (+ d_m d_m)) 2.0))))
(*
t_1
(-
1.0
(* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d_m)) 2.0)) (/ h l))))))))d_m = fabs(d);
double code(double d_m, double h, double l, double M, double D) {
double t_0 = sqrt((1.0 / (h * l)));
double t_1 = d_m * t_0;
double tmp;
if (d_m <= 3.8e-162) {
tmp = (-0.125 * (((M * D) * ((M * D) * (t_0 * h))) / d_m)) / l;
} else if (d_m <= 1.25e+149) {
tmp = t_1 * (1.0 - (((((M * D) * h) / l) * (M * D)) / (((d_m + d_m) * (d_m + d_m)) * 2.0)));
} else {
tmp = t_1 * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d_m)), 2.0)) * (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 = sqrt((1.0d0 / (h * l)))
t_1 = d_m * t_0
if (d_m <= 3.8d-162) then
tmp = ((-0.125d0) * (((m * d) * ((m * d) * (t_0 * h))) / d_m)) / l
else if (d_m <= 1.25d+149) then
tmp = t_1 * (1.0d0 - (((((m * d) * h) / l) * (m * d)) / (((d_m + d_m) * (d_m + d_m)) * 2.0d0)))
else
tmp = t_1 * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d) / (2.0d0 * d_m)) ** 2.0d0)) * (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.sqrt((1.0 / (h * l)));
double t_1 = d_m * t_0;
double tmp;
if (d_m <= 3.8e-162) {
tmp = (-0.125 * (((M * D) * ((M * D) * (t_0 * h))) / d_m)) / l;
} else if (d_m <= 1.25e+149) {
tmp = t_1 * (1.0 - (((((M * D) * h) / l) * (M * D)) / (((d_m + d_m) * (d_m + d_m)) * 2.0)));
} else {
tmp = t_1 * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l)));
}
return tmp;
}
d_m = math.fabs(d) def code(d_m, h, l, M, D): t_0 = math.sqrt((1.0 / (h * l))) t_1 = d_m * t_0 tmp = 0 if d_m <= 3.8e-162: tmp = (-0.125 * (((M * D) * ((M * D) * (t_0 * h))) / d_m)) / l elif d_m <= 1.25e+149: tmp = t_1 * (1.0 - (((((M * D) * h) / l) * (M * D)) / (((d_m + d_m) * (d_m + d_m)) * 2.0))) else: tmp = t_1 * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l))) return tmp
d_m = abs(d) function code(d_m, h, l, M, D) t_0 = sqrt(Float64(1.0 / Float64(h * l))) t_1 = Float64(d_m * t_0) tmp = 0.0 if (d_m <= 3.8e-162) tmp = Float64(Float64(-0.125 * Float64(Float64(Float64(M * D) * Float64(Float64(M * D) * Float64(t_0 * h))) / d_m)) / l); elseif (d_m <= 1.25e+149) tmp = Float64(t_1 * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(M * D) * h) / l) * Float64(M * D)) / Float64(Float64(Float64(d_m + d_m) * Float64(d_m + d_m)) * 2.0)))); else tmp = Float64(t_1 * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d_m)) ^ 2.0)) * Float64(h / l)))); end return tmp end
d_m = abs(d); function tmp_2 = code(d_m, h, l, M, D) t_0 = sqrt((1.0 / (h * l))); t_1 = d_m * t_0; tmp = 0.0; if (d_m <= 3.8e-162) tmp = (-0.125 * (((M * D) * ((M * D) * (t_0 * h))) / d_m)) / l; elseif (d_m <= 1.25e+149) tmp = t_1 * (1.0 - (((((M * D) * h) / l) * (M * D)) / (((d_m + d_m) * (d_m + d_m)) * 2.0))); else tmp = t_1 * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d_m)) ^ 2.0)) * (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[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(d$95$m * t$95$0), $MachinePrecision]}, If[LessEqual[d$95$m, 3.8e-162], N[(N[(-0.125 * N[(N[(N[(M * D), $MachinePrecision] * N[(N[(M * D), $MachinePrecision] * N[(t$95$0 * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / d$95$m), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision], If[LessEqual[d$95$m, 1.25e+149], N[(t$95$1 * N[(1.0 - N[(N[(N[(N[(N[(M * D), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(d$95$m + d$95$m), $MachinePrecision] * N[(d$95$m + d$95$m), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * 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]]]]]
\begin{array}{l}
d_m = \left|d\right|
\\
\begin{array}{l}
t_0 := \sqrt{\frac{1}{h \cdot \ell}}\\
t_1 := d\_m \cdot t\_0\\
\mathbf{if}\;d\_m \leq 3.8 \cdot 10^{-162}:\\
\;\;\;\;\frac{-0.125 \cdot \frac{\left(M \cdot D\right) \cdot \left(\left(M \cdot D\right) \cdot \left(t\_0 \cdot h\right)\right)}{d\_m}}{\ell}\\
\mathbf{elif}\;d\_m \leq 1.25 \cdot 10^{+149}:\\
\;\;\;\;t\_1 \cdot \left(1 - \frac{\frac{\left(M \cdot D\right) \cdot h}{\ell} \cdot \left(M \cdot D\right)}{\left(\left(d\_m + d\_m\right) \cdot \left(d\_m + d\_m\right)\right) \cdot 2}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 \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)\\
\end{array}
\end{array}
if d < 3.80000000000000005e-162Initial program 35.4%
Applied rewrites30.6%
Taylor expanded in d around 0
Applied rewrites33.2%
Applied rewrites41.7%
if 3.80000000000000005e-162 < d < 1.24999999999999998e149Initial program 35.4%
Applied rewrites42.5%
Taylor expanded in d around 0
Applied rewrites69.2%
Applied rewrites63.8%
Applied rewrites63.4%
if 1.24999999999999998e149 < d Initial program 35.4%
Applied rewrites42.5%
Taylor expanded in d around 0
Applied rewrites69.2%
d_m = (fabs.f64 d)
(FPCore (d_m h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ 1.0 (* h l)))) (t_1 (* d_m t_0)))
(if (<= d_m 3.8e-162)
(/ (* -0.125 (/ (* (* M D) (* (* M D) (* t_0 h))) d_m)) l)
(if (<= d_m 1.5e+149)
(*
t_1
(-
1.0
(/
(* (/ (* (* M D) h) l) (* M D))
(* (* (+ d_m d_m) (+ d_m d_m)) 2.0))))
(*
t_1
(-
1.0
(*
(* (/ (* (* M M) D) (+ d_m d_m)) (/ D (* (+ d_m d_m) 2.0)))
(/ h l))))))))d_m = fabs(d);
double code(double d_m, double h, double l, double M, double D) {
double t_0 = sqrt((1.0 / (h * l)));
double t_1 = d_m * t_0;
double tmp;
if (d_m <= 3.8e-162) {
tmp = (-0.125 * (((M * D) * ((M * D) * (t_0 * h))) / d_m)) / l;
} else if (d_m <= 1.5e+149) {
tmp = t_1 * (1.0 - (((((M * D) * h) / l) * (M * D)) / (((d_m + d_m) * (d_m + d_m)) * 2.0)));
} else {
tmp = t_1 * (1.0 - (((((M * M) * D) / (d_m + d_m)) * (D / ((d_m + d_m) * 2.0))) * (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 = sqrt((1.0d0 / (h * l)))
t_1 = d_m * t_0
if (d_m <= 3.8d-162) then
tmp = ((-0.125d0) * (((m * d) * ((m * d) * (t_0 * h))) / d_m)) / l
else if (d_m <= 1.5d+149) then
tmp = t_1 * (1.0d0 - (((((m * d) * h) / l) * (m * d)) / (((d_m + d_m) * (d_m + d_m)) * 2.0d0)))
else
tmp = t_1 * (1.0d0 - (((((m * m) * d) / (d_m + d_m)) * (d / ((d_m + d_m) * 2.0d0))) * (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.sqrt((1.0 / (h * l)));
double t_1 = d_m * t_0;
double tmp;
if (d_m <= 3.8e-162) {
tmp = (-0.125 * (((M * D) * ((M * D) * (t_0 * h))) / d_m)) / l;
} else if (d_m <= 1.5e+149) {
tmp = t_1 * (1.0 - (((((M * D) * h) / l) * (M * D)) / (((d_m + d_m) * (d_m + d_m)) * 2.0)));
} else {
tmp = t_1 * (1.0 - (((((M * M) * D) / (d_m + d_m)) * (D / ((d_m + d_m) * 2.0))) * (h / l)));
}
return tmp;
}
d_m = math.fabs(d) def code(d_m, h, l, M, D): t_0 = math.sqrt((1.0 / (h * l))) t_1 = d_m * t_0 tmp = 0 if d_m <= 3.8e-162: tmp = (-0.125 * (((M * D) * ((M * D) * (t_0 * h))) / d_m)) / l elif d_m <= 1.5e+149: tmp = t_1 * (1.0 - (((((M * D) * h) / l) * (M * D)) / (((d_m + d_m) * (d_m + d_m)) * 2.0))) else: tmp = t_1 * (1.0 - (((((M * M) * D) / (d_m + d_m)) * (D / ((d_m + d_m) * 2.0))) * (h / l))) return tmp
d_m = abs(d) function code(d_m, h, l, M, D) t_0 = sqrt(Float64(1.0 / Float64(h * l))) t_1 = Float64(d_m * t_0) tmp = 0.0 if (d_m <= 3.8e-162) tmp = Float64(Float64(-0.125 * Float64(Float64(Float64(M * D) * Float64(Float64(M * D) * Float64(t_0 * h))) / d_m)) / l); elseif (d_m <= 1.5e+149) tmp = Float64(t_1 * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(M * D) * h) / l) * Float64(M * D)) / Float64(Float64(Float64(d_m + d_m) * Float64(d_m + d_m)) * 2.0)))); else tmp = Float64(t_1 * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(M * M) * D) / Float64(d_m + d_m)) * Float64(D / Float64(Float64(d_m + d_m) * 2.0))) * Float64(h / l)))); end return tmp end
d_m = abs(d); function tmp_2 = code(d_m, h, l, M, D) t_0 = sqrt((1.0 / (h * l))); t_1 = d_m * t_0; tmp = 0.0; if (d_m <= 3.8e-162) tmp = (-0.125 * (((M * D) * ((M * D) * (t_0 * h))) / d_m)) / l; elseif (d_m <= 1.5e+149) tmp = t_1 * (1.0 - (((((M * D) * h) / l) * (M * D)) / (((d_m + d_m) * (d_m + d_m)) * 2.0))); else tmp = t_1 * (1.0 - (((((M * M) * D) / (d_m + d_m)) * (D / ((d_m + d_m) * 2.0))) * (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[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(d$95$m * t$95$0), $MachinePrecision]}, If[LessEqual[d$95$m, 3.8e-162], N[(N[(-0.125 * N[(N[(N[(M * D), $MachinePrecision] * N[(N[(M * D), $MachinePrecision] * N[(t$95$0 * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / d$95$m), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision], If[LessEqual[d$95$m, 1.5e+149], N[(t$95$1 * N[(1.0 - N[(N[(N[(N[(N[(M * D), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(d$95$m + d$95$m), $MachinePrecision] * N[(d$95$m + d$95$m), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(1.0 - N[(N[(N[(N[(N[(M * M), $MachinePrecision] * D), $MachinePrecision] / N[(d$95$m + d$95$m), $MachinePrecision]), $MachinePrecision] * N[(D / N[(N[(d$95$m + d$95$m), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
d_m = \left|d\right|
\\
\begin{array}{l}
t_0 := \sqrt{\frac{1}{h \cdot \ell}}\\
t_1 := d\_m \cdot t\_0\\
\mathbf{if}\;d\_m \leq 3.8 \cdot 10^{-162}:\\
\;\;\;\;\frac{-0.125 \cdot \frac{\left(M \cdot D\right) \cdot \left(\left(M \cdot D\right) \cdot \left(t\_0 \cdot h\right)\right)}{d\_m}}{\ell}\\
\mathbf{elif}\;d\_m \leq 1.5 \cdot 10^{+149}:\\
\;\;\;\;t\_1 \cdot \left(1 - \frac{\frac{\left(M \cdot D\right) \cdot h}{\ell} \cdot \left(M \cdot D\right)}{\left(\left(d\_m + d\_m\right) \cdot \left(d\_m + d\_m\right)\right) \cdot 2}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \left(1 - \left(\frac{\left(M \cdot M\right) \cdot D}{d\_m + d\_m} \cdot \frac{D}{\left(d\_m + d\_m\right) \cdot 2}\right) \cdot \frac{h}{\ell}\right)\\
\end{array}
\end{array}
if d < 3.80000000000000005e-162Initial program 35.4%
Applied rewrites30.6%
Taylor expanded in d around 0
Applied rewrites33.2%
Applied rewrites41.7%
if 3.80000000000000005e-162 < d < 1.50000000000000002e149Initial program 35.4%
Applied rewrites42.5%
Taylor expanded in d around 0
Applied rewrites69.2%
Applied rewrites63.8%
Applied rewrites63.4%
if 1.50000000000000002e149 < d Initial program 35.4%
Applied rewrites42.5%
Taylor expanded in d around 0
Applied rewrites69.2%
Applied rewrites60.7%
d_m = (fabs.f64 d)
(FPCore (d_m h l M D)
:precision binary64
(let* ((t_0 (* (* M D) h))
(t_1 (sqrt (/ 1.0 (* h l))))
(t_2 (* d_m t_1))
(t_3 (* (* (+ d_m d_m) (+ d_m d_m)) 2.0)))
(if (<= d_m 3.8e-162)
(/ (* -0.125 (/ (* (* M D) (* (* M D) (* t_1 h))) d_m)) l)
(if (<= d_m 2e-56)
(* t_2 (- 1.0 (/ (* (/ t_0 l) (* M D)) t_3)))
(* t_2 (- 1.0 (* (/ t_0 (* l t_3)) (* M D))))))))d_m = fabs(d);
double code(double d_m, double h, double l, double M, double D) {
double t_0 = (M * D) * h;
double t_1 = sqrt((1.0 / (h * l)));
double t_2 = d_m * t_1;
double t_3 = ((d_m + d_m) * (d_m + d_m)) * 2.0;
double tmp;
if (d_m <= 3.8e-162) {
tmp = (-0.125 * (((M * D) * ((M * D) * (t_1 * h))) / d_m)) / l;
} else if (d_m <= 2e-56) {
tmp = t_2 * (1.0 - (((t_0 / l) * (M * D)) / t_3));
} else {
tmp = t_2 * (1.0 - ((t_0 / (l * t_3)) * (M * 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) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = (m * d) * h
t_1 = sqrt((1.0d0 / (h * l)))
t_2 = d_m * t_1
t_3 = ((d_m + d_m) * (d_m + d_m)) * 2.0d0
if (d_m <= 3.8d-162) then
tmp = ((-0.125d0) * (((m * d) * ((m * d) * (t_1 * h))) / d_m)) / l
else if (d_m <= 2d-56) then
tmp = t_2 * (1.0d0 - (((t_0 / l) * (m * d)) / t_3))
else
tmp = t_2 * (1.0d0 - ((t_0 / (l * t_3)) * (m * 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 t_0 = (M * D) * h;
double t_1 = Math.sqrt((1.0 / (h * l)));
double t_2 = d_m * t_1;
double t_3 = ((d_m + d_m) * (d_m + d_m)) * 2.0;
double tmp;
if (d_m <= 3.8e-162) {
tmp = (-0.125 * (((M * D) * ((M * D) * (t_1 * h))) / d_m)) / l;
} else if (d_m <= 2e-56) {
tmp = t_2 * (1.0 - (((t_0 / l) * (M * D)) / t_3));
} else {
tmp = t_2 * (1.0 - ((t_0 / (l * t_3)) * (M * D)));
}
return tmp;
}
d_m = math.fabs(d) def code(d_m, h, l, M, D): t_0 = (M * D) * h t_1 = math.sqrt((1.0 / (h * l))) t_2 = d_m * t_1 t_3 = ((d_m + d_m) * (d_m + d_m)) * 2.0 tmp = 0 if d_m <= 3.8e-162: tmp = (-0.125 * (((M * D) * ((M * D) * (t_1 * h))) / d_m)) / l elif d_m <= 2e-56: tmp = t_2 * (1.0 - (((t_0 / l) * (M * D)) / t_3)) else: tmp = t_2 * (1.0 - ((t_0 / (l * t_3)) * (M * D))) return tmp
d_m = abs(d) function code(d_m, h, l, M, D) t_0 = Float64(Float64(M * D) * h) t_1 = sqrt(Float64(1.0 / Float64(h * l))) t_2 = Float64(d_m * t_1) t_3 = Float64(Float64(Float64(d_m + d_m) * Float64(d_m + d_m)) * 2.0) tmp = 0.0 if (d_m <= 3.8e-162) tmp = Float64(Float64(-0.125 * Float64(Float64(Float64(M * D) * Float64(Float64(M * D) * Float64(t_1 * h))) / d_m)) / l); elseif (d_m <= 2e-56) tmp = Float64(t_2 * Float64(1.0 - Float64(Float64(Float64(t_0 / l) * Float64(M * D)) / t_3))); else tmp = Float64(t_2 * Float64(1.0 - Float64(Float64(t_0 / Float64(l * t_3)) * Float64(M * D)))); end return tmp end
d_m = abs(d); function tmp_2 = code(d_m, h, l, M, D) t_0 = (M * D) * h; t_1 = sqrt((1.0 / (h * l))); t_2 = d_m * t_1; t_3 = ((d_m + d_m) * (d_m + d_m)) * 2.0; tmp = 0.0; if (d_m <= 3.8e-162) tmp = (-0.125 * (((M * D) * ((M * D) * (t_1 * h))) / d_m)) / l; elseif (d_m <= 2e-56) tmp = t_2 * (1.0 - (((t_0 / l) * (M * D)) / t_3)); else tmp = t_2 * (1.0 - ((t_0 / (l * t_3)) * (M * D))); 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[(M * D), $MachinePrecision] * h), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(d$95$m * t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(d$95$m + d$95$m), $MachinePrecision] * N[(d$95$m + d$95$m), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]}, If[LessEqual[d$95$m, 3.8e-162], N[(N[(-0.125 * N[(N[(N[(M * D), $MachinePrecision] * N[(N[(M * D), $MachinePrecision] * N[(t$95$1 * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / d$95$m), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision], If[LessEqual[d$95$m, 2e-56], N[(t$95$2 * N[(1.0 - N[(N[(N[(t$95$0 / l), $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision] / t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$2 * N[(1.0 - N[(N[(t$95$0 / N[(l * t$95$3), $MachinePrecision]), $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
d_m = \left|d\right|
\\
\begin{array}{l}
t_0 := \left(M \cdot D\right) \cdot h\\
t_1 := \sqrt{\frac{1}{h \cdot \ell}}\\
t_2 := d\_m \cdot t\_1\\
t_3 := \left(\left(d\_m + d\_m\right) \cdot \left(d\_m + d\_m\right)\right) \cdot 2\\
\mathbf{if}\;d\_m \leq 3.8 \cdot 10^{-162}:\\
\;\;\;\;\frac{-0.125 \cdot \frac{\left(M \cdot D\right) \cdot \left(\left(M \cdot D\right) \cdot \left(t\_1 \cdot h\right)\right)}{d\_m}}{\ell}\\
\mathbf{elif}\;d\_m \leq 2 \cdot 10^{-56}:\\
\;\;\;\;t\_2 \cdot \left(1 - \frac{\frac{t\_0}{\ell} \cdot \left(M \cdot D\right)}{t\_3}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2 \cdot \left(1 - \frac{t\_0}{\ell \cdot t\_3} \cdot \left(M \cdot D\right)\right)\\
\end{array}
\end{array}
if d < 3.80000000000000005e-162Initial program 35.4%
Applied rewrites30.6%
Taylor expanded in d around 0
Applied rewrites33.2%
Applied rewrites41.7%
if 3.80000000000000005e-162 < d < 2.0000000000000001e-56Initial program 35.4%
Applied rewrites42.5%
Taylor expanded in d around 0
Applied rewrites69.2%
Applied rewrites63.8%
Applied rewrites63.4%
if 2.0000000000000001e-56 < d Initial program 35.4%
Applied rewrites42.5%
Taylor expanded in d around 0
Applied rewrites69.2%
Applied rewrites63.8%
d_m = (fabs.f64 d)
(FPCore (d_m h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ 1.0 (* h l)))))
(if (<= d_m 1.1e-139)
(/ (* -0.125 (/ (* (* M D) (* (* M D) (* t_0 h))) d_m)) l)
(*
(* d_m t_0)
(-
1.0
(*
(/ (* (* M D) h) (* l (* (* (+ d_m d_m) (+ d_m d_m)) 2.0)))
(* M D)))))))d_m = fabs(d);
double code(double d_m, double h, double l, double M, double D) {
double t_0 = sqrt((1.0 / (h * l)));
double tmp;
if (d_m <= 1.1e-139) {
tmp = (-0.125 * (((M * D) * ((M * D) * (t_0 * h))) / d_m)) / l;
} else {
tmp = (d_m * t_0) * (1.0 - ((((M * D) * h) / (l * (((d_m + d_m) * (d_m + d_m)) * 2.0))) * (M * 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) :: t_0
real(8) :: tmp
t_0 = sqrt((1.0d0 / (h * l)))
if (d_m <= 1.1d-139) then
tmp = ((-0.125d0) * (((m * d) * ((m * d) * (t_0 * h))) / d_m)) / l
else
tmp = (d_m * t_0) * (1.0d0 - ((((m * d) * h) / (l * (((d_m + d_m) * (d_m + d_m)) * 2.0d0))) * (m * 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 t_0 = Math.sqrt((1.0 / (h * l)));
double tmp;
if (d_m <= 1.1e-139) {
tmp = (-0.125 * (((M * D) * ((M * D) * (t_0 * h))) / d_m)) / l;
} else {
tmp = (d_m * t_0) * (1.0 - ((((M * D) * h) / (l * (((d_m + d_m) * (d_m + d_m)) * 2.0))) * (M * D)));
}
return tmp;
}
d_m = math.fabs(d) def code(d_m, h, l, M, D): t_0 = math.sqrt((1.0 / (h * l))) tmp = 0 if d_m <= 1.1e-139: tmp = (-0.125 * (((M * D) * ((M * D) * (t_0 * h))) / d_m)) / l else: tmp = (d_m * t_0) * (1.0 - ((((M * D) * h) / (l * (((d_m + d_m) * (d_m + d_m)) * 2.0))) * (M * D))) return tmp
d_m = abs(d) function code(d_m, h, l, M, D) t_0 = sqrt(Float64(1.0 / Float64(h * l))) tmp = 0.0 if (d_m <= 1.1e-139) tmp = Float64(Float64(-0.125 * Float64(Float64(Float64(M * D) * Float64(Float64(M * D) * Float64(t_0 * h))) / d_m)) / l); else tmp = Float64(Float64(d_m * t_0) * Float64(1.0 - Float64(Float64(Float64(Float64(M * D) * h) / Float64(l * Float64(Float64(Float64(d_m + d_m) * Float64(d_m + d_m)) * 2.0))) * Float64(M * D)))); end return tmp end
d_m = abs(d); function tmp_2 = code(d_m, h, l, M, D) t_0 = sqrt((1.0 / (h * l))); tmp = 0.0; if (d_m <= 1.1e-139) tmp = (-0.125 * (((M * D) * ((M * D) * (t_0 * h))) / d_m)) / l; else tmp = (d_m * t_0) * (1.0 - ((((M * D) * h) / (l * (((d_m + d_m) * (d_m + d_m)) * 2.0))) * (M * D))); end tmp_2 = tmp; end
d_m = N[Abs[d], $MachinePrecision]
code[d$95$m_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d$95$m, 1.1e-139], N[(N[(-0.125 * N[(N[(N[(M * D), $MachinePrecision] * N[(N[(M * D), $MachinePrecision] * N[(t$95$0 * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / d$95$m), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision], N[(N[(d$95$m * t$95$0), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(M * D), $MachinePrecision] * h), $MachinePrecision] / N[(l * N[(N[(N[(d$95$m + d$95$m), $MachinePrecision] * N[(d$95$m + d$95$m), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
d_m = \left|d\right|
\\
\begin{array}{l}
t_0 := \sqrt{\frac{1}{h \cdot \ell}}\\
\mathbf{if}\;d\_m \leq 1.1 \cdot 10^{-139}:\\
\;\;\;\;\frac{-0.125 \cdot \frac{\left(M \cdot D\right) \cdot \left(\left(M \cdot D\right) \cdot \left(t\_0 \cdot h\right)\right)}{d\_m}}{\ell}\\
\mathbf{else}:\\
\;\;\;\;\left(d\_m \cdot t\_0\right) \cdot \left(1 - \frac{\left(M \cdot D\right) \cdot h}{\ell \cdot \left(\left(\left(d\_m + d\_m\right) \cdot \left(d\_m + d\_m\right)\right) \cdot 2\right)} \cdot \left(M \cdot D\right)\right)\\
\end{array}
\end{array}
if d < 1.10000000000000005e-139Initial program 35.4%
Applied rewrites30.6%
Taylor expanded in d around 0
Applied rewrites33.2%
Applied rewrites41.7%
if 1.10000000000000005e-139 < d Initial program 35.4%
Applied rewrites42.5%
Taylor expanded in d around 0
Applied rewrites69.2%
Applied rewrites63.8%
d_m = (fabs.f64 d)
(FPCore (d_m h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ 1.0 (* h l)))))
(if (<= d_m 1.1e-139)
(/ (* -0.125 (/ (* (* M D) (* (* M D) (* t_0 h))) d_m)) l)
(*
(* d_m t_0)
(-
1.0
(*
(* (/ (* (* M D) h) (* (* (+ d_m d_m) (+ d_m d_m)) (* 2.0 l))) D)
M))))))d_m = fabs(d);
double code(double d_m, double h, double l, double M, double D) {
double t_0 = sqrt((1.0 / (h * l)));
double tmp;
if (d_m <= 1.1e-139) {
tmp = (-0.125 * (((M * D) * ((M * D) * (t_0 * h))) / d_m)) / l;
} else {
tmp = (d_m * t_0) * (1.0 - (((((M * D) * h) / (((d_m + d_m) * (d_m + d_m)) * (2.0 * l))) * D) * M));
}
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 = sqrt((1.0d0 / (h * l)))
if (d_m <= 1.1d-139) then
tmp = ((-0.125d0) * (((m * d) * ((m * d) * (t_0 * h))) / d_m)) / l
else
tmp = (d_m * t_0) * (1.0d0 - (((((m * d) * h) / (((d_m + d_m) * (d_m + d_m)) * (2.0d0 * l))) * d) * m))
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.sqrt((1.0 / (h * l)));
double tmp;
if (d_m <= 1.1e-139) {
tmp = (-0.125 * (((M * D) * ((M * D) * (t_0 * h))) / d_m)) / l;
} else {
tmp = (d_m * t_0) * (1.0 - (((((M * D) * h) / (((d_m + d_m) * (d_m + d_m)) * (2.0 * l))) * D) * M));
}
return tmp;
}
d_m = math.fabs(d) def code(d_m, h, l, M, D): t_0 = math.sqrt((1.0 / (h * l))) tmp = 0 if d_m <= 1.1e-139: tmp = (-0.125 * (((M * D) * ((M * D) * (t_0 * h))) / d_m)) / l else: tmp = (d_m * t_0) * (1.0 - (((((M * D) * h) / (((d_m + d_m) * (d_m + d_m)) * (2.0 * l))) * D) * M)) return tmp
d_m = abs(d) function code(d_m, h, l, M, D) t_0 = sqrt(Float64(1.0 / Float64(h * l))) tmp = 0.0 if (d_m <= 1.1e-139) tmp = Float64(Float64(-0.125 * Float64(Float64(Float64(M * D) * Float64(Float64(M * D) * Float64(t_0 * h))) / d_m)) / l); else tmp = Float64(Float64(d_m * t_0) * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(M * D) * h) / Float64(Float64(Float64(d_m + d_m) * Float64(d_m + d_m)) * Float64(2.0 * l))) * D) * M))); end return tmp end
d_m = abs(d); function tmp_2 = code(d_m, h, l, M, D) t_0 = sqrt((1.0 / (h * l))); tmp = 0.0; if (d_m <= 1.1e-139) tmp = (-0.125 * (((M * D) * ((M * D) * (t_0 * h))) / d_m)) / l; else tmp = (d_m * t_0) * (1.0 - (((((M * D) * h) / (((d_m + d_m) * (d_m + d_m)) * (2.0 * l))) * D) * M)); end tmp_2 = tmp; end
d_m = N[Abs[d], $MachinePrecision]
code[d$95$m_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d$95$m, 1.1e-139], N[(N[(-0.125 * N[(N[(N[(M * D), $MachinePrecision] * N[(N[(M * D), $MachinePrecision] * N[(t$95$0 * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / d$95$m), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision], N[(N[(d$95$m * t$95$0), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(N[(M * D), $MachinePrecision] * h), $MachinePrecision] / N[(N[(N[(d$95$m + d$95$m), $MachinePrecision] * N[(d$95$m + d$95$m), $MachinePrecision]), $MachinePrecision] * N[(2.0 * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * D), $MachinePrecision] * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
d_m = \left|d\right|
\\
\begin{array}{l}
t_0 := \sqrt{\frac{1}{h \cdot \ell}}\\
\mathbf{if}\;d\_m \leq 1.1 \cdot 10^{-139}:\\
\;\;\;\;\frac{-0.125 \cdot \frac{\left(M \cdot D\right) \cdot \left(\left(M \cdot D\right) \cdot \left(t\_0 \cdot h\right)\right)}{d\_m}}{\ell}\\
\mathbf{else}:\\
\;\;\;\;\left(d\_m \cdot t\_0\right) \cdot \left(1 - \left(\frac{\left(M \cdot D\right) \cdot h}{\left(\left(d\_m + d\_m\right) \cdot \left(d\_m + d\_m\right)\right) \cdot \left(2 \cdot \ell\right)} \cdot D\right) \cdot M\right)\\
\end{array}
\end{array}
if d < 1.10000000000000005e-139Initial program 35.4%
Applied rewrites30.6%
Taylor expanded in d around 0
Applied rewrites33.2%
Applied rewrites41.7%
if 1.10000000000000005e-139 < d Initial program 35.4%
Applied rewrites42.5%
Taylor expanded in d around 0
Applied rewrites69.2%
Applied rewrites63.8%
Applied rewrites63.3%
d_m = (fabs.f64 d)
(FPCore (d_m h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ 1.0 (* h l)))))
(if (<= (* M D) 2e+28)
(* (* d_m t_0) 1.0)
(/ (* -0.125 (/ (* (* M D) (* (* M D) (* t_0 h))) d_m)) l))))d_m = fabs(d);
double code(double d_m, double h, double l, double M, double D) {
double t_0 = sqrt((1.0 / (h * l)));
double tmp;
if ((M * D) <= 2e+28) {
tmp = (d_m * t_0) * 1.0;
} else {
tmp = (-0.125 * (((M * D) * ((M * D) * (t_0 * h))) / d_m)) / 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) :: tmp
t_0 = sqrt((1.0d0 / (h * l)))
if ((m * d) <= 2d+28) then
tmp = (d_m * t_0) * 1.0d0
else
tmp = ((-0.125d0) * (((m * d) * ((m * d) * (t_0 * h))) / d_m)) / 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.sqrt((1.0 / (h * l)));
double tmp;
if ((M * D) <= 2e+28) {
tmp = (d_m * t_0) * 1.0;
} else {
tmp = (-0.125 * (((M * D) * ((M * D) * (t_0 * h))) / d_m)) / l;
}
return tmp;
}
d_m = math.fabs(d) def code(d_m, h, l, M, D): t_0 = math.sqrt((1.0 / (h * l))) tmp = 0 if (M * D) <= 2e+28: tmp = (d_m * t_0) * 1.0 else: tmp = (-0.125 * (((M * D) * ((M * D) * (t_0 * h))) / d_m)) / l return tmp
d_m = abs(d) function code(d_m, h, l, M, D) t_0 = sqrt(Float64(1.0 / Float64(h * l))) tmp = 0.0 if (Float64(M * D) <= 2e+28) tmp = Float64(Float64(d_m * t_0) * 1.0); else tmp = Float64(Float64(-0.125 * Float64(Float64(Float64(M * D) * Float64(Float64(M * D) * Float64(t_0 * h))) / d_m)) / l); end return tmp end
d_m = abs(d); function tmp_2 = code(d_m, h, l, M, D) t_0 = sqrt((1.0 / (h * l))); tmp = 0.0; if ((M * D) <= 2e+28) tmp = (d_m * t_0) * 1.0; else tmp = (-0.125 * (((M * D) * ((M * D) * (t_0 * h))) / d_m)) / 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[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(M * D), $MachinePrecision], 2e+28], N[(N[(d$95$m * t$95$0), $MachinePrecision] * 1.0), $MachinePrecision], N[(N[(-0.125 * N[(N[(N[(M * D), $MachinePrecision] * N[(N[(M * D), $MachinePrecision] * N[(t$95$0 * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / d$95$m), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]]]
\begin{array}{l}
d_m = \left|d\right|
\\
\begin{array}{l}
t_0 := \sqrt{\frac{1}{h \cdot \ell}}\\
\mathbf{if}\;M \cdot D \leq 2 \cdot 10^{+28}:\\
\;\;\;\;\left(d\_m \cdot t\_0\right) \cdot 1\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.125 \cdot \frac{\left(M \cdot D\right) \cdot \left(\left(M \cdot D\right) \cdot \left(t\_0 \cdot h\right)\right)}{d\_m}}{\ell}\\
\end{array}
\end{array}
if (*.f64 M D) < 1.99999999999999992e28Initial program 35.4%
Applied rewrites42.5%
Taylor expanded in d around 0
Applied rewrites69.2%
Taylor expanded in d around inf
Applied rewrites42.1%
if 1.99999999999999992e28 < (*.f64 M D) Initial program 35.4%
Applied rewrites30.6%
Taylor expanded in d around 0
Applied rewrites33.2%
Applied rewrites41.7%
d_m = (fabs.f64 d)
(FPCore (d_m h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ 1.0 (* h l)))))
(if (<= (* M D) 2e+67)
(* (* d_m t_0) 1.0)
(/ (* -0.125 (/ (* (* (* D (* t_0 (* M M))) h) D) d_m)) l))))d_m = fabs(d);
double code(double d_m, double h, double l, double M, double D) {
double t_0 = sqrt((1.0 / (h * l)));
double tmp;
if ((M * D) <= 2e+67) {
tmp = (d_m * t_0) * 1.0;
} else {
tmp = (-0.125 * ((((D * (t_0 * (M * M))) * h) * D) / d_m)) / 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) :: tmp
t_0 = sqrt((1.0d0 / (h * l)))
if ((m * d) <= 2d+67) then
tmp = (d_m * t_0) * 1.0d0
else
tmp = ((-0.125d0) * ((((d * (t_0 * (m * m))) * h) * d) / d_m)) / 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.sqrt((1.0 / (h * l)));
double tmp;
if ((M * D) <= 2e+67) {
tmp = (d_m * t_0) * 1.0;
} else {
tmp = (-0.125 * ((((D * (t_0 * (M * M))) * h) * D) / d_m)) / l;
}
return tmp;
}
d_m = math.fabs(d) def code(d_m, h, l, M, D): t_0 = math.sqrt((1.0 / (h * l))) tmp = 0 if (M * D) <= 2e+67: tmp = (d_m * t_0) * 1.0 else: tmp = (-0.125 * ((((D * (t_0 * (M * M))) * h) * D) / d_m)) / l return tmp
d_m = abs(d) function code(d_m, h, l, M, D) t_0 = sqrt(Float64(1.0 / Float64(h * l))) tmp = 0.0 if (Float64(M * D) <= 2e+67) tmp = Float64(Float64(d_m * t_0) * 1.0); else tmp = Float64(Float64(-0.125 * Float64(Float64(Float64(Float64(D * Float64(t_0 * Float64(M * M))) * h) * D) / d_m)) / l); end return tmp end
d_m = abs(d); function tmp_2 = code(d_m, h, l, M, D) t_0 = sqrt((1.0 / (h * l))); tmp = 0.0; if ((M * D) <= 2e+67) tmp = (d_m * t_0) * 1.0; else tmp = (-0.125 * ((((D * (t_0 * (M * M))) * h) * D) / d_m)) / 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[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(M * D), $MachinePrecision], 2e+67], N[(N[(d$95$m * t$95$0), $MachinePrecision] * 1.0), $MachinePrecision], N[(N[(-0.125 * N[(N[(N[(N[(D * N[(t$95$0 * N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * h), $MachinePrecision] * D), $MachinePrecision] / d$95$m), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]]]
\begin{array}{l}
d_m = \left|d\right|
\\
\begin{array}{l}
t_0 := \sqrt{\frac{1}{h \cdot \ell}}\\
\mathbf{if}\;M \cdot D \leq 2 \cdot 10^{+67}:\\
\;\;\;\;\left(d\_m \cdot t\_0\right) \cdot 1\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.125 \cdot \frac{\left(\left(D \cdot \left(t\_0 \cdot \left(M \cdot M\right)\right)\right) \cdot h\right) \cdot D}{d\_m}}{\ell}\\
\end{array}
\end{array}
if (*.f64 M D) < 1.99999999999999997e67Initial program 35.4%
Applied rewrites42.5%
Taylor expanded in d around 0
Applied rewrites69.2%
Taylor expanded in d around inf
Applied rewrites42.1%
if 1.99999999999999997e67 < (*.f64 M D) Initial program 35.4%
Applied rewrites30.6%
Taylor expanded in d around 0
Applied rewrites33.2%
Applied rewrites34.4%
Applied rewrites35.4%
d_m = (fabs.f64 d)
(FPCore (d_m h l M D)
:precision binary64
(if (<= h -1e+59)
(* (/ (sqrt (/ l h)) l) (- d_m))
(if (<= h 1.8e+189)
(* (* d_m (sqrt (/ 1.0 (* h l)))) 1.0)
(* -1.0 (/ (* d_m (sqrt (/ h l))) h)))))d_m = fabs(d);
double code(double d_m, double h, double l, double M, double D) {
double tmp;
if (h <= -1e+59) {
tmp = (sqrt((l / h)) / l) * -d_m;
} else if (h <= 1.8e+189) {
tmp = (d_m * sqrt((1.0 / (h * l)))) * 1.0;
} else {
tmp = -1.0 * ((d_m * sqrt((h / 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) :: tmp
if (h <= (-1d+59)) then
tmp = (sqrt((l / h)) / l) * -d_m
else if (h <= 1.8d+189) then
tmp = (d_m * sqrt((1.0d0 / (h * l)))) * 1.0d0
else
tmp = (-1.0d0) * ((d_m * sqrt((h / 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 tmp;
if (h <= -1e+59) {
tmp = (Math.sqrt((l / h)) / l) * -d_m;
} else if (h <= 1.8e+189) {
tmp = (d_m * Math.sqrt((1.0 / (h * l)))) * 1.0;
} else {
tmp = -1.0 * ((d_m * Math.sqrt((h / l))) / h);
}
return tmp;
}
d_m = math.fabs(d) def code(d_m, h, l, M, D): tmp = 0 if h <= -1e+59: tmp = (math.sqrt((l / h)) / l) * -d_m elif h <= 1.8e+189: tmp = (d_m * math.sqrt((1.0 / (h * l)))) * 1.0 else: tmp = -1.0 * ((d_m * math.sqrt((h / l))) / h) return tmp
d_m = abs(d) function code(d_m, h, l, M, D) tmp = 0.0 if (h <= -1e+59) tmp = Float64(Float64(sqrt(Float64(l / h)) / l) * Float64(-d_m)); elseif (h <= 1.8e+189) tmp = Float64(Float64(d_m * sqrt(Float64(1.0 / Float64(h * l)))) * 1.0); else tmp = Float64(-1.0 * Float64(Float64(d_m * sqrt(Float64(h / l))) / h)); end return tmp end
d_m = abs(d); function tmp_2 = code(d_m, h, l, M, D) tmp = 0.0; if (h <= -1e+59) tmp = (sqrt((l / h)) / l) * -d_m; elseif (h <= 1.8e+189) tmp = (d_m * sqrt((1.0 / (h * l)))) * 1.0; else tmp = -1.0 * ((d_m * sqrt((h / l))) / h); end tmp_2 = tmp; end
d_m = N[Abs[d], $MachinePrecision] code[d$95$m_, h_, l_, M_, D_] := If[LessEqual[h, -1e+59], N[(N[(N[Sqrt[N[(l / h), $MachinePrecision]], $MachinePrecision] / l), $MachinePrecision] * (-d$95$m)), $MachinePrecision], If[LessEqual[h, 1.8e+189], N[(N[(d$95$m * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], N[(-1.0 * N[(N[(d$95$m * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
d_m = \left|d\right|
\\
\begin{array}{l}
\mathbf{if}\;h \leq -1 \cdot 10^{+59}:\\
\;\;\;\;\frac{\sqrt{\frac{\ell}{h}}}{\ell} \cdot \left(-d\_m\right)\\
\mathbf{elif}\;h \leq 1.8 \cdot 10^{+189}:\\
\;\;\;\;\left(d\_m \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot 1\\
\mathbf{else}:\\
\;\;\;\;-1 \cdot \frac{d\_m \cdot \sqrt{\frac{h}{\ell}}}{h}\\
\end{array}
\end{array}
if h < -9.99999999999999972e58Initial program 35.4%
Applied rewrites42.5%
Taylor expanded in d around -inf
Applied rewrites10.4%
Applied rewrites10.4%
Taylor expanded in l around 0
Applied rewrites22.9%
if -9.99999999999999972e58 < h < 1.80000000000000004e189Initial program 35.4%
Applied rewrites42.5%
Taylor expanded in d around 0
Applied rewrites69.2%
Taylor expanded in d around inf
Applied rewrites42.1%
if 1.80000000000000004e189 < h Initial program 35.4%
Applied rewrites42.5%
Taylor expanded in d around -inf
Applied rewrites10.4%
Taylor expanded in h around 0
Applied rewrites24.9%
d_m = (fabs.f64 d)
(FPCore (d_m h l M D)
:precision binary64
(if (<= h -1e+59)
(* (/ (sqrt (/ l h)) l) (- d_m))
(if (<= h 1.95e+189)
(* (* d_m (sqrt (/ 1.0 (* h l)))) 1.0)
(* (/ (sqrt (/ h l)) h) (- d_m)))))d_m = fabs(d);
double code(double d_m, double h, double l, double M, double D) {
double tmp;
if (h <= -1e+59) {
tmp = (sqrt((l / h)) / l) * -d_m;
} else if (h <= 1.95e+189) {
tmp = (d_m * sqrt((1.0 / (h * l)))) * 1.0;
} else {
tmp = (sqrt((h / l)) / h) * -d_m;
}
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 (h <= (-1d+59)) then
tmp = (sqrt((l / h)) / l) * -d_m
else if (h <= 1.95d+189) then
tmp = (d_m * sqrt((1.0d0 / (h * l)))) * 1.0d0
else
tmp = (sqrt((h / l)) / h) * -d_m
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 (h <= -1e+59) {
tmp = (Math.sqrt((l / h)) / l) * -d_m;
} else if (h <= 1.95e+189) {
tmp = (d_m * Math.sqrt((1.0 / (h * l)))) * 1.0;
} else {
tmp = (Math.sqrt((h / l)) / h) * -d_m;
}
return tmp;
}
d_m = math.fabs(d) def code(d_m, h, l, M, D): tmp = 0 if h <= -1e+59: tmp = (math.sqrt((l / h)) / l) * -d_m elif h <= 1.95e+189: tmp = (d_m * math.sqrt((1.0 / (h * l)))) * 1.0 else: tmp = (math.sqrt((h / l)) / h) * -d_m return tmp
d_m = abs(d) function code(d_m, h, l, M, D) tmp = 0.0 if (h <= -1e+59) tmp = Float64(Float64(sqrt(Float64(l / h)) / l) * Float64(-d_m)); elseif (h <= 1.95e+189) tmp = Float64(Float64(d_m * sqrt(Float64(1.0 / Float64(h * l)))) * 1.0); else tmp = Float64(Float64(sqrt(Float64(h / l)) / h) * Float64(-d_m)); end return tmp end
d_m = abs(d); function tmp_2 = code(d_m, h, l, M, D) tmp = 0.0; if (h <= -1e+59) tmp = (sqrt((l / h)) / l) * -d_m; elseif (h <= 1.95e+189) tmp = (d_m * sqrt((1.0 / (h * l)))) * 1.0; else tmp = (sqrt((h / l)) / h) * -d_m; end tmp_2 = tmp; end
d_m = N[Abs[d], $MachinePrecision] code[d$95$m_, h_, l_, M_, D_] := If[LessEqual[h, -1e+59], N[(N[(N[Sqrt[N[(l / h), $MachinePrecision]], $MachinePrecision] / l), $MachinePrecision] * (-d$95$m)), $MachinePrecision], If[LessEqual[h, 1.95e+189], N[(N[(d$95$m * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], N[(N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] / h), $MachinePrecision] * (-d$95$m)), $MachinePrecision]]]
\begin{array}{l}
d_m = \left|d\right|
\\
\begin{array}{l}
\mathbf{if}\;h \leq -1 \cdot 10^{+59}:\\
\;\;\;\;\frac{\sqrt{\frac{\ell}{h}}}{\ell} \cdot \left(-d\_m\right)\\
\mathbf{elif}\;h \leq 1.95 \cdot 10^{+189}:\\
\;\;\;\;\left(d\_m \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot 1\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{\frac{h}{\ell}}}{h} \cdot \left(-d\_m\right)\\
\end{array}
\end{array}
if h < -9.99999999999999972e58Initial program 35.4%
Applied rewrites42.5%
Taylor expanded in d around -inf
Applied rewrites10.4%
Applied rewrites10.4%
Taylor expanded in l around 0
Applied rewrites22.9%
if -9.99999999999999972e58 < h < 1.95e189Initial program 35.4%
Applied rewrites42.5%
Taylor expanded in d around 0
Applied rewrites69.2%
Taylor expanded in d around inf
Applied rewrites42.1%
if 1.95e189 < h Initial program 35.4%
Applied rewrites42.5%
Taylor expanded in d around -inf
Applied rewrites10.4%
Applied rewrites10.4%
Taylor expanded in h around 0
Applied rewrites25.8%
d_m = (fabs.f64 d)
(FPCore (d_m h l M D)
:precision binary64
(if (<= h -2e-304)
(* (/ (sqrt (/ l h)) l) (- d_m))
(if (<= h 1.45e+170)
(* (sqrt (/ d_m h)) (sqrt (/ d_m l)))
(* (/ (sqrt (/ h l)) h) (- d_m)))))d_m = fabs(d);
double code(double d_m, double h, double l, double M, double D) {
double tmp;
if (h <= -2e-304) {
tmp = (sqrt((l / h)) / l) * -d_m;
} else if (h <= 1.45e+170) {
tmp = sqrt((d_m / h)) * sqrt((d_m / l));
} else {
tmp = (sqrt((h / l)) / h) * -d_m;
}
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 (h <= (-2d-304)) then
tmp = (sqrt((l / h)) / l) * -d_m
else if (h <= 1.45d+170) then
tmp = sqrt((d_m / h)) * sqrt((d_m / l))
else
tmp = (sqrt((h / l)) / h) * -d_m
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 (h <= -2e-304) {
tmp = (Math.sqrt((l / h)) / l) * -d_m;
} else if (h <= 1.45e+170) {
tmp = Math.sqrt((d_m / h)) * Math.sqrt((d_m / l));
} else {
tmp = (Math.sqrt((h / l)) / h) * -d_m;
}
return tmp;
}
d_m = math.fabs(d) def code(d_m, h, l, M, D): tmp = 0 if h <= -2e-304: tmp = (math.sqrt((l / h)) / l) * -d_m elif h <= 1.45e+170: tmp = math.sqrt((d_m / h)) * math.sqrt((d_m / l)) else: tmp = (math.sqrt((h / l)) / h) * -d_m return tmp
d_m = abs(d) function code(d_m, h, l, M, D) tmp = 0.0 if (h <= -2e-304) tmp = Float64(Float64(sqrt(Float64(l / h)) / l) * Float64(-d_m)); elseif (h <= 1.45e+170) tmp = Float64(sqrt(Float64(d_m / h)) * sqrt(Float64(d_m / l))); else tmp = Float64(Float64(sqrt(Float64(h / l)) / h) * Float64(-d_m)); end return tmp end
d_m = abs(d); function tmp_2 = code(d_m, h, l, M, D) tmp = 0.0; if (h <= -2e-304) tmp = (sqrt((l / h)) / l) * -d_m; elseif (h <= 1.45e+170) tmp = sqrt((d_m / h)) * sqrt((d_m / l)); else tmp = (sqrt((h / l)) / h) * -d_m; end tmp_2 = tmp; end
d_m = N[Abs[d], $MachinePrecision] code[d$95$m_, h_, l_, M_, D_] := If[LessEqual[h, -2e-304], N[(N[(N[Sqrt[N[(l / h), $MachinePrecision]], $MachinePrecision] / l), $MachinePrecision] * (-d$95$m)), $MachinePrecision], If[LessEqual[h, 1.45e+170], N[(N[Sqrt[N[(d$95$m / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d$95$m / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] / h), $MachinePrecision] * (-d$95$m)), $MachinePrecision]]]
\begin{array}{l}
d_m = \left|d\right|
\\
\begin{array}{l}
\mathbf{if}\;h \leq -2 \cdot 10^{-304}:\\
\;\;\;\;\frac{\sqrt{\frac{\ell}{h}}}{\ell} \cdot \left(-d\_m\right)\\
\mathbf{elif}\;h \leq 1.45 \cdot 10^{+170}:\\
\;\;\;\;\sqrt{\frac{d\_m}{h}} \cdot \sqrt{\frac{d\_m}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{\frac{h}{\ell}}}{h} \cdot \left(-d\_m\right)\\
\end{array}
\end{array}
if h < -1.99999999999999994e-304Initial program 35.4%
Applied rewrites42.5%
Taylor expanded in d around -inf
Applied rewrites10.4%
Applied rewrites10.4%
Taylor expanded in l around 0
Applied rewrites22.9%
if -1.99999999999999994e-304 < h < 1.45e170Initial program 35.4%
Taylor expanded in h around 0
Applied rewrites18.8%
Applied rewrites19.9%
Taylor expanded in l around inf
Applied rewrites20.0%
if 1.45e170 < h Initial program 35.4%
Applied rewrites42.5%
Taylor expanded in d around -inf
Applied rewrites10.4%
Applied rewrites10.4%
Taylor expanded in h around 0
Applied rewrites25.8%
d_m = (fabs.f64 d)
(FPCore (d_m h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ h l))))
(if (<= h -2e-304)
(* (/ (sqrt (/ l h)) l) (- d_m))
(if (<= h 2.05e+169) (/ (* d_m t_0) h) (* (/ t_0 h) (- d_m))))))d_m = fabs(d);
double code(double d_m, double h, double l, double M, double D) {
double t_0 = sqrt((h / l));
double tmp;
if (h <= -2e-304) {
tmp = (sqrt((l / h)) / l) * -d_m;
} else if (h <= 2.05e+169) {
tmp = (d_m * t_0) / h;
} else {
tmp = (t_0 / h) * -d_m;
}
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 = sqrt((h / l))
if (h <= (-2d-304)) then
tmp = (sqrt((l / h)) / l) * -d_m
else if (h <= 2.05d+169) then
tmp = (d_m * t_0) / h
else
tmp = (t_0 / h) * -d_m
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.sqrt((h / l));
double tmp;
if (h <= -2e-304) {
tmp = (Math.sqrt((l / h)) / l) * -d_m;
} else if (h <= 2.05e+169) {
tmp = (d_m * t_0) / h;
} else {
tmp = (t_0 / h) * -d_m;
}
return tmp;
}
d_m = math.fabs(d) def code(d_m, h, l, M, D): t_0 = math.sqrt((h / l)) tmp = 0 if h <= -2e-304: tmp = (math.sqrt((l / h)) / l) * -d_m elif h <= 2.05e+169: tmp = (d_m * t_0) / h else: tmp = (t_0 / h) * -d_m return tmp
d_m = abs(d) function code(d_m, h, l, M, D) t_0 = sqrt(Float64(h / l)) tmp = 0.0 if (h <= -2e-304) tmp = Float64(Float64(sqrt(Float64(l / h)) / l) * Float64(-d_m)); elseif (h <= 2.05e+169) tmp = Float64(Float64(d_m * t_0) / h); else tmp = Float64(Float64(t_0 / h) * Float64(-d_m)); end return tmp end
d_m = abs(d); function tmp_2 = code(d_m, h, l, M, D) t_0 = sqrt((h / l)); tmp = 0.0; if (h <= -2e-304) tmp = (sqrt((l / h)) / l) * -d_m; elseif (h <= 2.05e+169) tmp = (d_m * t_0) / h; else tmp = (t_0 / h) * -d_m; end tmp_2 = tmp; end
d_m = N[Abs[d], $MachinePrecision]
code[d$95$m_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[h, -2e-304], N[(N[(N[Sqrt[N[(l / h), $MachinePrecision]], $MachinePrecision] / l), $MachinePrecision] * (-d$95$m)), $MachinePrecision], If[LessEqual[h, 2.05e+169], N[(N[(d$95$m * t$95$0), $MachinePrecision] / h), $MachinePrecision], N[(N[(t$95$0 / h), $MachinePrecision] * (-d$95$m)), $MachinePrecision]]]]
\begin{array}{l}
d_m = \left|d\right|
\\
\begin{array}{l}
t_0 := \sqrt{\frac{h}{\ell}}\\
\mathbf{if}\;h \leq -2 \cdot 10^{-304}:\\
\;\;\;\;\frac{\sqrt{\frac{\ell}{h}}}{\ell} \cdot \left(-d\_m\right)\\
\mathbf{elif}\;h \leq 2.05 \cdot 10^{+169}:\\
\;\;\;\;\frac{d\_m \cdot t\_0}{h}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0}{h} \cdot \left(-d\_m\right)\\
\end{array}
\end{array}
if h < -1.99999999999999994e-304Initial program 35.4%
Applied rewrites42.5%
Taylor expanded in d around -inf
Applied rewrites10.4%
Applied rewrites10.4%
Taylor expanded in l around 0
Applied rewrites22.9%
if -1.99999999999999994e-304 < h < 2.0500000000000002e169Initial program 35.4%
Taylor expanded in h around 0
Applied rewrites18.8%
Applied rewrites19.9%
Taylor expanded in d around 0
Applied rewrites25.4%
if 2.0500000000000002e169 < h Initial program 35.4%
Applied rewrites42.5%
Taylor expanded in d around -inf
Applied rewrites10.4%
Applied rewrites10.4%
Taylor expanded in h around 0
Applied rewrites25.8%
d_m = (fabs.f64 d) (FPCore (d_m h l M D) :precision binary64 (let* ((t_0 (sqrt (/ h l))) (t_1 (* (/ t_0 h) (- d_m)))) (if (<= h -2e-302) t_1 (if (<= h 2.05e+169) (/ (* d_m t_0) h) t_1))))
d_m = fabs(d);
double code(double d_m, double h, double l, double M, double D) {
double t_0 = sqrt((h / l));
double t_1 = (t_0 / h) * -d_m;
double tmp;
if (h <= -2e-302) {
tmp = t_1;
} else if (h <= 2.05e+169) {
tmp = (d_m * t_0) / h;
} else {
tmp = t_1;
}
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 = sqrt((h / l))
t_1 = (t_0 / h) * -d_m
if (h <= (-2d-302)) then
tmp = t_1
else if (h <= 2.05d+169) then
tmp = (d_m * t_0) / h
else
tmp = t_1
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.sqrt((h / l));
double t_1 = (t_0 / h) * -d_m;
double tmp;
if (h <= -2e-302) {
tmp = t_1;
} else if (h <= 2.05e+169) {
tmp = (d_m * t_0) / h;
} else {
tmp = t_1;
}
return tmp;
}
d_m = math.fabs(d) def code(d_m, h, l, M, D): t_0 = math.sqrt((h / l)) t_1 = (t_0 / h) * -d_m tmp = 0 if h <= -2e-302: tmp = t_1 elif h <= 2.05e+169: tmp = (d_m * t_0) / h else: tmp = t_1 return tmp
d_m = abs(d) function code(d_m, h, l, M, D) t_0 = sqrt(Float64(h / l)) t_1 = Float64(Float64(t_0 / h) * Float64(-d_m)) tmp = 0.0 if (h <= -2e-302) tmp = t_1; elseif (h <= 2.05e+169) tmp = Float64(Float64(d_m * t_0) / h); else tmp = t_1; end return tmp end
d_m = abs(d); function tmp_2 = code(d_m, h, l, M, D) t_0 = sqrt((h / l)); t_1 = (t_0 / h) * -d_m; tmp = 0.0; if (h <= -2e-302) tmp = t_1; elseif (h <= 2.05e+169) tmp = (d_m * t_0) / h; else tmp = t_1; end tmp_2 = tmp; end
d_m = N[Abs[d], $MachinePrecision]
code[d$95$m_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 / h), $MachinePrecision] * (-d$95$m)), $MachinePrecision]}, If[LessEqual[h, -2e-302], t$95$1, If[LessEqual[h, 2.05e+169], N[(N[(d$95$m * t$95$0), $MachinePrecision] / h), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
d_m = \left|d\right|
\\
\begin{array}{l}
t_0 := \sqrt{\frac{h}{\ell}}\\
t_1 := \frac{t\_0}{h} \cdot \left(-d\_m\right)\\
\mathbf{if}\;h \leq -2 \cdot 10^{-302}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;h \leq 2.05 \cdot 10^{+169}:\\
\;\;\;\;\frac{d\_m \cdot t\_0}{h}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if h < -1.9999999999999999e-302 or 2.0500000000000002e169 < h Initial program 35.4%
Applied rewrites42.5%
Taylor expanded in d around -inf
Applied rewrites10.4%
Applied rewrites10.4%
Taylor expanded in h around 0
Applied rewrites25.8%
if -1.9999999999999999e-302 < h < 2.0500000000000002e169Initial program 35.4%
Taylor expanded in h around 0
Applied rewrites18.8%
Applied rewrites19.9%
Taylor expanded in d around 0
Applied rewrites25.4%
d_m = (fabs.f64 d)
(FPCore (d_m h l M D)
:precision binary64
(if (<=
(*
(* (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))))
-5e+148)
(* (sqrt (/ 1.0 (* h l))) (- d_m))
(/ (* d_m (sqrt (/ h l))) h)))d_m = fabs(d);
double code(double d_m, double h, double l, double M, double D) {
double tmp;
if (((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)))) <= -5e+148) {
tmp = sqrt((1.0 / (h * l))) * -d_m;
} else {
tmp = (d_m * sqrt((h / 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) :: tmp
if (((((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)))) <= (-5d+148)) then
tmp = sqrt((1.0d0 / (h * l))) * -d_m
else
tmp = (d_m * sqrt((h / 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 tmp;
if (((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)))) <= -5e+148) {
tmp = Math.sqrt((1.0 / (h * l))) * -d_m;
} else {
tmp = (d_m * Math.sqrt((h / l))) / h;
}
return tmp;
}
d_m = math.fabs(d) def code(d_m, h, l, M, D): tmp = 0 if ((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)))) <= -5e+148: tmp = math.sqrt((1.0 / (h * l))) * -d_m else: tmp = (d_m * math.sqrt((h / l))) / h return tmp
d_m = abs(d) function code(d_m, h, l, M, D) tmp = 0.0 if (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)))) <= -5e+148) tmp = Float64(sqrt(Float64(1.0 / Float64(h * l))) * Float64(-d_m)); else tmp = Float64(Float64(d_m * sqrt(Float64(h / l))) / h); end return tmp end
d_m = abs(d); function tmp_2 = code(d_m, h, l, M, D) tmp = 0.0; if (((((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)))) <= -5e+148) tmp = sqrt((1.0 / (h * l))) * -d_m; else tmp = (d_m * sqrt((h / l))) / h; end tmp_2 = tmp; end
d_m = N[Abs[d], $MachinePrecision] code[d$95$m_, h_, l_, M_, D_] := If[LessEqual[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], -5e+148], N[(N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-d$95$m)), $MachinePrecision], N[(N[(d$95$m * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]]
\begin{array}{l}
d_m = \left|d\right|
\\
\begin{array}{l}
\mathbf{if}\;\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) \leq -5 \cdot 10^{+148}:\\
\;\;\;\;\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(-d\_m\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d\_m \cdot \sqrt{\frac{h}{\ell}}}{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)))) < -5.00000000000000024e148Initial program 35.4%
Applied rewrites42.5%
Taylor expanded in d around -inf
Applied rewrites10.4%
Applied rewrites10.4%
if -5.00000000000000024e148 < (*.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 35.4%
Taylor expanded in h around 0
Applied rewrites18.8%
Applied rewrites19.9%
Taylor expanded in d around 0
Applied rewrites25.4%
d_m = (fabs.f64 d) (FPCore (d_m h l M D) :precision binary64 (/ (* d_m (sqrt (/ h l))) h))
d_m = fabs(d);
double code(double d_m, double h, double l, double M, double D) {
return (d_m * sqrt((h / 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((h / 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((h / l))) / h;
}
d_m = math.fabs(d) def code(d_m, h, l, M, D): return (d_m * math.sqrt((h / l))) / h
d_m = abs(d) function code(d_m, h, l, M, D) return Float64(Float64(d_m * sqrt(Float64(h / l))) / h) end
d_m = abs(d); function tmp = code(d_m, h, l, M, D) tmp = (d_m * sqrt((h / l))) / h; end
d_m = N[Abs[d], $MachinePrecision] code[d$95$m_, h_, l_, M_, D_] := N[(N[(d$95$m * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]
\begin{array}{l}
d_m = \left|d\right|
\\
\frac{d\_m \cdot \sqrt{\frac{h}{\ell}}}{h}
\end{array}
Initial program 35.4%
Taylor expanded in h around 0
Applied rewrites18.8%
Applied rewrites19.9%
Taylor expanded in d around 0
Applied rewrites25.4%
herbie shell --seed 2025153
(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)))))