
(FPCore (d h l M D) :precision binary64 (* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
double code(double d, double h, double l, double M, double D) {
return (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
end function
public static double code(double d, double h, double l, double M, double D) {
return (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
def code(d, h, l, M, D): return (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))
function code(d, h, l, M, D) return Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) end
function tmp = code(d, h, l, M, D) tmp = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); end
code[d_, h_, l_, M_, D_] := N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)
\end{array}
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (d h l M D) :precision binary64 (* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
double code(double d, double h, double l, double M, double D) {
return (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
end function
public static double code(double d, double h, double l, double M, double D) {
return (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
def code(d, h, l, M, D): return (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))
function code(d, h, l, M, D) return Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) end
function tmp = code(d, h, l, M, D) tmp = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); end
code[d_, h_, l_, M_, D_] := N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)
\end{array}
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d l)))
(t_1 (* (/ D d) (/ M 2.0)))
(t_2 (- 1.0 (/ (* (* (pow (/ (* D M) (* 2.0 d)) 2.0) 0.5) h) l))))
(if (<= d -4.5e+260)
(* (* (- d) (pow (* h l) -0.5)) (- 1.0 (/ (* (* (* t_1 t_1) 0.5) h) l)))
(if (<= d -6e-102)
(* (* t_0 (sqrt (/ d h))) t_2)
(if (<= d 2.15e-188)
(/ (* (* (pow (/ h l) 1.5) (/ (pow (* D M) 2.0) d)) -0.125) h)
(* (/ (* (sqrt d) t_0) (sqrt h)) t_2))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / l));
double t_1 = (D / d) * (M / 2.0);
double t_2 = 1.0 - (((pow(((D * M) / (2.0 * d)), 2.0) * 0.5) * h) / l);
double tmp;
if (d <= -4.5e+260) {
tmp = (-d * pow((h * l), -0.5)) * (1.0 - ((((t_1 * t_1) * 0.5) * h) / l));
} else if (d <= -6e-102) {
tmp = (t_0 * sqrt((d / h))) * t_2;
} else if (d <= 2.15e-188) {
tmp = ((pow((h / l), 1.5) * (pow((D * M), 2.0) / d)) * -0.125) / h;
} else {
tmp = ((sqrt(d) * t_0) / sqrt(h)) * t_2;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(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
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = sqrt((d / l))
t_1 = (d_1 / d) * (m / 2.0d0)
t_2 = 1.0d0 - ((((((d_1 * m) / (2.0d0 * d)) ** 2.0d0) * 0.5d0) * h) / l)
if (d <= (-4.5d+260)) then
tmp = (-d * ((h * l) ** (-0.5d0))) * (1.0d0 - ((((t_1 * t_1) * 0.5d0) * h) / l))
else if (d <= (-6d-102)) then
tmp = (t_0 * sqrt((d / h))) * t_2
else if (d <= 2.15d-188) then
tmp = ((((h / l) ** 1.5d0) * (((d_1 * m) ** 2.0d0) / d)) * (-0.125d0)) / h
else
tmp = ((sqrt(d) * t_0) / sqrt(h)) * t_2
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((d / l));
double t_1 = (D / d) * (M / 2.0);
double t_2 = 1.0 - (((Math.pow(((D * M) / (2.0 * d)), 2.0) * 0.5) * h) / l);
double tmp;
if (d <= -4.5e+260) {
tmp = (-d * Math.pow((h * l), -0.5)) * (1.0 - ((((t_1 * t_1) * 0.5) * h) / l));
} else if (d <= -6e-102) {
tmp = (t_0 * Math.sqrt((d / h))) * t_2;
} else if (d <= 2.15e-188) {
tmp = ((Math.pow((h / l), 1.5) * (Math.pow((D * M), 2.0) / d)) * -0.125) / h;
} else {
tmp = ((Math.sqrt(d) * t_0) / Math.sqrt(h)) * t_2;
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.sqrt((d / l)) t_1 = (D / d) * (M / 2.0) t_2 = 1.0 - (((math.pow(((D * M) / (2.0 * d)), 2.0) * 0.5) * h) / l) tmp = 0 if d <= -4.5e+260: tmp = (-d * math.pow((h * l), -0.5)) * (1.0 - ((((t_1 * t_1) * 0.5) * h) / l)) elif d <= -6e-102: tmp = (t_0 * math.sqrt((d / h))) * t_2 elif d <= 2.15e-188: tmp = ((math.pow((h / l), 1.5) * (math.pow((D * M), 2.0) / d)) * -0.125) / h else: tmp = ((math.sqrt(d) * t_0) / math.sqrt(h)) * t_2 return tmp
function code(d, h, l, M, D) t_0 = sqrt(Float64(d / l)) t_1 = Float64(Float64(D / d) * Float64(M / 2.0)) t_2 = Float64(1.0 - Float64(Float64(Float64((Float64(Float64(D * M) / Float64(2.0 * d)) ^ 2.0) * 0.5) * h) / l)) tmp = 0.0 if (d <= -4.5e+260) tmp = Float64(Float64(Float64(-d) * (Float64(h * l) ^ -0.5)) * Float64(1.0 - Float64(Float64(Float64(Float64(t_1 * t_1) * 0.5) * h) / l))); elseif (d <= -6e-102) tmp = Float64(Float64(t_0 * sqrt(Float64(d / h))) * t_2); elseif (d <= 2.15e-188) tmp = Float64(Float64(Float64((Float64(h / l) ^ 1.5) * Float64((Float64(D * M) ^ 2.0) / d)) * -0.125) / h); else tmp = Float64(Float64(Float64(sqrt(d) * t_0) / sqrt(h)) * t_2); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = sqrt((d / l)); t_1 = (D / d) * (M / 2.0); t_2 = 1.0 - ((((((D * M) / (2.0 * d)) ^ 2.0) * 0.5) * h) / l); tmp = 0.0; if (d <= -4.5e+260) tmp = (-d * ((h * l) ^ -0.5)) * (1.0 - ((((t_1 * t_1) * 0.5) * h) / l)); elseif (d <= -6e-102) tmp = (t_0 * sqrt((d / h))) * t_2; elseif (d <= 2.15e-188) tmp = ((((h / l) ^ 1.5) * (((D * M) ^ 2.0) / d)) * -0.125) / h; else tmp = ((sqrt(d) * t_0) / sqrt(h)) * t_2; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(D / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(1.0 - N[(N[(N[(N[Power[N[(N[(D * M), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * 0.5), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -4.5e+260], N[(N[((-d) * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(t$95$1 * t$95$1), $MachinePrecision] * 0.5), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -6e-102], N[(N[(t$95$0 * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision], If[LessEqual[d, 2.15e-188], N[(N[(N[(N[Power[N[(h / l), $MachinePrecision], 1.5], $MachinePrecision] * N[(N[Power[N[(D * M), $MachinePrecision], 2.0], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision] / h), $MachinePrecision], N[(N[(N[(N[Sqrt[d], $MachinePrecision] * t$95$0), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
t_1 := \frac{D}{d} \cdot \frac{M}{2}\\
t_2 := 1 - \frac{\left({\left(\frac{D \cdot M}{2 \cdot d}\right)}^{2} \cdot 0.5\right) \cdot h}{\ell}\\
\mathbf{if}\;d \leq -4.5 \cdot 10^{+260}:\\
\;\;\;\;\left(\left(-d\right) \cdot {\left(h \cdot \ell\right)}^{-0.5}\right) \cdot \left(1 - \frac{\left(\left(t\_1 \cdot t\_1\right) \cdot 0.5\right) \cdot h}{\ell}\right)\\
\mathbf{elif}\;d \leq -6 \cdot 10^{-102}:\\
\;\;\;\;\left(t\_0 \cdot \sqrt{\frac{d}{h}}\right) \cdot t\_2\\
\mathbf{elif}\;d \leq 2.15 \cdot 10^{-188}:\\
\;\;\;\;\frac{\left({\left(\frac{h}{\ell}\right)}^{1.5} \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}\right) \cdot -0.125}{h}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d} \cdot t\_0}{\sqrt{h}} \cdot t\_2\\
\end{array}
\end{array}
if d < -4.50000000000000023e260Initial program 71.6%
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 rewrites76.7%
Taylor expanded in d around 0
metadata-evalN/A
pow1/2N/A
sqrt-divN/A
metadata-evalN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
inv-powN/A
*-commutativeN/A
sqrt-pow1N/A
lower-pow.f64N/A
lift-*.f64N/A
metadata-eval1.2
Applied rewrites1.2%
lift-pow.f64N/A
unpow2N/A
lower-*.f641.2
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f641.2
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f641.2
Applied rewrites1.2%
Taylor expanded in h around -inf
sqrt-pow2N/A
metadata-evalN/A
metadata-evalN/A
*-commutativeN/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
inv-powN/A
*-commutativeN/A
sqrt-pow1N/A
metadata-evalN/A
lift-pow.f64N/A
*-commutativeN/A
lower-*.f6485.1
Applied rewrites85.1%
if -4.50000000000000023e260 < d < -6e-102Initial program 77.7%
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 rewrites80.3%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f64N/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f6480.3
Applied rewrites80.3%
lift-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f6480.2
Applied rewrites80.2%
if -6e-102 < d < 2.14999999999999994e-188Initial program 44.3%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites45.9%
Taylor expanded in d around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
cube-divN/A
sqrt-pow1N/A
lower-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow-prod-downN/A
lift-pow.f64N/A
lift-*.f64N/A
lift-/.f6456.1
Applied rewrites56.1%
if 2.14999999999999994e-188 < d Initial program 73.4%
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 rewrites75.3%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f64N/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f6475.3
Applied rewrites75.3%
lift-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f6475.7
Applied rewrites75.7%
lift-*.f64N/A
lift-/.f64N/A
lift-sqrt.f64N/A
lift-/.f64N/A
lift-sqrt.f64N/A
*-commutativeN/A
sqrt-divN/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lift-sqrt.f64N/A
lift-/.f64N/A
lower-sqrt.f6484.9
Applied rewrites84.9%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ h l)))
(t_1
(*
(* (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))))))
(if (<= t_1 -5000000000000.0)
(/ (* d (- t_0)) h)
(if (<= t_1 INFINITY)
(/ (* t_0 d) h)
(* (* -1.0 d) (sqrt (/ 1.0 (* h l))))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((h / l));
double t_1 = (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 tmp;
if (t_1 <= -5000000000000.0) {
tmp = (d * -t_0) / h;
} else if (t_1 <= ((double) INFINITY)) {
tmp = (t_0 * d) / h;
} else {
tmp = (-1.0 * d) * sqrt((1.0 / (h * l)));
}
return tmp;
}
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((h / l));
double t_1 = (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)));
double tmp;
if (t_1 <= -5000000000000.0) {
tmp = (d * -t_0) / h;
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = (t_0 * d) / h;
} else {
tmp = (-1.0 * d) * Math.sqrt((1.0 / (h * l)));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.sqrt((h / l)) t_1 = (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))) tmp = 0 if t_1 <= -5000000000000.0: tmp = (d * -t_0) / h elif t_1 <= math.inf: tmp = (t_0 * d) / h else: tmp = (-1.0 * d) * math.sqrt((1.0 / (h * l))) return tmp
function code(d, h, l, M, D) t_0 = sqrt(Float64(h / l)) t_1 = 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)))) tmp = 0.0 if (t_1 <= -5000000000000.0) tmp = Float64(Float64(d * Float64(-t_0)) / h); elseif (t_1 <= Inf) tmp = Float64(Float64(t_0 * d) / h); else tmp = Float64(Float64(-1.0 * d) * sqrt(Float64(1.0 / Float64(h * l)))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = sqrt((h / l)); t_1 = (((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))); tmp = 0.0; if (t_1 <= -5000000000000.0) tmp = (d * -t_0) / h; elseif (t_1 <= Inf) tmp = (t_0 * d) / h; else tmp = (-1.0 * d) * sqrt((1.0 / (h * l))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = 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]}, If[LessEqual[t$95$1, -5000000000000.0], N[(N[(d * (-t$95$0)), $MachinePrecision] / h), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(N[(t$95$0 * d), $MachinePrecision] / h), $MachinePrecision], N[(N[(-1.0 * d), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\frac{h}{\ell}}\\
t_1 := \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)\\
\mathbf{if}\;t\_1 \leq -5000000000000:\\
\;\;\;\;\frac{d \cdot \left(-t\_0\right)}{h}\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\frac{t\_0 \cdot d}{h}\\
\mathbf{else}:\\
\;\;\;\;\left(-1 \cdot d\right) \cdot \sqrt{\frac{1}{h \cdot \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)))) < -5e12Initial program 87.4%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites52.4%
Taylor expanded in l around -inf
sqrt-pow2N/A
metadata-evalN/A
metadata-evalN/A
associate-*l*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lift-sqrt.f64N/A
lift-/.f6422.8
Applied rewrites22.8%
if -5e12 < (*.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 77.9%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites57.8%
Taylor expanded in d around inf
*-commutativeN/A
lift-sqrt.f64N/A
lift-/.f64N/A
lift-*.f6471.9
Applied rewrites71.9%
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 0.0%
Taylor expanded in l around -inf
lower-*.f64N/A
sqrt-pow2N/A
metadata-evalN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f6414.0
Applied rewrites14.0%
lift-*.f64N/A
lift-pow.f64N/A
unpow-1N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6414.0
Applied rewrites14.0%
(FPCore (d h l M D)
:precision binary64
(if (<=
(*
(* (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))))
-5000000000000.0)
(/ (* d (- (sqrt (/ h l)))) h)
(* (* (sqrt (/ d l)) (sqrt (/ d h))) 1.0)))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (((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)))) <= -5000000000000.0) {
tmp = (d * -sqrt((h / l))) / h;
} else {
tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(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
real(8) :: tmp
if (((((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)))) <= (-5000000000000.0d0)) then
tmp = (d * -sqrt((h / l))) / h
else
tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0d0
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (((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)))) <= -5000000000000.0) {
tmp = (d * -Math.sqrt((h / l))) / h;
} else {
tmp = (Math.sqrt((d / l)) * Math.sqrt((d / h))) * 1.0;
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if ((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)))) <= -5000000000000.0: tmp = (d * -math.sqrt((h / l))) / h else: tmp = (math.sqrt((d / l)) * math.sqrt((d / h))) * 1.0 return tmp
function code(d, h, l, M, D) tmp = 0.0 if (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)))) <= -5000000000000.0) tmp = Float64(Float64(d * Float64(-sqrt(Float64(h / l)))) / h); else tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * 1.0); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (((((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)))) <= -5000000000000.0) tmp = (d * -sqrt((h / l))) / h; else tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[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], -5000000000000.0], N[(N[(d * (-N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / h), $MachinePrecision], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\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) \leq -5000000000000:\\
\;\;\;\;\frac{d \cdot \left(-\sqrt{\frac{h}{\ell}}\right)}{h}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot 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)))) < -5e12Initial program 87.4%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites52.4%
Taylor expanded in l around -inf
sqrt-pow2N/A
metadata-evalN/A
metadata-evalN/A
associate-*l*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lift-sqrt.f64N/A
lift-/.f6422.8
Applied rewrites22.8%
if -5e12 < (*.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 56.7%
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 rewrites59.1%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f64N/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f6459.1
Applied rewrites59.1%
Taylor expanded in d around inf
frac-times56.9
*-commutative56.9
associate-*r/56.9
metadata-eval56.9
Applied rewrites56.9%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d l))) (t_1 (* (/ D d) (/ M 2.0))))
(if (<= d -4.5e+260)
(* (* (- d) (pow (* h l) -0.5)) (- 1.0 (/ (* (* (* t_1 t_1) 0.5) h) l)))
(if (<= d -9.5e-113)
(*
(* t_0 (sqrt (/ d h)))
(- 1.0 (/ (* (* (pow (/ (* D M) (* 2.0 d)) 2.0) 0.5) h) l)))
(if (<= d -5e-310)
(/
(fma
(* -0.125 (/ (* (* D M) (* D M)) d))
(sqrt (pow (/ h l) 3.0))
(* (sqrt (/ h l)) d))
h)
(if (<= d 7.5e-35)
(*
(* (/ (sqrt d) (sqrt h)) (/ (sqrt d) (sqrt l)))
(-
1.0
(* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l))))
(*
(/ (* (sqrt d) t_0) (sqrt h))
(- 1.0 (/ (* (* (pow (* (/ M 2.0) (/ D d)) 2.0) 0.5) h) l)))))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / l));
double t_1 = (D / d) * (M / 2.0);
double tmp;
if (d <= -4.5e+260) {
tmp = (-d * pow((h * l), -0.5)) * (1.0 - ((((t_1 * t_1) * 0.5) * h) / l));
} else if (d <= -9.5e-113) {
tmp = (t_0 * sqrt((d / h))) * (1.0 - (((pow(((D * M) / (2.0 * d)), 2.0) * 0.5) * h) / l));
} else if (d <= -5e-310) {
tmp = fma((-0.125 * (((D * M) * (D * M)) / d)), sqrt(pow((h / l), 3.0)), (sqrt((h / l)) * d)) / h;
} else if (d <= 7.5e-35) {
tmp = ((sqrt(d) / sqrt(h)) * (sqrt(d) / sqrt(l))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
} else {
tmp = ((sqrt(d) * t_0) / sqrt(h)) * (1.0 - (((pow(((M / 2.0) * (D / d)), 2.0) * 0.5) * h) / l));
}
return tmp;
}
function code(d, h, l, M, D) t_0 = sqrt(Float64(d / l)) t_1 = Float64(Float64(D / d) * Float64(M / 2.0)) tmp = 0.0 if (d <= -4.5e+260) tmp = Float64(Float64(Float64(-d) * (Float64(h * l) ^ -0.5)) * Float64(1.0 - Float64(Float64(Float64(Float64(t_1 * t_1) * 0.5) * h) / l))); elseif (d <= -9.5e-113) tmp = Float64(Float64(t_0 * sqrt(Float64(d / h))) * Float64(1.0 - Float64(Float64(Float64((Float64(Float64(D * M) / Float64(2.0 * d)) ^ 2.0) * 0.5) * h) / l))); elseif (d <= -5e-310) tmp = Float64(fma(Float64(-0.125 * Float64(Float64(Float64(D * M) * Float64(D * M)) / d)), sqrt((Float64(h / l) ^ 3.0)), Float64(sqrt(Float64(h / l)) * d)) / h); elseif (d <= 7.5e-35) tmp = Float64(Float64(Float64(sqrt(d) / sqrt(h)) * Float64(sqrt(d) / sqrt(l))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))); else tmp = Float64(Float64(Float64(sqrt(d) * t_0) / sqrt(h)) * Float64(1.0 - Float64(Float64(Float64((Float64(Float64(M / 2.0) * Float64(D / d)) ^ 2.0) * 0.5) * h) / l))); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(D / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -4.5e+260], N[(N[((-d) * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(t$95$1 * t$95$1), $MachinePrecision] * 0.5), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -9.5e-113], N[(N[(t$95$0 * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[Power[N[(N[(D * M), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * 0.5), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -5e-310], N[(N[(N[(-0.125 * N[(N[(N[(D * M), $MachinePrecision] * N[(D * M), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[Power[N[(h / l), $MachinePrecision], 3.0], $MachinePrecision]], $MachinePrecision] + N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], If[LessEqual[d, 7.5e-35], N[(N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $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], N[(N[(N[(N[Sqrt[d], $MachinePrecision] * t$95$0), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[Power[N[(N[(M / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * 0.5), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
t_1 := \frac{D}{d} \cdot \frac{M}{2}\\
\mathbf{if}\;d \leq -4.5 \cdot 10^{+260}:\\
\;\;\;\;\left(\left(-d\right) \cdot {\left(h \cdot \ell\right)}^{-0.5}\right) \cdot \left(1 - \frac{\left(\left(t\_1 \cdot t\_1\right) \cdot 0.5\right) \cdot h}{\ell}\right)\\
\mathbf{elif}\;d \leq -9.5 \cdot 10^{-113}:\\
\;\;\;\;\left(t\_0 \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - \frac{\left({\left(\frac{D \cdot M}{2 \cdot d}\right)}^{2} \cdot 0.5\right) \cdot h}{\ell}\right)\\
\mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-0.125 \cdot \frac{\left(D \cdot M\right) \cdot \left(D \cdot M\right)}{d}, \sqrt{{\left(\frac{h}{\ell}\right)}^{3}}, \sqrt{\frac{h}{\ell}} \cdot d\right)}{h}\\
\mathbf{elif}\;d \leq 7.5 \cdot 10^{-35}:\\
\;\;\;\;\left(\frac{\sqrt{d}}{\sqrt{h}} \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\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)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d} \cdot t\_0}{\sqrt{h}} \cdot \left(1 - \frac{\left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot 0.5\right) \cdot h}{\ell}\right)\\
\end{array}
\end{array}
if d < -4.50000000000000023e260Initial program 71.6%
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 rewrites76.7%
Taylor expanded in d around 0
metadata-evalN/A
pow1/2N/A
sqrt-divN/A
metadata-evalN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
inv-powN/A
*-commutativeN/A
sqrt-pow1N/A
lower-pow.f64N/A
lift-*.f64N/A
metadata-eval1.2
Applied rewrites1.2%
lift-pow.f64N/A
unpow2N/A
lower-*.f641.2
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f641.2
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f641.2
Applied rewrites1.2%
Taylor expanded in h around -inf
sqrt-pow2N/A
metadata-evalN/A
metadata-evalN/A
*-commutativeN/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
inv-powN/A
*-commutativeN/A
sqrt-pow1N/A
metadata-evalN/A
lift-pow.f64N/A
*-commutativeN/A
lower-*.f6485.1
Applied rewrites85.1%
if -4.50000000000000023e260 < d < -9.49999999999999987e-113Initial program 77.1%
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 rewrites79.8%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f64N/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f6479.8
Applied rewrites79.8%
lift-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f6479.7
Applied rewrites79.7%
if -9.49999999999999987e-113 < d < -4.999999999999985e-310Initial program 46.9%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites46.8%
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
lower-*.f64N/A
lift-*.f64N/A
lift-*.f6446.8
Applied rewrites46.8%
if -4.999999999999985e-310 < d < 7.5e-35Initial program 54.4%
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6465.2
Applied rewrites65.2%
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow1/2N/A
sqrt-divN/A
lower-/.f64N/A
lift-sqrt.f64N/A
lower-sqrt.f6472.6
Applied rewrites72.6%
if 7.5e-35 < d Initial program 76.4%
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 rewrites79.1%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow1/2N/A
sqrt-divN/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-sqrt.f64N/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f64N/A
lift-sqrt.f6488.7
Applied rewrites88.7%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* (/ D d) (/ M 2.0)))
(t_1
(*
(* (sqrt (/ d l)) (sqrt (/ d h)))
(- 1.0 (/ (* (* (pow (/ (* D M) (* 2.0 d)) 2.0) 0.5) h) l))))
(t_2
(*
(* (pow (* l h) -0.5) d)
(- 1.0 (/ (* (* (* t_0 (* (/ D d) (* 0.5 M))) 0.5) h) l)))))
(if (<= d -4.5e+260)
(* (* (- d) (pow (* h l) -0.5)) (- 1.0 (/ (* (* (* t_0 t_0) 0.5) h) l)))
(if (<= d -9.5e-113)
t_1
(if (<= d 2e-307)
(/
(fma
(* -0.125 (/ (* (* D M) (* D M)) d))
(sqrt (pow (/ h l) 3.0))
(* (sqrt (/ h l)) d))
h)
(if (<= d 1.65e-174) t_2 (if (<= d 6e+125) t_1 t_2)))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = (D / d) * (M / 2.0);
double t_1 = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - (((pow(((D * M) / (2.0 * d)), 2.0) * 0.5) * h) / l));
double t_2 = (pow((l * h), -0.5) * d) * (1.0 - ((((t_0 * ((D / d) * (0.5 * M))) * 0.5) * h) / l));
double tmp;
if (d <= -4.5e+260) {
tmp = (-d * pow((h * l), -0.5)) * (1.0 - ((((t_0 * t_0) * 0.5) * h) / l));
} else if (d <= -9.5e-113) {
tmp = t_1;
} else if (d <= 2e-307) {
tmp = fma((-0.125 * (((D * M) * (D * M)) / d)), sqrt(pow((h / l), 3.0)), (sqrt((h / l)) * d)) / h;
} else if (d <= 1.65e-174) {
tmp = t_2;
} else if (d <= 6e+125) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
function code(d, h, l, M, D) t_0 = Float64(Float64(D / d) * Float64(M / 2.0)) t_1 = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * Float64(1.0 - Float64(Float64(Float64((Float64(Float64(D * M) / Float64(2.0 * d)) ^ 2.0) * 0.5) * h) / l))) t_2 = Float64(Float64((Float64(l * h) ^ -0.5) * d) * Float64(1.0 - Float64(Float64(Float64(Float64(t_0 * Float64(Float64(D / d) * Float64(0.5 * M))) * 0.5) * h) / l))) tmp = 0.0 if (d <= -4.5e+260) tmp = Float64(Float64(Float64(-d) * (Float64(h * l) ^ -0.5)) * Float64(1.0 - Float64(Float64(Float64(Float64(t_0 * t_0) * 0.5) * h) / l))); elseif (d <= -9.5e-113) tmp = t_1; elseif (d <= 2e-307) tmp = Float64(fma(Float64(-0.125 * Float64(Float64(Float64(D * M) * Float64(D * M)) / d)), sqrt((Float64(h / l) ^ 3.0)), Float64(sqrt(Float64(h / l)) * d)) / h); elseif (d <= 1.65e-174) tmp = t_2; elseif (d <= 6e+125) tmp = t_1; else tmp = t_2; end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(D / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[Power[N[(N[(D * M), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * 0.5), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision] * d), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(t$95$0 * N[(N[(D / d), $MachinePrecision] * N[(0.5 * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -4.5e+260], N[(N[((-d) * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(t$95$0 * t$95$0), $MachinePrecision] * 0.5), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -9.5e-113], t$95$1, If[LessEqual[d, 2e-307], N[(N[(N[(-0.125 * N[(N[(N[(D * M), $MachinePrecision] * N[(D * M), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[Power[N[(h / l), $MachinePrecision], 3.0], $MachinePrecision]], $MachinePrecision] + N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], If[LessEqual[d, 1.65e-174], t$95$2, If[LessEqual[d, 6e+125], t$95$1, t$95$2]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{D}{d} \cdot \frac{M}{2}\\
t_1 := \left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - \frac{\left({\left(\frac{D \cdot M}{2 \cdot d}\right)}^{2} \cdot 0.5\right) \cdot h}{\ell}\right)\\
t_2 := \left({\left(\ell \cdot h\right)}^{-0.5} \cdot d\right) \cdot \left(1 - \frac{\left(\left(t\_0 \cdot \left(\frac{D}{d} \cdot \left(0.5 \cdot M\right)\right)\right) \cdot 0.5\right) \cdot h}{\ell}\right)\\
\mathbf{if}\;d \leq -4.5 \cdot 10^{+260}:\\
\;\;\;\;\left(\left(-d\right) \cdot {\left(h \cdot \ell\right)}^{-0.5}\right) \cdot \left(1 - \frac{\left(\left(t\_0 \cdot t\_0\right) \cdot 0.5\right) \cdot h}{\ell}\right)\\
\mathbf{elif}\;d \leq -9.5 \cdot 10^{-113}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d \leq 2 \cdot 10^{-307}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-0.125 \cdot \frac{\left(D \cdot M\right) \cdot \left(D \cdot M\right)}{d}, \sqrt{{\left(\frac{h}{\ell}\right)}^{3}}, \sqrt{\frac{h}{\ell}} \cdot d\right)}{h}\\
\mathbf{elif}\;d \leq 1.65 \cdot 10^{-174}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;d \leq 6 \cdot 10^{+125}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if d < -4.50000000000000023e260Initial program 71.6%
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 rewrites76.7%
Taylor expanded in d around 0
metadata-evalN/A
pow1/2N/A
sqrt-divN/A
metadata-evalN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
inv-powN/A
*-commutativeN/A
sqrt-pow1N/A
lower-pow.f64N/A
lift-*.f64N/A
metadata-eval1.2
Applied rewrites1.2%
lift-pow.f64N/A
unpow2N/A
lower-*.f641.2
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f641.2
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f641.2
Applied rewrites1.2%
Taylor expanded in h around -inf
sqrt-pow2N/A
metadata-evalN/A
metadata-evalN/A
*-commutativeN/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
inv-powN/A
*-commutativeN/A
sqrt-pow1N/A
metadata-evalN/A
lift-pow.f64N/A
*-commutativeN/A
lower-*.f6485.1
Applied rewrites85.1%
if -4.50000000000000023e260 < d < -9.49999999999999987e-113 or 1.65e-174 < d < 6.0000000000000003e125Initial program 76.4%
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 rewrites78.7%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f64N/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f6478.7
Applied rewrites78.7%
lift-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f6478.9
Applied rewrites78.9%
if -9.49999999999999987e-113 < d < 1.99999999999999982e-307Initial program 46.9%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites46.9%
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
lower-*.f64N/A
lift-*.f64N/A
lift-*.f6446.9
Applied rewrites46.9%
if 1.99999999999999982e-307 < d < 1.65e-174 or 6.0000000000000003e125 < d Initial program 58.0%
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 rewrites59.2%
Taylor expanded in d around 0
metadata-evalN/A
pow1/2N/A
sqrt-divN/A
metadata-evalN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
inv-powN/A
*-commutativeN/A
sqrt-pow1N/A
lower-pow.f64N/A
lift-*.f64N/A
metadata-eval74.6
Applied rewrites74.6%
lift-pow.f64N/A
unpow2N/A
lower-*.f6474.6
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f6474.6
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f6474.6
Applied rewrites74.6%
Taylor expanded in M around 0
lower-*.f6474.6
Applied rewrites74.6%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d l)))
(t_1 (* (/ D d) (/ M 2.0)))
(t_2 (- 1.0 (/ (* (* (pow (/ (* D M) (* 2.0 d)) 2.0) 0.5) h) l))))
(if (<= d -4.5e+260)
(* (* (- d) (pow (* h l) -0.5)) (- 1.0 (/ (* (* (* t_1 t_1) 0.5) h) l)))
(if (<= d -9.5e-113)
(* (* t_0 (sqrt (/ d h))) t_2)
(if (<= d 3.2e-299)
(/
(fma
(* -0.125 (/ (* (* D M) (* D M)) d))
(sqrt (pow (/ h l) 3.0))
(* (sqrt (/ h l)) d))
h)
(* (/ (* (sqrt d) t_0) (sqrt h)) t_2))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / l));
double t_1 = (D / d) * (M / 2.0);
double t_2 = 1.0 - (((pow(((D * M) / (2.0 * d)), 2.0) * 0.5) * h) / l);
double tmp;
if (d <= -4.5e+260) {
tmp = (-d * pow((h * l), -0.5)) * (1.0 - ((((t_1 * t_1) * 0.5) * h) / l));
} else if (d <= -9.5e-113) {
tmp = (t_0 * sqrt((d / h))) * t_2;
} else if (d <= 3.2e-299) {
tmp = fma((-0.125 * (((D * M) * (D * M)) / d)), sqrt(pow((h / l), 3.0)), (sqrt((h / l)) * d)) / h;
} else {
tmp = ((sqrt(d) * t_0) / sqrt(h)) * t_2;
}
return tmp;
}
function code(d, h, l, M, D) t_0 = sqrt(Float64(d / l)) t_1 = Float64(Float64(D / d) * Float64(M / 2.0)) t_2 = Float64(1.0 - Float64(Float64(Float64((Float64(Float64(D * M) / Float64(2.0 * d)) ^ 2.0) * 0.5) * h) / l)) tmp = 0.0 if (d <= -4.5e+260) tmp = Float64(Float64(Float64(-d) * (Float64(h * l) ^ -0.5)) * Float64(1.0 - Float64(Float64(Float64(Float64(t_1 * t_1) * 0.5) * h) / l))); elseif (d <= -9.5e-113) tmp = Float64(Float64(t_0 * sqrt(Float64(d / h))) * t_2); elseif (d <= 3.2e-299) tmp = Float64(fma(Float64(-0.125 * Float64(Float64(Float64(D * M) * Float64(D * M)) / d)), sqrt((Float64(h / l) ^ 3.0)), Float64(sqrt(Float64(h / l)) * d)) / h); else tmp = Float64(Float64(Float64(sqrt(d) * t_0) / sqrt(h)) * t_2); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(D / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(1.0 - N[(N[(N[(N[Power[N[(N[(D * M), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * 0.5), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -4.5e+260], N[(N[((-d) * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(t$95$1 * t$95$1), $MachinePrecision] * 0.5), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -9.5e-113], N[(N[(t$95$0 * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision], If[LessEqual[d, 3.2e-299], N[(N[(N[(-0.125 * N[(N[(N[(D * M), $MachinePrecision] * N[(D * M), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[Power[N[(h / l), $MachinePrecision], 3.0], $MachinePrecision]], $MachinePrecision] + N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[(N[(N[(N[Sqrt[d], $MachinePrecision] * t$95$0), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
t_1 := \frac{D}{d} \cdot \frac{M}{2}\\
t_2 := 1 - \frac{\left({\left(\frac{D \cdot M}{2 \cdot d}\right)}^{2} \cdot 0.5\right) \cdot h}{\ell}\\
\mathbf{if}\;d \leq -4.5 \cdot 10^{+260}:\\
\;\;\;\;\left(\left(-d\right) \cdot {\left(h \cdot \ell\right)}^{-0.5}\right) \cdot \left(1 - \frac{\left(\left(t\_1 \cdot t\_1\right) \cdot 0.5\right) \cdot h}{\ell}\right)\\
\mathbf{elif}\;d \leq -9.5 \cdot 10^{-113}:\\
\;\;\;\;\left(t\_0 \cdot \sqrt{\frac{d}{h}}\right) \cdot t\_2\\
\mathbf{elif}\;d \leq 3.2 \cdot 10^{-299}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-0.125 \cdot \frac{\left(D \cdot M\right) \cdot \left(D \cdot M\right)}{d}, \sqrt{{\left(\frac{h}{\ell}\right)}^{3}}, \sqrt{\frac{h}{\ell}} \cdot d\right)}{h}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d} \cdot t\_0}{\sqrt{h}} \cdot t\_2\\
\end{array}
\end{array}
if d < -4.50000000000000023e260Initial program 71.6%
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 rewrites76.7%
Taylor expanded in d around 0
metadata-evalN/A
pow1/2N/A
sqrt-divN/A
metadata-evalN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
inv-powN/A
*-commutativeN/A
sqrt-pow1N/A
lower-pow.f64N/A
lift-*.f64N/A
metadata-eval1.2
Applied rewrites1.2%
lift-pow.f64N/A
unpow2N/A
lower-*.f641.2
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f641.2
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f641.2
Applied rewrites1.2%
Taylor expanded in h around -inf
sqrt-pow2N/A
metadata-evalN/A
metadata-evalN/A
*-commutativeN/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
inv-powN/A
*-commutativeN/A
sqrt-pow1N/A
metadata-evalN/A
lift-pow.f64N/A
*-commutativeN/A
lower-*.f6485.1
Applied rewrites85.1%
if -4.50000000000000023e260 < d < -9.49999999999999987e-113Initial program 77.1%
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 rewrites79.8%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f64N/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f6479.8
Applied rewrites79.8%
lift-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f6479.7
Applied rewrites79.7%
if -9.49999999999999987e-113 < d < 3.20000000000000008e-299Initial program 45.9%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites46.5%
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
lower-*.f64N/A
lift-*.f64N/A
lift-*.f6446.5
Applied rewrites46.5%
if 3.20000000000000008e-299 < d Initial program 67.3%
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 rewrites68.9%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f64N/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f6468.9
Applied rewrites68.9%
lift-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f6469.2
Applied rewrites69.2%
lift-*.f64N/A
lift-/.f64N/A
lift-sqrt.f64N/A
lift-/.f64N/A
lift-sqrt.f64N/A
*-commutativeN/A
sqrt-divN/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lift-sqrt.f64N/A
lift-/.f64N/A
lower-sqrt.f6479.3
Applied rewrites79.3%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* (/ D d) (/ M 2.0)))
(t_1
(*
(* (pow (* l h) -0.5) d)
(- 1.0 (/ (* (* (* t_0 (* (/ D d) (* 0.5 M))) 0.5) h) l))))
(t_2 (* (sqrt (/ d l)) (sqrt (/ d h)))))
(if (<= d -1.28e-70)
(* t_2 (- 1.0 (/ (* (* (* t_0 t_0) 0.5) h) l)))
(if (<= d 2e-307)
(/
(fma
(* -0.125 (/ (* (* D M) (* D M)) d))
(sqrt (pow (/ h l) 3.0))
(* (sqrt (/ h l)) d))
h)
(if (<= d 1.65e-174)
t_1
(if (<= d 6e+125)
(* t_2 (- 1.0 (/ (* (* (pow (/ (* D M) (* 2.0 d)) 2.0) 0.5) h) l)))
t_1))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = (D / d) * (M / 2.0);
double t_1 = (pow((l * h), -0.5) * d) * (1.0 - ((((t_0 * ((D / d) * (0.5 * M))) * 0.5) * h) / l));
double t_2 = sqrt((d / l)) * sqrt((d / h));
double tmp;
if (d <= -1.28e-70) {
tmp = t_2 * (1.0 - ((((t_0 * t_0) * 0.5) * h) / l));
} else if (d <= 2e-307) {
tmp = fma((-0.125 * (((D * M) * (D * M)) / d)), sqrt(pow((h / l), 3.0)), (sqrt((h / l)) * d)) / h;
} else if (d <= 1.65e-174) {
tmp = t_1;
} else if (d <= 6e+125) {
tmp = t_2 * (1.0 - (((pow(((D * M) / (2.0 * d)), 2.0) * 0.5) * h) / l));
} else {
tmp = t_1;
}
return tmp;
}
function code(d, h, l, M, D) t_0 = Float64(Float64(D / d) * Float64(M / 2.0)) t_1 = Float64(Float64((Float64(l * h) ^ -0.5) * d) * Float64(1.0 - Float64(Float64(Float64(Float64(t_0 * Float64(Float64(D / d) * Float64(0.5 * M))) * 0.5) * h) / l))) t_2 = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) tmp = 0.0 if (d <= -1.28e-70) tmp = Float64(t_2 * Float64(1.0 - Float64(Float64(Float64(Float64(t_0 * t_0) * 0.5) * h) / l))); elseif (d <= 2e-307) tmp = Float64(fma(Float64(-0.125 * Float64(Float64(Float64(D * M) * Float64(D * M)) / d)), sqrt((Float64(h / l) ^ 3.0)), Float64(sqrt(Float64(h / l)) * d)) / h); elseif (d <= 1.65e-174) tmp = t_1; elseif (d <= 6e+125) tmp = Float64(t_2 * Float64(1.0 - Float64(Float64(Float64((Float64(Float64(D * M) / Float64(2.0 * d)) ^ 2.0) * 0.5) * h) / l))); else tmp = t_1; end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(D / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision] * d), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(t$95$0 * N[(N[(D / d), $MachinePrecision] * N[(0.5 * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -1.28e-70], N[(t$95$2 * N[(1.0 - N[(N[(N[(N[(t$95$0 * t$95$0), $MachinePrecision] * 0.5), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2e-307], N[(N[(N[(-0.125 * N[(N[(N[(D * M), $MachinePrecision] * N[(D * M), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[Power[N[(h / l), $MachinePrecision], 3.0], $MachinePrecision]], $MachinePrecision] + N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], If[LessEqual[d, 1.65e-174], t$95$1, If[LessEqual[d, 6e+125], N[(t$95$2 * N[(1.0 - N[(N[(N[(N[Power[N[(N[(D * M), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * 0.5), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{D}{d} \cdot \frac{M}{2}\\
t_1 := \left({\left(\ell \cdot h\right)}^{-0.5} \cdot d\right) \cdot \left(1 - \frac{\left(\left(t\_0 \cdot \left(\frac{D}{d} \cdot \left(0.5 \cdot M\right)\right)\right) \cdot 0.5\right) \cdot h}{\ell}\right)\\
t_2 := \sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{if}\;d \leq -1.28 \cdot 10^{-70}:\\
\;\;\;\;t\_2 \cdot \left(1 - \frac{\left(\left(t\_0 \cdot t\_0\right) \cdot 0.5\right) \cdot h}{\ell}\right)\\
\mathbf{elif}\;d \leq 2 \cdot 10^{-307}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-0.125 \cdot \frac{\left(D \cdot M\right) \cdot \left(D \cdot M\right)}{d}, \sqrt{{\left(\frac{h}{\ell}\right)}^{3}}, \sqrt{\frac{h}{\ell}} \cdot d\right)}{h}\\
\mathbf{elif}\;d \leq 1.65 \cdot 10^{-174}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d \leq 6 \cdot 10^{+125}:\\
\;\;\;\;t\_2 \cdot \left(1 - \frac{\left({\left(\frac{D \cdot M}{2 \cdot d}\right)}^{2} \cdot 0.5\right) \cdot h}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if d < -1.28e-70Initial program 77.7%
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 rewrites80.5%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f64N/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f6480.5
Applied rewrites80.5%
lift-pow.f64N/A
unpow2N/A
lower-*.f6480.5
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f6480.5
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f6480.5
Applied rewrites80.5%
if -1.28e-70 < d < 1.99999999999999982e-307Initial program 50.2%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites47.4%
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
lower-*.f64N/A
lift-*.f64N/A
lift-*.f6447.4
Applied rewrites47.4%
if 1.99999999999999982e-307 < d < 1.65e-174 or 6.0000000000000003e125 < d Initial program 58.0%
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 rewrites59.2%
Taylor expanded in d around 0
metadata-evalN/A
pow1/2N/A
sqrt-divN/A
metadata-evalN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
inv-powN/A
*-commutativeN/A
sqrt-pow1N/A
lower-pow.f64N/A
lift-*.f64N/A
metadata-eval74.6
Applied rewrites74.6%
lift-pow.f64N/A
unpow2N/A
lower-*.f6474.6
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f6474.6
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f6474.6
Applied rewrites74.6%
Taylor expanded in M around 0
lower-*.f6474.6
Applied rewrites74.6%
if 1.65e-174 < d < 6.0000000000000003e125Initial program 75.6%
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 rewrites77.5%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f64N/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f6477.5
Applied rewrites77.5%
lift-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f6478.0
Applied rewrites78.0%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* (/ D d) (/ M 2.0))))
(if (<= d -1.28e-70)
(*
(* (sqrt (/ d l)) (sqrt (/ d h)))
(- 1.0 (/ (* (* (* t_0 t_0) 0.5) h) l)))
(if (<= d 2e-307)
(/
(fma
(* -0.125 (/ (* (* D M) (* D M)) d))
(sqrt (pow (/ h l) 3.0))
(* (sqrt (/ h l)) d))
h)
(*
(* (pow (* l h) -0.5) d)
(- 1.0 (/ (* (* (* t_0 (* (/ D d) (* 0.5 M))) 0.5) h) l)))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = (D / d) * (M / 2.0);
double tmp;
if (d <= -1.28e-70) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - ((((t_0 * t_0) * 0.5) * h) / l));
} else if (d <= 2e-307) {
tmp = fma((-0.125 * (((D * M) * (D * M)) / d)), sqrt(pow((h / l), 3.0)), (sqrt((h / l)) * d)) / h;
} else {
tmp = (pow((l * h), -0.5) * d) * (1.0 - ((((t_0 * ((D / d) * (0.5 * M))) * 0.5) * h) / l));
}
return tmp;
}
function code(d, h, l, M, D) t_0 = Float64(Float64(D / d) * Float64(M / 2.0)) tmp = 0.0 if (d <= -1.28e-70) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * Float64(1.0 - Float64(Float64(Float64(Float64(t_0 * t_0) * 0.5) * h) / l))); elseif (d <= 2e-307) tmp = Float64(fma(Float64(-0.125 * Float64(Float64(Float64(D * M) * Float64(D * M)) / d)), sqrt((Float64(h / l) ^ 3.0)), Float64(sqrt(Float64(h / l)) * d)) / h); else tmp = Float64(Float64((Float64(l * h) ^ -0.5) * d) * Float64(1.0 - Float64(Float64(Float64(Float64(t_0 * Float64(Float64(D / d) * Float64(0.5 * M))) * 0.5) * h) / l))); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(D / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -1.28e-70], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(t$95$0 * t$95$0), $MachinePrecision] * 0.5), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2e-307], N[(N[(N[(-0.125 * N[(N[(N[(D * M), $MachinePrecision] * N[(D * M), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[Power[N[(h / l), $MachinePrecision], 3.0], $MachinePrecision]], $MachinePrecision] + N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[(N[(N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision] * d), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(t$95$0 * N[(N[(D / d), $MachinePrecision] * N[(0.5 * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{D}{d} \cdot \frac{M}{2}\\
\mathbf{if}\;d \leq -1.28 \cdot 10^{-70}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - \frac{\left(\left(t\_0 \cdot t\_0\right) \cdot 0.5\right) \cdot h}{\ell}\right)\\
\mathbf{elif}\;d \leq 2 \cdot 10^{-307}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-0.125 \cdot \frac{\left(D \cdot M\right) \cdot \left(D \cdot M\right)}{d}, \sqrt{{\left(\frac{h}{\ell}\right)}^{3}}, \sqrt{\frac{h}{\ell}} \cdot d\right)}{h}\\
\mathbf{else}:\\
\;\;\;\;\left({\left(\ell \cdot h\right)}^{-0.5} \cdot d\right) \cdot \left(1 - \frac{\left(\left(t\_0 \cdot \left(\frac{D}{d} \cdot \left(0.5 \cdot M\right)\right)\right) \cdot 0.5\right) \cdot h}{\ell}\right)\\
\end{array}
\end{array}
if d < -1.28e-70Initial program 77.7%
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 rewrites80.5%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f64N/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f6480.5
Applied rewrites80.5%
lift-pow.f64N/A
unpow2N/A
lower-*.f6480.5
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f6480.5
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f6480.5
Applied rewrites80.5%
if -1.28e-70 < d < 1.99999999999999982e-307Initial program 50.2%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites47.4%
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
lower-*.f64N/A
lift-*.f64N/A
lift-*.f6447.4
Applied rewrites47.4%
if 1.99999999999999982e-307 < d Initial program 66.7%
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 rewrites68.2%
Taylor expanded in d around 0
metadata-evalN/A
pow1/2N/A
sqrt-divN/A
metadata-evalN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
inv-powN/A
*-commutativeN/A
sqrt-pow1N/A
lower-pow.f64N/A
lift-*.f64N/A
metadata-eval74.5
Applied rewrites74.5%
lift-pow.f64N/A
unpow2N/A
lower-*.f6474.5
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f6474.5
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f6474.5
Applied rewrites74.5%
Taylor expanded in M around 0
lower-*.f6474.5
Applied rewrites74.5%
(FPCore (d h l M D)
:precision binary64
(if (<= l -4.2e+138)
(* (* -1.0 d) (sqrt (/ 1.0 (* h l))))
(if (<= l 6e+156)
(*
(* (sqrt (/ d l)) (sqrt (/ d h)))
(-
1.0
(/ (* (* (* (* (* (/ D 2.0) (/ M d)) (/ D d)) (/ M 2.0)) 0.5) h) l)))
(* (/ 1.0 (* (sqrt l) (sqrt h))) d))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -4.2e+138) {
tmp = (-1.0 * d) * sqrt((1.0 / (h * l)));
} else if (l <= 6e+156) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - (((((((D / 2.0) * (M / d)) * (D / d)) * (M / 2.0)) * 0.5) * h) / l));
} else {
tmp = (1.0 / (sqrt(l) * sqrt(h))) * d;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(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
real(8) :: tmp
if (l <= (-4.2d+138)) then
tmp = ((-1.0d0) * d) * sqrt((1.0d0 / (h * l)))
else if (l <= 6d+156) then
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0d0 - (((((((d_1 / 2.0d0) * (m / d)) * (d_1 / d)) * (m / 2.0d0)) * 0.5d0) * h) / l))
else
tmp = (1.0d0 / (sqrt(l) * sqrt(h))) * d
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -4.2e+138) {
tmp = (-1.0 * d) * Math.sqrt((1.0 / (h * l)));
} else if (l <= 6e+156) {
tmp = (Math.sqrt((d / l)) * Math.sqrt((d / h))) * (1.0 - (((((((D / 2.0) * (M / d)) * (D / d)) * (M / 2.0)) * 0.5) * h) / l));
} else {
tmp = (1.0 / (Math.sqrt(l) * Math.sqrt(h))) * d;
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if l <= -4.2e+138: tmp = (-1.0 * d) * math.sqrt((1.0 / (h * l))) elif l <= 6e+156: tmp = (math.sqrt((d / l)) * math.sqrt((d / h))) * (1.0 - (((((((D / 2.0) * (M / d)) * (D / d)) * (M / 2.0)) * 0.5) * h) / l)) else: tmp = (1.0 / (math.sqrt(l) * math.sqrt(h))) * d return tmp
function code(d, h, l, M, D) tmp = 0.0 if (l <= -4.2e+138) tmp = Float64(Float64(-1.0 * d) * sqrt(Float64(1.0 / Float64(h * l)))); elseif (l <= 6e+156) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(Float64(Float64(D / 2.0) * Float64(M / d)) * Float64(D / d)) * Float64(M / 2.0)) * 0.5) * h) / l))); else tmp = Float64(Float64(1.0 / Float64(sqrt(l) * sqrt(h))) * d); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (l <= -4.2e+138) tmp = (-1.0 * d) * sqrt((1.0 / (h * l))); elseif (l <= 6e+156) tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - (((((((D / 2.0) * (M / d)) * (D / d)) * (M / 2.0)) * 0.5) * h) / l)); else tmp = (1.0 / (sqrt(l) * sqrt(h))) * d; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[l, -4.2e+138], N[(N[(-1.0 * d), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 6e+156], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(N[(N[(N[(D / 2.0), $MachinePrecision] * N[(M / d), $MachinePrecision]), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * d), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -4.2 \cdot 10^{+138}:\\
\;\;\;\;\left(-1 \cdot d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
\mathbf{elif}\;\ell \leq 6 \cdot 10^{+156}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - \frac{\left(\left(\left(\left(\frac{D}{2} \cdot \frac{M}{d}\right) \cdot \frac{D}{d}\right) \cdot \frac{M}{2}\right) \cdot 0.5\right) \cdot h}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{\ell} \cdot \sqrt{h}} \cdot d\\
\end{array}
\end{array}
if l < -4.20000000000000014e138Initial program 50.7%
Taylor expanded in l around -inf
lower-*.f64N/A
sqrt-pow2N/A
metadata-evalN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f6446.6
Applied rewrites46.6%
lift-*.f64N/A
lift-pow.f64N/A
unpow-1N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6446.6
Applied rewrites46.6%
if -4.20000000000000014e138 < l < 5.9999999999999999e156Initial program 72.4%
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 rewrites74.8%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f64N/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f6474.8
Applied rewrites74.8%
lift-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f6475.2
Applied rewrites75.2%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
frac-timesN/A
lift-/.f64N/A
lift-/.f64N/A
lift-*.f6474.8
lower-pow.f64N/A
pow2N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6473.6
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6472.8
Applied rewrites72.8%
if 5.9999999999999999e156 < l Initial program 50.6%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f6448.3
Applied rewrites48.3%
lift-*.f64N/A
lift-pow.f64N/A
lower-sqrt.f64N/A
*-commutativeN/A
inv-powN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
*-commutativeN/A
lower-sqrt.f64N/A
lift-*.f6448.3
Applied rewrites48.3%
lift-*.f64N/A
lift-sqrt.f64N/A
sqrt-prodN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6463.7
Applied rewrites63.7%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* (/ D d) (/ M 2.0))))
(if (<= l 4.4e+163)
(*
(* (sqrt (/ d l)) (sqrt (/ d h)))
(- 1.0 (/ (* (* (* t_0 t_0) 0.5) h) l)))
(* (/ 1.0 (* (sqrt l) (sqrt h))) d))))
double code(double d, double h, double l, double M, double D) {
double t_0 = (D / d) * (M / 2.0);
double tmp;
if (l <= 4.4e+163) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - ((((t_0 * t_0) * 0.5) * h) / l));
} else {
tmp = (1.0 / (sqrt(l) * sqrt(h))) * d;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(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
real(8) :: t_0
real(8) :: tmp
t_0 = (d_1 / d) * (m / 2.0d0)
if (l <= 4.4d+163) then
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0d0 - ((((t_0 * t_0) * 0.5d0) * h) / l))
else
tmp = (1.0d0 / (sqrt(l) * sqrt(h))) * d
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = (D / d) * (M / 2.0);
double tmp;
if (l <= 4.4e+163) {
tmp = (Math.sqrt((d / l)) * Math.sqrt((d / h))) * (1.0 - ((((t_0 * t_0) * 0.5) * h) / l));
} else {
tmp = (1.0 / (Math.sqrt(l) * Math.sqrt(h))) * d;
}
return tmp;
}
def code(d, h, l, M, D): t_0 = (D / d) * (M / 2.0) tmp = 0 if l <= 4.4e+163: tmp = (math.sqrt((d / l)) * math.sqrt((d / h))) * (1.0 - ((((t_0 * t_0) * 0.5) * h) / l)) else: tmp = (1.0 / (math.sqrt(l) * math.sqrt(h))) * d return tmp
function code(d, h, l, M, D) t_0 = Float64(Float64(D / d) * Float64(M / 2.0)) tmp = 0.0 if (l <= 4.4e+163) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * Float64(1.0 - Float64(Float64(Float64(Float64(t_0 * t_0) * 0.5) * h) / l))); else tmp = Float64(Float64(1.0 / Float64(sqrt(l) * sqrt(h))) * d); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = (D / d) * (M / 2.0); tmp = 0.0; if (l <= 4.4e+163) tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - ((((t_0 * t_0) * 0.5) * h) / l)); else tmp = (1.0 / (sqrt(l) * sqrt(h))) * d; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(D / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, 4.4e+163], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(t$95$0 * t$95$0), $MachinePrecision] * 0.5), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * d), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{D}{d} \cdot \frac{M}{2}\\
\mathbf{if}\;\ell \leq 4.4 \cdot 10^{+163}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - \frac{\left(\left(t\_0 \cdot t\_0\right) \cdot 0.5\right) \cdot h}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{\ell} \cdot \sqrt{h}} \cdot d\\
\end{array}
\end{array}
if l < 4.39999999999999973e163Initial program 69.1%
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 rewrites71.0%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f64N/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f6471.0
Applied rewrites71.0%
lift-pow.f64N/A
unpow2N/A
lower-*.f6471.0
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f6471.0
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f6471.0
Applied rewrites71.0%
if 4.39999999999999973e163 < l Initial program 50.1%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f6449.1
Applied rewrites49.1%
lift-*.f64N/A
lift-pow.f64N/A
lower-sqrt.f64N/A
*-commutativeN/A
inv-powN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
*-commutativeN/A
lower-sqrt.f64N/A
lift-*.f6449.0
Applied rewrites49.0%
lift-*.f64N/A
lift-sqrt.f64N/A
sqrt-prodN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6464.4
Applied rewrites64.4%
(FPCore (d h l M D)
:precision binary64
(if (<= l -8e-168)
(* (* -1.0 d) (sqrt (/ 1.0 (* h l))))
(if (<= l 2.25e-298)
(/ (* d (- (sqrt (/ h l)))) h)
(* (/ 1.0 (* (sqrt l) (sqrt h))) d))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -8e-168) {
tmp = (-1.0 * d) * sqrt((1.0 / (h * l)));
} else if (l <= 2.25e-298) {
tmp = (d * -sqrt((h / l))) / h;
} else {
tmp = (1.0 / (sqrt(l) * sqrt(h))) * d;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(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
real(8) :: tmp
if (l <= (-8d-168)) then
tmp = ((-1.0d0) * d) * sqrt((1.0d0 / (h * l)))
else if (l <= 2.25d-298) then
tmp = (d * -sqrt((h / l))) / h
else
tmp = (1.0d0 / (sqrt(l) * sqrt(h))) * d
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -8e-168) {
tmp = (-1.0 * d) * Math.sqrt((1.0 / (h * l)));
} else if (l <= 2.25e-298) {
tmp = (d * -Math.sqrt((h / l))) / h;
} else {
tmp = (1.0 / (Math.sqrt(l) * Math.sqrt(h))) * d;
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if l <= -8e-168: tmp = (-1.0 * d) * math.sqrt((1.0 / (h * l))) elif l <= 2.25e-298: tmp = (d * -math.sqrt((h / l))) / h else: tmp = (1.0 / (math.sqrt(l) * math.sqrt(h))) * d return tmp
function code(d, h, l, M, D) tmp = 0.0 if (l <= -8e-168) tmp = Float64(Float64(-1.0 * d) * sqrt(Float64(1.0 / Float64(h * l)))); elseif (l <= 2.25e-298) tmp = Float64(Float64(d * Float64(-sqrt(Float64(h / l)))) / h); else tmp = Float64(Float64(1.0 / Float64(sqrt(l) * sqrt(h))) * d); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (l <= -8e-168) tmp = (-1.0 * d) * sqrt((1.0 / (h * l))); elseif (l <= 2.25e-298) tmp = (d * -sqrt((h / l))) / h; else tmp = (1.0 / (sqrt(l) * sqrt(h))) * d; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[l, -8e-168], N[(N[(-1.0 * d), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.25e-298], N[(N[(d * (-N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / h), $MachinePrecision], N[(N[(1.0 / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * d), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -8 \cdot 10^{-168}:\\
\;\;\;\;\left(-1 \cdot d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
\mathbf{elif}\;\ell \leq 2.25 \cdot 10^{-298}:\\
\;\;\;\;\frac{d \cdot \left(-\sqrt{\frac{h}{\ell}}\right)}{h}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{\ell} \cdot \sqrt{h}} \cdot d\\
\end{array}
\end{array}
if l < -8.0000000000000004e-168Initial program 65.3%
Taylor expanded in l around -inf
lower-*.f64N/A
sqrt-pow2N/A
metadata-evalN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f6446.0
Applied rewrites46.0%
lift-*.f64N/A
lift-pow.f64N/A
unpow-1N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6446.0
Applied rewrites46.0%
if -8.0000000000000004e-168 < l < 2.24999999999999996e-298Initial program 72.2%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites40.9%
Taylor expanded in l around -inf
sqrt-pow2N/A
metadata-evalN/A
metadata-evalN/A
associate-*l*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lift-sqrt.f64N/A
lift-/.f6431.9
Applied rewrites31.9%
if 2.24999999999999996e-298 < l Initial program 66.7%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f6442.6
Applied rewrites42.6%
lift-*.f64N/A
lift-pow.f64N/A
lower-sqrt.f64N/A
*-commutativeN/A
inv-powN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
*-commutativeN/A
lower-sqrt.f64N/A
lift-*.f6442.8
Applied rewrites42.8%
lift-*.f64N/A
lift-sqrt.f64N/A
sqrt-prodN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6450.9
Applied rewrites50.9%
(FPCore (d h l M D) :precision binary64 (if (<= l -2e-238) (* (* -1.0 d) (sqrt (/ 1.0 (* h l)))) (* (sqrt (/ (/ 1.0 h) l)) d)))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -2e-238) {
tmp = (-1.0 * d) * sqrt((1.0 / (h * l)));
} else {
tmp = sqrt(((1.0 / h) / l)) * d;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(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
real(8) :: tmp
if (l <= (-2d-238)) then
tmp = ((-1.0d0) * d) * sqrt((1.0d0 / (h * l)))
else
tmp = sqrt(((1.0d0 / h) / l)) * d
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -2e-238) {
tmp = (-1.0 * d) * Math.sqrt((1.0 / (h * l)));
} else {
tmp = Math.sqrt(((1.0 / h) / l)) * d;
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if l <= -2e-238: tmp = (-1.0 * d) * math.sqrt((1.0 / (h * l))) else: tmp = math.sqrt(((1.0 / h) / l)) * d return tmp
function code(d, h, l, M, D) tmp = 0.0 if (l <= -2e-238) tmp = Float64(Float64(-1.0 * d) * sqrt(Float64(1.0 / Float64(h * l)))); else tmp = Float64(sqrt(Float64(Float64(1.0 / h) / l)) * d); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (l <= -2e-238) tmp = (-1.0 * d) * sqrt((1.0 / (h * l))); else tmp = sqrt(((1.0 / h) / l)) * d; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[l, -2e-238], N[(N[(-1.0 * d), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2 \cdot 10^{-238}:\\
\;\;\;\;\left(-1 \cdot d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{\frac{1}{h}}{\ell}} \cdot d\\
\end{array}
\end{array}
if l < -2e-238Initial program 66.2%
Taylor expanded in l around -inf
lower-*.f64N/A
sqrt-pow2N/A
metadata-evalN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f6443.7
Applied rewrites43.7%
lift-*.f64N/A
lift-pow.f64N/A
unpow-1N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6443.7
Applied rewrites43.7%
if -2e-238 < l Initial program 67.3%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f6440.7
Applied rewrites40.7%
lift-*.f64N/A
lift-pow.f64N/A
*-commutativeN/A
inv-powN/A
associate-/r*N/A
lower-/.f64N/A
inv-powN/A
lower-pow.f6441.0
Applied rewrites41.0%
lift-pow.f64N/A
inv-powN/A
lower-/.f6441.0
Applied rewrites41.0%
(FPCore (d h l M D) :precision binary64 (if (<= l -2e-238) (* (* -1.0 d) (sqrt (/ 1.0 (* h l)))) (* (sqrt (/ 1.0 (* l h))) d)))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -2e-238) {
tmp = (-1.0 * d) * sqrt((1.0 / (h * l)));
} else {
tmp = sqrt((1.0 / (l * h))) * d;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(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
real(8) :: tmp
if (l <= (-2d-238)) then
tmp = ((-1.0d0) * d) * sqrt((1.0d0 / (h * l)))
else
tmp = sqrt((1.0d0 / (l * h))) * d
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -2e-238) {
tmp = (-1.0 * d) * Math.sqrt((1.0 / (h * l)));
} else {
tmp = Math.sqrt((1.0 / (l * h))) * d;
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if l <= -2e-238: tmp = (-1.0 * d) * math.sqrt((1.0 / (h * l))) else: tmp = math.sqrt((1.0 / (l * h))) * d return tmp
function code(d, h, l, M, D) tmp = 0.0 if (l <= -2e-238) tmp = Float64(Float64(-1.0 * d) * sqrt(Float64(1.0 / Float64(h * l)))); else tmp = Float64(sqrt(Float64(1.0 / Float64(l * h))) * d); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (l <= -2e-238) tmp = (-1.0 * d) * sqrt((1.0 / (h * l))); else tmp = sqrt((1.0 / (l * h))) * d; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[l, -2e-238], N[(N[(-1.0 * d), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2 \cdot 10^{-238}:\\
\;\;\;\;\left(-1 \cdot d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{1}{\ell \cdot h}} \cdot d\\
\end{array}
\end{array}
if l < -2e-238Initial program 66.2%
Taylor expanded in l around -inf
lower-*.f64N/A
sqrt-pow2N/A
metadata-evalN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f6443.7
Applied rewrites43.7%
lift-*.f64N/A
lift-pow.f64N/A
unpow-1N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6443.7
Applied rewrites43.7%
if -2e-238 < l Initial program 67.3%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f6440.7
Applied rewrites40.7%
lift-*.f64N/A
lift-pow.f64N/A
unpow-1N/A
lower-/.f64N/A
lift-*.f6440.7
Applied rewrites40.7%
(FPCore (d h l M D) :precision binary64 (* (sqrt (/ 1.0 (* l h))) d))
double code(double d, double h, double l, double M, double D) {
return sqrt((1.0 / (l * h))) * d;
}
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 = sqrt((1.0d0 / (l * h))) * d
end function
public static double code(double d, double h, double l, double M, double D) {
return Math.sqrt((1.0 / (l * h))) * d;
}
def code(d, h, l, M, D): return math.sqrt((1.0 / (l * h))) * d
function code(d, h, l, M, D) return Float64(sqrt(Float64(1.0 / Float64(l * h))) * d) end
function tmp = code(d, h, l, M, D) tmp = sqrt((1.0 / (l * h))) * d; end
code[d_, h_, l_, M_, D_] := N[(N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\frac{1}{\ell \cdot h}} \cdot d
\end{array}
Initial program 66.8%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f6426.5
Applied rewrites26.5%
lift-*.f64N/A
lift-pow.f64N/A
unpow-1N/A
lower-/.f64N/A
lift-*.f6426.5
Applied rewrites26.5%
herbie shell --seed 2025096
(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)))))