
(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 18 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 (/ D (+ d_m d_m)))
(t_1
(- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d_m)) 2.0)) (/ h l))))
(t_2
(* (* (pow (/ d_m h) (/ 1.0 2.0)) (pow (/ d_m l) (/ 1.0 2.0))) t_1))
(t_3 (* (sqrt (/ 1.0 (* l h))) d_m)))
(if (<= t_2 0.0)
(* t_3 t_1)
(if (<= t_2 5e+234)
(* (/ 1.0 (* (sqrt l) (sqrt h))) d_m)
(* t_3 (- 1.0 (/ (* (* (* M (* t_0 (* t_0 M))) 0.5) h) l)))))))d_m = fabs(d);
double code(double d_m, double h, double l, double M, double D) {
double t_0 = D / (d_m + d_m);
double t_1 = 1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l));
double t_2 = (pow((d_m / h), (1.0 / 2.0)) * pow((d_m / l), (1.0 / 2.0))) * t_1;
double t_3 = sqrt((1.0 / (l * h))) * d_m;
double tmp;
if (t_2 <= 0.0) {
tmp = t_3 * t_1;
} else if (t_2 <= 5e+234) {
tmp = (1.0 / (sqrt(l) * sqrt(h))) * d_m;
} else {
tmp = t_3 * (1.0 - ((((M * (t_0 * (t_0 * M))) * 0.5) * 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) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = d / (d_m + d_m)
t_1 = 1.0d0 - (((1.0d0 / 2.0d0) * (((m * d) / (2.0d0 * d_m)) ** 2.0d0)) * (h / l))
t_2 = (((d_m / h) ** (1.0d0 / 2.0d0)) * ((d_m / l) ** (1.0d0 / 2.0d0))) * t_1
t_3 = sqrt((1.0d0 / (l * h))) * d_m
if (t_2 <= 0.0d0) then
tmp = t_3 * t_1
else if (t_2 <= 5d+234) then
tmp = (1.0d0 / (sqrt(l) * sqrt(h))) * d_m
else
tmp = t_3 * (1.0d0 - ((((m * (t_0 * (t_0 * m))) * 0.5d0) * 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 = D / (d_m + d_m);
double t_1 = 1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l));
double t_2 = (Math.pow((d_m / h), (1.0 / 2.0)) * Math.pow((d_m / l), (1.0 / 2.0))) * t_1;
double t_3 = Math.sqrt((1.0 / (l * h))) * d_m;
double tmp;
if (t_2 <= 0.0) {
tmp = t_3 * t_1;
} else if (t_2 <= 5e+234) {
tmp = (1.0 / (Math.sqrt(l) * Math.sqrt(h))) * d_m;
} else {
tmp = t_3 * (1.0 - ((((M * (t_0 * (t_0 * M))) * 0.5) * h) / l));
}
return tmp;
}
d_m = math.fabs(d) def code(d_m, h, l, M, D): t_0 = D / (d_m + d_m) t_1 = 1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l)) t_2 = (math.pow((d_m / h), (1.0 / 2.0)) * math.pow((d_m / l), (1.0 / 2.0))) * t_1 t_3 = math.sqrt((1.0 / (l * h))) * d_m tmp = 0 if t_2 <= 0.0: tmp = t_3 * t_1 elif t_2 <= 5e+234: tmp = (1.0 / (math.sqrt(l) * math.sqrt(h))) * d_m else: tmp = t_3 * (1.0 - ((((M * (t_0 * (t_0 * M))) * 0.5) * h) / l)) return tmp
d_m = abs(d) function code(d_m, h, l, M, D) t_0 = Float64(D / Float64(d_m + d_m)) 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))) t_2 = Float64(Float64((Float64(d_m / h) ^ Float64(1.0 / 2.0)) * (Float64(d_m / l) ^ Float64(1.0 / 2.0))) * t_1) t_3 = Float64(sqrt(Float64(1.0 / Float64(l * h))) * d_m) tmp = 0.0 if (t_2 <= 0.0) tmp = Float64(t_3 * t_1); elseif (t_2 <= 5e+234) tmp = Float64(Float64(1.0 / Float64(sqrt(l) * sqrt(h))) * d_m); else tmp = Float64(t_3 * Float64(1.0 - Float64(Float64(Float64(Float64(M * Float64(t_0 * Float64(t_0 * M))) * 0.5) * h) / l))); end return tmp end
d_m = abs(d); function tmp_2 = code(d_m, h, l, M, D) t_0 = D / (d_m + d_m); t_1 = 1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d_m)) ^ 2.0)) * (h / l)); t_2 = (((d_m / h) ^ (1.0 / 2.0)) * ((d_m / l) ^ (1.0 / 2.0))) * t_1; t_3 = sqrt((1.0 / (l * h))) * d_m; tmp = 0.0; if (t_2 <= 0.0) tmp = t_3 * t_1; elseif (t_2 <= 5e+234) tmp = (1.0 / (sqrt(l) * sqrt(h))) * d_m; else tmp = t_3 * (1.0 - ((((M * (t_0 * (t_0 * M))) * 0.5) * 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[(D / N[(d$95$m + d$95$m), $MachinePrecision]), $MachinePrecision]}, Block[{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]}, Block[{t$95$2 = 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$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * d$95$m), $MachinePrecision]}, If[LessEqual[t$95$2, 0.0], N[(t$95$3 * t$95$1), $MachinePrecision], If[LessEqual[t$95$2, 5e+234], N[(N[(1.0 / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * d$95$m), $MachinePrecision], N[(t$95$3 * N[(1.0 - N[(N[(N[(N[(M * N[(t$95$0 * N[(t$95$0 * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
d_m = \left|d\right|
\\
\begin{array}{l}
t_0 := \frac{D}{d\_m + d\_m}\\
t_1 := 1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d\_m}\right)}^{2}\right) \cdot \frac{h}{\ell}\\
t_2 := \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\_1\\
t_3 := \sqrt{\frac{1}{\ell \cdot h}} \cdot d\_m\\
\mathbf{if}\;t\_2 \leq 0:\\
\;\;\;\;t\_3 \cdot t\_1\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+234}:\\
\;\;\;\;\frac{1}{\sqrt{\ell} \cdot \sqrt{h}} \cdot d\_m\\
\mathbf{else}:\\
\;\;\;\;t\_3 \cdot \left(1 - \frac{\left(\left(M \cdot \left(t\_0 \cdot \left(t\_0 \cdot M\right)\right)\right) \cdot 0.5\right) \cdot 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)))) < -0.0Initial program 35.2%
Taylor expanded in d around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6469.0
Applied rewrites69.0%
if -0.0 < (*.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.0000000000000003e234Initial program 35.2%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6442.1
Applied rewrites42.1%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
sqrt-divN/A
metadata-evalN/A
*-commutativeN/A
lower-/.f64N/A
lower-sqrt.f64N/A
*-commutativeN/A
lift-*.f6442.3
Applied rewrites42.3%
lift-*.f64N/A
lift-sqrt.f64N/A
sqrt-prodN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lift-sqrt.f6424.8
Applied rewrites24.8%
if 5.0000000000000003e234 < (*.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.2%
Taylor expanded in d around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6469.0
Applied rewrites69.0%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-/l*N/A
count-2-revN/A
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
Applied rewrites72.6%
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 (/ D (+ d_m d_m)))
(t_2 (- 1.0 (/ (* (* (* M (* t_1 (* t_1 M))) 0.5) h) l))))
(if (<= t_0 0.0)
(* (/ d_m (sqrt (* l h))) t_2)
(if (<= t_0 5e+234)
(* (/ 1.0 (* (sqrt l) (sqrt h))) d_m)
(* (* (sqrt (/ 1.0 (* l h))) d_m) t_2)))))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 = D / (d_m + d_m);
double t_2 = 1.0 - ((((M * (t_1 * (t_1 * M))) * 0.5) * h) / l);
double tmp;
if (t_0 <= 0.0) {
tmp = (d_m / sqrt((l * h))) * t_2;
} else if (t_0 <= 5e+234) {
tmp = (1.0 / (sqrt(l) * sqrt(h))) * d_m;
} else {
tmp = (sqrt((1.0 / (l * h))) * d_m) * t_2;
}
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) :: 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 = d / (d_m + d_m)
t_2 = 1.0d0 - ((((m * (t_1 * (t_1 * m))) * 0.5d0) * h) / l)
if (t_0 <= 0.0d0) then
tmp = (d_m / sqrt((l * h))) * t_2
else if (t_0 <= 5d+234) then
tmp = (1.0d0 / (sqrt(l) * sqrt(h))) * d_m
else
tmp = (sqrt((1.0d0 / (l * h))) * d_m) * t_2
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 = D / (d_m + d_m);
double t_2 = 1.0 - ((((M * (t_1 * (t_1 * M))) * 0.5) * h) / l);
double tmp;
if (t_0 <= 0.0) {
tmp = (d_m / Math.sqrt((l * h))) * t_2;
} else if (t_0 <= 5e+234) {
tmp = (1.0 / (Math.sqrt(l) * Math.sqrt(h))) * d_m;
} else {
tmp = (Math.sqrt((1.0 / (l * h))) * d_m) * t_2;
}
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 = D / (d_m + d_m) t_2 = 1.0 - ((((M * (t_1 * (t_1 * M))) * 0.5) * h) / l) tmp = 0 if t_0 <= 0.0: tmp = (d_m / math.sqrt((l * h))) * t_2 elif t_0 <= 5e+234: tmp = (1.0 / (math.sqrt(l) * math.sqrt(h))) * d_m else: tmp = (math.sqrt((1.0 / (l * h))) * d_m) * t_2 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(D / Float64(d_m + d_m)) t_2 = Float64(1.0 - Float64(Float64(Float64(Float64(M * Float64(t_1 * Float64(t_1 * M))) * 0.5) * h) / l)) tmp = 0.0 if (t_0 <= 0.0) tmp = Float64(Float64(d_m / sqrt(Float64(l * h))) * t_2); elseif (t_0 <= 5e+234) tmp = Float64(Float64(1.0 / Float64(sqrt(l) * sqrt(h))) * d_m); else tmp = Float64(Float64(sqrt(Float64(1.0 / Float64(l * h))) * d_m) * t_2); 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 = D / (d_m + d_m); t_2 = 1.0 - ((((M * (t_1 * (t_1 * M))) * 0.5) * h) / l); tmp = 0.0; if (t_0 <= 0.0) tmp = (d_m / sqrt((l * h))) * t_2; elseif (t_0 <= 5e+234) tmp = (1.0 / (sqrt(l) * sqrt(h))) * d_m; else tmp = (sqrt((1.0 / (l * h))) * d_m) * t_2; 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[(D / N[(d$95$m + d$95$m), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(1.0 - N[(N[(N[(N[(M * N[(t$95$1 * N[(t$95$1 * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 0.0], N[(N[(d$95$m / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision], If[LessEqual[t$95$0, 5e+234], N[(N[(1.0 / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * d$95$m), $MachinePrecision], N[(N[(N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * d$95$m), $MachinePrecision] * t$95$2), $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 := \frac{D}{d\_m + d\_m}\\
t_2 := 1 - \frac{\left(\left(M \cdot \left(t\_1 \cdot \left(t\_1 \cdot M\right)\right)\right) \cdot 0.5\right) \cdot h}{\ell}\\
\mathbf{if}\;t\_0 \leq 0:\\
\;\;\;\;\frac{d\_m}{\sqrt{\ell \cdot h}} \cdot t\_2\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+234}:\\
\;\;\;\;\frac{1}{\sqrt{\ell} \cdot \sqrt{h}} \cdot d\_m\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\_m\right) \cdot t\_2\\
\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)))) < -0.0Initial program 35.2%
Taylor expanded in d around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6469.0
Applied rewrites69.0%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-/l*N/A
count-2-revN/A
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
Applied rewrites72.6%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lower-sqrt.f64N/A
sqrt-divN/A
metadata-evalN/A
associate-*l/N/A
*-commutativeN/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-*.f6472.9
Applied rewrites72.9%
Taylor expanded in d around 0
Applied rewrites72.9%
if -0.0 < (*.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.0000000000000003e234Initial program 35.2%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6442.1
Applied rewrites42.1%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
sqrt-divN/A
metadata-evalN/A
*-commutativeN/A
lower-/.f64N/A
lower-sqrt.f64N/A
*-commutativeN/A
lift-*.f6442.3
Applied rewrites42.3%
lift-*.f64N/A
lift-sqrt.f64N/A
sqrt-prodN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lift-sqrt.f6424.8
Applied rewrites24.8%
if 5.0000000000000003e234 < (*.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.2%
Taylor expanded in d around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6469.0
Applied rewrites69.0%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-/l*N/A
count-2-revN/A
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
Applied rewrites72.6%
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 (/ D (+ d_m d_m)))
(t_2
(*
(/ d_m (sqrt (* l h)))
(- 1.0 (/ (* (* (* M (* t_1 (* t_1 M))) 0.5) h) l)))))
(if (<= t_0 0.0)
t_2
(if (<= t_0 5e+234) (* (/ 1.0 (* (sqrt l) (sqrt h))) d_m) t_2))))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 = D / (d_m + d_m);
double t_2 = (d_m / sqrt((l * h))) * (1.0 - ((((M * (t_1 * (t_1 * M))) * 0.5) * h) / l));
double tmp;
if (t_0 <= 0.0) {
tmp = t_2;
} else if (t_0 <= 5e+234) {
tmp = (1.0 / (sqrt(l) * sqrt(h))) * d_m;
} else {
tmp = t_2;
}
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) :: 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 = d / (d_m + d_m)
t_2 = (d_m / sqrt((l * h))) * (1.0d0 - ((((m * (t_1 * (t_1 * m))) * 0.5d0) * h) / l))
if (t_0 <= 0.0d0) then
tmp = t_2
else if (t_0 <= 5d+234) then
tmp = (1.0d0 / (sqrt(l) * sqrt(h))) * d_m
else
tmp = t_2
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 = D / (d_m + d_m);
double t_2 = (d_m / Math.sqrt((l * h))) * (1.0 - ((((M * (t_1 * (t_1 * M))) * 0.5) * h) / l));
double tmp;
if (t_0 <= 0.0) {
tmp = t_2;
} else if (t_0 <= 5e+234) {
tmp = (1.0 / (Math.sqrt(l) * Math.sqrt(h))) * d_m;
} else {
tmp = t_2;
}
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 = D / (d_m + d_m) t_2 = (d_m / math.sqrt((l * h))) * (1.0 - ((((M * (t_1 * (t_1 * M))) * 0.5) * h) / l)) tmp = 0 if t_0 <= 0.0: tmp = t_2 elif t_0 <= 5e+234: tmp = (1.0 / (math.sqrt(l) * math.sqrt(h))) * d_m else: tmp = t_2 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(D / Float64(d_m + d_m)) t_2 = Float64(Float64(d_m / sqrt(Float64(l * h))) * Float64(1.0 - Float64(Float64(Float64(Float64(M * Float64(t_1 * Float64(t_1 * M))) * 0.5) * h) / l))) tmp = 0.0 if (t_0 <= 0.0) tmp = t_2; elseif (t_0 <= 5e+234) tmp = Float64(Float64(1.0 / Float64(sqrt(l) * sqrt(h))) * d_m); else tmp = t_2; 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 = D / (d_m + d_m); t_2 = (d_m / sqrt((l * h))) * (1.0 - ((((M * (t_1 * (t_1 * M))) * 0.5) * h) / l)); tmp = 0.0; if (t_0 <= 0.0) tmp = t_2; elseif (t_0 <= 5e+234) tmp = (1.0 / (sqrt(l) * sqrt(h))) * d_m; else tmp = t_2; 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[(D / N[(d$95$m + d$95$m), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(d$95$m / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(M * N[(t$95$1 * N[(t$95$1 * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 0.0], t$95$2, If[LessEqual[t$95$0, 5e+234], N[(N[(1.0 / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * d$95$m), $MachinePrecision], t$95$2]]]]]
\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 := \frac{D}{d\_m + d\_m}\\
t_2 := \frac{d\_m}{\sqrt{\ell \cdot h}} \cdot \left(1 - \frac{\left(\left(M \cdot \left(t\_1 \cdot \left(t\_1 \cdot M\right)\right)\right) \cdot 0.5\right) \cdot h}{\ell}\right)\\
\mathbf{if}\;t\_0 \leq 0:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+234}:\\
\;\;\;\;\frac{1}{\sqrt{\ell} \cdot \sqrt{h}} \cdot d\_m\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\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)))) < -0.0 or 5.0000000000000003e234 < (*.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.2%
Taylor expanded in d around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6469.0
Applied rewrites69.0%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-/l*N/A
count-2-revN/A
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
Applied rewrites72.6%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lower-sqrt.f64N/A
sqrt-divN/A
metadata-evalN/A
associate-*l/N/A
*-commutativeN/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-*.f6472.9
Applied rewrites72.9%
Taylor expanded in d around 0
Applied rewrites72.9%
if -0.0 < (*.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.0000000000000003e234Initial program 35.2%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6442.1
Applied rewrites42.1%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
sqrt-divN/A
metadata-evalN/A
*-commutativeN/A
lower-/.f64N/A
lower-sqrt.f64N/A
*-commutativeN/A
lift-*.f6442.3
Applied rewrites42.3%
lift-*.f64N/A
lift-sqrt.f64N/A
sqrt-prodN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lift-sqrt.f6424.8
Applied rewrites24.8%
d_m = (fabs.f64 d)
(FPCore (d_m h l M D)
:precision binary64
(let* ((t_0 (/ D (+ d_m d_m)))
(t_1 (* M t_0))
(t_2 (* (pow (/ d_m h) (/ 1.0 2.0)) (pow (/ d_m l) (/ 1.0 2.0)))))
(if (<=
(*
t_2
(- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d_m)) 2.0)) (/ h l))))
5e+234)
(* t_2 (- 1.0 (/ (* (* (* t_1 t_1) 0.5) h) l)))
(*
(* (sqrt (/ 1.0 (* l h))) d_m)
(- 1.0 (/ (* (* (* M (* t_0 (* t_0 M))) 0.5) h) l))))))d_m = fabs(d);
double code(double d_m, double h, double l, double M, double D) {
double t_0 = D / (d_m + d_m);
double t_1 = M * t_0;
double t_2 = pow((d_m / h), (1.0 / 2.0)) * pow((d_m / l), (1.0 / 2.0));
double tmp;
if ((t_2 * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l)))) <= 5e+234) {
tmp = t_2 * (1.0 - ((((t_1 * t_1) * 0.5) * h) / l));
} else {
tmp = (sqrt((1.0 / (l * h))) * d_m) * (1.0 - ((((M * (t_0 * (t_0 * M))) * 0.5) * 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) :: t_2
real(8) :: tmp
t_0 = d / (d_m + d_m)
t_1 = m * t_0
t_2 = ((d_m / h) ** (1.0d0 / 2.0d0)) * ((d_m / l) ** (1.0d0 / 2.0d0))
if ((t_2 * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d) / (2.0d0 * d_m)) ** 2.0d0)) * (h / l)))) <= 5d+234) then
tmp = t_2 * (1.0d0 - ((((t_1 * t_1) * 0.5d0) * h) / l))
else
tmp = (sqrt((1.0d0 / (l * h))) * d_m) * (1.0d0 - ((((m * (t_0 * (t_0 * m))) * 0.5d0) * 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 = D / (d_m + d_m);
double t_1 = M * t_0;
double t_2 = Math.pow((d_m / h), (1.0 / 2.0)) * Math.pow((d_m / l), (1.0 / 2.0));
double tmp;
if ((t_2 * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l)))) <= 5e+234) {
tmp = t_2 * (1.0 - ((((t_1 * t_1) * 0.5) * h) / l));
} else {
tmp = (Math.sqrt((1.0 / (l * h))) * d_m) * (1.0 - ((((M * (t_0 * (t_0 * M))) * 0.5) * h) / l));
}
return tmp;
}
d_m = math.fabs(d) def code(d_m, h, l, M, D): t_0 = D / (d_m + d_m) t_1 = M * t_0 t_2 = math.pow((d_m / h), (1.0 / 2.0)) * math.pow((d_m / l), (1.0 / 2.0)) tmp = 0 if (t_2 * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l)))) <= 5e+234: tmp = t_2 * (1.0 - ((((t_1 * t_1) * 0.5) * h) / l)) else: tmp = (math.sqrt((1.0 / (l * h))) * d_m) * (1.0 - ((((M * (t_0 * (t_0 * M))) * 0.5) * h) / l)) return tmp
d_m = abs(d) function code(d_m, h, l, M, D) t_0 = Float64(D / Float64(d_m + d_m)) t_1 = Float64(M * t_0) t_2 = Float64((Float64(d_m / h) ^ Float64(1.0 / 2.0)) * (Float64(d_m / l) ^ Float64(1.0 / 2.0))) tmp = 0.0 if (Float64(t_2 * 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+234) tmp = Float64(t_2 * Float64(1.0 - Float64(Float64(Float64(Float64(t_1 * t_1) * 0.5) * h) / l))); else tmp = Float64(Float64(sqrt(Float64(1.0 / Float64(l * h))) * d_m) * Float64(1.0 - Float64(Float64(Float64(Float64(M * Float64(t_0 * Float64(t_0 * M))) * 0.5) * h) / l))); end return tmp end
d_m = abs(d); function tmp_2 = code(d_m, h, l, M, D) t_0 = D / (d_m + d_m); t_1 = M * t_0; t_2 = ((d_m / h) ^ (1.0 / 2.0)) * ((d_m / l) ^ (1.0 / 2.0)); tmp = 0.0; if ((t_2 * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d_m)) ^ 2.0)) * (h / l)))) <= 5e+234) tmp = t_2 * (1.0 - ((((t_1 * t_1) * 0.5) * h) / l)); else tmp = (sqrt((1.0 / (l * h))) * d_m) * (1.0 - ((((M * (t_0 * (t_0 * M))) * 0.5) * 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[(D / N[(d$95$m + d$95$m), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(M * t$95$0), $MachinePrecision]}, Block[{t$95$2 = 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]}, If[LessEqual[N[(t$95$2 * 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+234], N[(t$95$2 * N[(1.0 - N[(N[(N[(N[(t$95$1 * t$95$1), $MachinePrecision] * 0.5), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * d$95$m), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(M * N[(t$95$0 * N[(t$95$0 * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
d_m = \left|d\right|
\\
\begin{array}{l}
t_0 := \frac{D}{d\_m + d\_m}\\
t_1 := M \cdot t\_0\\
t_2 := {\left(\frac{d\_m}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d\_m}{\ell}\right)}^{\left(\frac{1}{2}\right)}\\
\mathbf{if}\;t\_2 \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^{+234}:\\
\;\;\;\;t\_2 \cdot \left(1 - \frac{\left(\left(t\_1 \cdot t\_1\right) \cdot 0.5\right) \cdot h}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\_m\right) \cdot \left(1 - \frac{\left(\left(M \cdot \left(t\_0 \cdot \left(t\_0 \cdot M\right)\right)\right) \cdot 0.5\right) \cdot 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)))) < 5.0000000000000003e234Initial program 35.2%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites36.0%
if 5.0000000000000003e234 < (*.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.2%
Taylor expanded in d around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6469.0
Applied rewrites69.0%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-/l*N/A
count-2-revN/A
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
Applied rewrites72.6%
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
(*
(-
1.0
(*
(* (* (* (/ (* D M) (+ d_m d_m)) (/ D (+ d_m d_m))) M) 0.5)
(/ h l)))
(/ d_m (sqrt (* l h))))))
(if (<= t_0 0.0)
t_1
(if (<= t_0 5e+234) (* (/ 1.0 (* (sqrt l) (sqrt h))) d_m) t_1))))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 = (1.0 - ((((((D * M) / (d_m + d_m)) * (D / (d_m + d_m))) * M) * 0.5) * (h / l))) * (d_m / sqrt((l * h)));
double tmp;
if (t_0 <= 0.0) {
tmp = t_1;
} else if (t_0 <= 5e+234) {
tmp = (1.0 / (sqrt(l) * sqrt(h))) * d_m;
} 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 = (((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 = (1.0d0 - ((((((d * m) / (d_m + d_m)) * (d / (d_m + d_m))) * m) * 0.5d0) * (h / l))) * (d_m / sqrt((l * h)))
if (t_0 <= 0.0d0) then
tmp = t_1
else if (t_0 <= 5d+234) then
tmp = (1.0d0 / (sqrt(l) * sqrt(h))) * d_m
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.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 = (1.0 - ((((((D * M) / (d_m + d_m)) * (D / (d_m + d_m))) * M) * 0.5) * (h / l))) * (d_m / Math.sqrt((l * h)));
double tmp;
if (t_0 <= 0.0) {
tmp = t_1;
} else if (t_0 <= 5e+234) {
tmp = (1.0 / (Math.sqrt(l) * Math.sqrt(h))) * d_m;
} else {
tmp = t_1;
}
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 = (1.0 - ((((((D * M) / (d_m + d_m)) * (D / (d_m + d_m))) * M) * 0.5) * (h / l))) * (d_m / math.sqrt((l * h))) tmp = 0 if t_0 <= 0.0: tmp = t_1 elif t_0 <= 5e+234: tmp = (1.0 / (math.sqrt(l) * math.sqrt(h))) * d_m else: tmp = t_1 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(Float64(1.0 - Float64(Float64(Float64(Float64(Float64(Float64(D * M) / Float64(d_m + d_m)) * Float64(D / Float64(d_m + d_m))) * M) * 0.5) * Float64(h / l))) * Float64(d_m / sqrt(Float64(l * h)))) tmp = 0.0 if (t_0 <= 0.0) tmp = t_1; elseif (t_0 <= 5e+234) tmp = Float64(Float64(1.0 / Float64(sqrt(l) * sqrt(h))) * d_m); else tmp = t_1; 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 = (1.0 - ((((((D * M) / (d_m + d_m)) * (D / (d_m + d_m))) * M) * 0.5) * (h / l))) * (d_m / sqrt((l * h))); tmp = 0.0; if (t_0 <= 0.0) tmp = t_1; elseif (t_0 <= 5e+234) tmp = (1.0 / (sqrt(l) * sqrt(h))) * d_m; 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[(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[(N[(1.0 - N[(N[(N[(N[(N[(N[(D * M), $MachinePrecision] / N[(d$95$m + d$95$m), $MachinePrecision]), $MachinePrecision] * N[(D / N[(d$95$m + d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * M), $MachinePrecision] * 0.5), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d$95$m / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 0.0], t$95$1, If[LessEqual[t$95$0, 5e+234], N[(N[(1.0 / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * d$95$m), $MachinePrecision], t$95$1]]]]
\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 := \left(1 - \left(\left(\left(\frac{D \cdot M}{d\_m + d\_m} \cdot \frac{D}{d\_m + d\_m}\right) \cdot M\right) \cdot 0.5\right) \cdot \frac{h}{\ell}\right) \cdot \frac{d\_m}{\sqrt{\ell \cdot h}}\\
\mathbf{if}\;t\_0 \leq 0:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+234}:\\
\;\;\;\;\frac{1}{\sqrt{\ell} \cdot \sqrt{h}} \cdot d\_m\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\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)))) < -0.0 or 5.0000000000000003e234 < (*.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.2%
Taylor expanded in d around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6469.0
Applied rewrites69.0%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-/l*N/A
count-2-revN/A
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
Applied rewrites72.6%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lower-sqrt.f64N/A
sqrt-divN/A
metadata-evalN/A
associate-*l/N/A
*-commutativeN/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-*.f6472.9
Applied rewrites72.9%
Applied rewrites67.4%
if -0.0 < (*.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.0000000000000003e234Initial program 35.2%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6442.1
Applied rewrites42.1%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
sqrt-divN/A
metadata-evalN/A
*-commutativeN/A
lower-/.f64N/A
lower-sqrt.f64N/A
*-commutativeN/A
lift-*.f6442.3
Applied rewrites42.3%
lift-*.f64N/A
lift-sqrt.f64N/A
sqrt-prodN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lift-sqrt.f6424.8
Applied rewrites24.8%
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 0.0)
(* (* -0.125 (* (* (* D D) M) (/ M d_m))) (sqrt (/ h (* (* l l) l))))
(if (<= t_0 INFINITY)
(* (/ 1.0 (* (sqrt l) (sqrt h))) d_m)
(*
(* (sqrt (/ 1.0 (* l h))) d_m)
(*
(fma (/ (* (* (* M M) D) D) (* (* d_m d_m) l)) -0.125 (/ 1.0 h))
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 <= 0.0) {
tmp = (-0.125 * (((D * D) * M) * (M / d_m))) * sqrt((h / ((l * l) * l)));
} else if (t_0 <= ((double) INFINITY)) {
tmp = (1.0 / (sqrt(l) * sqrt(h))) * d_m;
} else {
tmp = (sqrt((1.0 / (l * h))) * d_m) * (fma(((((M * M) * D) * D) / ((d_m * d_m) * l)), -0.125, (1.0 / h)) * 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 <= 0.0) tmp = Float64(Float64(-0.125 * Float64(Float64(Float64(D * D) * M) * Float64(M / d_m))) * sqrt(Float64(h / Float64(Float64(l * l) * l)))); elseif (t_0 <= Inf) tmp = Float64(Float64(1.0 / Float64(sqrt(l) * sqrt(h))) * d_m); else tmp = Float64(Float64(sqrt(Float64(1.0 / Float64(l * h))) * d_m) * Float64(fma(Float64(Float64(Float64(Float64(M * M) * D) * D) / Float64(Float64(d_m * d_m) * l)), -0.125, Float64(1.0 / h)) * h)); end return 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, 0.0], N[(N[(-0.125 * N[(N[(N[(D * D), $MachinePrecision] * M), $MachinePrecision] * N[(M / d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(h / N[(N[(l * l), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(N[(1.0 / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * d$95$m), $MachinePrecision], N[(N[(N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * d$95$m), $MachinePrecision] * N[(N[(N[(N[(N[(N[(M * M), $MachinePrecision] * D), $MachinePrecision] * D), $MachinePrecision] / N[(N[(d$95$m * d$95$m), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] * -0.125 + N[(1.0 / h), $MachinePrecision]), $MachinePrecision] * h), $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 0:\\
\;\;\;\;\left(-0.125 \cdot \left(\left(\left(D \cdot D\right) \cdot M\right) \cdot \frac{M}{d\_m}\right)\right) \cdot \sqrt{\frac{h}{\left(\ell \cdot \ell\right) \cdot \ell}}\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;\frac{1}{\sqrt{\ell} \cdot \sqrt{h}} \cdot d\_m\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\_m\right) \cdot \left(\mathsf{fma}\left(\frac{\left(\left(M \cdot M\right) \cdot D\right) \cdot D}{\left(d\_m \cdot d\_m\right) \cdot \ell}, -0.125, \frac{1}{h}\right) \cdot h\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)))) < -0.0Initial program 35.2%
Taylor expanded in d around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6469.0
Applied rewrites69.0%
Taylor expanded in d around 0
unpow-prod-downN/A
metadata-evalN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f64N/A
pow3N/A
Applied rewrites27.6%
lift-*.f64N/A
lift-/.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6429.0
Applied rewrites29.0%
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
lift-/.f64N/A
lower-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lift-/.f6430.0
Applied rewrites30.0%
if -0.0 < (*.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)))) < +inf.0Initial program 35.2%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6442.1
Applied rewrites42.1%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
sqrt-divN/A
metadata-evalN/A
*-commutativeN/A
lower-/.f64N/A
lower-sqrt.f64N/A
*-commutativeN/A
lift-*.f6442.3
Applied rewrites42.3%
lift-*.f64N/A
lift-sqrt.f64N/A
sqrt-prodN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lift-sqrt.f6424.8
Applied rewrites24.8%
if +inf.0 < (*.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.2%
Taylor expanded in d around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6469.0
Applied rewrites69.0%
Taylor expanded in h around inf
*-commutativeN/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
lower-*.f64N/A
Applied rewrites54.6%
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 0.0)
(* (* -0.125 (* (* (* D D) M) (/ M d_m))) (sqrt (/ h (* (* l l) l))))
(if (<= t_0 INFINITY)
(* (/ 1.0 (* (sqrt l) (sqrt h))) d_m)
(*
(* (sqrt (/ 1.0 (* l h))) d_m)
(/ (- l (* (/ (* (* (* M M) h) (* D D)) (* d_m d_m)) 0.125)) 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 tmp;
if (t_0 <= 0.0) {
tmp = (-0.125 * (((D * D) * M) * (M / d_m))) * sqrt((h / ((l * l) * l)));
} else if (t_0 <= ((double) INFINITY)) {
tmp = (1.0 / (sqrt(l) * sqrt(h))) * d_m;
} else {
tmp = (sqrt((1.0 / (l * h))) * d_m) * ((l - (((((M * M) * h) * (D * D)) / (d_m * d_m)) * 0.125)) / l);
}
return tmp;
}
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 <= 0.0) {
tmp = (-0.125 * (((D * D) * M) * (M / d_m))) * Math.sqrt((h / ((l * l) * l)));
} else if (t_0 <= Double.POSITIVE_INFINITY) {
tmp = (1.0 / (Math.sqrt(l) * Math.sqrt(h))) * d_m;
} else {
tmp = (Math.sqrt((1.0 / (l * h))) * d_m) * ((l - (((((M * M) * h) * (D * D)) / (d_m * d_m)) * 0.125)) / 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))) tmp = 0 if t_0 <= 0.0: tmp = (-0.125 * (((D * D) * M) * (M / d_m))) * math.sqrt((h / ((l * l) * l))) elif t_0 <= math.inf: tmp = (1.0 / (math.sqrt(l) * math.sqrt(h))) * d_m else: tmp = (math.sqrt((1.0 / (l * h))) * d_m) * ((l - (((((M * M) * h) * (D * D)) / (d_m * d_m)) * 0.125)) / 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)))) tmp = 0.0 if (t_0 <= 0.0) tmp = Float64(Float64(-0.125 * Float64(Float64(Float64(D * D) * M) * Float64(M / d_m))) * sqrt(Float64(h / Float64(Float64(l * l) * l)))); elseif (t_0 <= Inf) tmp = Float64(Float64(1.0 / Float64(sqrt(l) * sqrt(h))) * d_m); else tmp = Float64(Float64(sqrt(Float64(1.0 / Float64(l * h))) * d_m) * Float64(Float64(l - Float64(Float64(Float64(Float64(Float64(M * M) * h) * Float64(D * D)) / Float64(d_m * d_m)) * 0.125)) / 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))); tmp = 0.0; if (t_0 <= 0.0) tmp = (-0.125 * (((D * D) * M) * (M / d_m))) * sqrt((h / ((l * l) * l))); elseif (t_0 <= Inf) tmp = (1.0 / (sqrt(l) * sqrt(h))) * d_m; else tmp = (sqrt((1.0 / (l * h))) * d_m) * ((l - (((((M * M) * h) * (D * D)) / (d_m * d_m)) * 0.125)) / 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]}, If[LessEqual[t$95$0, 0.0], N[(N[(-0.125 * N[(N[(N[(D * D), $MachinePrecision] * M), $MachinePrecision] * N[(M / d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(h / N[(N[(l * l), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(N[(1.0 / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * d$95$m), $MachinePrecision], N[(N[(N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * d$95$m), $MachinePrecision] * N[(N[(l - N[(N[(N[(N[(N[(M * M), $MachinePrecision] * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision] / N[(d$95$m * d$95$m), $MachinePrecision]), $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision] / l), $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 0:\\
\;\;\;\;\left(-0.125 \cdot \left(\left(\left(D \cdot D\right) \cdot M\right) \cdot \frac{M}{d\_m}\right)\right) \cdot \sqrt{\frac{h}{\left(\ell \cdot \ell\right) \cdot \ell}}\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;\frac{1}{\sqrt{\ell} \cdot \sqrt{h}} \cdot d\_m\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\_m\right) \cdot \frac{\ell - \frac{\left(\left(M \cdot M\right) \cdot h\right) \cdot \left(D \cdot D\right)}{d\_m \cdot d\_m} \cdot 0.125}{\ell}\\
\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)))) < -0.0Initial program 35.2%
Taylor expanded in d around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6469.0
Applied rewrites69.0%
Taylor expanded in d around 0
unpow-prod-downN/A
metadata-evalN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f64N/A
pow3N/A
Applied rewrites27.6%
lift-*.f64N/A
lift-/.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6429.0
Applied rewrites29.0%
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
lift-/.f64N/A
lower-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lift-/.f6430.0
Applied rewrites30.0%
if -0.0 < (*.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)))) < +inf.0Initial program 35.2%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6442.1
Applied rewrites42.1%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
sqrt-divN/A
metadata-evalN/A
*-commutativeN/A
lower-/.f64N/A
lower-sqrt.f64N/A
*-commutativeN/A
lift-*.f6442.3
Applied rewrites42.3%
lift-*.f64N/A
lift-sqrt.f64N/A
sqrt-prodN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lift-sqrt.f6424.8
Applied rewrites24.8%
if +inf.0 < (*.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.2%
Taylor expanded in d around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6469.0
Applied rewrites69.0%
Taylor expanded in l around 0
lower-/.f64N/A
Applied rewrites49.8%
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 0.0)
(* (* -0.125 (* (* (* D D) M) (/ M d_m))) (sqrt (/ h (* (* l l) l))))
(if (<= t_0 INFINITY)
(* (/ 1.0 (* (sqrt l) (sqrt h))) d_m)
(*
(* (sqrt (/ 1.0 (* l h))) d_m)
(- 1.0 (/ (* (* (/ (* (* M M) (* D D)) (* d_m d_m)) 0.125) 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 tmp;
if (t_0 <= 0.0) {
tmp = (-0.125 * (((D * D) * M) * (M / d_m))) * sqrt((h / ((l * l) * l)));
} else if (t_0 <= ((double) INFINITY)) {
tmp = (1.0 / (sqrt(l) * sqrt(h))) * d_m;
} else {
tmp = (sqrt((1.0 / (l * h))) * d_m) * (1.0 - ((((((M * M) * (D * D)) / (d_m * d_m)) * 0.125) * h) / l));
}
return tmp;
}
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 <= 0.0) {
tmp = (-0.125 * (((D * D) * M) * (M / d_m))) * Math.sqrt((h / ((l * l) * l)));
} else if (t_0 <= Double.POSITIVE_INFINITY) {
tmp = (1.0 / (Math.sqrt(l) * Math.sqrt(h))) * d_m;
} else {
tmp = (Math.sqrt((1.0 / (l * h))) * d_m) * (1.0 - ((((((M * M) * (D * D)) / (d_m * d_m)) * 0.125) * 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))) tmp = 0 if t_0 <= 0.0: tmp = (-0.125 * (((D * D) * M) * (M / d_m))) * math.sqrt((h / ((l * l) * l))) elif t_0 <= math.inf: tmp = (1.0 / (math.sqrt(l) * math.sqrt(h))) * d_m else: tmp = (math.sqrt((1.0 / (l * h))) * d_m) * (1.0 - ((((((M * M) * (D * D)) / (d_m * d_m)) * 0.125) * 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)))) tmp = 0.0 if (t_0 <= 0.0) tmp = Float64(Float64(-0.125 * Float64(Float64(Float64(D * D) * M) * Float64(M / d_m))) * sqrt(Float64(h / Float64(Float64(l * l) * l)))); elseif (t_0 <= Inf) tmp = Float64(Float64(1.0 / Float64(sqrt(l) * sqrt(h))) * d_m); else tmp = Float64(Float64(sqrt(Float64(1.0 / Float64(l * h))) * d_m) * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(Float64(M * M) * Float64(D * D)) / Float64(d_m * d_m)) * 0.125) * 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))); tmp = 0.0; if (t_0 <= 0.0) tmp = (-0.125 * (((D * D) * M) * (M / d_m))) * sqrt((h / ((l * l) * l))); elseif (t_0 <= Inf) tmp = (1.0 / (sqrt(l) * sqrt(h))) * d_m; else tmp = (sqrt((1.0 / (l * h))) * d_m) * (1.0 - ((((((M * M) * (D * D)) / (d_m * d_m)) * 0.125) * 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]}, If[LessEqual[t$95$0, 0.0], N[(N[(-0.125 * N[(N[(N[(D * D), $MachinePrecision] * M), $MachinePrecision] * N[(M / d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(h / N[(N[(l * l), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(N[(1.0 / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * d$95$m), $MachinePrecision], N[(N[(N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * d$95$m), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(N[(N[(M * M), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision] / N[(d$95$m * d$95$m), $MachinePrecision]), $MachinePrecision] * 0.125), $MachinePrecision] * h), $MachinePrecision] / l), $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 0:\\
\;\;\;\;\left(-0.125 \cdot \left(\left(\left(D \cdot D\right) \cdot M\right) \cdot \frac{M}{d\_m}\right)\right) \cdot \sqrt{\frac{h}{\left(\ell \cdot \ell\right) \cdot \ell}}\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;\frac{1}{\sqrt{\ell} \cdot \sqrt{h}} \cdot d\_m\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\_m\right) \cdot \left(1 - \frac{\left(\frac{\left(M \cdot M\right) \cdot \left(D \cdot D\right)}{d\_m \cdot d\_m} \cdot 0.125\right) \cdot 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)))) < -0.0Initial program 35.2%
Taylor expanded in d around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6469.0
Applied rewrites69.0%
Taylor expanded in d around 0
unpow-prod-downN/A
metadata-evalN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f64N/A
pow3N/A
Applied rewrites27.6%
lift-*.f64N/A
lift-/.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6429.0
Applied rewrites29.0%
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
lift-/.f64N/A
lower-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lift-/.f6430.0
Applied rewrites30.0%
if -0.0 < (*.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)))) < +inf.0Initial program 35.2%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6442.1
Applied rewrites42.1%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
sqrt-divN/A
metadata-evalN/A
*-commutativeN/A
lower-/.f64N/A
lower-sqrt.f64N/A
*-commutativeN/A
lift-*.f6442.3
Applied rewrites42.3%
lift-*.f64N/A
lift-sqrt.f64N/A
sqrt-prodN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lift-sqrt.f6424.8
Applied rewrites24.8%
if +inf.0 < (*.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.2%
Taylor expanded in d around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6469.0
Applied rewrites69.0%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-/l*N/A
count-2-revN/A
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
Applied rewrites72.6%
Taylor expanded in d around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6450.7
Applied rewrites50.7%
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 0.0)
(* (* -0.125 (* (* (* D D) M) (/ M d_m))) (sqrt (/ h (* (* l l) l))))
(if (<= t_0 INFINITY)
(* (/ 1.0 (* (sqrt l) (sqrt h))) d_m)
(*
(* (sqrt (/ 1.0 (* l h))) d_m)
(- 1.0 (* (* (/ (* (* (* M M) D) D) (* d_m d_m)) 0.125) (/ 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 tmp;
if (t_0 <= 0.0) {
tmp = (-0.125 * (((D * D) * M) * (M / d_m))) * sqrt((h / ((l * l) * l)));
} else if (t_0 <= ((double) INFINITY)) {
tmp = (1.0 / (sqrt(l) * sqrt(h))) * d_m;
} else {
tmp = (sqrt((1.0 / (l * h))) * d_m) * (1.0 - ((((((M * M) * D) * D) / (d_m * d_m)) * 0.125) * (h / l)));
}
return tmp;
}
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 <= 0.0) {
tmp = (-0.125 * (((D * D) * M) * (M / d_m))) * Math.sqrt((h / ((l * l) * l)));
} else if (t_0 <= Double.POSITIVE_INFINITY) {
tmp = (1.0 / (Math.sqrt(l) * Math.sqrt(h))) * d_m;
} else {
tmp = (Math.sqrt((1.0 / (l * h))) * d_m) * (1.0 - ((((((M * M) * D) * D) / (d_m * d_m)) * 0.125) * (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))) tmp = 0 if t_0 <= 0.0: tmp = (-0.125 * (((D * D) * M) * (M / d_m))) * math.sqrt((h / ((l * l) * l))) elif t_0 <= math.inf: tmp = (1.0 / (math.sqrt(l) * math.sqrt(h))) * d_m else: tmp = (math.sqrt((1.0 / (l * h))) * d_m) * (1.0 - ((((((M * M) * D) * D) / (d_m * d_m)) * 0.125) * (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)))) tmp = 0.0 if (t_0 <= 0.0) tmp = Float64(Float64(-0.125 * Float64(Float64(Float64(D * D) * M) * Float64(M / d_m))) * sqrt(Float64(h / Float64(Float64(l * l) * l)))); elseif (t_0 <= Inf) tmp = Float64(Float64(1.0 / Float64(sqrt(l) * sqrt(h))) * d_m); else tmp = Float64(Float64(sqrt(Float64(1.0 / Float64(l * h))) * d_m) * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(Float64(M * M) * D) * D) / Float64(d_m * d_m)) * 0.125) * 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))); tmp = 0.0; if (t_0 <= 0.0) tmp = (-0.125 * (((D * D) * M) * (M / d_m))) * sqrt((h / ((l * l) * l))); elseif (t_0 <= Inf) tmp = (1.0 / (sqrt(l) * sqrt(h))) * d_m; else tmp = (sqrt((1.0 / (l * h))) * d_m) * (1.0 - ((((((M * M) * D) * D) / (d_m * d_m)) * 0.125) * (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]}, If[LessEqual[t$95$0, 0.0], N[(N[(-0.125 * N[(N[(N[(D * D), $MachinePrecision] * M), $MachinePrecision] * N[(M / d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(h / N[(N[(l * l), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(N[(1.0 / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * d$95$m), $MachinePrecision], N[(N[(N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * d$95$m), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(N[(N[(M * M), $MachinePrecision] * D), $MachinePrecision] * D), $MachinePrecision] / N[(d$95$m * d$95$m), $MachinePrecision]), $MachinePrecision] * 0.125), $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)\\
\mathbf{if}\;t\_0 \leq 0:\\
\;\;\;\;\left(-0.125 \cdot \left(\left(\left(D \cdot D\right) \cdot M\right) \cdot \frac{M}{d\_m}\right)\right) \cdot \sqrt{\frac{h}{\left(\ell \cdot \ell\right) \cdot \ell}}\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;\frac{1}{\sqrt{\ell} \cdot \sqrt{h}} \cdot d\_m\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\_m\right) \cdot \left(1 - \left(\frac{\left(\left(M \cdot M\right) \cdot D\right) \cdot D}{d\_m \cdot d\_m} \cdot 0.125\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)))) < -0.0Initial program 35.2%
Taylor expanded in d around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6469.0
Applied rewrites69.0%
Taylor expanded in d around 0
unpow-prod-downN/A
metadata-evalN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f64N/A
pow3N/A
Applied rewrites27.6%
lift-*.f64N/A
lift-/.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6429.0
Applied rewrites29.0%
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
lift-/.f64N/A
lower-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lift-/.f6430.0
Applied rewrites30.0%
if -0.0 < (*.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)))) < +inf.0Initial program 35.2%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6442.1
Applied rewrites42.1%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
sqrt-divN/A
metadata-evalN/A
*-commutativeN/A
lower-/.f64N/A
lower-sqrt.f64N/A
*-commutativeN/A
lift-*.f6442.3
Applied rewrites42.3%
lift-*.f64N/A
lift-sqrt.f64N/A
sqrt-prodN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lift-sqrt.f6424.8
Applied rewrites24.8%
if +inf.0 < (*.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.2%
Taylor expanded in d around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6469.0
Applied rewrites69.0%
Taylor expanded in d around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
pow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6451.1
Applied rewrites51.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 0.0)
(* (* -0.125 (* (* (* D D) M) (/ M d_m))) (sqrt (/ h (* (* l l) l))))
(if (<= t_0 5e+234)
(* (/ 1.0 (* (sqrt l) (sqrt h))) d_m)
(* (sqrt (/ (/ 1.0 l) h)) d_m)))))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 <= 0.0) {
tmp = (-0.125 * (((D * D) * M) * (M / d_m))) * sqrt((h / ((l * l) * l)));
} else if (t_0 <= 5e+234) {
tmp = (1.0 / (sqrt(l) * sqrt(h))) * d_m;
} else {
tmp = sqrt(((1.0 / 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) :: 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 <= 0.0d0) then
tmp = ((-0.125d0) * (((d * d) * m) * (m / d_m))) * sqrt((h / ((l * l) * l)))
else if (t_0 <= 5d+234) then
tmp = (1.0d0 / (sqrt(l) * sqrt(h))) * d_m
else
tmp = sqrt(((1.0d0 / 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 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 <= 0.0) {
tmp = (-0.125 * (((D * D) * M) * (M / d_m))) * Math.sqrt((h / ((l * l) * l)));
} else if (t_0 <= 5e+234) {
tmp = (1.0 / (Math.sqrt(l) * Math.sqrt(h))) * d_m;
} else {
tmp = Math.sqrt(((1.0 / l) / h)) * d_m;
}
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 <= 0.0: tmp = (-0.125 * (((D * D) * M) * (M / d_m))) * math.sqrt((h / ((l * l) * l))) elif t_0 <= 5e+234: tmp = (1.0 / (math.sqrt(l) * math.sqrt(h))) * d_m else: tmp = math.sqrt(((1.0 / l) / h)) * d_m 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 <= 0.0) tmp = Float64(Float64(-0.125 * Float64(Float64(Float64(D * D) * M) * Float64(M / d_m))) * sqrt(Float64(h / Float64(Float64(l * l) * l)))); elseif (t_0 <= 5e+234) tmp = Float64(Float64(1.0 / Float64(sqrt(l) * sqrt(h))) * d_m); else tmp = Float64(sqrt(Float64(Float64(1.0 / l) / h)) * d_m); 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 <= 0.0) tmp = (-0.125 * (((D * D) * M) * (M / d_m))) * sqrt((h / ((l * l) * l))); elseif (t_0 <= 5e+234) tmp = (1.0 / (sqrt(l) * sqrt(h))) * d_m; else tmp = sqrt(((1.0 / l) / 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[(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, 0.0], N[(N[(-0.125 * N[(N[(N[(D * D), $MachinePrecision] * M), $MachinePrecision] * N[(M / d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(h / N[(N[(l * l), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+234], N[(N[(1.0 / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * d$95$m), $MachinePrecision], N[(N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision] * d$95$m), $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 0:\\
\;\;\;\;\left(-0.125 \cdot \left(\left(\left(D \cdot D\right) \cdot M\right) \cdot \frac{M}{d\_m}\right)\right) \cdot \sqrt{\frac{h}{\left(\ell \cdot \ell\right) \cdot \ell}}\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+234}:\\
\;\;\;\;\frac{1}{\sqrt{\ell} \cdot \sqrt{h}} \cdot d\_m\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot d\_m\\
\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)))) < -0.0Initial program 35.2%
Taylor expanded in d around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6469.0
Applied rewrites69.0%
Taylor expanded in d around 0
unpow-prod-downN/A
metadata-evalN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f64N/A
pow3N/A
Applied rewrites27.6%
lift-*.f64N/A
lift-/.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6429.0
Applied rewrites29.0%
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
lift-/.f64N/A
lower-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lift-/.f6430.0
Applied rewrites30.0%
if -0.0 < (*.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.0000000000000003e234Initial program 35.2%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6442.1
Applied rewrites42.1%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
sqrt-divN/A
metadata-evalN/A
*-commutativeN/A
lower-/.f64N/A
lower-sqrt.f64N/A
*-commutativeN/A
lift-*.f6442.3
Applied rewrites42.3%
lift-*.f64N/A
lift-sqrt.f64N/A
sqrt-prodN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lift-sqrt.f6424.8
Applied rewrites24.8%
if 5.0000000000000003e234 < (*.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.2%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6442.1
Applied rewrites42.1%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6442.4
Applied rewrites42.4%
d_m = (fabs.f64 d) (FPCore (d_m h l M D) :precision binary64 (if (<= M 2.05e-69) (* (sqrt (/ (/ 1.0 l) h)) d_m) (/ (* (* (sqrt (/ h (* (* l l) l))) (* (* (* M M) D) D)) -0.125) d_m)))
d_m = fabs(d);
double code(double d_m, double h, double l, double M, double D) {
double tmp;
if (M <= 2.05e-69) {
tmp = sqrt(((1.0 / l) / h)) * d_m;
} else {
tmp = ((sqrt((h / ((l * l) * l))) * (((M * M) * D) * D)) * -0.125) / 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 (m <= 2.05d-69) then
tmp = sqrt(((1.0d0 / l) / h)) * d_m
else
tmp = ((sqrt((h / ((l * l) * l))) * (((m * m) * d) * d)) * (-0.125d0)) / 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 (M <= 2.05e-69) {
tmp = Math.sqrt(((1.0 / l) / h)) * d_m;
} else {
tmp = ((Math.sqrt((h / ((l * l) * l))) * (((M * M) * D) * D)) * -0.125) / d_m;
}
return tmp;
}
d_m = math.fabs(d) def code(d_m, h, l, M, D): tmp = 0 if M <= 2.05e-69: tmp = math.sqrt(((1.0 / l) / h)) * d_m else: tmp = ((math.sqrt((h / ((l * l) * l))) * (((M * M) * D) * D)) * -0.125) / d_m return tmp
d_m = abs(d) function code(d_m, h, l, M, D) tmp = 0.0 if (M <= 2.05e-69) tmp = Float64(sqrt(Float64(Float64(1.0 / l) / h)) * d_m); else tmp = Float64(Float64(Float64(sqrt(Float64(h / Float64(Float64(l * l) * l))) * Float64(Float64(Float64(M * M) * D) * D)) * -0.125) / d_m); end return tmp end
d_m = abs(d); function tmp_2 = code(d_m, h, l, M, D) tmp = 0.0; if (M <= 2.05e-69) tmp = sqrt(((1.0 / l) / h)) * d_m; else tmp = ((sqrt((h / ((l * l) * l))) * (((M * M) * D) * D)) * -0.125) / d_m; end tmp_2 = tmp; end
d_m = N[Abs[d], $MachinePrecision] code[d$95$m_, h_, l_, M_, D_] := If[LessEqual[M, 2.05e-69], N[(N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision] * d$95$m), $MachinePrecision], N[(N[(N[(N[Sqrt[N[(h / N[(N[(l * l), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(N[(M * M), $MachinePrecision] * D), $MachinePrecision] * D), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision] / d$95$m), $MachinePrecision]]
\begin{array}{l}
d_m = \left|d\right|
\\
\begin{array}{l}
\mathbf{if}\;M \leq 2.05 \cdot 10^{-69}:\\
\;\;\;\;\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot d\_m\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(\sqrt{\frac{h}{\left(\ell \cdot \ell\right) \cdot \ell}} \cdot \left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right)\right) \cdot -0.125}{d\_m}\\
\end{array}
\end{array}
if M < 2.04999999999999995e-69Initial program 35.2%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6442.1
Applied rewrites42.1%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6442.4
Applied rewrites42.4%
if 2.04999999999999995e-69 < M Initial program 35.2%
Taylor expanded in d around 0
lower-/.f64N/A
Applied rewrites31.4%
Taylor expanded in d around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites29.9%
d_m = (fabs.f64 d) (FPCore (d_m h l M D) :precision binary64 (if (<= M 2.6e-58) (* (sqrt (/ (/ 1.0 l) h)) d_m) (* (* -0.125 (* (* D D) (/ (* M M) d_m))) (sqrt (/ h (* (* l l) l))))))
d_m = fabs(d);
double code(double d_m, double h, double l, double M, double D) {
double tmp;
if (M <= 2.6e-58) {
tmp = sqrt(((1.0 / l) / h)) * d_m;
} else {
tmp = (-0.125 * ((D * D) * ((M * M) / d_m))) * sqrt((h / ((l * l) * 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) :: tmp
if (m <= 2.6d-58) then
tmp = sqrt(((1.0d0 / l) / h)) * d_m
else
tmp = ((-0.125d0) * ((d * d) * ((m * m) / d_m))) * sqrt((h / ((l * l) * 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 tmp;
if (M <= 2.6e-58) {
tmp = Math.sqrt(((1.0 / l) / h)) * d_m;
} else {
tmp = (-0.125 * ((D * D) * ((M * M) / d_m))) * Math.sqrt((h / ((l * l) * l)));
}
return tmp;
}
d_m = math.fabs(d) def code(d_m, h, l, M, D): tmp = 0 if M <= 2.6e-58: tmp = math.sqrt(((1.0 / l) / h)) * d_m else: tmp = (-0.125 * ((D * D) * ((M * M) / d_m))) * math.sqrt((h / ((l * l) * l))) return tmp
d_m = abs(d) function code(d_m, h, l, M, D) tmp = 0.0 if (M <= 2.6e-58) tmp = Float64(sqrt(Float64(Float64(1.0 / l) / h)) * d_m); else tmp = Float64(Float64(-0.125 * Float64(Float64(D * D) * Float64(Float64(M * M) / d_m))) * sqrt(Float64(h / Float64(Float64(l * l) * l)))); 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-58) tmp = sqrt(((1.0 / l) / h)) * d_m; else tmp = (-0.125 * ((D * D) * ((M * M) / d_m))) * sqrt((h / ((l * l) * l))); end tmp_2 = tmp; end
d_m = N[Abs[d], $MachinePrecision] code[d$95$m_, h_, l_, M_, D_] := If[LessEqual[M, 2.6e-58], N[(N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision] * d$95$m), $MachinePrecision], N[(N[(-0.125 * N[(N[(D * D), $MachinePrecision] * N[(N[(M * M), $MachinePrecision] / d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(h / N[(N[(l * l), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
d_m = \left|d\right|
\\
\begin{array}{l}
\mathbf{if}\;M \leq 2.6 \cdot 10^{-58}:\\
\;\;\;\;\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot d\_m\\
\mathbf{else}:\\
\;\;\;\;\left(-0.125 \cdot \left(\left(D \cdot D\right) \cdot \frac{M \cdot M}{d\_m}\right)\right) \cdot \sqrt{\frac{h}{\left(\ell \cdot \ell\right) \cdot \ell}}\\
\end{array}
\end{array}
if M < 2.60000000000000007e-58Initial program 35.2%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6442.1
Applied rewrites42.1%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6442.4
Applied rewrites42.4%
if 2.60000000000000007e-58 < M Initial program 35.2%
Taylor expanded in d around 0
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
unpow3N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6427.6
Applied rewrites27.6%
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 0.0)
(/ (* (* d_m d_m) (- (sqrt (/ 1.0 (* l h))))) d_m)
(if (<= t_0 5e+234)
(* (/ 1.0 (* (sqrt l) (sqrt h))) d_m)
(* (sqrt (/ (/ 1.0 l) h)) d_m)))))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 <= 0.0) {
tmp = ((d_m * d_m) * -sqrt((1.0 / (l * h)))) / d_m;
} else if (t_0 <= 5e+234) {
tmp = (1.0 / (sqrt(l) * sqrt(h))) * d_m;
} else {
tmp = sqrt(((1.0 / 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) :: 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 <= 0.0d0) then
tmp = ((d_m * d_m) * -sqrt((1.0d0 / (l * h)))) / d_m
else if (t_0 <= 5d+234) then
tmp = (1.0d0 / (sqrt(l) * sqrt(h))) * d_m
else
tmp = sqrt(((1.0d0 / 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 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 <= 0.0) {
tmp = ((d_m * d_m) * -Math.sqrt((1.0 / (l * h)))) / d_m;
} else if (t_0 <= 5e+234) {
tmp = (1.0 / (Math.sqrt(l) * Math.sqrt(h))) * d_m;
} else {
tmp = Math.sqrt(((1.0 / l) / h)) * d_m;
}
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 <= 0.0: tmp = ((d_m * d_m) * -math.sqrt((1.0 / (l * h)))) / d_m elif t_0 <= 5e+234: tmp = (1.0 / (math.sqrt(l) * math.sqrt(h))) * d_m else: tmp = math.sqrt(((1.0 / l) / h)) * d_m 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 <= 0.0) tmp = Float64(Float64(Float64(d_m * d_m) * Float64(-sqrt(Float64(1.0 / Float64(l * h))))) / d_m); elseif (t_0 <= 5e+234) tmp = Float64(Float64(1.0 / Float64(sqrt(l) * sqrt(h))) * d_m); else tmp = Float64(sqrt(Float64(Float64(1.0 / l) / h)) * d_m); 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 <= 0.0) tmp = ((d_m * d_m) * -sqrt((1.0 / (l * h)))) / d_m; elseif (t_0 <= 5e+234) tmp = (1.0 / (sqrt(l) * sqrt(h))) * d_m; else tmp = sqrt(((1.0 / l) / 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[(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, 0.0], N[(N[(N[(d$95$m * d$95$m), $MachinePrecision] * (-N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / d$95$m), $MachinePrecision], If[LessEqual[t$95$0, 5e+234], N[(N[(1.0 / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * d$95$m), $MachinePrecision], N[(N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision] * d$95$m), $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 0:\\
\;\;\;\;\frac{\left(d\_m \cdot d\_m\right) \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)}{d\_m}\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+234}:\\
\;\;\;\;\frac{1}{\sqrt{\ell} \cdot \sqrt{h}} \cdot d\_m\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot d\_m\\
\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)))) < -0.0Initial program 35.2%
Taylor expanded in d around 0
lower-/.f64N/A
Applied rewrites31.4%
Taylor expanded in l around -inf
sqrt-pow2N/A
metadata-evalN/A
metadata-evalN/A
associate-*l*N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-sqrt.f64N/A
lift-/.f64N/A
lift-*.f6411.1
Applied rewrites11.1%
if -0.0 < (*.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.0000000000000003e234Initial program 35.2%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6442.1
Applied rewrites42.1%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
sqrt-divN/A
metadata-evalN/A
*-commutativeN/A
lower-/.f64N/A
lower-sqrt.f64N/A
*-commutativeN/A
lift-*.f6442.3
Applied rewrites42.3%
lift-*.f64N/A
lift-sqrt.f64N/A
sqrt-prodN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lift-sqrt.f6424.8
Applied rewrites24.8%
if 5.0000000000000003e234 < (*.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.2%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6442.1
Applied rewrites42.1%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6442.4
Applied rewrites42.4%
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 0.0)
(* d_m (- (sqrt (/ 1.0 (* l h)))))
(if (<= t_0 5e+234)
(* (/ 1.0 (* (sqrt l) (sqrt h))) d_m)
(* (sqrt (/ (/ 1.0 l) h)) d_m)))))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 <= 0.0) {
tmp = d_m * -sqrt((1.0 / (l * h)));
} else if (t_0 <= 5e+234) {
tmp = (1.0 / (sqrt(l) * sqrt(h))) * d_m;
} else {
tmp = sqrt(((1.0 / 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) :: 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 <= 0.0d0) then
tmp = d_m * -sqrt((1.0d0 / (l * h)))
else if (t_0 <= 5d+234) then
tmp = (1.0d0 / (sqrt(l) * sqrt(h))) * d_m
else
tmp = sqrt(((1.0d0 / 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 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 <= 0.0) {
tmp = d_m * -Math.sqrt((1.0 / (l * h)));
} else if (t_0 <= 5e+234) {
tmp = (1.0 / (Math.sqrt(l) * Math.sqrt(h))) * d_m;
} else {
tmp = Math.sqrt(((1.0 / l) / h)) * d_m;
}
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 <= 0.0: tmp = d_m * -math.sqrt((1.0 / (l * h))) elif t_0 <= 5e+234: tmp = (1.0 / (math.sqrt(l) * math.sqrt(h))) * d_m else: tmp = math.sqrt(((1.0 / l) / h)) * d_m 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 <= 0.0) tmp = Float64(d_m * Float64(-sqrt(Float64(1.0 / Float64(l * h))))); elseif (t_0 <= 5e+234) tmp = Float64(Float64(1.0 / Float64(sqrt(l) * sqrt(h))) * d_m); else tmp = Float64(sqrt(Float64(Float64(1.0 / l) / h)) * d_m); 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 <= 0.0) tmp = d_m * -sqrt((1.0 / (l * h))); elseif (t_0 <= 5e+234) tmp = (1.0 / (sqrt(l) * sqrt(h))) * d_m; else tmp = sqrt(((1.0 / l) / 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[(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, 0.0], N[(d$95$m * (-N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[t$95$0, 5e+234], N[(N[(1.0 / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * d$95$m), $MachinePrecision], N[(N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision] * d$95$m), $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 0:\\
\;\;\;\;d\_m \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+234}:\\
\;\;\;\;\frac{1}{\sqrt{\ell} \cdot \sqrt{h}} \cdot d\_m\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot d\_m\\
\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)))) < -0.0Initial program 35.2%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lower-pow.f64N/A
lower-*.f64N/A
lift-/.f64N/A
lift-/.f6455.2
lift-/.f64N/A
metadata-eval55.2
Applied rewrites55.2%
Taylor expanded in d around -inf
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-sqrt.f64N/A
lift-/.f64N/A
lift-*.f649.8
Applied rewrites9.8%
if -0.0 < (*.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.0000000000000003e234Initial program 35.2%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6442.1
Applied rewrites42.1%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
sqrt-divN/A
metadata-evalN/A
*-commutativeN/A
lower-/.f64N/A
lower-sqrt.f64N/A
*-commutativeN/A
lift-*.f6442.3
Applied rewrites42.3%
lift-*.f64N/A
lift-sqrt.f64N/A
sqrt-prodN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lift-sqrt.f6424.8
Applied rewrites24.8%
if 5.0000000000000003e234 < (*.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.2%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6442.1
Applied rewrites42.1%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6442.4
Applied rewrites42.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))))
-2e-226)
(* d_m (- (sqrt (/ 1.0 (* l h)))))
(* (sqrt (/ (/ 1.0 l) h)) d_m)))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)))) <= -2e-226) {
tmp = d_m * -sqrt((1.0 / (l * h)));
} else {
tmp = sqrt(((1.0 / 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 (((((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)))) <= (-2d-226)) then
tmp = d_m * -sqrt((1.0d0 / (l * h)))
else
tmp = sqrt(((1.0d0 / 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 (((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)))) <= -2e-226) {
tmp = d_m * -Math.sqrt((1.0 / (l * h)));
} else {
tmp = Math.sqrt(((1.0 / l) / h)) * d_m;
}
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)))) <= -2e-226: tmp = d_m * -math.sqrt((1.0 / (l * h))) else: tmp = math.sqrt(((1.0 / l) / h)) * d_m 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)))) <= -2e-226) tmp = Float64(d_m * Float64(-sqrt(Float64(1.0 / Float64(l * h))))); else tmp = Float64(sqrt(Float64(Float64(1.0 / l) / h)) * d_m); 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)))) <= -2e-226) tmp = d_m * -sqrt((1.0 / (l * h))); else tmp = sqrt(((1.0 / 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[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], -2e-226], N[(d$95$m * (-N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision] * d$95$m), $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 -2 \cdot 10^{-226}:\\
\;\;\;\;d\_m \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot d\_m\\
\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)))) < -1.99999999999999984e-226Initial program 35.2%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lower-pow.f64N/A
lower-*.f64N/A
lift-/.f64N/A
lift-/.f6455.2
lift-/.f64N/A
metadata-eval55.2
Applied rewrites55.2%
Taylor expanded in d around -inf
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-sqrt.f64N/A
lift-/.f64N/A
lift-*.f649.8
Applied rewrites9.8%
if -1.99999999999999984e-226 < (*.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.2%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6442.1
Applied rewrites42.1%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6442.4
Applied rewrites42.4%
d_m = (fabs.f64 d) (FPCore (d_m h l M D) :precision binary64 (* (sqrt (/ (/ 1.0 l) h)) d_m))
d_m = fabs(d);
double code(double d_m, double h, double l, double M, double D) {
return sqrt(((1.0 / l) / h)) * d_m;
}
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 = sqrt(((1.0d0 / l) / h)) * d_m
end function
d_m = Math.abs(d);
public static double code(double d_m, double h, double l, double M, double D) {
return Math.sqrt(((1.0 / l) / h)) * d_m;
}
d_m = math.fabs(d) def code(d_m, h, l, M, D): return math.sqrt(((1.0 / l) / h)) * d_m
d_m = abs(d) function code(d_m, h, l, M, D) return Float64(sqrt(Float64(Float64(1.0 / l) / h)) * d_m) end
d_m = abs(d); function tmp = code(d_m, h, l, M, D) tmp = sqrt(((1.0 / l) / h)) * d_m; end
d_m = N[Abs[d], $MachinePrecision] code[d$95$m_, h_, l_, M_, D_] := N[(N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision] * d$95$m), $MachinePrecision]
\begin{array}{l}
d_m = \left|d\right|
\\
\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot d\_m
\end{array}
Initial program 35.2%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6442.1
Applied rewrites42.1%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6442.4
Applied rewrites42.4%
d_m = (fabs.f64 d) (FPCore (d_m h l M D) :precision binary64 (* (sqrt (/ (/ 1.0 h) l)) d_m))
d_m = fabs(d);
double code(double d_m, double h, double l, double M, double D) {
return sqrt(((1.0 / h) / l)) * d_m;
}
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 = sqrt(((1.0d0 / h) / l)) * d_m
end function
d_m = Math.abs(d);
public static double code(double d_m, double h, double l, double M, double D) {
return Math.sqrt(((1.0 / h) / l)) * d_m;
}
d_m = math.fabs(d) def code(d_m, h, l, M, D): return math.sqrt(((1.0 / h) / l)) * d_m
d_m = abs(d) function code(d_m, h, l, M, D) return Float64(sqrt(Float64(Float64(1.0 / h) / l)) * d_m) end
d_m = abs(d); function tmp = code(d_m, h, l, M, D) tmp = sqrt(((1.0 / h) / l)) * d_m; end
d_m = N[Abs[d], $MachinePrecision] code[d$95$m_, h_, l_, M_, D_] := N[(N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision] * d$95$m), $MachinePrecision]
\begin{array}{l}
d_m = \left|d\right|
\\
\sqrt{\frac{\frac{1}{h}}{\ell}} \cdot d\_m
\end{array}
Initial program 35.2%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6442.1
Applied rewrites42.1%
lift-*.f64N/A
*-commutativeN/A
lower-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6442.4
Applied rewrites42.4%
d_m = (fabs.f64 d) (FPCore (d_m h l M D) :precision binary64 (* (sqrt (/ 1.0 (* l h))) d_m))
d_m = fabs(d);
double code(double d_m, double h, double l, double M, double D) {
return sqrt((1.0 / (l * h))) * d_m;
}
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 = sqrt((1.0d0 / (l * h))) * d_m
end function
d_m = Math.abs(d);
public static double code(double d_m, double h, double l, double M, double D) {
return Math.sqrt((1.0 / (l * h))) * d_m;
}
d_m = math.fabs(d) def code(d_m, h, l, M, D): return math.sqrt((1.0 / (l * h))) * d_m
d_m = abs(d) function code(d_m, h, l, M, D) return Float64(sqrt(Float64(1.0 / Float64(l * h))) * d_m) end
d_m = abs(d); function tmp = code(d_m, h, l, M, D) tmp = sqrt((1.0 / (l * h))) * d_m; end
d_m = N[Abs[d], $MachinePrecision] code[d$95$m_, h_, l_, M_, D_] := N[(N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * d$95$m), $MachinePrecision]
\begin{array}{l}
d_m = \left|d\right|
\\
\sqrt{\frac{1}{\ell \cdot h}} \cdot d\_m
\end{array}
Initial program 35.2%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6442.1
Applied rewrites42.1%
herbie shell --seed 2025124
(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)))))